Class: RuboCop::AST::Builder
- Inherits:
-
Parser::Builders::Default
- Object
- Parser::Builders::Default
- RuboCop::AST::Builder
- Defined in:
- lib/rubocop/ast/builder.rb
Overview
‘RuboCop::Builder` is an AST builder that is utilized to let `Parser` generate ASTs with Node.
Constant Summary collapse
- NODE_MAP =
{ ArrayNode => [:array], CaseNode => [:case], ForNode => [:for], HashNode => [:hash], IfNode => [:if], KeywordSplatNode => [:kwsplat], PairNode => [:pair], UntilNode => [:until, :until_post], WhenNode => [:when], WhileNode => [:while, :while_post] }.freeze
Instance Method Summary collapse
-
#n(type, children, source_map) ⇒ Node
Generates Node from the given information.
-
#string_value(token) ⇒ Object
TODO: Figure out what to do about literal encoding handling…
Instance Method Details
#n(type, children, source_map) ⇒ Node
Generates Node from the given information.
32 33 34 |
# File 'lib/rubocop/ast/builder.rb', line 32 def n(type, children, source_map) node_klass(type).new(type, children, location: source_map) end |
#string_value(token) ⇒ Object
TODO: Figure out what to do about literal encoding handling… More details here github.com/whitequark/parser/issues/283
38 39 40 |
# File 'lib/rubocop/ast/builder.rb', line 38 def string_value(token) value(token) end |