Ejemplo n.º 1
0
        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());
        }
Ejemplo n.º 2
0
        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.");
            }
        }
Ejemplo n.º 3
0
        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);
            }
        }
Ejemplo n.º 4
0
        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}");
            }
        }