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
(ParserController pc, JspReader reader, Node parent, boolean isTagFile,
boolean directivesOnly, Jar jar, String pageEnc, String jspConfigPageEnc, boolean isDefaultPageEncoding,
boolean isBomPresent)
| 101 | * @throws JasperException If an error occurs during parsing |
| 102 | */ |
| 103 | public static Node.Nodes parse(ParserController pc, JspReader reader, Node parent, boolean isTagFile, |
| 104 | boolean directivesOnly, Jar jar, String pageEnc, String jspConfigPageEnc, boolean isDefaultPageEncoding, |
| 105 | boolean isBomPresent) throws JasperException { |
| 106 | |
| 107 | Parser parser = new Parser(pc, reader, isTagFile, directivesOnly, jar); |
| 108 | |
| 109 | Node.Root root = new Node.Root(reader.mark(), parent, false, |
| 110 | pc.getJspCompilationContext().getOptions().getTempVariableNamePrefix()); |
| 111 | root.setPageEncoding(pageEnc); |
| 112 | root.setJspConfigPageEncoding(jspConfigPageEnc); |
| 113 | root.setIsDefaultPageEncoding(isDefaultPageEncoding); |
| 114 | root.setIsBomPresent(isBomPresent); |
| 115 | |
| 116 | // For the Top level page, add include-prelude and include-coda |
| 117 | PageInfo pageInfo = pc.getCompiler().getPageInfo(); |
| 118 | if (parent == null && !isTagFile) { |
| 119 | parser.addInclude(root, pageInfo.getIncludePrelude()); |
| 120 | } |
| 121 | if (directivesOnly) { |
| 122 | parser.parseFileDirectives(root); |
| 123 | } else { |
| 124 | while (reader.hasMoreInput()) { |
| 125 | parser.parseElements(root); |
| 126 | } |
| 127 | } |
| 128 | if (parent == null && !isTagFile) { |
| 129 | parser.addInclude(root, pageInfo.getIncludeCoda()); |
| 130 | } |
| 131 | |
| 132 | return new Node.Nodes(root); |
| 133 | } |
| 134 | |
| 135 | /** |
| 136 | * Attributes ::= (S Attribute)* S? |
no test coverage detected