Package org.jruby.parser
Class ParserManager
java.lang.Object
org.jruby.parser.ParserManager
Front-end API to parsing Ruby source.
Notes: 1. file parses can deserialize from IR but evals never do.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddGetsLoop
(Ruby runtime, ParseResult oldRoot, boolean printing, boolean processLineEndings, boolean split) getLineStub
(ThreadContext context, IRubyObject arg) parseEval
(String fileName, int lineNumber, String source, DynamicScope scope) parseEval
(String fileName, int lineNumber, ByteList source, DynamicScope scope) parseFile
(String fileName, int lineNumber, InputStream in, org.jcodings.Encoding encoding) Parse a (non-main) file.parseMainFile
(String fileName, int lineNumber, InputStream in, org.jcodings.Encoding encoding, DynamicScope scope, ParserType type) Parse main file (-e or main script file).
-
Field Details
-
PARSER_WASM
public static final boolean PARSER_WASM -
parserTiming
public final boolean parserTiming
-
-
Constructor Details
-
ParserManager
-
-
Method Details
-
getParser
-
parseEval
- Parameters:
fileName
- the potentially relative path filelineNumber
- the zero-indexed linesource
- the sourcescope
- scope of the eval which for embedding can potentially be none- Returns:
- the parsed Ruby
-
parseEval
- Parameters:
fileName
- the potentially relative path filelineNumber
- the zero-indexed linesource
- the sourcescope
- scope of the eval- Returns:
- the parsed Ruby
-
parseMainFile
public ParseResult parseMainFile(String fileName, int lineNumber, InputStream in, org.jcodings.Encoding encoding, DynamicScope scope, ParserType type) Parse main file (-e or main script file). Other file parses should use parseFile. Evals should use parseEval.- Parameters:
fileName
- the potentially relative path filelineNumber
- the zero-indexed linein
- the sourceencoding
- the encoding to treat the source unless magic comments intervenescope
- top-level binding in case of MAIN file (eval uses should call parseEval instead).type
- whether this is eval, is -e, or should worry about DATA- Returns:
- the parsed Ruby
-
parseFile
public ParseResult parseFile(String fileName, int lineNumber, InputStream in, org.jcodings.Encoding encoding) Parse a (non-main) file. Other file parses should use parseFile. Evals should use parseEval.- Parameters:
fileName
- the potentially relative path filelineNumber
- the zero-indexed linein
- the sourceencoding
- the encoding to treat the source unless magic comments intervene- Returns:
-
getParserStats
-
getLineStub
-
addGetsLoop
public ParseResult addGetsLoop(Ruby runtime, ParseResult oldRoot, boolean printing, boolean processLineEndings, boolean split)
-