public override void EnterExpression([NotNull] DslGrammarParser.ExpressionContext context) { if (OnEnterExpression == null) { return; } AntlrTokenType tokenType = (AntlrTokenType)Enum.Parse(typeof(AntlrTokenType), context.OPERATOR().GetText()); OnEnterExpression(tokenType, context.WORD().GetText()); }
private void OnInitEntry(AntlrTokenType tokenType, string tokenValue) { if (tokenType == AntlrTokenType.SOURCE) { if (tokenValue.Equals("BlockProcessor", StringComparison.InvariantCultureIgnoreCase)) { var sourceElement = new BlockProcessorSource <Block>(_blockProcessor); _blockProcessorPipelineBuilder = new PipelineBuilder <Block, Block>(sourceElement); return; } throw new ArgumentException($"Given token {tokenType} value {tokenValue} is not supported."); } }
public override void EnterInit([NotNull] DslGrammarParser.InitContext context) { if (OnEnterInit == null) { return; } var sourceNode = context.expression().First(); var nodeText = sourceNode.OPERATOR().GetText(); var isTokenType = Enum.IsDefined(typeof(AntlrTokenType), nodeText); var tokenValue = sourceNode.WORD().GetText(); if (isTokenType && nodeText.Equals("SOURCE")) { AntlrTokenType type; AntlrTokenType.TryParse(nodeText, out type); OnEnterInit(type, tokenValue); } }
private void OnExpressionEntry(AntlrTokenType tokenType, string tokenValue) { switch (tokenType) { case AntlrTokenType.SOURCE: break; case AntlrTokenType.WHERE: break; case AntlrTokenType.WATCH: SetWatchOnPipeline(tokenValue); break; case AntlrTokenType.PUBLISH: AddPublisher(tokenValue); break; default: throw new ArgumentException($"Given token is not supported {tokenType}"); } }