private void State_11() { // 11 // if (isCurrentLexemID()) { CurrentState = 12; lexemsIterator++; State_12(); } else if (CurrentLexemValue() == "input" || CurrentLexemValue() == "output") { CurrentState = 14; lexemsIterator++; State_14(); } else if (CurrentLexemValue() == "if") { CurrentState = 51; lexemsIterator++; Out.Log(Out.State.LogInfo, "Call half-automat LOGICAL EXPRESSION"); ActionStack.Push(State_17); HalfAutomatLogicalExpression(); } else if (CurrentLexemValue() == "for") { CurrentState = 23; lexemsIterator++; State_23(); } else { throw new LexemException(CurrentLineNumber(), "Invalid operator"); } }
private void State_34() { if (ActionStack.Last() != ActionStack.WrongLexem) { Action returnState = ActionStack.Pop(); returnState(); } }
public static Action Pop() { Action returnValue = ActionStack.Last(); if (returnValue != ActionStack.WrongLexem) { _stack.RemoveAt(_stack.Count - 1); } return(returnValue); }
private void State_29() { if (CurrentLexemValue() == "next") { Action returnState = ActionStack.Pop(); lexemsIterator++; returnState(); } else { throw new LexemException(CurrentLineNumber(), "Missed next"); } }
private void State_27() { if (CurrentLexemValue() == "\n") { ActionStack.Push(State_28); lexemsIterator++; HalfAutomatOperatorsBlock(); } else { throw new LexemException(CurrentLineNumber(), "Missed ENTER"); } }
private void State_26() { if (CurrentLexemValue() == "step") { ActionStack.Push(State_27); lexemsIterator++; HalfAutomatExpression(); } else { throw new LexemException(CurrentLineNumber(), "Missed step"); } }
private void State_53() { if (CurrentLexemValue() == "or" || CurrentLexemValue() == "and") { CurrentState = 51; lexemsIterator++; State_51(); } else { Action returnState = ActionStack.Pop(); returnState(); } }
private void State_33() { if (CurrentLexemValue() == "}") { Action returnState = ActionStack.Pop(); lexemsIterator++; returnState(); } else { ActionStack.Push(State_32); HalfAutomatOperator(); } }
private void State_31() { if (CurrentLexemValue() == "{") { CurrentState = 32; lexemsIterator++; State_32(); } else { ActionStack.Push(State_34); HalfAutomatOperator(); } }
private void State_8() { if (CurrentLexemValue() == "@end") { Out.Log(Out.State.LogInfo, "Syntax Analyzer finish success"); return; } else { CurrentState = 11; ActionStack.Push(State_7); Out.Log(Out.State.LogInfo, "Call half-automat OPERATOR"); HalfAutomatOperator(); } }
private void State_54() { HashSet <string> operators = new HashSet <string>() { ">", ">=", "<", "<=", "equ", "!=" }; if (operators.Contains(CurrentLexemValue())) { ActionStack.Push(State_53); lexemsIterator++; HalfAutomatExpression(); } else { throw new LexemException(CurrentLineNumber(), "Unknow operator " + CurrentLexemValue()); } }
private void State_42() { HashSet <string> operators = new HashSet <string>() { "+", "-", "*", "/", "^" }; if (operators.Contains(CurrentLexemValue())) { CurrentState = 41; lexemsIterator++; State_41(); } else { Action returnState = ActionStack.Pop(); returnState(); } }
private void State_41() { if (isCurrentLexemID() || isCurrentLexemCONST()) { CurrentState = 42; lexemsIterator++; State_42(); } else if (CurrentLexemValue() == "(") { ActionStack.Push(State_43); lexemsIterator++; HalfAutomatExpression(); } else { throw new LexemException(CurrentLineNumber(), "Missed ( or ID or CONST"); } }
private void State_16() { if (CurrentLexemValue() == ",") { CurrentState = 15; lexemsIterator++; State_15(); } else if (CurrentLexemValue() == ")") { Action returnState = ActionStack.Pop(); lexemsIterator++; returnState(); } else { throw new LexemException(CurrentLineNumber(), "Missed ) or ,"); } }
private void State_51() { if (CurrentLexemValue() == "!") { CurrentState = 51; lexemsIterator++; State_51(); } else if (CurrentLexemValue() == "[") { ActionStack.Push(State_52); lexemsIterator++; HalfAutomatLogicalExpression(); } else { ActionStack.Push(State_54); HalfAutomatExpression(); } }