public static void Process() { tokens = LexicalAnalyzer.Lexems; pos = 0; currentVisibility = null; variables.Clear(); Stmt(); }
public Visibility() { parentVisibility = SyntaxAnalyzer.currentVisibility; SyntaxAnalyzer.currentVisibility = this; }
static void Stmt() { if (tokens[pos++].Type != TokenType.OpenCurlyBracket) throw new ErrorException("Фрагмент кода должен начинаться с \'{\'",tokens[pos-1], ErrorType.SyntaxError); new Visibility(); do { switch (tokens[pos++].Type) { case TokenType.Identifier: currentVisibility.FindOrCreate(tokens[pos - 1].Value, 0); //tokens[pos-1].Value //проверить объявленность переменной Assignment(); break; case TokenType.If: If(); break; case TokenType.CloseCurlyBracket: currentVisibility = currentVisibility.parentVisibility; return; break; case TokenType.Number: throw new ErrorException("Ожидается присвоение константе: " + tokens[pos - 1].Value, tokens[pos - 1], ErrorType.SyntaxError); return; break; default: throw new ErrorException("Неожиданный символStmt: " + tokens[pos - 1].Value, tokens[pos - 1], ErrorType.SyntaxError); } } while (true); }