MCPcopy Create free account
hub / github.com/mozilla/rhino / parse

Method parse

rhino/src/main/java/org/mozilla/javascript/Parser.java:614–629  ·  view source on GitHub ↗

Builds a parse tree from the given source string. @return an AstRoot object representing the parsed program. If the parse fails, null will be returned. (The parse failure will result in a call to the ErrorReporter from CompilerEnvirons.)

(String sourceString, String sourceURI, int lineno)

Source from the content-addressed store, hash-verified

612 * ErrorReporter} from {@link CompilerEnvirons}.)
613 */
614 public AstRoot parse(String sourceString, String sourceURI, int lineno) {
615 if (parseFinished) throw new IllegalStateException("parser reused");
616 this.sourceURI = sourceURI;
617 if (compilerEnv.isIdeMode()) {
618 this.sourceChars = sourceString.toCharArray();
619 }
620 currentPos = ts = new TokenStream(this, null, sourceString, lineno);
621 try {
622 return parse();
623 } catch (IOException iox) {
624 // Should never happen
625 throw new IllegalStateException();
626 } finally {
627 parseFinished = true;
628 }
629 }
630
631 /**
632 * Builds a parse tree from the given sourcereader.

Callers 15

parseMethod · 0.95
assertSourceMethod · 0.95
parseStrictMethod · 0.95
parseMethod · 0.95
parseMethod · 0.95
parseMethod · 0.95
compileMethod · 0.95
parseMethod · 0.95

Calls 15

readReaderMethod · 0.95
peekTokenMethod · 0.95
consumeTokenMethod · 0.95
functionMethod · 0.95
statementMethod · 0.95
getDirectiveMethod · 0.95
getNodeEndMethod · 0.95
setParentMethod · 0.95
lookupMessageMethod · 0.95
reportRuntimeErrorMethod · 0.95
lineNumberMethod · 0.95
reportErrorsIfExistsMethod · 0.95

Tested by 15

parseMethod · 0.76
assertSourceMethod · 0.76
parseStrictMethod · 0.76
parseMethod · 0.76
parseMethod · 0.76
parseMethod · 0.76
compileMethod · 0.76
parseMethod · 0.76