コード例 #1
0
        public override bool Parse(SyntacticState state)
        {
            // check whether we need to ignore nullable types
            int flag = state.GetFlag <int>(StateFlags.IgnoreNullableAfterPosition);

            if (flag > 0 && state.InnerPosition >= flag)
            {
                // perform parsing ignoring nullable types
                state.RaiseFlag(StateFlags.IgnoreNullable);

                bool parsed = ParseAny(
                    state,
                    new ParseAll(LeftAngleBracketTerminal.S, ShiftExpression.S),
                    new ParseAll(RightAngleBracketTerminal.S, ShiftExpression.S),
                    new ParseAll(LessOrEqualTerminal.S, ShiftExpression.S),
                    new ParseAll(GreaterOrEqualTerminal.S, ShiftExpression.S),
                    new ParseAll(IsTerminal.S, Type.S),
                    new ParseAll(AsTerminal.S, Type.S));

                state.LowerFlag(StateFlags.IgnoreNullable);
                return(parsed);
            }

            // perform usual parsing
            return(ParseAny(
                       state,
                       new ParseAll(LeftAngleBracketTerminal.S, ShiftExpression.S),
                       new ParseAll(RightAngleBracketTerminal.S, ShiftExpression.S),
                       new ParseAll(LessOrEqualTerminal.S, ShiftExpression.S),
                       new ParseAll(GreaterOrEqualTerminal.S, ShiftExpression.S),
                       new ParseAll(IsTerminal.S, Type.S),
                       new ParseAll(AsTerminal.S, Type.S)));
        }
コード例 #2
0
        public override bool Parse(SyntacticState state)
        {
            // check whether we need to ignore nullable types
            int flag = state.GetFlag<int>(StateFlags.IgnoreNullableAfterPosition);
            if (flag > 0 && state.InnerPosition >= flag)
            {
                // perform parsing ignoring nullable types
                state.RaiseFlag(StateFlags.IgnoreNullable);

                bool parsed = ParseAny(
                    state,
                    new ParseAll(LeftAngleBracketTerminal.S, ShiftExpression.S),
                    new ParseAll(RightAngleBracketTerminal.S, ShiftExpression.S),
                    new ParseAll(LessOrEqualTerminal.S, ShiftExpression.S),
                    new ParseAll(GreaterOrEqualTerminal.S, ShiftExpression.S),
                    new ParseAll(IsTerminal.S, Type.S),
                    new ParseAll(AsTerminal.S, Type.S));

                state.LowerFlag(StateFlags.IgnoreNullable);
                return parsed;
            }

            // perform usual parsing
            return ParseAny(
                state,
                new ParseAll(LeftAngleBracketTerminal.S, ShiftExpression.S),
                new ParseAll(RightAngleBracketTerminal.S, ShiftExpression.S),
                new ParseAll(LessOrEqualTerminal.S, ShiftExpression.S),
                new ParseAll(GreaterOrEqualTerminal.S, ShiftExpression.S),
                new ParseAll(IsTerminal.S, Type.S),
                new ParseAll(AsTerminal.S, Type.S));
        }
コード例 #3
0
ファイル: QueryBodyClause.cs プロジェクト: shuruev/NutaParser
        public override bool Parse(SyntacticState state)
        {
            // this is a special case when we want to
            // prohibit using LINQ keywords as identifiers
            state.RaiseFlag(StateFlags.InsideLinq);

            bool parsed = ParseAny(
                state,
                FromClause.S,
                LetClause.S,
                WhereClause.S,
                JoinIntoClause.S,
                JoinClause.S,
                OrderbyClause.S);

            state.LowerFlag(StateFlags.InsideLinq);
            return(parsed);
        }
コード例 #4
0
ファイル: QueryBodyClause.cs プロジェクト: shuruev/NutaParser
        public override bool Parse(SyntacticState state)
        {
            // this is a special case when we want to
            // prohibit using LINQ keywords as identifiers
            state.RaiseFlag(StateFlags.InsideLinq);

            bool parsed = ParseAny(
                state,
                FromClause.S,
                LetClause.S,
                WhereClause.S,
                JoinIntoClause.S,
                JoinClause.S,
                OrderbyClause.S);

            state.LowerFlag(StateFlags.InsideLinq);
            return parsed;
        }