Аналізатор.Lexem GetNextLexem() { if (count >= Lexems.Count) { return(null); } else { CurrentLexem = Lexems[count++]; return(CurrentLexem); } }
public bool check(out Dictionary <int, keeper> states) { states = States; while (true) { bool found = false; Аналізатор.Lexem Lexem = GetNextLexem(); if (Lexem == null) { throw new ApplicationException("{ expected in line:" + Lexems[count - 1].LineNumber); } for (int i = 0; i < States[numberOfState].labels.Count; i++) { if (Lexem.Code == States[numberOfState].labels[i]) { if (States[numberOfState].nextstate[i] == 0) { if (stack.Count > 0) { numberOfState = stack.Pop(); found = true; break; } else { if (Lexems.Count - count > 0) { throw new ApplicationException("After the last scope cannot be any text Line:" + Lexem.LineNumber); } return(true); } } else { if (States[numberOfState].stack[i] != 0) { stack.Push(States[numberOfState].stack[i]); numberOfState = States[numberOfState].nextstate[i]; found = true; break; } else { numberOfState = States[numberOfState].nextstate[i]; found = true; break; } } } } if (!found) { if (States[numberOfState].notequals is int) { if ((int)States[numberOfState].notequals == 0) { numberOfState = stack.Pop(); count--; found = true; } else { stack.Push(States[numberOfState].additionalstack); numberOfState = (int)States[numberOfState].notequals; count--; found = true; } } } if (!found) { throw new ApplicationException(States[numberOfState].notequals as string + " at line " + Lexem.LineNumber); } } }