Asserts a parse tree.

@param rootType     the type of the root of the tree.
@param preorder     the preorder traversal of the tree.
@param parseResults a helper class
483799
public static void assertTree(int rootType, String preorder, ParseResults parseResults)
    {
        assertTree(rootType, preorder, parseResults.getTree());
    }
158107
public static <A, B, C, T> Parser<T> sequence(
      final Parser<A> p1, final Parser<B> p2, final Parser<C> p3,
      final Map3<? super A, ? super B, ? super C, ? extends T> map) {
    return new Parser<T>() {
      @Override boolean apply(ParseContext ctxt) {
        boolean r1 = p1.apply(ctxt);
        if (!r1) return false;
        A o1 = p1.getReturn(ctxt);
        boolean r2 = p2.apply(ctxt);
        if (!r2) return false;
        B o2 = p2.getReturn(ctxt);
        boolean r3 = p3.apply(ctxt);
        if (!r3) return false;
        C o3 = p3.getReturn(ctxt);
        ctxt.result = map.map(o1, o2, o3);
        return true;
      }
      @Override public String toString() {
        return map.toString();
      }
    };
  }
278354
void setResult(JCExpression tree, Type type) {
        result = type;
        if (env.info.isSpeculative) {
            //if we are in a speculative branch we can save the type in the tree itself
            //as there's no risk of polluting the original tree.
            tree.type = result;
        }
    }
855325
private AbsAxis parseReverceAxis() {

        AbsAxis axis;
        if (is("parent", true)) {

            axis = new ParentAxis(getTransaction());

        } else if (is("ancestor", true)) {

            axis = new AncestorAxis(getTransaction());

        } else if (is("ancestor-or-self", true)) {

            axis = new AncestorAxis(getTransaction(), true);

        } else if (is("preceding", true)) {

            axis = new PrecedingAxis(getTransaction());

        } else {
            consume("preceding-sibling", true);

            axis = new PrecedingSiblingAxis(getTransaction());

        }

        consume(TokenType.COLON, true);
        consume(TokenType.COLON, true);

        return axis;
    }
201567
def register_default_plugins(root_parser: ParserRegistryWithConverters):
    
    # -------------------- CORE ---------------------------
    try:
        # -- primitive types
        from parsyfiles.plugins_base.support_for_primitive_types import get_default_primitive_parsers, \
            get_default_primitive_converters
        root_parser.register_parsers(get_default_primitive_parsers())
        root_parser.register_converters(get_default_primitive_converters())
    except ImportError as e:
        warn_import_error('primitive types', e)
    try:
        # -- collections
        from parsyfiles.plugins_base.support_for_collections import get_default_collection_parsers, \
            get_default_collection_converters
        root_parser.register_parsers(get_default_collection_parsers(root_parser, root_parser))
        root_parser.register_converters(get_default_collection_converters(root_parser))
    except ImportError as e:
        warn_import_error('dict', e)
    try:
        # -- objects
        from parsyfiles.plugins_base.support_for_objects import get_default_object_parsers, \
            get_default_object_converters
        root_parser.register_parsers(get_default_object_parsers(root_parser, root_parser))
        root_parser.register_converters(get_default_object_converters(root_parser))
    except ImportError as e:
        warn_import_error('objects', e)
    try:
        # -- config
        from parsyfiles.plugins_base.support_for_configparser import get_default_config_parsers, \
            get_default_config_converters
        root_parser.register_parsers(get_default_config_parsers())
        root_parser.register_converters(get_default_config_converters(root_parser))
    except ImportError as e:
        warn_import_error('config', e)

    # ------------------------- OPTIONAL -----------------
    try:
        # -- jprops
        from parsyfiles.plugins_optional.support_for_jprops import get_default_jprops_parsers
        root_parser.register_parsers(get_default_jprops_parsers(root_parser, root_parser))
        # root_parser.register_converters()
    except ImportError as e:
        warn_import_error('jprops', e)
    try:
        # -- yaml
        from parsyfiles.plugins_optional.support_for_yaml import get_default_yaml_parsers
        root_parser.register_parsers(get_default_yaml_parsers(root_parser, root_parser))
        # root_parser.register_converters()
    except ImportError as e:
        warn_import_error('yaml', e)
    try:
        # -- numpy
        from parsyfiles.plugins_optional.support_for_numpy import get_default_np_parsers, get_default_np_converters
        root_parser.register_parsers(get_default_np_parsers())
        root_parser.register_converters(get_default_np_converters())
    except ImportError as e:
        warn_import_error('numpy', e)
    try:
        # -- pandas
        from parsyfiles.plugins_optional.support_for_pandas import get_default_pandas_parsers, \
            get_default_pandas_converters
        root_parser.register_parsers(get_default_pandas_parsers())
        root_parser.register_converters(get_default_pandas_converters())
    except ImportError as e:
        warn_import_error('pandas', e)
