Example #1
0
        private PqlPatternNode Pattern()
        {
            PqlToken   id      = currentToken;
            PqlSynonym synonym = new PqlSynonym(id);

            Eat(PqlTokenType.IDENT);
            Eat(PqlTokenType.LPAREN);
            PqlArgument varRef = Ref();

            Eat(PqlTokenType.COMMA);

            PqlExpr expr = null;

            if (currentToken.Type == PqlTokenType.STRING)
            {
                expr = Expr(true);
            }
            else if (currentToken.Type == PqlTokenType.FLOOR)
            {
                Eat(PqlTokenType.FLOOR);
                if (currentToken.Type == PqlTokenType.STRING)
                {
                    expr = Expr(false);
                    Eat(PqlTokenType.FLOOR);
                }
                else if (currentToken.Type == PqlTokenType.COMMA)
                {
                    Eat(PqlTokenType.COMMA);
                    Eat(PqlTokenType.FLOOR);
                }
            }
            Eat(PqlTokenType.RPAREN);
            return(new PqlPatternNode(synonym, varRef, expr));
        }
Example #2
0
        private PqlDeclaration Declaration(PqlToken declarationType)
        {
            PqlToken   id      = currentToken;
            PqlSynonym synonym = new PqlSynonym(id);

            Eat(PqlTokenType.IDENT);
            if (currentToken.Type == PqlTokenType.COMMA)
            {
                Eat(PqlTokenType.COMMA);
            }
            return(new PqlDeclaration(declarationType, synonym));
        }