Package Parser

Examples of Parser.Parser


      this.literals = entry.getLiterals();
      this.terms = entry.getTerms();
      this.rootNode = entry.getRootNode();
      this.tree = entry.getTree();
    } else {
      Parser p = new Parser(new StringReader(";"));
      rootNode = p.parse(new StringReader(query), null);
      rootNode.childrenAccept(this, null);
      TreeBuilder builder = new TreeBuilder(rootNode);
      tree = builder.getRootNode();
      entry = new CacheEntry(this.negatedTerms, this.andTerms, this.orTerms, this.literals, this.terms, rootNode, tree);
      synchronized (cache) {
View Full Code Here


  private TreeNode rootNode = null;
  private TreeNode currentNode = null;
  private boolean currentlyInCheckChildren = false;
 
  public TreeBuilder(String query) throws ParseException {
    Parser p = new Parser(new StringReader(";"));
    ASTJexlScript script = p.parse(new StringReader(query), null);
    // Check to see if the child node is an AND or OR. If not, then
    // there must be just a single value in the query expression
    rootNode = new TreeNode();
    rootNode.setType(RootNode.class);
    currentNode = rootNode;
View Full Code Here

     * @return where clauses to use to build the query.
     * @throws InvalidSearchConditionException in case of errors retrieving identifiers.
     */
    private Set<String> getWhereClause(final String expression, final String value)
            throws InvalidSearchConditionException {
        final Parser parser = new Parser(new StringReader(expression));

        // Schema names
        final List<String> identifiers = new ArrayList<String>();

        // Literals
        final List<String> literals = new ArrayList<String>();

        // Get schema names and literals
        Token token;
        while ((token = parser.getNextToken()) != null && StringUtils.hasText(token.toString())) {

            if (token.kind == ParserConstants.STRING_LITERAL) {
                literals.add(token.toString().substring(1, token.toString().length() - 1));
            }

View Full Code Here

     * @return where clauses to use to build the query.
     * @throws InvalidSearchConditionException in case of errors retrieving identifiers.
     */
    private Set<String> getWhereClause(final String expression, final String value)
            throws InvalidSearchConditionException {
        final Parser parser = new Parser(new StringReader(expression));

        // Schema names
        final List<String> identifiers = new ArrayList<String>();

        // Literals
        final List<String> literals = new ArrayList<String>();

        // Get schema names and literals
        Token token;
        while ((token = parser.getNextToken()) != null && StringUtils.hasText(token.toString())) {

            if (token.kind == ParserConstants.STRING_LITERAL) {
                literals.add(token.toString().substring(1, token.toString().length() - 1));
            }

View Full Code Here

    {
        JexlContext jc = new MapContext();
        jc.set("aString", "Hello");
        Foo foo = new Foo();
        jc.set("foo", foo);
        Parser parser = new Parser(new StringReader(";"));
        parser.parse(new StringReader("aString = 'World';"), null);
       
        assertExpression(jc, "hello = 'world'", "world");
        assertEquals("hello variable not changed", "world", jc.get("hello"));
        assertExpression(jc, "result = 1 + 1", new Integer(2));
        assertEquals("result variable not changed", new Integer(2), jc.get("result"));
View Full Code Here

    {
        JexlContext jc = new MapContext();
        jc.set("aString", "Hello");
        Foo foo = new Foo();
        jc.set("foo", foo);
        Parser parser = new Parser(new StringReader(";"));
        parser.parse(new StringReader("aString = 'World';"), null);
       
        assertExpression(jc, "hello = 'world'", "world");
        assertEquals("hello variable not changed", "world", jc.get("hello"));
        assertExpression(jc, "result = 1 + 1", new Integer(2));
        assertEquals("result variable not changed", new Integer(2), jc.get("result"));
View Full Code Here

     * @return where clauses to use to build the query.
     * @throws InvalidSearchConditionException in case of errors retrieving identifiers.
     */
    private Set<String> getWhereClause(final String expression, final String value)
            throws InvalidSearchConditionException {
        final Parser parser = new Parser(new StringReader(expression));

        // Schema names
        final List<String> identifiers = new ArrayList<String>();

        // Literals
        final List<String> literals = new ArrayList<String>();

        // Get schema names and literals
        Token token;
        while ((token = parser.getNextToken()) != null && StringUtils.hasText(token.toString())) {

            if (token.kind == ParserConstants.STRING_LITERAL) {
                literals.add(token.toString().substring(1, token.toString().length() - 1));
            }

View Full Code Here

            {
                output.write(BufferUtil.toArray(buffer));
            }

            final CountDownLatch latch = new CountDownLatch(1);
            Parser parser = new Parser(byteBufferPool, new Parser.Listener.Adapter()
            {
                @Override
                public boolean onGoAway(GoAwayFrame frame)
                {
                    latch.countDown();
View Full Code Here

            {
                output.write(BufferUtil.toArray(buffer));
            }

            final AtomicReference<HeadersFrame> frameRef = new AtomicReference<>();
            Parser parser = new Parser(byteBufferPool, new Parser.Listener.Adapter()
            {
                @Override
                public boolean onSettings(SettingsFrame frame)
                {
                    latch.countDown();
View Full Code Here

                output.write(BufferUtil.toArray(buffer));
            }

            final AtomicReference<HeadersFrame> headersRef = new AtomicReference<>();
            final AtomicReference<DataFrame> dataRef = new AtomicReference<>();
            Parser parser = new Parser(byteBufferPool, new Parser.Listener.Adapter()
            {
                @Override
                public boolean onSettings(SettingsFrame frame)
                {
                    latch.countDown();
View Full Code Here

TOP

Related Classes of Parser.Parser

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.