64319
@Requires({
    "roots != null",
    "diagnosticManager != null"
  })
  @Ensures({
    "result != null",
    "result.size() >= roots.size()",
    "result.size() <= 2 * roots.size()"
  })
  protected List<TypeModel> createTypes(Set<TypeElement> roots,
                                        DiagnosticManager diagnosticManager) {
    boolean errors = false;

    /*
     * Extract all type names that will be part of this compilation
     * task.
     */
    final HashSet<String> knownTypeNames = new HashSet<String>();
    for (TypeElement r : roots) {
      ElementScanner6<Void, Void> visitor =
          new ElementScanner6<Void, Void>() {
            @Override
            public Void visitType(TypeElement e, Void p) {
              knownTypeNames.add(e.getQualifiedName().toString());
              return super.visitType(e, p);
            }
          };
      r.accept(visitor, null);
    }
    /*
     * Mark annotations inherited from classes compiled in the same
     * task as weak so we don't generate stubs for them later on. This
     * prevents name clashes due to erasure.
     */
    ArrayList<TypeModel> undecoratedTypes =
        new ArrayList<TypeModel>(roots.size());
    for (TypeElement r : roots) {
      TypeModel type = factory.createType(r, diagnosticManager);
      ElementScanner annotator =
          new ElementScanner() {
            @Override
            public void visitContractAnnotation(
                ContractAnnotationModel annotation) {
              if (annotation.isVirtual()
                  && knownTypeNames.contains(
                      annotation.getOwner().getQualifiedName())) {
                annotation.setWeakVirtual(true);
              }
            }
          };
      type.accept(annotator);
      undecoratedTypes.add(type);
    }
    /*
     * Decorate the type models with contract methods and create
     * helper types.
     */
    ArrayList<TypeModel> types =
        new ArrayList<TypeModel>(undecoratedTypes.size());
    for (TypeModel type : undecoratedTypes) {
      ClassContractCreator creator =
          new ClassContractCreator(diagnosticManager);
      type.accept(creator);
      TypeModel helper = creator.getHelperType();
      types.add(type);
      if (helper != null) {
        types.add(helper);
      }
    }

    return types;
  }
655434
public static void registerTypeBeanParser(BeanParser beanParser, Type... genericTypes) {
    for (Type genericType : genericTypes) {
      typeBeanParserMap.put(genericType, beanParser);
    }
  }
196870
private static <T> void checkPreconditions(final Class<T> type, final TextParser<T> parser) {
        if(type == null) {
            throw new NullPointerException("type is null.");
        }
        
        if(parser == null) {
            throw new NullPointerException("parser is null.");
        }
    }
690022
JCPrimitiveTypeTree basicType() {
        JCPrimitiveTypeTree t = to(F.at(token.pos).TypeIdent(typetag(token.kind)));
        nextToken();
        return t;
    }
46194
public void accept(final TokenType tokenType) {
        if (lexer.getCurrentToken().getType() != tokenType) {
            throw new SQLParsingException(lexer, tokenType);
        }
        lexer.nextToken();
    }
1198138
public static boolean copyTreeToResult(Node tree, Result result)
    {
        try {
            // Use a Transformer for output
            TransformerFactory tFactory = TransformerFactory.newInstance();
            Transformer transformer = tFactory.newTransformer();

            DOMSource source = new DOMSource(tree);
            transformer.transform(source, result);
            return true;    // Success
        } catch (TransformerConfigurationException tce) {
            // Error generated by the parser
            tce.printStackTrace();
        } catch (TransformerException te) {
            // Error generated by the parser
            te.printStackTrace();
        }
        return false;   // Failure
    }
1028591
public static <T extends Tree> Matcher<T> isPrimitiveType() {
    return new Matcher<T>() {
      @Override
      public boolean matches(Tree t, VisitorState state) {
        Type type = getType(t);
        return type != null && type.isPrimitive();
      }
    };
  }
676262
private void parseEntitiesSheet(
      Repository<Entity> entitiesRepo, IntermediateParseResults intermediateResults) {
    if (entitiesRepo != null) {
      checkEntitySheetHeaders(entitiesRepo);

      int rowIndex = 1;
      for (Entity entity : entitiesRepo) {
        rowIndex++;
        parseSingleEntityType(intermediateResults, rowIndex, entity);
      }
    }
  }
1137727
@SuppressWarnings("resource")
    @Override
    protected HoconTreeTraversingParser _createParser(InputStream in, IOContext ctxt)
        throws IOException, JsonParseException
    {
        Reader r = _createReader(in, null, ctxt);
        return _createParser(r, ctxt);
    }
353486
@Override
    <T> T read(Class<T> rootType) {
        try {
            try {
                return parseRemaining(rootType);
            } finally {
                input.close();
            }
        } catch (RuntimeException ex) {
            throw ex;
        } catch (Exception ex) {
            throw new RuntimeException(ex);
        }
    }
633208
protected void parseNodeTypeDefinition( TokenStream tokens ) {
        // Parse the name, and create the path and a property for the name ...
        Name name = parseNodeTypeName(tokens);
        JcrNodeTypeTemplate nodeType = new JcrNodeTypeTemplate(context);
        try {
            nodeType.setName(string(name));
        } catch (ConstraintViolationException e) {
            assert false : "Names should always be syntactically valid";
        }

        // Read the (optional) supertypes ...
        List<Name> supertypes = parseSupertypes(tokens);
        try {
            nodeType.setDeclaredSuperTypeNames(names(supertypes));

            // Read the node type options (and vendor extensions) ...
            parseNodeTypeOptions(tokens, nodeType);

            // Parse property and child node definitions ...
            parsePropertyOrChildNodeDefinitions(tokens, nodeType);
        } catch (ConstraintViolationException e) {
            assert false : "Names should always be syntactically valid";
        }

        this.nodeTypes.add(nodeType);
    }
800430
Class evalReturnType( CallStack callstack, Interpreter interpreter )
        throws EvalError
    {
        insureNodesParsed();
        if ( returnTypeNode != null )
            return returnTypeNode.evalReturnType( callstack, interpreter );
        else
            return null;
    }