Package org.antlr.v4.runtime.atn

Examples of org.antlr.v4.runtime.atn.SemanticContext$Predicate


        {
          elementOptions.append("tokenIndex=").append(tok.getTokenIndex());
        }

        if ( node instanceof GrammarASTWithOptions ) {
          GrammarASTWithOptions o = (GrammarASTWithOptions)node;
          for (Map.Entry<String, GrammarAST> entry : o.getOptions().entrySet()) {
            if (elementOptions.length() > 0) {
              elementOptions.append(',');
            }

            elementOptions.append(entry.getKey());
View Full Code Here


  public AltAST addPrecedenceArgToRules(AltAST t, int prec) {
    if ( t==null ) return null;
    // get all top-level rule refs from ALT
    List<GrammarAST> outerAltRuleRefs = t.getNodesWithTypePreorderDFS(IntervalSet.of(RULE_REF));
    for (GrammarAST x : outerAltRuleRefs) {
      RuleRefAST rref = (RuleRefAST)x;
      boolean recursive = rref.getText().equals(ruleName);
      boolean rightmost = rref == outerAltRuleRefs.get(outerAltRuleRefs.size()-1);
      if ( recursive && rightmost ) {
        GrammarAST dummyValueNode = new GrammarAST(new CommonToken(ANTLRParser.INT, ""+prec));
        rref.setOption(LeftRecursiveRuleTransformer.PRECEDENCE_OPTION_NAME, dummyValueNode);
      }
    }
    return t;
  }
View Full Code Here

       
        vv.getRenderContext().setVertexShapeTransformer(new ClusterVertexShapeFunction());
       
        final PredicatedParallelEdgeIndexFunction eif = PredicatedParallelEdgeIndexFunction.getInstance();
        final Set exclusions = new HashSet();
        eif.setPredicate(new Predicate() {

      public boolean evaluate(Object e) {
       
        return exclusions.contains(e);
      }});
View Full Code Here

       
        vv.getRenderContext().setVertexShapeTransformer(new ClusterVertexShapeFunction());
       
        final PredicatedParallelEdgeIndexFunction eif = PredicatedParallelEdgeIndexFunction.getInstance();
        final Set exclusions = new HashSet();
        eif.setPredicate(new Predicate() {

      public boolean evaluate(Object e) {
       
        return exclusions.contains(e);
      }});
View Full Code Here

            if (i % 6 == 0) {
                sixes.add(new Integer(i));
            }
        }

        truePred = new Predicate() {
            public boolean evaluate(Object x) {
                return true;
            }
        };

        falsePred = new Predicate() {
            public boolean evaluate(Object x) {
                return true;
            }
        };

        evenPred = new Predicate() {
            public boolean evaluate(Object x) {
                return (((Integer) x).intValue() % 2 == 0);
            }
        };

        oddPred = new Predicate() {
            public boolean evaluate(Object x) {
                return (((Integer) x).intValue() % 2 == 1);
            }
        };

        threePred = new Predicate() {
            public boolean evaluate(Object x) {
                return (((Integer) x).intValue() % 3 == 0);
            }
        };

        fourPred = new Predicate() {
            public boolean evaluate(Object x) {
                return (((Integer) x).intValue() % 4 == 0);
            }
        };
View Full Code Here

            // success
        }
    }

    private void verifyElementsInPredicate(final String[] elements) {
        Predicate pred = new Predicate() {
            public boolean evaluate(Object x) {
                for (int i = 0; i < elements.length; i++)
                    if (elements[i].equals(x))
                        return true;
                return false;
View Full Code Here

     *
     * @param i the Iterator to "filter"
     * @return "filtered" iterator
     */
    protected FilterIterator makePassThroughFilter(Iterator i) {
        Predicate pred = new Predicate() {
            public boolean evaluate(Object x) {
                return true;
            }
        };
        return new FilterIterator(i, pred);
View Full Code Here

     *
     * @param i the Iterator to "filter"
     * @return "filtered" iterator
     */
    protected FilterIterator makeBlockAllFilter(Iterator i) {
        Predicate pred = new Predicate() {
            public boolean evaluate(Object x) {
                return false;
            }
        };
        return new FilterIterator(i, pred);
View Full Code Here

    }
   
    //--------------------------------------------------------------------------

    protected Predicate stringPredicate() {
        return new Predicate() {
            public boolean evaluate(Object o) {
                return o instanceof String;
            }
        };
    }
View Full Code Here

    }
   
    //--------------------------------------------------------------------------
   
    protected Predicate stringPredicate() {
        return new Predicate() {
            public boolean evaluate(Object o) {
                return o instanceof String;
            }
        };
    }
View Full Code Here

TOP

Related Classes of org.antlr.v4.runtime.atn.SemanticContext$Predicate

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.