public static GATNode _expression(this LL1Processor ll1) { var node = new GATNode(); var offset = 0; var search = WordContainer.GetWordType(offset); var depth = 0; var finishSearch = false; while (search != WordType.IGNORE) { switch (search) { case WordType.SEMICOLON: { var simpleExpression = ll1._simpleExpression(); node.AddChild(simpleExpression); node.generator = Expression1; finishSearch = true; break; } case WordType.EQUAL: { var VAR = ll1._var(); node.AddChild(VAR); node.generator = Expression2; WordContainer.Advance(WordType.EQUAL); var expression = ll1._expression(); node.AddChild(expression); finishSearch = true; break; } case WordType.BRACKET_L: { depth++; break; } case WordType.BRACKET_R: { depth--; if (depth < 0) { var simpleExpression = ll1._simpleExpression(); node.AddChild(simpleExpression); node.generator = Expression1; finishSearch = true; } break; } } if (finishSearch) { break; } offset++; search = WordContainer.GetWordType(offset); } return(node); }