Package org.modeshape.common.text

Examples of org.modeshape.common.text.TokenStream


     * @param content the content
     * @throws ParsingException if there is a problem parsing the content
     */
    protected void parse( String content ) {
        Tokenizer tokenizer = new CndTokenizer(false, true);
        TokenStream tokens = new TokenStream(content, tokenizer, false);
        tokens.start();
        while (tokens.hasNext()) {
            // Keep reading while we can recognize one of the two types of statements ...
            if (tokens.matches("<", ANY_VALUE, "=", ANY_VALUE, ">")) {
                parseNamespaceMapping(tokens);
            } else if (tokens.matches("[", ANY_VALUE, "]")) {
                parseNodeTypeDefinition(tokens);
            } else {
                Position position = tokens.previousPosition();
                throw new ParsingException(position, CndI18n.expectedNamespaceOrNodeDefinition.text(tokens.consume(),
                                                                                                    position.getLine(),
                                                                                                    position.getColumn()));
            }
        }
    }
View Full Code Here


        return new OrderBySpec(Order.DESCENDING, attributeName);
    }

    protected TokenStream tokenize( String xpath ) {
        Tokenizer tokenizer = new XPathParser.XPathTokenizer(false); // skip comments
        return new TokenStream(xpath, tokenizer, true).start(); // case sensitive!!
    }
View Full Code Here

    protected Path path( String path ) {
        return (Path)typeSystem.getTypeFactory(PropertyType.PATH.getName()).create(path);
    }

    protected TokenStream tokens( String content ) {
        return new TokenStream(content, new BasicSqlQueryParser.SqlTokenizer(false), false).start();
    }
View Full Code Here

    protected Path path( String path ) {
        return (Path)typeSystem.getTypeFactory(PropertyType.PATH.getName()).create(path);
    }

    protected TokenStream tokens( String content ) {
        return new TokenStream(content, new BasicSqlQueryParser.SqlTokenizer(false), false).start();
    }
View Full Code Here

    @Override
    public QueryCommand parseQuery( String query,
                                    TypeSystem typeSystem ) {
        Tokenizer tokenizer = new SqlTokenizer(false);
        TokenStream tokens = new TokenStream(query, tokenizer, false);
        tokens.start();
        return parseQueryCommand(tokens, typeSystem);
    }
View Full Code Here

     * @throws IllegalArgumentException if the expression is null
     */
    public Term parse( String fullTextSearchExpression ) {
        CheckArg.isNotNull(fullTextSearchExpression, "fullTextSearchExpression");
        Tokenizer tokenizer = new TermTokenizer();
        TokenStream stream = new TokenStream(fullTextSearchExpression, tokenizer, false);
        return parse(stream.start());
    }
View Full Code Here

        this.typeSystem = context;
    }

    public Component parseXPath( String xpath ) {
        Tokenizer tokenizer = new XPathTokenizer(false); // skip comments
        TokenStream tokens = new TokenStream(xpath, tokenizer, true).start(); // case sensitive!!
        return parseXPath(tokens);
    }
View Full Code Here

    @FixFor( "MODE-869" )
    @Test
    public void shouldParseStaticOperandWithSubqueryWithoutConsumingExtraTokens() {
        QueryCommand expected = parser.parseQuery(tokens("SELECT * FROM tableA"), typeSystem);
        TokenStream tokens = tokens("SELECT * FROM tableA)");
        StaticOperand operand = parser.parseStaticOperand(tokens, typeSystem);
        assertThat(operand, is(instanceOf(Subquery.class)));
        Subquery subquery = (Subquery)operand;
        assertThat(subquery.getQuery(), is(expected));
        assertThat(tokens.canConsume(')'), is(true));
    }
View Full Code Here

    protected DateTime date( String dateTime ) {
        return (DateTime)typeSystem.getDateTimeFactory().create(dateTime);
    }

    protected TokenStream tokens( String content ) {
        return new TokenStream(content, new BasicSqlQueryParser.SqlTokenizer(false), false).start();
    }
View Full Code Here

TOP

Related Classes of org.modeshape.common.text.TokenStream

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.