This represents the result of a call to ::parse or ::parse_file. It contains the AST, any comments that were encounters, and any errors that were encountered.
- A
- D
- F
- M
- N
- S
Attributes
[R] | comments | The list of comments that were encountered during parsing. |
[R] | data_loc | An optional location that represents the location of the content after the __END__ marker. This content is loaded into the DATA constant when the file being parsed is the main file being executed. |
[R] | errors | The list of errors that were generated during parsing. |
[R] | magic_comments | The list of magic comments that were encountered during parsing. |
[R] | source | A |
[R] | value | The value that was generated by parsing. Normally this holds the AST, but it can sometimes how a list of tokens or other results passed back from the parser. |
[R] | warnings | The list of warnings that were generated during parsing. |
Class Public methods
new(value, comments, magic_comments, data_loc, errors, warnings, source) Link
Create a new parse result object with the given values.
# File ruby/lib/prism/parse_result.rb, line 387 def initialize(value, comments, magic_comments, data_loc, errors, warnings, source) @value = value @comments = comments @magic_comments = magic_comments @data_loc = data_loc @errors = errors @warnings = warnings @source = source end
Instance Public methods
attach_comments!() Link
Attach the list of comments to their respective locations in the tree.
deconstruct_keys(keys) Link
Implement the hash pattern matching interface for ParseResult
.
failure?() Link
Returns true if there were errors during parsing and false if there were not.
mark_newlines!() Link
Walk the tree and mark nodes that are on a new line.