public static Verb Parse(ref List <String> statements, ref int index) { Verb verb = null; String statement = statements[index].Trim(); int idx = statement.IndexOf(" ");//--- Find first space if (idx != -1) { String lineNo = statement.Substring(0, idx); String command = statement.Substring(idx).Trim(); String[] parts = command.Split(','); String verbName = parts[0].Trim(); if ("DEFINE" == verbName) { verb = new Define(ref statements, ref index); } else if ("END" == verbName) { verb = new End(ref statements, ref index); } else if ("DECLARE" == verbName) { verb = new Declare(ref statements, ref index); } else if ("REQUIRE" == verbName) { verb = new Require(ref statements, ref index); } else if ("APPLY" == verbName) { verb = new Signal(ref statements, ref index); } else { verb = new Verb(ref statements, ref index); } verb.LineNo = lineNo; } return(verb); }
public static Verb Parse(ref List<String> statements, ref int index) { Verb verb = null; String statement = statements[index].Trim(); int idx = statement.IndexOf(" ");//--- Find first space if( idx != -1 ) { String lineNo = statement.Substring(0, idx); String command = statement.Substring(idx).Trim(); String[] parts = command.Split(','); String verbName = parts[0].Trim(); if( "DEFINE" == verbName ) verb = new Define(ref statements, ref index); else if( "END" == verbName ) verb = new End(ref statements, ref index); else if( "DECLARE" == verbName ) verb = new Declare(ref statements, ref index); else if( "REQUIRE" == verbName ) verb = new Require(ref statements, ref index); else if( "APPLY" == verbName ) verb = new Signal(ref statements, ref index); else verb = new Verb(ref statements, ref index); verb.LineNo = lineNo; } return verb; }