コード例 #1
0
        private WordExpression ParseWordExpression()
        {
            if (this.token != TokenType.Word &&
                this.token != TokenType.QuotedString &&
                this.token != TokenType.Anonymous &&
                this.token != TokenType.Any)
            {
                this.AssertTokenType(TokenType.Word);
            }

            string word = this.lexer.Current;

            WordExpression wordExpression = null;

            switch (this.token)
            {
            case TokenType.Word:
                wordExpression = new WordExpression(word);
                break;

            case TokenType.QuotedString:
                string wordWithoutQuotes = word.Substring(1, word.Length - 2);
                wordExpression = new WordExpression(wordWithoutQuotes);
                break;

            case TokenType.Any:
                wordExpression = new AnyExpression();
                break;

            case TokenType.Anonymous:
                wordExpression = new AnonymousExpression();
                break;
            }

            this.MoveNext();
            return(wordExpression);
        }
コード例 #2
0
ファイル: Parser.cs プロジェクト: bnantz/NCS-V1-1
        private WordExpression ParseWordExpression()
        {
            if (this.token != TokenType.Word
                && this.token != TokenType.QuotedString
                && this.token != TokenType.Anonymous
                && this.token != TokenType.Any)
            {
                this.AssertTokenType(TokenType.Word);
            }

            string word = this.lexer.Current;

            WordExpression wordExpression = null;

            switch (this.token)
            {
                case TokenType.Word:
                    wordExpression = new WordExpression(word);
                    break;
                case TokenType.QuotedString:
                    string wordWithoutQuotes = word.Substring(1, word.Length - 2);
                    wordExpression = new WordExpression(wordWithoutQuotes);
                    break;
                case TokenType.Any:
                    wordExpression = new AnyExpression();
                    break;
                case TokenType.Anonymous:
                    wordExpression = new AnonymousExpression();
                    break;
            }

            this.MoveNext();
            return wordExpression;
        }