Class Parser::Builders::Default
In: lib/parser/builders/default.rb
Parent: Object

Default AST builder. Uses {AST::Node}s.

Methods

Attributes

emit_file_line_as_literals  [RW]  If set to true, `FILE` and `LINE` are transformed to literal nodes. For example, `s(:str, "lib/foo.rb")` and `s(:int, 10)`.

If set to false, `FILE` and `LINE` are emitted as-is, i.e. as `s(:FILE)` and `s(:LINE)` nodes.

Source maps are identical in both cases.

@return [Boolean]

emit_lambda  [RW]  AST compatibility attribute; since `-> {}` is not semantically equivalent to `lambda {}`, all new code should set this attribute to true.

If set to false (the default), `-> {}` is emitted as `s(:block, s(:send, nil, :lambda), s(:args), nil)`.

If set to true, `-> {}` is emitted as `s(:block, s(:lambda), s(:args), nil)`.

@return [Boolean]

emit_procarg0  [RW]  AST compatibility attribute; block arguments of `m { |a| }` are not semantically equivalent to block arguments of `m { |a,| }` or `m { |a, b| }`, all new code should set this attribute to true.

If set to false (the default), arguments of `m { |a| }` are emitted as `s(:args, s(:arg, :a))`

If set to true, arguments of `m { |a| }` are emitted as `s(:args, s(:procarg0, :a))

@return [Boolean]

parser  [RW]  @api private

Public Class methods

@api private

Initializes attributes:

  * `emit_file_line_as_literals`: `true`

Public Instance methods

Ruby 1.8 block arguments

Expression grouping

Indented (interpolated, noninterpolated, executable) strings

Logical operations: and, or

Singletons

Regular expressions

[Validate]