예제 #1
0
        public static bool TryParseNode(Genero4glParser parser, out DisplayStatement node, bool isArray, List <TokenKind> validExitKeywords = null, bool returnFalseInsteadOfErrors = false)
        {
            node = new DisplayStatement();
            bool result = true;

            switch (parser.PeekToken().Kind)
            {
            case TokenKind.AcceptKeyword:
            case TokenKind.ContinueKeyword:
            case TokenKind.ExitKeyword:
            {
                if (parser.PeekToken(TokenKind.DisplayKeyword, 2))
                {
                    parser.NextToken();
                    node.StartIndex = parser.Token.Span.Start;
                    parser.NextToken();
                }
                else
                {
                    result = false;
                }
                break;
            }

            default:
            {
                result = false;
                break;
            }
            }

            return(result);
        }
예제 #2
0
        private static bool TryGetDisplayStatement(Genero4glParser parser, out DisplayStatement node, bool isArray, bool returnFalseInsteadOfErrors = false)
        {
            bool result = false;

            node = null;

            DisplayStatement inputStmt;

            if ((result = DisplayStatement.TryParseNode(parser, out inputStmt, isArray, null, returnFalseInsteadOfErrors)))
            {
                node = inputStmt;
            }

            return(result);
        }