Class: LibRubyParser::ParserResult
- Inherits:
-
Object
- Object
- LibRubyParser::ParserResult
- Defined in:
- lib/lib-ruby-parser.rb
Overview
Combination of all data that +LibRubyParser+ can give you
Instance Attribute Summary collapse
-
#ast ⇒ Node?
Abstract Syntax Tree that was constructed from you code.
-
#comments ⇒ Array<Comment>
List of comments extracted from the source code.
-
#diagnostics ⇒ Array<Diagnostic>
List of all diagnostics (errors and warings) that have been recorded during lexing and parsing.
-
#input ⇒ DecodedInput
Input that was used for parsing.
-
#magic_comments ⇒ Array<MagicComment>
List of magic comments extracted from the source code.
-
#tokens ⇒ Array<Token>
List of tokens returned by a Lexer and consumed by a Parser.
Instance Attribute Details
#ast ⇒ Node?
Abstract Syntax Tree that was constructed from you code. +nil+ if the code gives no AST nodes
235 236 237 |
# File 'lib/lib-ruby-parser.rb', line 235 def ast @ast end |
#comments ⇒ Array<Comment>
List of comments extracted from the source code.
252 253 254 |
# File 'lib/lib-ruby-parser.rb', line 252 def comments @comments end |
#diagnostics ⇒ Array<Diagnostic>
List of all diagnostics (errors and warings) that have been recorded during lexing and parsing
247 248 249 |
# File 'lib/lib-ruby-parser.rb', line 247 def diagnostics @diagnostics end |
#input ⇒ DecodedInput
Input that was used for parsing.
Note: this input is not necessary the same byte array that you passed to Parser::parse. If encoding of the input is not +UTF-8+ or +ASCII-8BIT/BINARY+ Parser invokes decoder that usually produces a different sequence of bytes.
Pass this data to +Loc#source+, otherwise you’ll get incorrect source ranges.
268 269 270 |
# File 'lib/lib-ruby-parser.rb', line 268 def input @input end |
#magic_comments ⇒ Array<MagicComment>
List of magic comments extracted from the source code.
257 258 259 |
# File 'lib/lib-ruby-parser.rb', line 257 def magic_comments @magic_comments end |
#tokens ⇒ Array<Token>
List of tokens returned by a Lexer and consumed by a Parser. Empty unless +:record_tokens+ is set to true.
241 242 243 |
# File 'lib/lib-ruby-parser.rb', line 241 def tokens @tokens end |