/// <inheritdoc/> protected override void OnRun() { #if DEBUG //Log($"_currToken = {_currToken}"); #endif _context.Recovery(_currToken); var parser = new LogicalQueryParser(_context); parser.Run(); var ruleInstanceItem = parser.Result; #if DEBUG //Log($"ruleInstanceItem = {ruleInstanceItem}"); #endif Result.Name = ruleInstanceItem.Name; Result.RuleInstance = ruleInstanceItem; Exit(); }
private void ProcessRuleOrFact() { _context.Recovery(_currToken); var parser = new LogicalQueryParser(_context); parser.Run(); var ruleInstanceItem = parser.Result; #if DEBUG //Log($"ruleInstanceItem = {ruleInstanceItem}"); #endif var value = new RuleInstanceValue(ruleInstanceItem); var node = new ConstValueAstExpression(); node.Value = value; var intermediateNode = new IntermediateAstNode(node); AstNodesLinker.SetNode(intermediateNode, _nodePoint); }
/// <inheritdoc/> protected override void OnRun() { #if DEBUG //Log($"_currToken = {_currToken}"); //Log($"_state = {_state}"); #endif switch (_state) { case State.Init: switch (_currToken.TokenKind) { case TokenKind.QuestionMark: Result.KindOfLogicalQueryOperation = KindOfLogicalQueryOperation.Select; _state = State.GotKindOfLogicalQueryOperation; break; case TokenKind.Word: switch (_currToken.KeyWordTokenKind) { case KeyWordTokenKind.Select: Result.KindOfLogicalQueryOperation = KindOfLogicalQueryOperation.Select; _state = State.GotKindOfLogicalQueryOperation; break; case KeyWordTokenKind.Insert: Result.KindOfLogicalQueryOperation = KindOfLogicalQueryOperation.Insert; _state = State.GotKindOfLogicalQueryOperation; break; default: throw new UnexpectedTokenException(_currToken); } break; default: throw new UnexpectedTokenException(_currToken); } break; case State.GotKindOfLogicalQueryOperation: switch (_currToken.TokenKind) { case TokenKind.OpenFactBracket: { _context.Recovery(_currToken); var parser = new LogicalQueryParser(_context); parser.Run(); var ruleInstanceItem = parser.Result; #if DEBUG //Log($"ruleInstanceItem = {ruleInstanceItem}"); #endif var value = new RuleInstanceValue(ruleInstanceItem); Result.Target = value; _state = State.GotTarget; } break; default: throw new UnexpectedTokenException(_currToken); } break; case State.GotTarget: switch (_currToken.TokenKind) { case TokenKind.LeftRightStream: case TokenKind.Semicolon: _context.Recovery(_currToken); Exit(); break; default: throw new UnexpectedTokenException(_currToken); } break; default: throw new ArgumentOutOfRangeException(nameof(_state), _state, null); } }
/// <inheritdoc/> protected override void OnRun() { #if DEBUG //Log($"_state = {_state}"); //Log($"_currToken = {_currToken}"); #endif switch (_state) { case State.Init: switch (_currToken.TokenKind) { case TokenKind.Word: switch (_currToken.KeyWordTokenKind) { case KeyWordTokenKind.Catch: _state = State.GotCatchMark; break; default: throw new UnexpectedTokenException(_currToken); } break; default: throw new UnexpectedTokenException(_currToken); } break; case State.GotCatchMark: switch (_currToken.TokenKind) { case TokenKind.OpenFigureBracket: ParseBody(); break; case TokenKind.OpenRoundBracket: _state = State.WaitForVariable; break; default: throw new UnexpectedTokenException(_currToken); } break; case State.WaitForVariable: switch (_currToken.TokenKind) { case TokenKind.Var: Result.VariableName = ParseName(_currToken.Content); _state = State.GotVariable; break; default: throw new UnexpectedTokenException(_currToken); } break; case State.GotVariable: switch (_currToken.TokenKind) { case TokenKind.CloseRoundBracket: _state = State.ClosedVariableSection; break; default: throw new UnexpectedTokenException(_currToken); } break; case State.ClosedVariableSection: switch (_currToken.TokenKind) { case TokenKind.OpenFigureBracket: ParseBody(); break; case TokenKind.Word: switch (_currToken.KeyWordTokenKind) { case KeyWordTokenKind.Where: _state = State.GotWhereMark; break; default: throw new UnexpectedTokenException(_currToken); } break; default: throw new UnexpectedTokenException(_currToken); } break; case State.GotWhereMark: switch (_currToken.TokenKind) { case TokenKind.OpenFactBracket: { _context.Recovery(_currToken); var parser = new LogicalQueryParser(_context); parser.Run(); Result.Condition = parser.Result; _state = State.GotCondition; } break; default: throw new UnexpectedTokenException(_currToken); } break; case State.GotCondition: switch (_currToken.TokenKind) { case TokenKind.OpenFigureBracket: ParseBody(); break; default: throw new UnexpectedTokenException(_currToken); } break; default: throw new ArgumentOutOfRangeException(nameof(_state), _state, null); } }
/// <inheritdoc/> protected override void OnRun() { #if DEBUG //Log($"_currToken = {_currToken}"); //Log($"Result = {Result}"); //Log($"_state = {_state}"); #endif switch (_state) { case State.Init: switch (_currToken.TokenKind) { case TokenKind.Word: switch (_currToken.KeyWordTokenKind) { case KeyWordTokenKind.On: _state = State.WaitForCondition; break; default: throw new UnexpectedTokenException(_currToken); } break; default: throw new UnexpectedTokenException(_currToken); } break; case State.WaitForCondition: switch (_currToken.TokenKind) { case TokenKind.Word: switch (_currToken.KeyWordTokenKind) { case KeyWordTokenKind.Init: _inlineTrigger.Kind = KindOfInlineTrigger.SystemEvent; _inlineTrigger.KindOfSystemEvent = KindOfSystemEventOfInlineTrigger.Init; _state = State.GotCondition; break; default: throw new UnexpectedTokenException(_currToken); } break; case TokenKind.OpenFactBracket: { _inlineTrigger.Kind = KindOfInlineTrigger.LogicConditional; _context.Recovery(_currToken); var parser = new LogicalQueryParser(_context); parser.Run(); _inlineTrigger.Condition = parser.Result; _state = State.GotCondition; } break; default: throw new UnexpectedTokenException(_currToken); } break; case State.GotCondition: switch (_currToken.TokenKind) { case TokenKind.Lambda: _state = State.WaitForAction; break; case TokenKind.OpenRoundBracket: { _context.Recovery(_currToken); var parser = new InlineTriggerBindingVariablesParser(_context); parser.Run(); #if DEBUG //Log($"parser.Result = {parser.Result.WriteListToString()}"); #endif _inlineTrigger.BindingVariables = new BindingVariables(parser.Result); _state = State.GotBindingVariables; } break; default: throw new UnexpectedTokenException(_currToken); } break; case State.GotBindingVariables: switch (_currToken.TokenKind) { case TokenKind.Lambda: _state = State.WaitForAction; break; default: throw new UnexpectedTokenException(_currToken); } break; case State.WaitForAction: switch (_currToken.TokenKind) { case TokenKind.OpenFigureBracket: { _context.Recovery(_currToken); var parser = new FunctionBodyParser(_context); parser.Run(); var statementsList = parser.Result; _inlineTrigger.Statements = statementsList; _inlineTrigger.CompiledFunctionBody = _context.Compiler.Compile(statementsList); _state = State.GotAction; } break; default: throw new UnexpectedTokenException(_currToken); } break; case State.GotAction: switch (_currToken.TokenKind) { case TokenKind.CloseFigureBracket: _context.Recovery(_currToken); Exit(); break; case TokenKind.Word: switch (_currToken.KeyWordTokenKind) { case KeyWordTokenKind.On: _context.Recovery(_currToken); Exit(); break; default: throw new UnexpectedTokenException(_currToken); } break; default: throw new UnexpectedTokenException(_currToken); } break; default: throw new ArgumentOutOfRangeException(nameof(_state), _state, null); } }
/// <inheritdoc/> protected override void OnRun() { #if DEBUG //Log($"_state = {_state}"); //Log($"_currToken = {_currToken}"); #endif switch (_state) { case State.Init: switch (_currToken.TokenKind) { case TokenKind.Word: switch (_currToken.KeyWordTokenKind) { case KeyWordTokenKind.Error: _state = State.GotError; break; default: throw new UnexpectedTokenException(_currToken); } break; default: throw new UnexpectedTokenException(_currToken); } break; case State.GotError: switch (_currToken.TokenKind) { case TokenKind.OpenFactBracket: { _context.Recovery(_currToken); var parser = new LogicalQueryParser(_context); parser.Run(); #if DEBUG //Log($"parser.Result = {parser.Result}"); #endif _rawStatement.RuleInstanceValue = new RuleInstanceValue(parser.Result); _state = State.GotFact; } break; default: throw new UnexpectedTokenException(_currToken); } break; case State.GotFact: switch (_currToken.TokenKind) { case TokenKind.Semicolon: Exit(); break; default: throw new UnexpectedTokenException(_currToken); } break; default: throw new ArgumentOutOfRangeException(nameof(_state), _state, null); } }