Class: LibRubyParser::ParserResult

Inherits:
Object
  • Object
show all
Defined in:
lib/lib-ruby-parser.rb

Overview

Combination of all data that +LibRubyParser+ can give you

Instance Attribute Summary collapse

Instance Attribute Details

#astNode?

Abstract Syntax Tree that was constructed from you code. +nil+ if the code gives no AST nodes

Returns:



235
236
237
# File 'lib/lib-ruby-parser.rb', line 235

def ast
  @ast
end

#commentsArray<Comment>

List of comments extracted from the source code.

Returns:



252
253
254
# File 'lib/lib-ruby-parser.rb', line 252

def comments
  @comments
end

#diagnosticsArray<Diagnostic>

List of all diagnostics (errors and warings) that have been recorded during lexing and parsing

Returns:



247
248
249
# File 'lib/lib-ruby-parser.rb', line 247

def diagnostics
  @diagnostics
end

#inputDecodedInput

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.

Returns:



268
269
270
# File 'lib/lib-ruby-parser.rb', line 268

def input
  @input
end

#magic_commentsArray<MagicComment>

List of magic comments extracted from the source code.

Returns:



257
258
259
# File 'lib/lib-ruby-parser.rb', line 257

def magic_comments
  @magic_comments
end

#tokensArray<Token>

List of tokens returned by a Lexer and consumed by a Parser. Empty unless +:record_tokens+ is set to true.

Returns:



241
242
243
# File 'lib/lib-ruby-parser.rb', line 241

def tokens
  @tokens
end