Module: LibRubyParser

Defined in:
lib/lib-ruby-parser/nodes.rb,
lib/lib-ruby-parser.rb,
lib/lib-ruby-parser/version.rb,
lib/lib-ruby-parser/messages.rb

Overview

Root module

Defined Under Namespace

Modules: Messages, Nodes Classes: Comment, DecodedInput, Diagnostic, DiagnosticMessage, Loc, MagicComment, Node, ParserResult, SourceLine, Token

Constant Summary collapse

DEFAULT_DECODER =

Default decoder that is used to re-encode input from non-utf-8 encoding to utf-8

proc do |encoding, input|
  encoding = Encoding.find(encoding)
  input.force_encoding(encoding).encode('utf-8')
end
VERSION =

Version of the lib-ruby-parser

'4.0.3.1'

Class Method Summary collapse

Class Method Details

.parse(input, options) ⇒ ParserResult

Parses given input according to given options

Parameters:

  • input (String)
  • options (Hash)

Options Hash (options):

  • :buffer_name (String)

    name of the input file

  • :decoder (#call) — default: DEFAULT_DECODER

    decoder, called with +encoding+ (String) and +input+ (String)

  • :record_tokens (true, false)

    When set to true Parser records tokens. When set to false ParserResult::tokens is guaranteed to be empty. If you don’t need tokens better set it to false to speed up parsing.

Returns:



287
288
# File 'lib/lib-ruby-parser.rb', line 287

def self.parse(input, options)
end