bundles/org.apache.jasper.glassfish/src/org/apache/jasper/compiler/Parser.java
public static Node.Nodes parse(ParserController pc,
                                   String path,
				   JspReader reader,
				   Node parent,
				   boolean isTagFile,
				   boolean directivesOnly,
				   URL jarFileUrl,
				   String pageEnc,
				   String jspConfigPageEnc,
                                   boolean isDefaultPageEncoding,
                                   boolean hasBom)
		throws JasperException {

	Parser parser = new Parser(pc, reader, isTagFile, directivesOnly,
                                   jarFileUrl, hasBom);

	Node.Root root = new Node.Root(reader.mark(), parent, false);
	root.setPageEncoding(pageEnc);
	root.setJspConfigPageEncoding(jspConfigPageEnc);
	root.setIsDefaultPageEncoding(isDefaultPageEncoding);
        root.setHasBom(hasBom);

        if (hasBom) {
            // Consume (remove) BOM, so it won't appear in page output
            char bomChar = (char) reader.nextChar();
            if (bomChar != 0xFEFF) {
                parser.err.jspError(
                        reader.mark(),
                        "jsp.error.invalidBom",
                        Integer.toHexString(bomChar).toUpperCase());
            }
        }

	if (directivesOnly) {
	    parser.parseTagFileDirectives(root);
	    return new Node.Nodes(root);
	}

	// For the Top level page, add inlcude-prelude and include-coda
	PageInfo pageInfo = pc.getCompiler().getPageInfo();
	if (parent == null) {
	    parser.addInclude(root, pageInfo.getIncludePrelude());
	}
	while (reader.hasMoreInput()) {
	    parser.parseElements(root);
	}
	if (parent == null) {
	    parser.addInclude(root, pageInfo.getIncludeCoda());
	    parser.pageInfo.setRootPath(path);
	}

	Node.Nodes page = new Node.Nodes(root);
	return page;
    }
public static Node.Nodes parse(ParserController pc,
                                   String path,
				   JspReader reader,
				   Node parent,
				   boolean isTagFile,
				   boolean directivesOnly,
				   URL jarFileUrl,
				   String pageEnc,
				   String jspConfigPageEnc,
                                   boolean isDefaultPageEncoding,
                                   boolean hasBom)
		throws JasperException {

	Parser parser = new Parser(pc, reader, isTagFile, directivesOnly,
                                   jarFileUrl, hasBom);

	Node.Root root = new Node.Root(reader.mark(), parent, false);
	root.setPageEncoding(pageEnc);
	root.setJspConfigPageEncoding(jspConfigPageEnc);
	root.setIsDefaultPageEncoding(isDefaultPageEncoding);
        root.setHasBom(hasBom);

        if (hasBom) {
            // Consume (remove) BOM, so it won't appear in page output
            char bomChar = (char) reader.nextChar();
            if (bomChar != 0xFEFF) {
                parser.err.jspError(
                        reader.mark(),
                        "jsp.error.invalidBom",
                        Integer.toHexString(bomChar).toUpperCase());
            }
        }

	if (directivesOnly) {
	    parser.parseTagFileDirectives(root);
	    return new Node.Nodes(root);
	}

	// For the Top level page, add inlcude-prelude and include-coda
	PageInfo pageInfo = pc.getCompiler().getPageInfo();
	if (parent == null) {
	    parser.addInclude(root, pageInfo.getIncludePrelude());
	}
	while (reader.hasMoreInput()) {
	    parser.parseElements(root);
	}
	if (parent == null) {
	    parser.addInclude(root, pageInfo.getIncludeCoda());
	    parser.pageInfo.setRootPath(path);
	}

	Node.Nodes page = new Node.Nodes(root);
	return page;
    }
The main entry for Parser

@param pc The ParseController, use for getting other objects in compiler
and for parsing included pages
@param reader To read the page
@param parent The parent node to this page, null for top level page
@return list of nodes representing the parsed page