Class: RuboCop::AST::Builder
- Inherits:
-
Parser::Builders::Default
- Object
- Parser::Builders::Default
- RuboCop::AST::Builder
- Defined in:
- lib/rubocop/ast/builder.rb
Overview
‘RuboCop::AST::Builder` is an AST builder that is utilized to let `Parser` generate ASTs with Node.
Constant Summary collapse
- NODE_MAP =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
{ and: AndNode, alias: AliasNode, arg: ArgNode, blockarg: ArgNode, forward_arg: ArgNode, kwarg: ArgNode, kwoptarg: ArgNode, kwrestarg: ArgNode, optarg: ArgNode, restarg: ArgNode, shadowarg: ArgNode, args: ArgsNode, array: ArrayNode, block: BlockNode, numblock: BlockNode, break: BreakNode, case_match: CaseMatchNode, case: CaseNode, class: ClassNode, const: ConstNode, def: DefNode, defined?: DefinedNode, defs: DefNode, dstr: DstrNode, ensure: EnsureNode, for: ForNode, forward_args: ForwardArgsNode, float: FloatNode, hash: HashNode, if: IfNode, in_pattern: InPatternNode, int: IntNode, index: IndexNode, indexasgn: IndexasgnNode, irange: RangeNode, erange: RangeNode, kwargs: HashNode, kwsplat: KeywordSplatNode, lambda: LambdaNode, module: ModuleNode, next: NextNode, or: OrNode, pair: PairNode, procarg0: Procarg0Node, regexp: RegexpNode, rescue: RescueNode, resbody: ResbodyNode, return: ReturnNode, csend: SendNode, send: SendNode, str: StrNode, xstr: StrNode, sclass: SelfClassNode, super: SuperNode, zsuper: SuperNode, sym: SymbolNode, until: UntilNode, until_post: UntilNode, when: WhenNode, while: WhileNode, while_post: WhileNode, yield: YieldNode }.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.
89 90 91 |
# File 'lib/rubocop/ast/builder.rb', line 89 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
95 96 97 |
# File 'lib/rubocop/ast/builder.rb', line 95 def string_value(token) value(token) end |