예제 #1
0
        public override void Parse(Parser parser)
        {
            var token = parser.Lexer.ReadNext();

            if (token.TokenType != TokenType.StartSequence)
            {
                Left = new FailNode(token);
                return;
            }
            token = parser.Lexer.ReadNext();
            if ((token.TokenType == TokenType.keyword) && (token.TokenValue == "Send"))
            {
                Left = new SendNode(token);
                Left.Parse(parser);
                token = parser.Lexer.ReadNext();
                if (token.TokenType != TokenType.EndSequence && token.TokenType != TokenType.Eos && token.TokenType != TokenType.Fail)
                {
                    Right = new SequenceNode(token);
                    Right.Parse(parser);
                }
            }
            if (token.TokenType != TokenType.EndSequence)
            {
                Right = new FailNode(token);
            }
        }
예제 #2
0
        public override void Parse(Parser parser)
        {
            Left = new BehaviorNode(Token);
            Left.Parse(parser);
            var token = parser.Peek();

            if (token.TokenType == TokenType.Eos)
            {
                return;
            }
            if (token.TokenType == TokenType.Fail)
            {
                Right = new FailNode(token);
                return;
            }
            Right = new BehaviorsNode(token);
            Right.Parse(parser);
        }