public static StatementNode Parse(TokenString tStr, ref int index) { switch (tStr[index].Type) { case TokenType.cBraceOpen: return(CompoundStaNode.Parse(tStr, ref index)); case TokenType.ifStatement: return(ConditionalStaNode.Parse(tStr, ref index)); case TokenType.doStatement: return(DoLoopStaNode.Parse(tStr, ref index)); case TokenType.whileStatement: return(WhileLoopStaNode.Parse(tStr, ref index)); case TokenType.forStatement: return(ForLoopStaNode.Parse(tStr, ref index)); case TokenType.returnStatement: return(ReturnStaNode.Parse(tStr, ref index)); case TokenType.lineEnd: return(NopStaNode.Parse(tStr, ref index)); default: return(ExpressionStaNode.Parse(tStr, ref index)); } }
public static NopStaNode Parse(TokenString tStr, ref int index) { if (!tStr.Match(index, TokenType.lineEnd)) { return(null); } NopStaNode node = new NopStaNode(tStr[index].Value); index++; return(node); }