Module: Prism::DSL
Overview
The DSL module provides a set of methods that can be used to create prism nodes in a more concise manner. For example, instead of writing:
source = Prism::Source.for("[1]")
Prism::ArrayNode.new(
source,
0,
Prism::Location.new(source, 0, 3),
0,
[
Prism::IntegerNode.new(
source,
0,
Prism::Location.new(source, 1, 1),
Prism::IntegerBaseFlags::DECIMAL,
1
)
],
Prism::Location.new(source, 0, 1),
Prism::Location.new(source, 2, 1)
)
you could instead write:
class Builder
include Prism::DSL
attr_reader :default_source
def initialize
@default_source = source("[1]")
end
def build
array_node(
location: location(start_offset: 0, length: 3),
elements: [
integer_node(
location: location(start_offset: 1, length: 1),
flags: integer_base_flag(:decimal),
value: 1
)
],
opening_loc: location(start_offset: 0, length: 1),
closing_loc: location(start_offset: 2, length: 1)
)
end
end
This is mostly helpful in the context of generating trees programmatically.
Instance Method Summary collapse
-
#alias_global_variable_node(source: default_source, node_id: 0, location: default_location, flags: 0, new_name: global_variable_read_node(source: source), old_name: global_variable_read_node(source: source), keyword_loc: location) ⇒ Object
Create a new AliasGlobalVariableNode node.
-
#alias_method_node(source: default_source, node_id: 0, location: default_location, flags: 0, new_name: symbol_node(source: source), old_name: symbol_node(source: source), keyword_loc: location) ⇒ Object
Create a new AliasMethodNode node.
-
#alternation_pattern_node(source: default_source, node_id: 0, location: default_location, flags: 0, left: default_node(source, location), right: default_node(source, location), operator_loc: location) ⇒ Object
Create a new AlternationPatternNode node.
-
#and_node(source: default_source, node_id: 0, location: default_location, flags: 0, left: default_node(source, location), right: default_node(source, location), operator_loc: location) ⇒ Object
Create a new AndNode node.
-
#arguments_node(source: default_source, node_id: 0, location: default_location, flags: 0, arguments: []) ⇒ Object
Create a new ArgumentsNode node.
-
#arguments_node_flag(name) ⇒ Object
Retrieve the value of one of the ArgumentsNodeFlags flags.
-
#array_node(source: default_source, node_id: 0, location: default_location, flags: 0, elements: [], opening_loc: nil, closing_loc: nil) ⇒ Object
Create a new ArrayNode node.
-
#array_node_flag(name) ⇒ Object
Retrieve the value of one of the ArrayNodeFlags flags.
-
#array_pattern_node(source: default_source, node_id: 0, location: default_location, flags: 0, constant: nil, requireds: [], rest: nil, posts: [], opening_loc: nil, closing_loc: nil) ⇒ Object
Create a new ArrayPatternNode node.
-
#assoc_node(source: default_source, node_id: 0, location: default_location, flags: 0, key: default_node(source, location), value: default_node(source, location), operator_loc: nil) ⇒ Object
Create a new AssocNode node.
-
#assoc_splat_node(source: default_source, node_id: 0, location: default_location, flags: 0, value: nil, operator_loc: location) ⇒ Object
Create a new AssocSplatNode node.
-
#back_reference_read_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"") ⇒ Object
Create a new BackReferenceReadNode node.
-
#begin_node(source: default_source, node_id: 0, location: default_location, flags: 0, begin_keyword_loc: nil, statements: nil, rescue_clause: nil, else_clause: nil, ensure_clause: nil, end_keyword_loc: nil) ⇒ Object
Create a new BeginNode node.
-
#block_argument_node(source: default_source, node_id: 0, location: default_location, flags: 0, expression: nil, operator_loc: location) ⇒ Object
Create a new BlockArgumentNode node.
-
#block_local_variable_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"") ⇒ Object
Create a new BlockLocalVariableNode node.
-
#block_node(source: default_source, node_id: 0, location: default_location, flags: 0, locals: [], parameters: nil, body: nil, opening_loc: location, closing_loc: location) ⇒ Object
Create a new BlockNode node.
-
#block_parameter_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: nil, name_loc: nil, operator_loc: location) ⇒ Object
Create a new BlockParameterNode node.
-
#block_parameters_node(source: default_source, node_id: 0, location: default_location, flags: 0, parameters: nil, locals: [], opening_loc: nil, closing_loc: nil) ⇒ Object
Create a new BlockParametersNode node.
-
#break_node(source: default_source, node_id: 0, location: default_location, flags: 0, arguments: nil, keyword_loc: location) ⇒ Object
Create a new BreakNode node.
-
#call_and_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, receiver: nil, call_operator_loc: nil, message_loc: nil, read_name: :"", write_name: :"", operator_loc: location, value: default_node(source, location)) ⇒ Object
Create a new CallAndWriteNode node.
-
#call_node(source: default_source, node_id: 0, location: default_location, flags: 0, receiver: nil, call_operator_loc: nil, name: :"", message_loc: nil, opening_loc: nil, arguments: nil, closing_loc: nil, equal_loc: nil, block: nil) ⇒ Object
Create a new CallNode node.
-
#call_node_flag(name) ⇒ Object
Retrieve the value of one of the CallNodeFlags flags.
-
#call_operator_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, receiver: nil, call_operator_loc: nil, message_loc: nil, read_name: :"", write_name: :"", binary_operator: :"", binary_operator_loc: location, value: default_node(source, location)) ⇒ Object
Create a new CallOperatorWriteNode node.
-
#call_or_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, receiver: nil, call_operator_loc: nil, message_loc: nil, read_name: :"", write_name: :"", operator_loc: location, value: default_node(source, location)) ⇒ Object
Create a new CallOrWriteNode node.
-
#call_target_node(source: default_source, node_id: 0, location: default_location, flags: 0, receiver: default_node(source, location), call_operator_loc: location, name: :"", message_loc: location) ⇒ Object
Create a new CallTargetNode node.
-
#capture_pattern_node(source: default_source, node_id: 0, location: default_location, flags: 0, value: default_node(source, location), target: local_variable_target_node(source: source), operator_loc: location) ⇒ Object
Create a new CapturePatternNode node.
-
#case_match_node(source: default_source, node_id: 0, location: default_location, flags: 0, predicate: nil, conditions: [], else_clause: nil, case_keyword_loc: location, end_keyword_loc: location) ⇒ Object
Create a new CaseMatchNode node.
-
#case_node(source: default_source, node_id: 0, location: default_location, flags: 0, predicate: nil, conditions: [], else_clause: nil, case_keyword_loc: location, end_keyword_loc: location) ⇒ Object
Create a new CaseNode node.
-
#class_node(source: default_source, node_id: 0, location: default_location, flags: 0, locals: [], class_keyword_loc: location, constant_path: constant_read_node(source: source), inheritance_operator_loc: nil, superclass: nil, body: nil, end_keyword_loc: location, name: :"") ⇒ Object
Create a new ClassNode node.
-
#class_variable_and_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", name_loc: location, operator_loc: location, value: default_node(source, location)) ⇒ Object
Create a new ClassVariableAndWriteNode node.
-
#class_variable_operator_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", name_loc: location, binary_operator_loc: location, value: default_node(source, location), binary_operator: :"") ⇒ Object
Create a new ClassVariableOperatorWriteNode node.
-
#class_variable_or_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", name_loc: location, operator_loc: location, value: default_node(source, location)) ⇒ Object
Create a new ClassVariableOrWriteNode node.
-
#class_variable_read_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"") ⇒ Object
Create a new ClassVariableReadNode node.
-
#class_variable_target_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"") ⇒ Object
Create a new ClassVariableTargetNode node.
-
#class_variable_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", name_loc: location, value: default_node(source, location), operator_loc: location) ⇒ Object
Create a new ClassVariableWriteNode node.
-
#constant_and_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", name_loc: location, operator_loc: location, value: default_node(source, location)) ⇒ Object
Create a new ConstantAndWriteNode node.
-
#constant_operator_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", name_loc: location, binary_operator_loc: location, value: default_node(source, location), binary_operator: :"") ⇒ Object
Create a new ConstantOperatorWriteNode node.
-
#constant_or_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", name_loc: location, operator_loc: location, value: default_node(source, location)) ⇒ Object
Create a new ConstantOrWriteNode node.
-
#constant_path_and_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, target: constant_path_node(source: source), operator_loc: location, value: default_node(source, location)) ⇒ Object
Create a new ConstantPathAndWriteNode node.
-
#constant_path_node(source: default_source, node_id: 0, location: default_location, flags: 0, parent: nil, name: nil, delimiter_loc: location, name_loc: location) ⇒ Object
Create a new ConstantPathNode node.
-
#constant_path_operator_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, target: constant_path_node(source: source), binary_operator_loc: location, value: default_node(source, location), binary_operator: :"") ⇒ Object
Create a new ConstantPathOperatorWriteNode node.
-
#constant_path_or_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, target: constant_path_node(source: source), operator_loc: location, value: default_node(source, location)) ⇒ Object
Create a new ConstantPathOrWriteNode node.
-
#constant_path_target_node(source: default_source, node_id: 0, location: default_location, flags: 0, parent: nil, name: nil, delimiter_loc: location, name_loc: location) ⇒ Object
Create a new ConstantPathTargetNode node.
-
#constant_path_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, target: constant_path_node(source: source), operator_loc: location, value: default_node(source, location)) ⇒ Object
Create a new ConstantPathWriteNode node.
-
#constant_read_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"") ⇒ Object
Create a new ConstantReadNode node.
-
#constant_target_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"") ⇒ Object
Create a new ConstantTargetNode node.
-
#constant_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", name_loc: location, value: default_node(source, location), operator_loc: location) ⇒ Object
Create a new ConstantWriteNode node.
-
#def_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", name_loc: location, receiver: nil, parameters: nil, body: nil, locals: [], def_keyword_loc: location, operator_loc: nil, lparen_loc: nil, rparen_loc: nil, equal_loc: nil, end_keyword_loc: nil) ⇒ Object
Create a new DefNode node.
-
#defined_node(source: default_source, node_id: 0, location: default_location, flags: 0, lparen_loc: nil, value: default_node(source, location), rparen_loc: nil, keyword_loc: location) ⇒ Object
Create a new DefinedNode node.
-
#else_node(source: default_source, node_id: 0, location: default_location, flags: 0, else_keyword_loc: location, statements: nil, end_keyword_loc: nil) ⇒ Object
Create a new ElseNode node.
-
#embedded_statements_node(source: default_source, node_id: 0, location: default_location, flags: 0, opening_loc: location, statements: nil, closing_loc: location) ⇒ Object
Create a new EmbeddedStatementsNode node.
-
#embedded_variable_node(source: default_source, node_id: 0, location: default_location, flags: 0, operator_loc: location, variable: instance_variable_read_node(source: source)) ⇒ Object
Create a new EmbeddedVariableNode node.
-
#encoding_flag(name) ⇒ Object
Retrieve the value of one of the EncodingFlags flags.
-
#ensure_node(source: default_source, node_id: 0, location: default_location, flags: 0, ensure_keyword_loc: location, statements: nil, end_keyword_loc: location) ⇒ Object
Create a new EnsureNode node.
-
#false_node(source: default_source, node_id: 0, location: default_location, flags: 0) ⇒ Object
Create a new FalseNode node.
-
#find_pattern_node(source: default_source, node_id: 0, location: default_location, flags: 0, constant: nil, left: splat_node(source: source), requireds: [], right: splat_node(source: source), opening_loc: nil, closing_loc: nil) ⇒ Object
Create a new FindPatternNode node.
-
#flip_flop_node(source: default_source, node_id: 0, location: default_location, flags: 0, left: nil, right: nil, operator_loc: location) ⇒ Object
Create a new FlipFlopNode node.
-
#float_node(source: default_source, node_id: 0, location: default_location, flags: 0, value: 0.0) ⇒ Object
Create a new FloatNode node.
-
#for_node(source: default_source, node_id: 0, location: default_location, flags: 0, index: local_variable_target_node(source: source), collection: default_node(source, location), statements: nil, for_keyword_loc: location, in_keyword_loc: location, do_keyword_loc: nil, end_keyword_loc: location) ⇒ Object
Create a new ForNode node.
-
#forwarding_arguments_node(source: default_source, node_id: 0, location: default_location, flags: 0) ⇒ Object
Create a new ForwardingArgumentsNode node.
-
#forwarding_parameter_node(source: default_source, node_id: 0, location: default_location, flags: 0) ⇒ Object
Create a new ForwardingParameterNode node.
-
#forwarding_super_node(source: default_source, node_id: 0, location: default_location, flags: 0, block: nil) ⇒ Object
Create a new ForwardingSuperNode node.
-
#global_variable_and_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", name_loc: location, operator_loc: location, value: default_node(source, location)) ⇒ Object
Create a new GlobalVariableAndWriteNode node.
-
#global_variable_operator_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", name_loc: location, binary_operator_loc: location, value: default_node(source, location), binary_operator: :"") ⇒ Object
Create a new GlobalVariableOperatorWriteNode node.
-
#global_variable_or_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", name_loc: location, operator_loc: location, value: default_node(source, location)) ⇒ Object
Create a new GlobalVariableOrWriteNode node.
-
#global_variable_read_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"") ⇒ Object
Create a new GlobalVariableReadNode node.
-
#global_variable_target_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"") ⇒ Object
Create a new GlobalVariableTargetNode node.
-
#global_variable_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", name_loc: location, value: default_node(source, location), operator_loc: location) ⇒ Object
Create a new GlobalVariableWriteNode node.
-
#hash_node(source: default_source, node_id: 0, location: default_location, flags: 0, opening_loc: location, elements: [], closing_loc: location) ⇒ Object
Create a new HashNode node.
-
#hash_pattern_node(source: default_source, node_id: 0, location: default_location, flags: 0, constant: nil, elements: [], rest: nil, opening_loc: nil, closing_loc: nil) ⇒ Object
Create a new HashPatternNode node.
-
#if_node(source: default_source, node_id: 0, location: default_location, flags: 0, if_keyword_loc: nil, predicate: default_node(source, location), then_keyword_loc: nil, statements: nil, subsequent: nil, end_keyword_loc: nil) ⇒ Object
Create a new IfNode node.
-
#imaginary_node(source: default_source, node_id: 0, location: default_location, flags: 0, numeric: float_node(source: source)) ⇒ Object
Create a new ImaginaryNode node.
-
#implicit_node(source: default_source, node_id: 0, location: default_location, flags: 0, value: local_variable_read_node(source: source)) ⇒ Object
Create a new ImplicitNode node.
-
#implicit_rest_node(source: default_source, node_id: 0, location: default_location, flags: 0) ⇒ Object
Create a new ImplicitRestNode node.
-
#in_node(source: default_source, node_id: 0, location: default_location, flags: 0, pattern: default_node(source, location), statements: nil, in_loc: location, then_loc: nil) ⇒ Object
Create a new InNode node.
-
#index_and_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, receiver: nil, call_operator_loc: nil, opening_loc: location, arguments: nil, closing_loc: location, block: nil, operator_loc: location, value: default_node(source, location)) ⇒ Object
Create a new IndexAndWriteNode node.
-
#index_operator_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, receiver: nil, call_operator_loc: nil, opening_loc: location, arguments: nil, closing_loc: location, block: nil, binary_operator: :"", binary_operator_loc: location, value: default_node(source, location)) ⇒ Object
Create a new IndexOperatorWriteNode node.
-
#index_or_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, receiver: nil, call_operator_loc: nil, opening_loc: location, arguments: nil, closing_loc: location, block: nil, operator_loc: location, value: default_node(source, location)) ⇒ Object
Create a new IndexOrWriteNode node.
-
#index_target_node(source: default_source, node_id: 0, location: default_location, flags: 0, receiver: default_node(source, location), opening_loc: location, arguments: nil, closing_loc: location, block: nil) ⇒ Object
Create a new IndexTargetNode node.
-
#instance_variable_and_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", name_loc: location, operator_loc: location, value: default_node(source, location)) ⇒ Object
Create a new InstanceVariableAndWriteNode node.
-
#instance_variable_operator_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", name_loc: location, binary_operator_loc: location, value: default_node(source, location), binary_operator: :"") ⇒ Object
Create a new InstanceVariableOperatorWriteNode node.
-
#instance_variable_or_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", name_loc: location, operator_loc: location, value: default_node(source, location)) ⇒ Object
Create a new InstanceVariableOrWriteNode node.
-
#instance_variable_read_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"") ⇒ Object
Create a new InstanceVariableReadNode node.
-
#instance_variable_target_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"") ⇒ Object
Create a new InstanceVariableTargetNode node.
-
#instance_variable_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", name_loc: location, value: default_node(source, location), operator_loc: location) ⇒ Object
Create a new InstanceVariableWriteNode node.
-
#integer_base_flag(name) ⇒ Object
Retrieve the value of one of the IntegerBaseFlags flags.
-
#integer_node(source: default_source, node_id: 0, location: default_location, flags: 0, value: 0) ⇒ Object
Create a new IntegerNode node.
-
#interpolated_match_last_line_node(source: default_source, node_id: 0, location: default_location, flags: 0, opening_loc: location, parts: [], closing_loc: location) ⇒ Object
Create a new InterpolatedMatchLastLineNode node.
-
#interpolated_regular_expression_node(source: default_source, node_id: 0, location: default_location, flags: 0, opening_loc: location, parts: [], closing_loc: location) ⇒ Object
Create a new InterpolatedRegularExpressionNode node.
-
#interpolated_string_node(source: default_source, node_id: 0, location: default_location, flags: 0, opening_loc: nil, parts: [], closing_loc: nil) ⇒ Object
Create a new InterpolatedStringNode node.
-
#interpolated_string_node_flag(name) ⇒ Object
Retrieve the value of one of the InterpolatedStringNodeFlags flags.
-
#interpolated_symbol_node(source: default_source, node_id: 0, location: default_location, flags: 0, opening_loc: nil, parts: [], closing_loc: nil) ⇒ Object
Create a new InterpolatedSymbolNode node.
-
#interpolated_x_string_node(source: default_source, node_id: 0, location: default_location, flags: 0, opening_loc: location, parts: [], closing_loc: location) ⇒ Object
Create a new InterpolatedXStringNode node.
-
#it_local_variable_read_node(source: default_source, node_id: 0, location: default_location, flags: 0) ⇒ Object
Create a new ItLocalVariableReadNode node.
-
#it_parameters_node(source: default_source, node_id: 0, location: default_location, flags: 0) ⇒ Object
Create a new ItParametersNode node.
-
#keyword_hash_node(source: default_source, node_id: 0, location: default_location, flags: 0, elements: []) ⇒ Object
Create a new KeywordHashNode node.
-
#keyword_hash_node_flag(name) ⇒ Object
Retrieve the value of one of the KeywordHashNodeFlags flags.
-
#keyword_rest_parameter_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: nil, name_loc: nil, operator_loc: location) ⇒ Object
Create a new KeywordRestParameterNode node.
-
#lambda_node(source: default_source, node_id: 0, location: default_location, flags: 0, locals: [], operator_loc: location, opening_loc: location, closing_loc: location, parameters: nil, body: nil) ⇒ Object
Create a new LambdaNode node.
-
#local_variable_and_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, name_loc: location, operator_loc: location, value: default_node(source, location), name: :"", depth: 0) ⇒ Object
Create a new LocalVariableAndWriteNode node.
-
#local_variable_operator_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, name_loc: location, binary_operator_loc: location, value: default_node(source, location), name: :"", binary_operator: :"", depth: 0) ⇒ Object
Create a new LocalVariableOperatorWriteNode node.
-
#local_variable_or_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, name_loc: location, operator_loc: location, value: default_node(source, location), name: :"", depth: 0) ⇒ Object
Create a new LocalVariableOrWriteNode node.
-
#local_variable_read_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", depth: 0) ⇒ Object
Create a new LocalVariableReadNode node.
-
#local_variable_target_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", depth: 0) ⇒ Object
Create a new LocalVariableTargetNode node.
-
#local_variable_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", depth: 0, name_loc: location, value: default_node(source, location), operator_loc: location) ⇒ Object
Create a new LocalVariableWriteNode node.
-
#location(source: default_source, start_offset: 0, length: 0) ⇒ Object
Create a new Location object.
-
#loop_flag(name) ⇒ Object
Retrieve the value of one of the LoopFlags flags.
-
#match_last_line_node(source: default_source, node_id: 0, location: default_location, flags: 0, opening_loc: location, content_loc: location, closing_loc: location, unescaped: "") ⇒ Object
Create a new MatchLastLineNode node.
-
#match_predicate_node(source: default_source, node_id: 0, location: default_location, flags: 0, value: default_node(source, location), pattern: default_node(source, location), operator_loc: location) ⇒ Object
Create a new MatchPredicateNode node.
-
#match_required_node(source: default_source, node_id: 0, location: default_location, flags: 0, value: default_node(source, location), pattern: default_node(source, location), operator_loc: location) ⇒ Object
Create a new MatchRequiredNode node.
-
#match_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, call: call_node(source: source), targets: []) ⇒ Object
Create a new MatchWriteNode node.
-
#missing_node(source: default_source, node_id: 0, location: default_location, flags: 0) ⇒ Object
Create a new MissingNode node.
-
#module_node(source: default_source, node_id: 0, location: default_location, flags: 0, locals: [], module_keyword_loc: location, constant_path: constant_read_node(source: source), body: nil, end_keyword_loc: location, name: :"") ⇒ Object
Create a new ModuleNode node.
-
#multi_target_node(source: default_source, node_id: 0, location: default_location, flags: 0, lefts: [], rest: nil, rights: [], lparen_loc: nil, rparen_loc: nil) ⇒ Object
Create a new MultiTargetNode node.
-
#multi_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, lefts: [], rest: nil, rights: [], lparen_loc: nil, rparen_loc: nil, operator_loc: location, value: default_node(source, location)) ⇒ Object
Create a new MultiWriteNode node.
-
#next_node(source: default_source, node_id: 0, location: default_location, flags: 0, arguments: nil, keyword_loc: location) ⇒ Object
Create a new NextNode node.
-
#nil_node(source: default_source, node_id: 0, location: default_location, flags: 0) ⇒ Object
Create a new NilNode node.
-
#no_keywords_parameter_node(source: default_source, node_id: 0, location: default_location, flags: 0, operator_loc: location, keyword_loc: location) ⇒ Object
Create a new NoKeywordsParameterNode node.
-
#numbered_parameters_node(source: default_source, node_id: 0, location: default_location, flags: 0, maximum: 0) ⇒ Object
Create a new NumberedParametersNode node.
-
#numbered_reference_read_node(source: default_source, node_id: 0, location: default_location, flags: 0, number: 0) ⇒ Object
Create a new NumberedReferenceReadNode node.
-
#optional_keyword_parameter_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", name_loc: location, value: default_node(source, location)) ⇒ Object
Create a new OptionalKeywordParameterNode node.
-
#optional_parameter_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", name_loc: location, operator_loc: location, value: default_node(source, location)) ⇒ Object
Create a new OptionalParameterNode node.
-
#or_node(source: default_source, node_id: 0, location: default_location, flags: 0, left: default_node(source, location), right: default_node(source, location), operator_loc: location) ⇒ Object
Create a new OrNode node.
-
#parameter_flag(name) ⇒ Object
Retrieve the value of one of the ParameterFlags flags.
-
#parameters_node(source: default_source, node_id: 0, location: default_location, flags: 0, requireds: [], optionals: [], rest: nil, posts: [], keywords: [], keyword_rest: nil, block: nil) ⇒ Object
Create a new ParametersNode node.
-
#parentheses_node(source: default_source, node_id: 0, location: default_location, flags: 0, body: nil, opening_loc: location, closing_loc: location) ⇒ Object
Create a new ParenthesesNode node.
-
#parentheses_node_flag(name) ⇒ Object
Retrieve the value of one of the ParenthesesNodeFlags flags.
-
#pinned_expression_node(source: default_source, node_id: 0, location: default_location, flags: 0, expression: default_node(source, location), operator_loc: location, lparen_loc: location, rparen_loc: location) ⇒ Object
Create a new PinnedExpressionNode node.
-
#pinned_variable_node(source: default_source, node_id: 0, location: default_location, flags: 0, variable: local_variable_read_node(source: source), operator_loc: location) ⇒ Object
Create a new PinnedVariableNode node.
-
#post_execution_node(source: default_source, node_id: 0, location: default_location, flags: 0, statements: nil, keyword_loc: location, opening_loc: location, closing_loc: location) ⇒ Object
Create a new PostExecutionNode node.
-
#pre_execution_node(source: default_source, node_id: 0, location: default_location, flags: 0, statements: nil, keyword_loc: location, opening_loc: location, closing_loc: location) ⇒ Object
Create a new PreExecutionNode node.
-
#program_node(source: default_source, node_id: 0, location: default_location, flags: 0, locals: [], statements: statements_node(source: source)) ⇒ Object
Create a new ProgramNode node.
-
#range_flag(name) ⇒ Object
Retrieve the value of one of the RangeFlags flags.
-
#range_node(source: default_source, node_id: 0, location: default_location, flags: 0, left: nil, right: nil, operator_loc: location) ⇒ Object
Create a new RangeNode node.
-
#rational_node(source: default_source, node_id: 0, location: default_location, flags: 0, numerator: 0, denominator: 0) ⇒ Object
Create a new RationalNode node.
-
#redo_node(source: default_source, node_id: 0, location: default_location, flags: 0) ⇒ Object
Create a new RedoNode node.
-
#regular_expression_flag(name) ⇒ Object
Retrieve the value of one of the RegularExpressionFlags flags.
-
#regular_expression_node(source: default_source, node_id: 0, location: default_location, flags: 0, opening_loc: location, content_loc: location, closing_loc: location, unescaped: "") ⇒ Object
Create a new RegularExpressionNode node.
-
#required_keyword_parameter_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", name_loc: location) ⇒ Object
Create a new RequiredKeywordParameterNode node.
-
#required_parameter_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"") ⇒ Object
Create a new RequiredParameterNode node.
-
#rescue_modifier_node(source: default_source, node_id: 0, location: default_location, flags: 0, expression: default_node(source, location), keyword_loc: location, rescue_expression: default_node(source, location)) ⇒ Object
Create a new RescueModifierNode node.
-
#rescue_node(source: default_source, node_id: 0, location: default_location, flags: 0, keyword_loc: location, exceptions: [], operator_loc: nil, reference: nil, then_keyword_loc: nil, statements: nil, subsequent: nil) ⇒ Object
Create a new RescueNode node.
-
#rest_parameter_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: nil, name_loc: nil, operator_loc: location) ⇒ Object
Create a new RestParameterNode node.
-
#retry_node(source: default_source, node_id: 0, location: default_location, flags: 0) ⇒ Object
Create a new RetryNode node.
-
#return_node(source: default_source, node_id: 0, location: default_location, flags: 0, keyword_loc: location, arguments: nil) ⇒ Object
Create a new ReturnNode node.
-
#self_node(source: default_source, node_id: 0, location: default_location, flags: 0) ⇒ Object
Create a new SelfNode node.
-
#shareable_constant_node(source: default_source, node_id: 0, location: default_location, flags: 0, write: constant_write_node(source: source)) ⇒ Object
Create a new ShareableConstantNode node.
-
#shareable_constant_node_flag(name) ⇒ Object
Retrieve the value of one of the ShareableConstantNodeFlags flags.
-
#singleton_class_node(source: default_source, node_id: 0, location: default_location, flags: 0, locals: [], class_keyword_loc: location, operator_loc: location, expression: default_node(source, location), body: nil, end_keyword_loc: location) ⇒ Object
Create a new SingletonClassNode node.
-
#source(string) ⇒ Object
Create a new Source object.
-
#source_encoding_node(source: default_source, node_id: 0, location: default_location, flags: 0) ⇒ Object
Create a new SourceEncodingNode node.
-
#source_file_node(source: default_source, node_id: 0, location: default_location, flags: 0, filepath: "") ⇒ Object
Create a new SourceFileNode node.
-
#source_line_node(source: default_source, node_id: 0, location: default_location, flags: 0) ⇒ Object
Create a new SourceLineNode node.
-
#splat_node(source: default_source, node_id: 0, location: default_location, flags: 0, operator_loc: location, expression: nil) ⇒ Object
Create a new SplatNode node.
-
#statements_node(source: default_source, node_id: 0, location: default_location, flags: 0, body: []) ⇒ Object
Create a new StatementsNode node.
-
#string_flag(name) ⇒ Object
Retrieve the value of one of the StringFlags flags.
-
#string_node(source: default_source, node_id: 0, location: default_location, flags: 0, opening_loc: nil, content_loc: location, closing_loc: nil, unescaped: "") ⇒ Object
Create a new StringNode node.
-
#super_node(source: default_source, node_id: 0, location: default_location, flags: 0, keyword_loc: location, lparen_loc: nil, arguments: nil, rparen_loc: nil, block: nil) ⇒ Object
Create a new SuperNode node.
-
#symbol_flag(name) ⇒ Object
Retrieve the value of one of the SymbolFlags flags.
-
#symbol_node(source: default_source, node_id: 0, location: default_location, flags: 0, opening_loc: nil, value_loc: nil, closing_loc: nil, unescaped: "") ⇒ Object
Create a new SymbolNode node.
-
#true_node(source: default_source, node_id: 0, location: default_location, flags: 0) ⇒ Object
Create a new TrueNode node.
-
#undef_node(source: default_source, node_id: 0, location: default_location, flags: 0, names: [], keyword_loc: location) ⇒ Object
Create a new UndefNode node.
-
#unless_node(source: default_source, node_id: 0, location: default_location, flags: 0, keyword_loc: location, predicate: default_node(source, location), then_keyword_loc: nil, statements: nil, else_clause: nil, end_keyword_loc: nil) ⇒ Object
Create a new UnlessNode node.
-
#until_node(source: default_source, node_id: 0, location: default_location, flags: 0, keyword_loc: location, do_keyword_loc: nil, closing_loc: nil, predicate: default_node(source, location), statements: nil) ⇒ Object
Create a new UntilNode node.
-
#when_node(source: default_source, node_id: 0, location: default_location, flags: 0, keyword_loc: location, conditions: [], then_keyword_loc: nil, statements: nil) ⇒ Object
Create a new WhenNode node.
-
#while_node(source: default_source, node_id: 0, location: default_location, flags: 0, keyword_loc: location, do_keyword_loc: nil, closing_loc: nil, predicate: default_node(source, location), statements: nil) ⇒ Object
Create a new WhileNode node.
-
#x_string_node(source: default_source, node_id: 0, location: default_location, flags: 0, opening_loc: location, content_loc: location, closing_loc: location, unescaped: "") ⇒ Object
Create a new XStringNode node.
-
#yield_node(source: default_source, node_id: 0, location: default_location, flags: 0, keyword_loc: location, lparen_loc: nil, arguments: nil, rparen_loc: nil) ⇒ Object
Create a new YieldNode node.
Instance Method Details
#alias_global_variable_node(source: default_source, node_id: 0, location: default_location, flags: 0, new_name: global_variable_read_node(source: source), old_name: global_variable_read_node(source: source), keyword_loc: location) ⇒ Object
Create a new AliasGlobalVariableNode node.
80 81 82 |
# File 'lib/prism/dsl.rb', line 80 def alias_global_variable_node(source: default_source, node_id: 0, location: default_location, flags: 0, new_name: global_variable_read_node(source: source), old_name: global_variable_read_node(source: source), keyword_loc: location) AliasGlobalVariableNode.new(source, node_id, location, flags, new_name, old_name, keyword_loc) end |
#alias_method_node(source: default_source, node_id: 0, location: default_location, flags: 0, new_name: symbol_node(source: source), old_name: symbol_node(source: source), keyword_loc: location) ⇒ Object
Create a new AliasMethodNode node.
85 86 87 |
# File 'lib/prism/dsl.rb', line 85 def alias_method_node(source: default_source, node_id: 0, location: default_location, flags: 0, new_name: symbol_node(source: source), old_name: symbol_node(source: source), keyword_loc: location) AliasMethodNode.new(source, node_id, location, flags, new_name, old_name, keyword_loc) end |
#alternation_pattern_node(source: default_source, node_id: 0, location: default_location, flags: 0, left: default_node(source, location), right: default_node(source, location), operator_loc: location) ⇒ Object
Create a new AlternationPatternNode node.
90 91 92 |
# File 'lib/prism/dsl.rb', line 90 def alternation_pattern_node(source: default_source, node_id: 0, location: default_location, flags: 0, left: default_node(source, location), right: default_node(source, location), operator_loc: location) AlternationPatternNode.new(source, node_id, location, flags, left, right, operator_loc) end |
#and_node(source: default_source, node_id: 0, location: default_location, flags: 0, left: default_node(source, location), right: default_node(source, location), operator_loc: location) ⇒ Object
Create a new AndNode node.
95 96 97 |
# File 'lib/prism/dsl.rb', line 95 def and_node(source: default_source, node_id: 0, location: default_location, flags: 0, left: default_node(source, location), right: default_node(source, location), operator_loc: location) AndNode.new(source, node_id, location, flags, left, right, operator_loc) end |
#arguments_node(source: default_source, node_id: 0, location: default_location, flags: 0, arguments: []) ⇒ Object
Create a new ArgumentsNode node.
100 101 102 |
# File 'lib/prism/dsl.rb', line 100 def arguments_node(source: default_source, node_id: 0, location: default_location, flags: 0, arguments: []) ArgumentsNode.new(source, node_id, location, flags, arguments) end |
#arguments_node_flag(name) ⇒ Object
Retrieve the value of one of the ArgumentsNodeFlags flags.
835 836 837 838 839 840 841 842 843 844 |
# File 'lib/prism/dsl.rb', line 835 def arguments_node_flag(name) case name when :contains_forwarding then ArgumentsNodeFlags::CONTAINS_FORWARDING when :contains_keywords then ArgumentsNodeFlags::CONTAINS_KEYWORDS when :contains_keyword_splat then ArgumentsNodeFlags::CONTAINS_KEYWORD_SPLAT when :contains_splat then ArgumentsNodeFlags::CONTAINS_SPLAT when :contains_multiple_splats then ArgumentsNodeFlags::CONTAINS_MULTIPLE_SPLATS else Kernel.raise ArgumentError, "invalid ArgumentsNodeFlags flag: #{name.inspect}" end end |
#array_node(source: default_source, node_id: 0, location: default_location, flags: 0, elements: [], opening_loc: nil, closing_loc: nil) ⇒ Object
Create a new ArrayNode node.
105 106 107 |
# File 'lib/prism/dsl.rb', line 105 def array_node(source: default_source, node_id: 0, location: default_location, flags: 0, elements: [], opening_loc: nil, closing_loc: nil) ArrayNode.new(source, node_id, location, flags, elements, opening_loc, closing_loc) end |
#array_node_flag(name) ⇒ Object
Retrieve the value of one of the ArrayNodeFlags flags.
847 848 849 850 851 852 |
# File 'lib/prism/dsl.rb', line 847 def array_node_flag(name) case name when :contains_splat then ArrayNodeFlags::CONTAINS_SPLAT else Kernel.raise ArgumentError, "invalid ArrayNodeFlags flag: #{name.inspect}" end end |
#array_pattern_node(source: default_source, node_id: 0, location: default_location, flags: 0, constant: nil, requireds: [], rest: nil, posts: [], opening_loc: nil, closing_loc: nil) ⇒ Object
Create a new ArrayPatternNode node.
110 111 112 |
# File 'lib/prism/dsl.rb', line 110 def array_pattern_node(source: default_source, node_id: 0, location: default_location, flags: 0, constant: nil, requireds: [], rest: nil, posts: [], opening_loc: nil, closing_loc: nil) ArrayPatternNode.new(source, node_id, location, flags, constant, requireds, rest, posts, opening_loc, closing_loc) end |
#assoc_node(source: default_source, node_id: 0, location: default_location, flags: 0, key: default_node(source, location), value: default_node(source, location), operator_loc: nil) ⇒ Object
Create a new AssocNode node.
115 116 117 |
# File 'lib/prism/dsl.rb', line 115 def assoc_node(source: default_source, node_id: 0, location: default_location, flags: 0, key: default_node(source, location), value: default_node(source, location), operator_loc: nil) AssocNode.new(source, node_id, location, flags, key, value, operator_loc) end |
#assoc_splat_node(source: default_source, node_id: 0, location: default_location, flags: 0, value: nil, operator_loc: location) ⇒ Object
Create a new AssocSplatNode node.
120 121 122 |
# File 'lib/prism/dsl.rb', line 120 def assoc_splat_node(source: default_source, node_id: 0, location: default_location, flags: 0, value: nil, operator_loc: location) AssocSplatNode.new(source, node_id, location, flags, value, operator_loc) end |
#back_reference_read_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"") ⇒ Object
Create a new BackReferenceReadNode node.
125 126 127 |
# File 'lib/prism/dsl.rb', line 125 def back_reference_read_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"") BackReferenceReadNode.new(source, node_id, location, flags, name) end |
#begin_node(source: default_source, node_id: 0, location: default_location, flags: 0, begin_keyword_loc: nil, statements: nil, rescue_clause: nil, else_clause: nil, ensure_clause: nil, end_keyword_loc: nil) ⇒ Object
Create a new BeginNode node.
130 131 132 |
# File 'lib/prism/dsl.rb', line 130 def begin_node(source: default_source, node_id: 0, location: default_location, flags: 0, begin_keyword_loc: nil, statements: nil, rescue_clause: nil, else_clause: nil, ensure_clause: nil, end_keyword_loc: nil) BeginNode.new(source, node_id, location, flags, begin_keyword_loc, statements, rescue_clause, else_clause, ensure_clause, end_keyword_loc) end |
#block_argument_node(source: default_source, node_id: 0, location: default_location, flags: 0, expression: nil, operator_loc: location) ⇒ Object
Create a new BlockArgumentNode node.
135 136 137 |
# File 'lib/prism/dsl.rb', line 135 def block_argument_node(source: default_source, node_id: 0, location: default_location, flags: 0, expression: nil, operator_loc: location) BlockArgumentNode.new(source, node_id, location, flags, expression, operator_loc) end |
#block_local_variable_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"") ⇒ Object
Create a new BlockLocalVariableNode node.
140 141 142 |
# File 'lib/prism/dsl.rb', line 140 def block_local_variable_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"") BlockLocalVariableNode.new(source, node_id, location, flags, name) end |
#block_node(source: default_source, node_id: 0, location: default_location, flags: 0, locals: [], parameters: nil, body: nil, opening_loc: location, closing_loc: location) ⇒ Object
Create a new BlockNode node.
145 146 147 |
# File 'lib/prism/dsl.rb', line 145 def block_node(source: default_source, node_id: 0, location: default_location, flags: 0, locals: [], parameters: nil, body: nil, opening_loc: location, closing_loc: location) BlockNode.new(source, node_id, location, flags, locals, parameters, body, opening_loc, closing_loc) end |
#block_parameter_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: nil, name_loc: nil, operator_loc: location) ⇒ Object
Create a new BlockParameterNode node.
150 151 152 |
# File 'lib/prism/dsl.rb', line 150 def block_parameter_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: nil, name_loc: nil, operator_loc: location) BlockParameterNode.new(source, node_id, location, flags, name, name_loc, operator_loc) end |
#block_parameters_node(source: default_source, node_id: 0, location: default_location, flags: 0, parameters: nil, locals: [], opening_loc: nil, closing_loc: nil) ⇒ Object
Create a new BlockParametersNode node.
155 156 157 |
# File 'lib/prism/dsl.rb', line 155 def block_parameters_node(source: default_source, node_id: 0, location: default_location, flags: 0, parameters: nil, locals: [], opening_loc: nil, closing_loc: nil) BlockParametersNode.new(source, node_id, location, flags, parameters, locals, opening_loc, closing_loc) end |
#break_node(source: default_source, node_id: 0, location: default_location, flags: 0, arguments: nil, keyword_loc: location) ⇒ Object
Create a new BreakNode node.
160 161 162 |
# File 'lib/prism/dsl.rb', line 160 def break_node(source: default_source, node_id: 0, location: default_location, flags: 0, arguments: nil, keyword_loc: location) BreakNode.new(source, node_id, location, flags, arguments, keyword_loc) end |
#call_and_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, receiver: nil, call_operator_loc: nil, message_loc: nil, read_name: :"", write_name: :"", operator_loc: location, value: default_node(source, location)) ⇒ Object
Create a new CallAndWriteNode node.
165 166 167 |
# File 'lib/prism/dsl.rb', line 165 def call_and_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, receiver: nil, call_operator_loc: nil, message_loc: nil, read_name: :"", write_name: :"", operator_loc: location, value: default_node(source, location)) CallAndWriteNode.new(source, node_id, location, flags, receiver, call_operator_loc, , read_name, write_name, operator_loc, value) end |
#call_node(source: default_source, node_id: 0, location: default_location, flags: 0, receiver: nil, call_operator_loc: nil, name: :"", message_loc: nil, opening_loc: nil, arguments: nil, closing_loc: nil, equal_loc: nil, block: nil) ⇒ Object
Create a new CallNode node.
170 171 172 |
# File 'lib/prism/dsl.rb', line 170 def call_node(source: default_source, node_id: 0, location: default_location, flags: 0, receiver: nil, call_operator_loc: nil, name: :"", message_loc: nil, opening_loc: nil, arguments: nil, closing_loc: nil, equal_loc: nil, block: nil) CallNode.new(source, node_id, location, flags, receiver, call_operator_loc, name, , opening_loc, arguments, closing_loc, equal_loc, block) end |
#call_node_flag(name) ⇒ Object
Retrieve the value of one of the CallNodeFlags flags.
855 856 857 858 859 860 861 862 863 |
# File 'lib/prism/dsl.rb', line 855 def call_node_flag(name) case name when :safe_navigation then CallNodeFlags::SAFE_NAVIGATION when :variable_call then CallNodeFlags::VARIABLE_CALL when :attribute_write then CallNodeFlags::ATTRIBUTE_WRITE when :ignore_visibility then CallNodeFlags::IGNORE_VISIBILITY else Kernel.raise ArgumentError, "invalid CallNodeFlags flag: #{name.inspect}" end end |
#call_operator_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, receiver: nil, call_operator_loc: nil, message_loc: nil, read_name: :"", write_name: :"", binary_operator: :"", binary_operator_loc: location, value: default_node(source, location)) ⇒ Object
Create a new CallOperatorWriteNode node.
175 176 177 |
# File 'lib/prism/dsl.rb', line 175 def call_operator_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, receiver: nil, call_operator_loc: nil, message_loc: nil, read_name: :"", write_name: :"", binary_operator: :"", binary_operator_loc: location, value: default_node(source, location)) CallOperatorWriteNode.new(source, node_id, location, flags, receiver, call_operator_loc, , read_name, write_name, binary_operator, binary_operator_loc, value) end |
#call_or_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, receiver: nil, call_operator_loc: nil, message_loc: nil, read_name: :"", write_name: :"", operator_loc: location, value: default_node(source, location)) ⇒ Object
Create a new CallOrWriteNode node.
180 181 182 |
# File 'lib/prism/dsl.rb', line 180 def call_or_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, receiver: nil, call_operator_loc: nil, message_loc: nil, read_name: :"", write_name: :"", operator_loc: location, value: default_node(source, location)) CallOrWriteNode.new(source, node_id, location, flags, receiver, call_operator_loc, , read_name, write_name, operator_loc, value) end |
#call_target_node(source: default_source, node_id: 0, location: default_location, flags: 0, receiver: default_node(source, location), call_operator_loc: location, name: :"", message_loc: location) ⇒ Object
Create a new CallTargetNode node.
185 186 187 |
# File 'lib/prism/dsl.rb', line 185 def call_target_node(source: default_source, node_id: 0, location: default_location, flags: 0, receiver: default_node(source, location), call_operator_loc: location, name: :"", message_loc: location) CallTargetNode.new(source, node_id, location, flags, receiver, call_operator_loc, name, ) end |
#capture_pattern_node(source: default_source, node_id: 0, location: default_location, flags: 0, value: default_node(source, location), target: local_variable_target_node(source: source), operator_loc: location) ⇒ Object
Create a new CapturePatternNode node.
190 191 192 |
# File 'lib/prism/dsl.rb', line 190 def capture_pattern_node(source: default_source, node_id: 0, location: default_location, flags: 0, value: default_node(source, location), target: local_variable_target_node(source: source), operator_loc: location) CapturePatternNode.new(source, node_id, location, flags, value, target, operator_loc) end |
#case_match_node(source: default_source, node_id: 0, location: default_location, flags: 0, predicate: nil, conditions: [], else_clause: nil, case_keyword_loc: location, end_keyword_loc: location) ⇒ Object
Create a new CaseMatchNode node.
195 196 197 |
# File 'lib/prism/dsl.rb', line 195 def case_match_node(source: default_source, node_id: 0, location: default_location, flags: 0, predicate: nil, conditions: [], else_clause: nil, case_keyword_loc: location, end_keyword_loc: location) CaseMatchNode.new(source, node_id, location, flags, predicate, conditions, else_clause, case_keyword_loc, end_keyword_loc) end |
#case_node(source: default_source, node_id: 0, location: default_location, flags: 0, predicate: nil, conditions: [], else_clause: nil, case_keyword_loc: location, end_keyword_loc: location) ⇒ Object
Create a new CaseNode node.
200 201 202 |
# File 'lib/prism/dsl.rb', line 200 def case_node(source: default_source, node_id: 0, location: default_location, flags: 0, predicate: nil, conditions: [], else_clause: nil, case_keyword_loc: location, end_keyword_loc: location) CaseNode.new(source, node_id, location, flags, predicate, conditions, else_clause, case_keyword_loc, end_keyword_loc) end |
#class_node(source: default_source, node_id: 0, location: default_location, flags: 0, locals: [], class_keyword_loc: location, constant_path: constant_read_node(source: source), inheritance_operator_loc: nil, superclass: nil, body: nil, end_keyword_loc: location, name: :"") ⇒ Object
Create a new ClassNode node.
205 206 207 |
# File 'lib/prism/dsl.rb', line 205 def class_node(source: default_source, node_id: 0, location: default_location, flags: 0, locals: [], class_keyword_loc: location, constant_path: constant_read_node(source: source), inheritance_operator_loc: nil, superclass: nil, body: nil, end_keyword_loc: location, name: :"") ClassNode.new(source, node_id, location, flags, locals, class_keyword_loc, constant_path, inheritance_operator_loc, superclass, body, end_keyword_loc, name) end |
#class_variable_and_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", name_loc: location, operator_loc: location, value: default_node(source, location)) ⇒ Object
Create a new ClassVariableAndWriteNode node.
210 211 212 |
# File 'lib/prism/dsl.rb', line 210 def class_variable_and_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", name_loc: location, operator_loc: location, value: default_node(source, location)) ClassVariableAndWriteNode.new(source, node_id, location, flags, name, name_loc, operator_loc, value) end |
#class_variable_operator_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", name_loc: location, binary_operator_loc: location, value: default_node(source, location), binary_operator: :"") ⇒ Object
Create a new ClassVariableOperatorWriteNode node.
215 216 217 |
# File 'lib/prism/dsl.rb', line 215 def class_variable_operator_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", name_loc: location, binary_operator_loc: location, value: default_node(source, location), binary_operator: :"") ClassVariableOperatorWriteNode.new(source, node_id, location, flags, name, name_loc, binary_operator_loc, value, binary_operator) end |
#class_variable_or_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", name_loc: location, operator_loc: location, value: default_node(source, location)) ⇒ Object
Create a new ClassVariableOrWriteNode node.
220 221 222 |
# File 'lib/prism/dsl.rb', line 220 def class_variable_or_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", name_loc: location, operator_loc: location, value: default_node(source, location)) ClassVariableOrWriteNode.new(source, node_id, location, flags, name, name_loc, operator_loc, value) end |
#class_variable_read_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"") ⇒ Object
Create a new ClassVariableReadNode node.
225 226 227 |
# File 'lib/prism/dsl.rb', line 225 def class_variable_read_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"") ClassVariableReadNode.new(source, node_id, location, flags, name) end |
#class_variable_target_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"") ⇒ Object
Create a new ClassVariableTargetNode node.
230 231 232 |
# File 'lib/prism/dsl.rb', line 230 def class_variable_target_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"") ClassVariableTargetNode.new(source, node_id, location, flags, name) end |
#class_variable_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", name_loc: location, value: default_node(source, location), operator_loc: location) ⇒ Object
Create a new ClassVariableWriteNode node.
235 236 237 |
# File 'lib/prism/dsl.rb', line 235 def class_variable_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", name_loc: location, value: default_node(source, location), operator_loc: location) ClassVariableWriteNode.new(source, node_id, location, flags, name, name_loc, value, operator_loc) end |
#constant_and_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", name_loc: location, operator_loc: location, value: default_node(source, location)) ⇒ Object
Create a new ConstantAndWriteNode node.
240 241 242 |
# File 'lib/prism/dsl.rb', line 240 def constant_and_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", name_loc: location, operator_loc: location, value: default_node(source, location)) ConstantAndWriteNode.new(source, node_id, location, flags, name, name_loc, operator_loc, value) end |
#constant_operator_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", name_loc: location, binary_operator_loc: location, value: default_node(source, location), binary_operator: :"") ⇒ Object
Create a new ConstantOperatorWriteNode node.
245 246 247 |
# File 'lib/prism/dsl.rb', line 245 def constant_operator_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", name_loc: location, binary_operator_loc: location, value: default_node(source, location), binary_operator: :"") ConstantOperatorWriteNode.new(source, node_id, location, flags, name, name_loc, binary_operator_loc, value, binary_operator) end |
#constant_or_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", name_loc: location, operator_loc: location, value: default_node(source, location)) ⇒ Object
Create a new ConstantOrWriteNode node.
250 251 252 |
# File 'lib/prism/dsl.rb', line 250 def constant_or_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", name_loc: location, operator_loc: location, value: default_node(source, location)) ConstantOrWriteNode.new(source, node_id, location, flags, name, name_loc, operator_loc, value) end |
#constant_path_and_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, target: constant_path_node(source: source), operator_loc: location, value: default_node(source, location)) ⇒ Object
Create a new ConstantPathAndWriteNode node.
255 256 257 |
# File 'lib/prism/dsl.rb', line 255 def constant_path_and_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, target: constant_path_node(source: source), operator_loc: location, value: default_node(source, location)) ConstantPathAndWriteNode.new(source, node_id, location, flags, target, operator_loc, value) end |
#constant_path_node(source: default_source, node_id: 0, location: default_location, flags: 0, parent: nil, name: nil, delimiter_loc: location, name_loc: location) ⇒ Object
Create a new ConstantPathNode node.
260 261 262 |
# File 'lib/prism/dsl.rb', line 260 def constant_path_node(source: default_source, node_id: 0, location: default_location, flags: 0, parent: nil, name: nil, delimiter_loc: location, name_loc: location) ConstantPathNode.new(source, node_id, location, flags, parent, name, delimiter_loc, name_loc) end |
#constant_path_operator_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, target: constant_path_node(source: source), binary_operator_loc: location, value: default_node(source, location), binary_operator: :"") ⇒ Object
Create a new ConstantPathOperatorWriteNode node.
265 266 267 |
# File 'lib/prism/dsl.rb', line 265 def constant_path_operator_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, target: constant_path_node(source: source), binary_operator_loc: location, value: default_node(source, location), binary_operator: :"") ConstantPathOperatorWriteNode.new(source, node_id, location, flags, target, binary_operator_loc, value, binary_operator) end |
#constant_path_or_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, target: constant_path_node(source: source), operator_loc: location, value: default_node(source, location)) ⇒ Object
Create a new ConstantPathOrWriteNode node.
270 271 272 |
# File 'lib/prism/dsl.rb', line 270 def constant_path_or_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, target: constant_path_node(source: source), operator_loc: location, value: default_node(source, location)) ConstantPathOrWriteNode.new(source, node_id, location, flags, target, operator_loc, value) end |
#constant_path_target_node(source: default_source, node_id: 0, location: default_location, flags: 0, parent: nil, name: nil, delimiter_loc: location, name_loc: location) ⇒ Object
Create a new ConstantPathTargetNode node.
275 276 277 |
# File 'lib/prism/dsl.rb', line 275 def constant_path_target_node(source: default_source, node_id: 0, location: default_location, flags: 0, parent: nil, name: nil, delimiter_loc: location, name_loc: location) ConstantPathTargetNode.new(source, node_id, location, flags, parent, name, delimiter_loc, name_loc) end |
#constant_path_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, target: constant_path_node(source: source), operator_loc: location, value: default_node(source, location)) ⇒ Object
Create a new ConstantPathWriteNode node.
280 281 282 |
# File 'lib/prism/dsl.rb', line 280 def constant_path_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, target: constant_path_node(source: source), operator_loc: location, value: default_node(source, location)) ConstantPathWriteNode.new(source, node_id, location, flags, target, operator_loc, value) end |
#constant_read_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"") ⇒ Object
Create a new ConstantReadNode node.
285 286 287 |
# File 'lib/prism/dsl.rb', line 285 def constant_read_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"") ConstantReadNode.new(source, node_id, location, flags, name) end |
#constant_target_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"") ⇒ Object
Create a new ConstantTargetNode node.
290 291 292 |
# File 'lib/prism/dsl.rb', line 290 def constant_target_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"") ConstantTargetNode.new(source, node_id, location, flags, name) end |
#constant_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", name_loc: location, value: default_node(source, location), operator_loc: location) ⇒ Object
Create a new ConstantWriteNode node.
295 296 297 |
# File 'lib/prism/dsl.rb', line 295 def constant_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", name_loc: location, value: default_node(source, location), operator_loc: location) ConstantWriteNode.new(source, node_id, location, flags, name, name_loc, value, operator_loc) end |
#def_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", name_loc: location, receiver: nil, parameters: nil, body: nil, locals: [], def_keyword_loc: location, operator_loc: nil, lparen_loc: nil, rparen_loc: nil, equal_loc: nil, end_keyword_loc: nil) ⇒ Object
Create a new DefNode node.
300 301 302 |
# File 'lib/prism/dsl.rb', line 300 def def_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", name_loc: location, receiver: nil, parameters: nil, body: nil, locals: [], def_keyword_loc: location, operator_loc: nil, lparen_loc: nil, rparen_loc: nil, equal_loc: nil, end_keyword_loc: nil) DefNode.new(source, node_id, location, flags, name, name_loc, receiver, parameters, body, locals, def_keyword_loc, operator_loc, lparen_loc, rparen_loc, equal_loc, end_keyword_loc) end |
#defined_node(source: default_source, node_id: 0, location: default_location, flags: 0, lparen_loc: nil, value: default_node(source, location), rparen_loc: nil, keyword_loc: location) ⇒ Object
Create a new DefinedNode node.
305 306 307 |
# File 'lib/prism/dsl.rb', line 305 def defined_node(source: default_source, node_id: 0, location: default_location, flags: 0, lparen_loc: nil, value: default_node(source, location), rparen_loc: nil, keyword_loc: location) DefinedNode.new(source, node_id, location, flags, lparen_loc, value, rparen_loc, keyword_loc) end |
#else_node(source: default_source, node_id: 0, location: default_location, flags: 0, else_keyword_loc: location, statements: nil, end_keyword_loc: nil) ⇒ Object
Create a new ElseNode node.
310 311 312 |
# File 'lib/prism/dsl.rb', line 310 def else_node(source: default_source, node_id: 0, location: default_location, flags: 0, else_keyword_loc: location, statements: nil, end_keyword_loc: nil) ElseNode.new(source, node_id, location, flags, else_keyword_loc, statements, end_keyword_loc) end |
#embedded_statements_node(source: default_source, node_id: 0, location: default_location, flags: 0, opening_loc: location, statements: nil, closing_loc: location) ⇒ Object
Create a new EmbeddedStatementsNode node.
315 316 317 |
# File 'lib/prism/dsl.rb', line 315 def (source: default_source, node_id: 0, location: default_location, flags: 0, opening_loc: location, statements: nil, closing_loc: location) EmbeddedStatementsNode.new(source, node_id, location, flags, opening_loc, statements, closing_loc) end |
#embedded_variable_node(source: default_source, node_id: 0, location: default_location, flags: 0, operator_loc: location, variable: instance_variable_read_node(source: source)) ⇒ Object
Create a new EmbeddedVariableNode node.
320 321 322 |
# File 'lib/prism/dsl.rb', line 320 def (source: default_source, node_id: 0, location: default_location, flags: 0, operator_loc: location, variable: instance_variable_read_node(source: source)) EmbeddedVariableNode.new(source, node_id, location, flags, operator_loc, variable) end |
#encoding_flag(name) ⇒ Object
Retrieve the value of one of the EncodingFlags flags.
866 867 868 869 870 871 872 |
# File 'lib/prism/dsl.rb', line 866 def encoding_flag(name) case name when :forced_utf8_encoding then EncodingFlags::FORCED_UTF8_ENCODING when :forced_binary_encoding then EncodingFlags::FORCED_BINARY_ENCODING else Kernel.raise ArgumentError, "invalid EncodingFlags flag: #{name.inspect}" end end |
#ensure_node(source: default_source, node_id: 0, location: default_location, flags: 0, ensure_keyword_loc: location, statements: nil, end_keyword_loc: location) ⇒ Object
Create a new EnsureNode node.
325 326 327 |
# File 'lib/prism/dsl.rb', line 325 def ensure_node(source: default_source, node_id: 0, location: default_location, flags: 0, ensure_keyword_loc: location, statements: nil, end_keyword_loc: location) EnsureNode.new(source, node_id, location, flags, ensure_keyword_loc, statements, end_keyword_loc) end |
#false_node(source: default_source, node_id: 0, location: default_location, flags: 0) ⇒ Object
Create a new FalseNode node.
330 331 332 |
# File 'lib/prism/dsl.rb', line 330 def false_node(source: default_source, node_id: 0, location: default_location, flags: 0) FalseNode.new(source, node_id, location, flags) end |
#find_pattern_node(source: default_source, node_id: 0, location: default_location, flags: 0, constant: nil, left: splat_node(source: source), requireds: [], right: splat_node(source: source), opening_loc: nil, closing_loc: nil) ⇒ Object
Create a new FindPatternNode node.
335 336 337 |
# File 'lib/prism/dsl.rb', line 335 def find_pattern_node(source: default_source, node_id: 0, location: default_location, flags: 0, constant: nil, left: splat_node(source: source), requireds: [], right: splat_node(source: source), opening_loc: nil, closing_loc: nil) FindPatternNode.new(source, node_id, location, flags, constant, left, requireds, right, opening_loc, closing_loc) end |
#flip_flop_node(source: default_source, node_id: 0, location: default_location, flags: 0, left: nil, right: nil, operator_loc: location) ⇒ Object
Create a new FlipFlopNode node.
340 341 342 |
# File 'lib/prism/dsl.rb', line 340 def flip_flop_node(source: default_source, node_id: 0, location: default_location, flags: 0, left: nil, right: nil, operator_loc: location) FlipFlopNode.new(source, node_id, location, flags, left, right, operator_loc) end |
#float_node(source: default_source, node_id: 0, location: default_location, flags: 0, value: 0.0) ⇒ Object
Create a new FloatNode node.
345 346 347 |
# File 'lib/prism/dsl.rb', line 345 def float_node(source: default_source, node_id: 0, location: default_location, flags: 0, value: 0.0) FloatNode.new(source, node_id, location, flags, value) end |
#for_node(source: default_source, node_id: 0, location: default_location, flags: 0, index: local_variable_target_node(source: source), collection: default_node(source, location), statements: nil, for_keyword_loc: location, in_keyword_loc: location, do_keyword_loc: nil, end_keyword_loc: location) ⇒ Object
Create a new ForNode node.
350 351 352 |
# File 'lib/prism/dsl.rb', line 350 def for_node(source: default_source, node_id: 0, location: default_location, flags: 0, index: local_variable_target_node(source: source), collection: default_node(source, location), statements: nil, for_keyword_loc: location, in_keyword_loc: location, do_keyword_loc: nil, end_keyword_loc: location) ForNode.new(source, node_id, location, flags, index, collection, statements, for_keyword_loc, in_keyword_loc, do_keyword_loc, end_keyword_loc) end |
#forwarding_arguments_node(source: default_source, node_id: 0, location: default_location, flags: 0) ⇒ Object
Create a new ForwardingArgumentsNode node.
355 356 357 |
# File 'lib/prism/dsl.rb', line 355 def forwarding_arguments_node(source: default_source, node_id: 0, location: default_location, flags: 0) ForwardingArgumentsNode.new(source, node_id, location, flags) end |
#forwarding_parameter_node(source: default_source, node_id: 0, location: default_location, flags: 0) ⇒ Object
Create a new ForwardingParameterNode node.
360 361 362 |
# File 'lib/prism/dsl.rb', line 360 def forwarding_parameter_node(source: default_source, node_id: 0, location: default_location, flags: 0) ForwardingParameterNode.new(source, node_id, location, flags) end |
#forwarding_super_node(source: default_source, node_id: 0, location: default_location, flags: 0, block: nil) ⇒ Object
Create a new ForwardingSuperNode node.
365 366 367 |
# File 'lib/prism/dsl.rb', line 365 def forwarding_super_node(source: default_source, node_id: 0, location: default_location, flags: 0, block: nil) ForwardingSuperNode.new(source, node_id, location, flags, block) end |
#global_variable_and_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", name_loc: location, operator_loc: location, value: default_node(source, location)) ⇒ Object
Create a new GlobalVariableAndWriteNode node.
370 371 372 |
# File 'lib/prism/dsl.rb', line 370 def global_variable_and_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", name_loc: location, operator_loc: location, value: default_node(source, location)) GlobalVariableAndWriteNode.new(source, node_id, location, flags, name, name_loc, operator_loc, value) end |
#global_variable_operator_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", name_loc: location, binary_operator_loc: location, value: default_node(source, location), binary_operator: :"") ⇒ Object
Create a new GlobalVariableOperatorWriteNode node.
375 376 377 |
# File 'lib/prism/dsl.rb', line 375 def global_variable_operator_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", name_loc: location, binary_operator_loc: location, value: default_node(source, location), binary_operator: :"") GlobalVariableOperatorWriteNode.new(source, node_id, location, flags, name, name_loc, binary_operator_loc, value, binary_operator) end |
#global_variable_or_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", name_loc: location, operator_loc: location, value: default_node(source, location)) ⇒ Object
Create a new GlobalVariableOrWriteNode node.
380 381 382 |
# File 'lib/prism/dsl.rb', line 380 def global_variable_or_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", name_loc: location, operator_loc: location, value: default_node(source, location)) GlobalVariableOrWriteNode.new(source, node_id, location, flags, name, name_loc, operator_loc, value) end |
#global_variable_read_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"") ⇒ Object
Create a new GlobalVariableReadNode node.
385 386 387 |
# File 'lib/prism/dsl.rb', line 385 def global_variable_read_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"") GlobalVariableReadNode.new(source, node_id, location, flags, name) end |
#global_variable_target_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"") ⇒ Object
Create a new GlobalVariableTargetNode node.
390 391 392 |
# File 'lib/prism/dsl.rb', line 390 def global_variable_target_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"") GlobalVariableTargetNode.new(source, node_id, location, flags, name) end |
#global_variable_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", name_loc: location, value: default_node(source, location), operator_loc: location) ⇒ Object
Create a new GlobalVariableWriteNode node.
395 396 397 |
# File 'lib/prism/dsl.rb', line 395 def global_variable_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", name_loc: location, value: default_node(source, location), operator_loc: location) GlobalVariableWriteNode.new(source, node_id, location, flags, name, name_loc, value, operator_loc) end |
#hash_node(source: default_source, node_id: 0, location: default_location, flags: 0, opening_loc: location, elements: [], closing_loc: location) ⇒ Object
Create a new HashNode node.
400 401 402 |
# File 'lib/prism/dsl.rb', line 400 def hash_node(source: default_source, node_id: 0, location: default_location, flags: 0, opening_loc: location, elements: [], closing_loc: location) HashNode.new(source, node_id, location, flags, opening_loc, elements, closing_loc) end |
#hash_pattern_node(source: default_source, node_id: 0, location: default_location, flags: 0, constant: nil, elements: [], rest: nil, opening_loc: nil, closing_loc: nil) ⇒ Object
Create a new HashPatternNode node.
405 406 407 |
# File 'lib/prism/dsl.rb', line 405 def hash_pattern_node(source: default_source, node_id: 0, location: default_location, flags: 0, constant: nil, elements: [], rest: nil, opening_loc: nil, closing_loc: nil) HashPatternNode.new(source, node_id, location, flags, constant, elements, rest, opening_loc, closing_loc) end |
#if_node(source: default_source, node_id: 0, location: default_location, flags: 0, if_keyword_loc: nil, predicate: default_node(source, location), then_keyword_loc: nil, statements: nil, subsequent: nil, end_keyword_loc: nil) ⇒ Object
Create a new IfNode node.
410 411 412 |
# File 'lib/prism/dsl.rb', line 410 def if_node(source: default_source, node_id: 0, location: default_location, flags: 0, if_keyword_loc: nil, predicate: default_node(source, location), then_keyword_loc: nil, statements: nil, subsequent: nil, end_keyword_loc: nil) IfNode.new(source, node_id, location, flags, if_keyword_loc, predicate, then_keyword_loc, statements, subsequent, end_keyword_loc) end |
#imaginary_node(source: default_source, node_id: 0, location: default_location, flags: 0, numeric: float_node(source: source)) ⇒ Object
Create a new ImaginaryNode node.
415 416 417 |
# File 'lib/prism/dsl.rb', line 415 def imaginary_node(source: default_source, node_id: 0, location: default_location, flags: 0, numeric: float_node(source: source)) ImaginaryNode.new(source, node_id, location, flags, numeric) end |
#implicit_node(source: default_source, node_id: 0, location: default_location, flags: 0, value: local_variable_read_node(source: source)) ⇒ Object
Create a new ImplicitNode node.
420 421 422 |
# File 'lib/prism/dsl.rb', line 420 def implicit_node(source: default_source, node_id: 0, location: default_location, flags: 0, value: local_variable_read_node(source: source)) ImplicitNode.new(source, node_id, location, flags, value) end |
#implicit_rest_node(source: default_source, node_id: 0, location: default_location, flags: 0) ⇒ Object
Create a new ImplicitRestNode node.
425 426 427 |
# File 'lib/prism/dsl.rb', line 425 def implicit_rest_node(source: default_source, node_id: 0, location: default_location, flags: 0) ImplicitRestNode.new(source, node_id, location, flags) end |
#in_node(source: default_source, node_id: 0, location: default_location, flags: 0, pattern: default_node(source, location), statements: nil, in_loc: location, then_loc: nil) ⇒ Object
Create a new InNode node.
430 431 432 |
# File 'lib/prism/dsl.rb', line 430 def in_node(source: default_source, node_id: 0, location: default_location, flags: 0, pattern: default_node(source, location), statements: nil, in_loc: location, then_loc: nil) InNode.new(source, node_id, location, flags, pattern, statements, in_loc, then_loc) end |
#index_and_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, receiver: nil, call_operator_loc: nil, opening_loc: location, arguments: nil, closing_loc: location, block: nil, operator_loc: location, value: default_node(source, location)) ⇒ Object
Create a new IndexAndWriteNode node.
435 436 437 |
# File 'lib/prism/dsl.rb', line 435 def index_and_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, receiver: nil, call_operator_loc: nil, opening_loc: location, arguments: nil, closing_loc: location, block: nil, operator_loc: location, value: default_node(source, location)) IndexAndWriteNode.new(source, node_id, location, flags, receiver, call_operator_loc, opening_loc, arguments, closing_loc, block, operator_loc, value) end |
#index_operator_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, receiver: nil, call_operator_loc: nil, opening_loc: location, arguments: nil, closing_loc: location, block: nil, binary_operator: :"", binary_operator_loc: location, value: default_node(source, location)) ⇒ Object
Create a new IndexOperatorWriteNode node.
440 441 442 |
# File 'lib/prism/dsl.rb', line 440 def index_operator_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, receiver: nil, call_operator_loc: nil, opening_loc: location, arguments: nil, closing_loc: location, block: nil, binary_operator: :"", binary_operator_loc: location, value: default_node(source, location)) IndexOperatorWriteNode.new(source, node_id, location, flags, receiver, call_operator_loc, opening_loc, arguments, closing_loc, block, binary_operator, binary_operator_loc, value) end |
#index_or_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, receiver: nil, call_operator_loc: nil, opening_loc: location, arguments: nil, closing_loc: location, block: nil, operator_loc: location, value: default_node(source, location)) ⇒ Object
Create a new IndexOrWriteNode node.
445 446 447 |
# File 'lib/prism/dsl.rb', line 445 def index_or_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, receiver: nil, call_operator_loc: nil, opening_loc: location, arguments: nil, closing_loc: location, block: nil, operator_loc: location, value: default_node(source, location)) IndexOrWriteNode.new(source, node_id, location, flags, receiver, call_operator_loc, opening_loc, arguments, closing_loc, block, operator_loc, value) end |
#index_target_node(source: default_source, node_id: 0, location: default_location, flags: 0, receiver: default_node(source, location), opening_loc: location, arguments: nil, closing_loc: location, block: nil) ⇒ Object
Create a new IndexTargetNode node.
450 451 452 |
# File 'lib/prism/dsl.rb', line 450 def index_target_node(source: default_source, node_id: 0, location: default_location, flags: 0, receiver: default_node(source, location), opening_loc: location, arguments: nil, closing_loc: location, block: nil) IndexTargetNode.new(source, node_id, location, flags, receiver, opening_loc, arguments, closing_loc, block) end |
#instance_variable_and_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", name_loc: location, operator_loc: location, value: default_node(source, location)) ⇒ Object
Create a new InstanceVariableAndWriteNode node.
455 456 457 |
# File 'lib/prism/dsl.rb', line 455 def instance_variable_and_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", name_loc: location, operator_loc: location, value: default_node(source, location)) InstanceVariableAndWriteNode.new(source, node_id, location, flags, name, name_loc, operator_loc, value) end |
#instance_variable_operator_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", name_loc: location, binary_operator_loc: location, value: default_node(source, location), binary_operator: :"") ⇒ Object
Create a new InstanceVariableOperatorWriteNode node.
460 461 462 |
# File 'lib/prism/dsl.rb', line 460 def instance_variable_operator_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", name_loc: location, binary_operator_loc: location, value: default_node(source, location), binary_operator: :"") InstanceVariableOperatorWriteNode.new(source, node_id, location, flags, name, name_loc, binary_operator_loc, value, binary_operator) end |
#instance_variable_or_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", name_loc: location, operator_loc: location, value: default_node(source, location)) ⇒ Object
Create a new InstanceVariableOrWriteNode node.
465 466 467 |
# File 'lib/prism/dsl.rb', line 465 def instance_variable_or_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", name_loc: location, operator_loc: location, value: default_node(source, location)) InstanceVariableOrWriteNode.new(source, node_id, location, flags, name, name_loc, operator_loc, value) end |
#instance_variable_read_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"") ⇒ Object
Create a new InstanceVariableReadNode node.
470 471 472 |
# File 'lib/prism/dsl.rb', line 470 def instance_variable_read_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"") InstanceVariableReadNode.new(source, node_id, location, flags, name) end |
#instance_variable_target_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"") ⇒ Object
Create a new InstanceVariableTargetNode node.
475 476 477 |
# File 'lib/prism/dsl.rb', line 475 def instance_variable_target_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"") InstanceVariableTargetNode.new(source, node_id, location, flags, name) end |
#instance_variable_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", name_loc: location, value: default_node(source, location), operator_loc: location) ⇒ Object
Create a new InstanceVariableWriteNode node.
480 481 482 |
# File 'lib/prism/dsl.rb', line 480 def instance_variable_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", name_loc: location, value: default_node(source, location), operator_loc: location) InstanceVariableWriteNode.new(source, node_id, location, flags, name, name_loc, value, operator_loc) end |
#integer_base_flag(name) ⇒ Object
Retrieve the value of one of the IntegerBaseFlags flags.
875 876 877 878 879 880 881 882 883 |
# File 'lib/prism/dsl.rb', line 875 def integer_base_flag(name) case name when :binary then IntegerBaseFlags::BINARY when :decimal then IntegerBaseFlags::DECIMAL when :octal then IntegerBaseFlags::OCTAL when :hexadecimal then IntegerBaseFlags::HEXADECIMAL else Kernel.raise ArgumentError, "invalid IntegerBaseFlags flag: #{name.inspect}" end end |
#integer_node(source: default_source, node_id: 0, location: default_location, flags: 0, value: 0) ⇒ Object
Create a new IntegerNode node.
485 486 487 |
# File 'lib/prism/dsl.rb', line 485 def integer_node(source: default_source, node_id: 0, location: default_location, flags: 0, value: 0) IntegerNode.new(source, node_id, location, flags, value) end |
#interpolated_match_last_line_node(source: default_source, node_id: 0, location: default_location, flags: 0, opening_loc: location, parts: [], closing_loc: location) ⇒ Object
Create a new InterpolatedMatchLastLineNode node.
490 491 492 |
# File 'lib/prism/dsl.rb', line 490 def interpolated_match_last_line_node(source: default_source, node_id: 0, location: default_location, flags: 0, opening_loc: location, parts: [], closing_loc: location) InterpolatedMatchLastLineNode.new(source, node_id, location, flags, opening_loc, parts, closing_loc) end |
#interpolated_regular_expression_node(source: default_source, node_id: 0, location: default_location, flags: 0, opening_loc: location, parts: [], closing_loc: location) ⇒ Object
Create a new InterpolatedRegularExpressionNode node.
495 496 497 |
# File 'lib/prism/dsl.rb', line 495 def interpolated_regular_expression_node(source: default_source, node_id: 0, location: default_location, flags: 0, opening_loc: location, parts: [], closing_loc: location) InterpolatedRegularExpressionNode.new(source, node_id, location, flags, opening_loc, parts, closing_loc) end |
#interpolated_string_node(source: default_source, node_id: 0, location: default_location, flags: 0, opening_loc: nil, parts: [], closing_loc: nil) ⇒ Object
Create a new InterpolatedStringNode node.
500 501 502 |
# File 'lib/prism/dsl.rb', line 500 def interpolated_string_node(source: default_source, node_id: 0, location: default_location, flags: 0, opening_loc: nil, parts: [], closing_loc: nil) InterpolatedStringNode.new(source, node_id, location, flags, opening_loc, parts, closing_loc) end |
#interpolated_string_node_flag(name) ⇒ Object
Retrieve the value of one of the InterpolatedStringNodeFlags flags.
886 887 888 889 890 891 892 |
# File 'lib/prism/dsl.rb', line 886 def interpolated_string_node_flag(name) case name when :frozen then InterpolatedStringNodeFlags::FROZEN when :mutable then InterpolatedStringNodeFlags::MUTABLE else Kernel.raise ArgumentError, "invalid InterpolatedStringNodeFlags flag: #{name.inspect}" end end |
#interpolated_symbol_node(source: default_source, node_id: 0, location: default_location, flags: 0, opening_loc: nil, parts: [], closing_loc: nil) ⇒ Object
Create a new InterpolatedSymbolNode node.
505 506 507 |
# File 'lib/prism/dsl.rb', line 505 def interpolated_symbol_node(source: default_source, node_id: 0, location: default_location, flags: 0, opening_loc: nil, parts: [], closing_loc: nil) InterpolatedSymbolNode.new(source, node_id, location, flags, opening_loc, parts, closing_loc) end |
#interpolated_x_string_node(source: default_source, node_id: 0, location: default_location, flags: 0, opening_loc: location, parts: [], closing_loc: location) ⇒ Object
Create a new InterpolatedXStringNode node.
510 511 512 |
# File 'lib/prism/dsl.rb', line 510 def interpolated_x_string_node(source: default_source, node_id: 0, location: default_location, flags: 0, opening_loc: location, parts: [], closing_loc: location) InterpolatedXStringNode.new(source, node_id, location, flags, opening_loc, parts, closing_loc) end |
#it_local_variable_read_node(source: default_source, node_id: 0, location: default_location, flags: 0) ⇒ Object
Create a new ItLocalVariableReadNode node.
515 516 517 |
# File 'lib/prism/dsl.rb', line 515 def it_local_variable_read_node(source: default_source, node_id: 0, location: default_location, flags: 0) ItLocalVariableReadNode.new(source, node_id, location, flags) end |
#it_parameters_node(source: default_source, node_id: 0, location: default_location, flags: 0) ⇒ Object
Create a new ItParametersNode node.
520 521 522 |
# File 'lib/prism/dsl.rb', line 520 def it_parameters_node(source: default_source, node_id: 0, location: default_location, flags: 0) ItParametersNode.new(source, node_id, location, flags) end |
#keyword_hash_node(source: default_source, node_id: 0, location: default_location, flags: 0, elements: []) ⇒ Object
Create a new KeywordHashNode node.
525 526 527 |
# File 'lib/prism/dsl.rb', line 525 def keyword_hash_node(source: default_source, node_id: 0, location: default_location, flags: 0, elements: []) KeywordHashNode.new(source, node_id, location, flags, elements) end |
#keyword_hash_node_flag(name) ⇒ Object
Retrieve the value of one of the KeywordHashNodeFlags flags.
895 896 897 898 899 900 |
# File 'lib/prism/dsl.rb', line 895 def keyword_hash_node_flag(name) case name when :symbol_keys then KeywordHashNodeFlags::SYMBOL_KEYS else Kernel.raise ArgumentError, "invalid KeywordHashNodeFlags flag: #{name.inspect}" end end |
#keyword_rest_parameter_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: nil, name_loc: nil, operator_loc: location) ⇒ Object
Create a new KeywordRestParameterNode node.
530 531 532 |
# File 'lib/prism/dsl.rb', line 530 def keyword_rest_parameter_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: nil, name_loc: nil, operator_loc: location) KeywordRestParameterNode.new(source, node_id, location, flags, name, name_loc, operator_loc) end |
#lambda_node(source: default_source, node_id: 0, location: default_location, flags: 0, locals: [], operator_loc: location, opening_loc: location, closing_loc: location, parameters: nil, body: nil) ⇒ Object
Create a new LambdaNode node.
535 536 537 |
# File 'lib/prism/dsl.rb', line 535 def lambda_node(source: default_source, node_id: 0, location: default_location, flags: 0, locals: [], operator_loc: location, opening_loc: location, closing_loc: location, parameters: nil, body: nil) LambdaNode.new(source, node_id, location, flags, locals, operator_loc, opening_loc, closing_loc, parameters, body) end |
#local_variable_and_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, name_loc: location, operator_loc: location, value: default_node(source, location), name: :"", depth: 0) ⇒ Object
Create a new LocalVariableAndWriteNode node.
540 541 542 |
# File 'lib/prism/dsl.rb', line 540 def local_variable_and_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, name_loc: location, operator_loc: location, value: default_node(source, location), name: :"", depth: 0) LocalVariableAndWriteNode.new(source, node_id, location, flags, name_loc, operator_loc, value, name, depth) end |
#local_variable_operator_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, name_loc: location, binary_operator_loc: location, value: default_node(source, location), name: :"", binary_operator: :"", depth: 0) ⇒ Object
Create a new LocalVariableOperatorWriteNode node.
545 546 547 |
# File 'lib/prism/dsl.rb', line 545 def local_variable_operator_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, name_loc: location, binary_operator_loc: location, value: default_node(source, location), name: :"", binary_operator: :"", depth: 0) LocalVariableOperatorWriteNode.new(source, node_id, location, flags, name_loc, binary_operator_loc, value, name, binary_operator, depth) end |
#local_variable_or_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, name_loc: location, operator_loc: location, value: default_node(source, location), name: :"", depth: 0) ⇒ Object
Create a new LocalVariableOrWriteNode node.
550 551 552 |
# File 'lib/prism/dsl.rb', line 550 def local_variable_or_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, name_loc: location, operator_loc: location, value: default_node(source, location), name: :"", depth: 0) LocalVariableOrWriteNode.new(source, node_id, location, flags, name_loc, operator_loc, value, name, depth) end |
#local_variable_read_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", depth: 0) ⇒ Object
Create a new LocalVariableReadNode node.
555 556 557 |
# File 'lib/prism/dsl.rb', line 555 def local_variable_read_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", depth: 0) LocalVariableReadNode.new(source, node_id, location, flags, name, depth) end |
#local_variable_target_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", depth: 0) ⇒ Object
Create a new LocalVariableTargetNode node.
560 561 562 |
# File 'lib/prism/dsl.rb', line 560 def local_variable_target_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", depth: 0) LocalVariableTargetNode.new(source, node_id, location, flags, name, depth) end |
#local_variable_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", depth: 0, name_loc: location, value: default_node(source, location), operator_loc: location) ⇒ Object
Create a new LocalVariableWriteNode node.
565 566 567 |
# File 'lib/prism/dsl.rb', line 565 def local_variable_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", depth: 0, name_loc: location, value: default_node(source, location), operator_loc: location) LocalVariableWriteNode.new(source, node_id, location, flags, name, depth, name_loc, value, operator_loc) end |
#location(source: default_source, start_offset: 0, length: 0) ⇒ Object
Create a new Location object.
75 76 77 |
# File 'lib/prism/dsl.rb', line 75 def location(source: default_source, start_offset: 0, length: 0) Location.new(source, start_offset, length) end |
#loop_flag(name) ⇒ Object
Retrieve the value of one of the LoopFlags flags.
903 904 905 906 907 908 |
# File 'lib/prism/dsl.rb', line 903 def loop_flag(name) case name when :begin_modifier then LoopFlags::BEGIN_MODIFIER else Kernel.raise ArgumentError, "invalid LoopFlags flag: #{name.inspect}" end end |
#match_last_line_node(source: default_source, node_id: 0, location: default_location, flags: 0, opening_loc: location, content_loc: location, closing_loc: location, unescaped: "") ⇒ Object
Create a new MatchLastLineNode node.
570 571 572 |
# File 'lib/prism/dsl.rb', line 570 def match_last_line_node(source: default_source, node_id: 0, location: default_location, flags: 0, opening_loc: location, content_loc: location, closing_loc: location, unescaped: "") MatchLastLineNode.new(source, node_id, location, flags, opening_loc, content_loc, closing_loc, unescaped) end |
#match_predicate_node(source: default_source, node_id: 0, location: default_location, flags: 0, value: default_node(source, location), pattern: default_node(source, location), operator_loc: location) ⇒ Object
Create a new MatchPredicateNode node.
575 576 577 |
# File 'lib/prism/dsl.rb', line 575 def match_predicate_node(source: default_source, node_id: 0, location: default_location, flags: 0, value: default_node(source, location), pattern: default_node(source, location), operator_loc: location) MatchPredicateNode.new(source, node_id, location, flags, value, pattern, operator_loc) end |
#match_required_node(source: default_source, node_id: 0, location: default_location, flags: 0, value: default_node(source, location), pattern: default_node(source, location), operator_loc: location) ⇒ Object
Create a new MatchRequiredNode node.
580 581 582 |
# File 'lib/prism/dsl.rb', line 580 def match_required_node(source: default_source, node_id: 0, location: default_location, flags: 0, value: default_node(source, location), pattern: default_node(source, location), operator_loc: location) MatchRequiredNode.new(source, node_id, location, flags, value, pattern, operator_loc) end |
#match_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, call: call_node(source: source), targets: []) ⇒ Object
Create a new MatchWriteNode node.
585 586 587 |
# File 'lib/prism/dsl.rb', line 585 def match_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, call: call_node(source: source), targets: []) MatchWriteNode.new(source, node_id, location, flags, call, targets) end |
#missing_node(source: default_source, node_id: 0, location: default_location, flags: 0) ⇒ Object
Create a new MissingNode node.
590 591 592 |
# File 'lib/prism/dsl.rb', line 590 def missing_node(source: default_source, node_id: 0, location: default_location, flags: 0) MissingNode.new(source, node_id, location, flags) end |
#module_node(source: default_source, node_id: 0, location: default_location, flags: 0, locals: [], module_keyword_loc: location, constant_path: constant_read_node(source: source), body: nil, end_keyword_loc: location, name: :"") ⇒ Object
Create a new ModuleNode node.
595 596 597 |
# File 'lib/prism/dsl.rb', line 595 def module_node(source: default_source, node_id: 0, location: default_location, flags: 0, locals: [], module_keyword_loc: location, constant_path: constant_read_node(source: source), body: nil, end_keyword_loc: location, name: :"") ModuleNode.new(source, node_id, location, flags, locals, module_keyword_loc, constant_path, body, end_keyword_loc, name) end |
#multi_target_node(source: default_source, node_id: 0, location: default_location, flags: 0, lefts: [], rest: nil, rights: [], lparen_loc: nil, rparen_loc: nil) ⇒ Object
Create a new MultiTargetNode node.
600 601 602 |
# File 'lib/prism/dsl.rb', line 600 def multi_target_node(source: default_source, node_id: 0, location: default_location, flags: 0, lefts: [], rest: nil, rights: [], lparen_loc: nil, rparen_loc: nil) MultiTargetNode.new(source, node_id, location, flags, lefts, rest, rights, lparen_loc, rparen_loc) end |
#multi_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, lefts: [], rest: nil, rights: [], lparen_loc: nil, rparen_loc: nil, operator_loc: location, value: default_node(source, location)) ⇒ Object
Create a new MultiWriteNode node.
605 606 607 |
# File 'lib/prism/dsl.rb', line 605 def multi_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, lefts: [], rest: nil, rights: [], lparen_loc: nil, rparen_loc: nil, operator_loc: location, value: default_node(source, location)) MultiWriteNode.new(source, node_id, location, flags, lefts, rest, rights, lparen_loc, rparen_loc, operator_loc, value) end |
#next_node(source: default_source, node_id: 0, location: default_location, flags: 0, arguments: nil, keyword_loc: location) ⇒ Object
Create a new NextNode node.
610 611 612 |
# File 'lib/prism/dsl.rb', line 610 def next_node(source: default_source, node_id: 0, location: default_location, flags: 0, arguments: nil, keyword_loc: location) NextNode.new(source, node_id, location, flags, arguments, keyword_loc) end |
#nil_node(source: default_source, node_id: 0, location: default_location, flags: 0) ⇒ Object
Create a new NilNode node.
615 616 617 |
# File 'lib/prism/dsl.rb', line 615 def nil_node(source: default_source, node_id: 0, location: default_location, flags: 0) NilNode.new(source, node_id, location, flags) end |
#no_keywords_parameter_node(source: default_source, node_id: 0, location: default_location, flags: 0, operator_loc: location, keyword_loc: location) ⇒ Object
Create a new NoKeywordsParameterNode node.
620 621 622 |
# File 'lib/prism/dsl.rb', line 620 def no_keywords_parameter_node(source: default_source, node_id: 0, location: default_location, flags: 0, operator_loc: location, keyword_loc: location) NoKeywordsParameterNode.new(source, node_id, location, flags, operator_loc, keyword_loc) end |
#numbered_parameters_node(source: default_source, node_id: 0, location: default_location, flags: 0, maximum: 0) ⇒ Object
Create a new NumberedParametersNode node.
625 626 627 |
# File 'lib/prism/dsl.rb', line 625 def numbered_parameters_node(source: default_source, node_id: 0, location: default_location, flags: 0, maximum: 0) NumberedParametersNode.new(source, node_id, location, flags, maximum) end |
#numbered_reference_read_node(source: default_source, node_id: 0, location: default_location, flags: 0, number: 0) ⇒ Object
Create a new NumberedReferenceReadNode node.
630 631 632 |
# File 'lib/prism/dsl.rb', line 630 def numbered_reference_read_node(source: default_source, node_id: 0, location: default_location, flags: 0, number: 0) NumberedReferenceReadNode.new(source, node_id, location, flags, number) end |
#optional_keyword_parameter_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", name_loc: location, value: default_node(source, location)) ⇒ Object
Create a new OptionalKeywordParameterNode node.
635 636 637 |
# File 'lib/prism/dsl.rb', line 635 def optional_keyword_parameter_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", name_loc: location, value: default_node(source, location)) OptionalKeywordParameterNode.new(source, node_id, location, flags, name, name_loc, value) end |
#optional_parameter_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", name_loc: location, operator_loc: location, value: default_node(source, location)) ⇒ Object
Create a new OptionalParameterNode node.
640 641 642 |
# File 'lib/prism/dsl.rb', line 640 def optional_parameter_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", name_loc: location, operator_loc: location, value: default_node(source, location)) OptionalParameterNode.new(source, node_id, location, flags, name, name_loc, operator_loc, value) end |
#or_node(source: default_source, node_id: 0, location: default_location, flags: 0, left: default_node(source, location), right: default_node(source, location), operator_loc: location) ⇒ Object
Create a new OrNode node.
645 646 647 |
# File 'lib/prism/dsl.rb', line 645 def or_node(source: default_source, node_id: 0, location: default_location, flags: 0, left: default_node(source, location), right: default_node(source, location), operator_loc: location) OrNode.new(source, node_id, location, flags, left, right, operator_loc) end |
#parameter_flag(name) ⇒ Object
Retrieve the value of one of the ParameterFlags flags.
911 912 913 914 915 916 |
# File 'lib/prism/dsl.rb', line 911 def parameter_flag(name) case name when :repeated_parameter then ParameterFlags::REPEATED_PARAMETER else Kernel.raise ArgumentError, "invalid ParameterFlags flag: #{name.inspect}" end end |
#parameters_node(source: default_source, node_id: 0, location: default_location, flags: 0, requireds: [], optionals: [], rest: nil, posts: [], keywords: [], keyword_rest: nil, block: nil) ⇒ Object
Create a new ParametersNode node.
650 651 652 |
# File 'lib/prism/dsl.rb', line 650 def parameters_node(source: default_source, node_id: 0, location: default_location, flags: 0, requireds: [], optionals: [], rest: nil, posts: [], keywords: [], keyword_rest: nil, block: nil) ParametersNode.new(source, node_id, location, flags, requireds, optionals, rest, posts, keywords, keyword_rest, block) end |
#parentheses_node(source: default_source, node_id: 0, location: default_location, flags: 0, body: nil, opening_loc: location, closing_loc: location) ⇒ Object
Create a new ParenthesesNode node.
655 656 657 |
# File 'lib/prism/dsl.rb', line 655 def parentheses_node(source: default_source, node_id: 0, location: default_location, flags: 0, body: nil, opening_loc: location, closing_loc: location) ParenthesesNode.new(source, node_id, location, flags, body, opening_loc, closing_loc) end |
#parentheses_node_flag(name) ⇒ Object
Retrieve the value of one of the ParenthesesNodeFlags flags.
919 920 921 922 923 924 |
# File 'lib/prism/dsl.rb', line 919 def parentheses_node_flag(name) case name when :multiple_statements then ParenthesesNodeFlags::MULTIPLE_STATEMENTS else Kernel.raise ArgumentError, "invalid ParenthesesNodeFlags flag: #{name.inspect}" end end |
#pinned_expression_node(source: default_source, node_id: 0, location: default_location, flags: 0, expression: default_node(source, location), operator_loc: location, lparen_loc: location, rparen_loc: location) ⇒ Object
Create a new PinnedExpressionNode node.
660 661 662 |
# File 'lib/prism/dsl.rb', line 660 def pinned_expression_node(source: default_source, node_id: 0, location: default_location, flags: 0, expression: default_node(source, location), operator_loc: location, lparen_loc: location, rparen_loc: location) PinnedExpressionNode.new(source, node_id, location, flags, expression, operator_loc, lparen_loc, rparen_loc) end |
#pinned_variable_node(source: default_source, node_id: 0, location: default_location, flags: 0, variable: local_variable_read_node(source: source), operator_loc: location) ⇒ Object
Create a new PinnedVariableNode node.
665 666 667 |
# File 'lib/prism/dsl.rb', line 665 def pinned_variable_node(source: default_source, node_id: 0, location: default_location, flags: 0, variable: local_variable_read_node(source: source), operator_loc: location) PinnedVariableNode.new(source, node_id, location, flags, variable, operator_loc) end |
#post_execution_node(source: default_source, node_id: 0, location: default_location, flags: 0, statements: nil, keyword_loc: location, opening_loc: location, closing_loc: location) ⇒ Object
Create a new PostExecutionNode node.
670 671 672 |
# File 'lib/prism/dsl.rb', line 670 def post_execution_node(source: default_source, node_id: 0, location: default_location, flags: 0, statements: nil, keyword_loc: location, opening_loc: location, closing_loc: location) PostExecutionNode.new(source, node_id, location, flags, statements, keyword_loc, opening_loc, closing_loc) end |
#pre_execution_node(source: default_source, node_id: 0, location: default_location, flags: 0, statements: nil, keyword_loc: location, opening_loc: location, closing_loc: location) ⇒ Object
Create a new PreExecutionNode node.
675 676 677 |
# File 'lib/prism/dsl.rb', line 675 def pre_execution_node(source: default_source, node_id: 0, location: default_location, flags: 0, statements: nil, keyword_loc: location, opening_loc: location, closing_loc: location) PreExecutionNode.new(source, node_id, location, flags, statements, keyword_loc, opening_loc, closing_loc) end |
#program_node(source: default_source, node_id: 0, location: default_location, flags: 0, locals: [], statements: statements_node(source: source)) ⇒ Object
Create a new ProgramNode node.
680 681 682 |
# File 'lib/prism/dsl.rb', line 680 def program_node(source: default_source, node_id: 0, location: default_location, flags: 0, locals: [], statements: statements_node(source: source)) ProgramNode.new(source, node_id, location, flags, locals, statements) end |
#range_flag(name) ⇒ Object
Retrieve the value of one of the RangeFlags flags.
927 928 929 930 931 932 |
# File 'lib/prism/dsl.rb', line 927 def range_flag(name) case name when :exclude_end then RangeFlags::EXCLUDE_END else Kernel.raise ArgumentError, "invalid RangeFlags flag: #{name.inspect}" end end |
#range_node(source: default_source, node_id: 0, location: default_location, flags: 0, left: nil, right: nil, operator_loc: location) ⇒ Object
Create a new RangeNode node.
685 686 687 |
# File 'lib/prism/dsl.rb', line 685 def range_node(source: default_source, node_id: 0, location: default_location, flags: 0, left: nil, right: nil, operator_loc: location) RangeNode.new(source, node_id, location, flags, left, right, operator_loc) end |
#rational_node(source: default_source, node_id: 0, location: default_location, flags: 0, numerator: 0, denominator: 0) ⇒ Object
Create a new RationalNode node.
690 691 692 |
# File 'lib/prism/dsl.rb', line 690 def rational_node(source: default_source, node_id: 0, location: default_location, flags: 0, numerator: 0, denominator: 0) RationalNode.new(source, node_id, location, flags, numerator, denominator) end |
#redo_node(source: default_source, node_id: 0, location: default_location, flags: 0) ⇒ Object
Create a new RedoNode node.
695 696 697 |
# File 'lib/prism/dsl.rb', line 695 def redo_node(source: default_source, node_id: 0, location: default_location, flags: 0) RedoNode.new(source, node_id, location, flags) end |
#regular_expression_flag(name) ⇒ Object
Retrieve the value of one of the RegularExpressionFlags flags.
935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 |
# File 'lib/prism/dsl.rb', line 935 def regular_expression_flag(name) case name when :ignore_case then RegularExpressionFlags::IGNORE_CASE when :extended then RegularExpressionFlags::EXTENDED when :multi_line then RegularExpressionFlags::MULTI_LINE when :once then RegularExpressionFlags::ONCE when :euc_jp then RegularExpressionFlags::EUC_JP when :ascii_8bit then RegularExpressionFlags::ASCII_8BIT when :windows_31j then RegularExpressionFlags::WINDOWS_31J when :utf_8 then RegularExpressionFlags::UTF_8 when :forced_utf8_encoding then RegularExpressionFlags::FORCED_UTF8_ENCODING when :forced_binary_encoding then RegularExpressionFlags::FORCED_BINARY_ENCODING when :forced_us_ascii_encoding then RegularExpressionFlags::FORCED_US_ASCII_ENCODING else Kernel.raise ArgumentError, "invalid RegularExpressionFlags flag: #{name.inspect}" end end |
#regular_expression_node(source: default_source, node_id: 0, location: default_location, flags: 0, opening_loc: location, content_loc: location, closing_loc: location, unescaped: "") ⇒ Object
Create a new RegularExpressionNode node.
700 701 702 |
# File 'lib/prism/dsl.rb', line 700 def regular_expression_node(source: default_source, node_id: 0, location: default_location, flags: 0, opening_loc: location, content_loc: location, closing_loc: location, unescaped: "") RegularExpressionNode.new(source, node_id, location, flags, opening_loc, content_loc, closing_loc, unescaped) end |
#required_keyword_parameter_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", name_loc: location) ⇒ Object
Create a new RequiredKeywordParameterNode node.
705 706 707 |
# File 'lib/prism/dsl.rb', line 705 def required_keyword_parameter_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", name_loc: location) RequiredKeywordParameterNode.new(source, node_id, location, flags, name, name_loc) end |
#required_parameter_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"") ⇒ Object
Create a new RequiredParameterNode node.
710 711 712 |
# File 'lib/prism/dsl.rb', line 710 def required_parameter_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"") RequiredParameterNode.new(source, node_id, location, flags, name) end |
#rescue_modifier_node(source: default_source, node_id: 0, location: default_location, flags: 0, expression: default_node(source, location), keyword_loc: location, rescue_expression: default_node(source, location)) ⇒ Object
Create a new RescueModifierNode node.
715 716 717 |
# File 'lib/prism/dsl.rb', line 715 def rescue_modifier_node(source: default_source, node_id: 0, location: default_location, flags: 0, expression: default_node(source, location), keyword_loc: location, rescue_expression: default_node(source, location)) RescueModifierNode.new(source, node_id, location, flags, expression, keyword_loc, rescue_expression) end |
#rescue_node(source: default_source, node_id: 0, location: default_location, flags: 0, keyword_loc: location, exceptions: [], operator_loc: nil, reference: nil, then_keyword_loc: nil, statements: nil, subsequent: nil) ⇒ Object
Create a new RescueNode node.
720 721 722 |
# File 'lib/prism/dsl.rb', line 720 def rescue_node(source: default_source, node_id: 0, location: default_location, flags: 0, keyword_loc: location, exceptions: [], operator_loc: nil, reference: nil, then_keyword_loc: nil, statements: nil, subsequent: nil) RescueNode.new(source, node_id, location, flags, keyword_loc, exceptions, operator_loc, reference, then_keyword_loc, statements, subsequent) end |
#rest_parameter_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: nil, name_loc: nil, operator_loc: location) ⇒ Object
Create a new RestParameterNode node.
725 726 727 |
# File 'lib/prism/dsl.rb', line 725 def rest_parameter_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: nil, name_loc: nil, operator_loc: location) RestParameterNode.new(source, node_id, location, flags, name, name_loc, operator_loc) end |
#retry_node(source: default_source, node_id: 0, location: default_location, flags: 0) ⇒ Object
Create a new RetryNode node.
730 731 732 |
# File 'lib/prism/dsl.rb', line 730 def retry_node(source: default_source, node_id: 0, location: default_location, flags: 0) RetryNode.new(source, node_id, location, flags) end |
#return_node(source: default_source, node_id: 0, location: default_location, flags: 0, keyword_loc: location, arguments: nil) ⇒ Object
Create a new ReturnNode node.
735 736 737 |
# File 'lib/prism/dsl.rb', line 735 def return_node(source: default_source, node_id: 0, location: default_location, flags: 0, keyword_loc: location, arguments: nil) ReturnNode.new(source, node_id, location, flags, keyword_loc, arguments) end |
#self_node(source: default_source, node_id: 0, location: default_location, flags: 0) ⇒ Object
Create a new SelfNode node.
740 741 742 |
# File 'lib/prism/dsl.rb', line 740 def self_node(source: default_source, node_id: 0, location: default_location, flags: 0) SelfNode.new(source, node_id, location, flags) end |
#shareable_constant_node(source: default_source, node_id: 0, location: default_location, flags: 0, write: constant_write_node(source: source)) ⇒ Object
Create a new ShareableConstantNode node.
745 746 747 |
# File 'lib/prism/dsl.rb', line 745 def shareable_constant_node(source: default_source, node_id: 0, location: default_location, flags: 0, write: constant_write_node(source: source)) ShareableConstantNode.new(source, node_id, location, flags, write) end |
#shareable_constant_node_flag(name) ⇒ Object
Retrieve the value of one of the ShareableConstantNodeFlags flags.
953 954 955 956 957 958 959 960 |
# File 'lib/prism/dsl.rb', line 953 def shareable_constant_node_flag(name) case name when :literal then ShareableConstantNodeFlags::LITERAL when :experimental_everything then ShareableConstantNodeFlags::EXPERIMENTAL_EVERYTHING when :experimental_copy then ShareableConstantNodeFlags::EXPERIMENTAL_COPY else Kernel.raise ArgumentError, "invalid ShareableConstantNodeFlags flag: #{name.inspect}" end end |
#singleton_class_node(source: default_source, node_id: 0, location: default_location, flags: 0, locals: [], class_keyword_loc: location, operator_loc: location, expression: default_node(source, location), body: nil, end_keyword_loc: location) ⇒ Object
Create a new SingletonClassNode node.
750 751 752 |
# File 'lib/prism/dsl.rb', line 750 def singleton_class_node(source: default_source, node_id: 0, location: default_location, flags: 0, locals: [], class_keyword_loc: location, operator_loc: location, expression: default_node(source, location), body: nil, end_keyword_loc: location) SingletonClassNode.new(source, node_id, location, flags, locals, class_keyword_loc, operator_loc, expression, body, end_keyword_loc) end |
#source(string) ⇒ Object
Create a new Source object.
70 71 72 |
# File 'lib/prism/dsl.rb', line 70 def source(string) Source.for(string) end |
#source_encoding_node(source: default_source, node_id: 0, location: default_location, flags: 0) ⇒ Object
Create a new SourceEncodingNode node.
755 756 757 |
# File 'lib/prism/dsl.rb', line 755 def source_encoding_node(source: default_source, node_id: 0, location: default_location, flags: 0) SourceEncodingNode.new(source, node_id, location, flags) end |
#source_file_node(source: default_source, node_id: 0, location: default_location, flags: 0, filepath: "") ⇒ Object
Create a new SourceFileNode node.
760 761 762 |
# File 'lib/prism/dsl.rb', line 760 def source_file_node(source: default_source, node_id: 0, location: default_location, flags: 0, filepath: "") SourceFileNode.new(source, node_id, location, flags, filepath) end |
#source_line_node(source: default_source, node_id: 0, location: default_location, flags: 0) ⇒ Object
Create a new SourceLineNode node.
765 766 767 |
# File 'lib/prism/dsl.rb', line 765 def source_line_node(source: default_source, node_id: 0, location: default_location, flags: 0) SourceLineNode.new(source, node_id, location, flags) end |
#splat_node(source: default_source, node_id: 0, location: default_location, flags: 0, operator_loc: location, expression: nil) ⇒ Object
Create a new SplatNode node.
770 771 772 |
# File 'lib/prism/dsl.rb', line 770 def splat_node(source: default_source, node_id: 0, location: default_location, flags: 0, operator_loc: location, expression: nil) SplatNode.new(source, node_id, location, flags, operator_loc, expression) end |
#statements_node(source: default_source, node_id: 0, location: default_location, flags: 0, body: []) ⇒ Object
Create a new StatementsNode node.
775 776 777 |
# File 'lib/prism/dsl.rb', line 775 def statements_node(source: default_source, node_id: 0, location: default_location, flags: 0, body: []) StatementsNode.new(source, node_id, location, flags, body) end |
#string_flag(name) ⇒ Object
Retrieve the value of one of the StringFlags flags.
963 964 965 966 967 968 969 970 971 |
# File 'lib/prism/dsl.rb', line 963 def string_flag(name) case name when :forced_utf8_encoding then StringFlags::FORCED_UTF8_ENCODING when :forced_binary_encoding then StringFlags::FORCED_BINARY_ENCODING when :frozen then StringFlags::FROZEN when :mutable then StringFlags::MUTABLE else Kernel.raise ArgumentError, "invalid StringFlags flag: #{name.inspect}" end end |
#string_node(source: default_source, node_id: 0, location: default_location, flags: 0, opening_loc: nil, content_loc: location, closing_loc: nil, unescaped: "") ⇒ Object
Create a new StringNode node.
780 781 782 |
# File 'lib/prism/dsl.rb', line 780 def string_node(source: default_source, node_id: 0, location: default_location, flags: 0, opening_loc: nil, content_loc: location, closing_loc: nil, unescaped: "") StringNode.new(source, node_id, location, flags, opening_loc, content_loc, closing_loc, unescaped) end |
#super_node(source: default_source, node_id: 0, location: default_location, flags: 0, keyword_loc: location, lparen_loc: nil, arguments: nil, rparen_loc: nil, block: nil) ⇒ Object
Create a new SuperNode node.
785 786 787 |
# File 'lib/prism/dsl.rb', line 785 def super_node(source: default_source, node_id: 0, location: default_location, flags: 0, keyword_loc: location, lparen_loc: nil, arguments: nil, rparen_loc: nil, block: nil) SuperNode.new(source, node_id, location, flags, keyword_loc, lparen_loc, arguments, rparen_loc, block) end |
#symbol_flag(name) ⇒ Object
Retrieve the value of one of the SymbolFlags flags.
974 975 976 977 978 979 980 981 |
# File 'lib/prism/dsl.rb', line 974 def symbol_flag(name) case name when :forced_utf8_encoding then SymbolFlags::FORCED_UTF8_ENCODING when :forced_binary_encoding then SymbolFlags::FORCED_BINARY_ENCODING when :forced_us_ascii_encoding then SymbolFlags::FORCED_US_ASCII_ENCODING else Kernel.raise ArgumentError, "invalid SymbolFlags flag: #{name.inspect}" end end |
#symbol_node(source: default_source, node_id: 0, location: default_location, flags: 0, opening_loc: nil, value_loc: nil, closing_loc: nil, unescaped: "") ⇒ Object
Create a new SymbolNode node.
790 791 792 |
# File 'lib/prism/dsl.rb', line 790 def symbol_node(source: default_source, node_id: 0, location: default_location, flags: 0, opening_loc: nil, value_loc: nil, closing_loc: nil, unescaped: "") SymbolNode.new(source, node_id, location, flags, opening_loc, value_loc, closing_loc, unescaped) end |
#true_node(source: default_source, node_id: 0, location: default_location, flags: 0) ⇒ Object
Create a new TrueNode node.
795 796 797 |
# File 'lib/prism/dsl.rb', line 795 def true_node(source: default_source, node_id: 0, location: default_location, flags: 0) TrueNode.new(source, node_id, location, flags) end |
#undef_node(source: default_source, node_id: 0, location: default_location, flags: 0, names: [], keyword_loc: location) ⇒ Object
Create a new UndefNode node.
800 801 802 |
# File 'lib/prism/dsl.rb', line 800 def undef_node(source: default_source, node_id: 0, location: default_location, flags: 0, names: [], keyword_loc: location) UndefNode.new(source, node_id, location, flags, names, keyword_loc) end |
#unless_node(source: default_source, node_id: 0, location: default_location, flags: 0, keyword_loc: location, predicate: default_node(source, location), then_keyword_loc: nil, statements: nil, else_clause: nil, end_keyword_loc: nil) ⇒ Object
Create a new UnlessNode node.
805 806 807 |
# File 'lib/prism/dsl.rb', line 805 def unless_node(source: default_source, node_id: 0, location: default_location, flags: 0, keyword_loc: location, predicate: default_node(source, location), then_keyword_loc: nil, statements: nil, else_clause: nil, end_keyword_loc: nil) UnlessNode.new(source, node_id, location, flags, keyword_loc, predicate, then_keyword_loc, statements, else_clause, end_keyword_loc) end |
#until_node(source: default_source, node_id: 0, location: default_location, flags: 0, keyword_loc: location, do_keyword_loc: nil, closing_loc: nil, predicate: default_node(source, location), statements: nil) ⇒ Object
Create a new UntilNode node.
810 811 812 |
# File 'lib/prism/dsl.rb', line 810 def until_node(source: default_source, node_id: 0, location: default_location, flags: 0, keyword_loc: location, do_keyword_loc: nil, closing_loc: nil, predicate: default_node(source, location), statements: nil) UntilNode.new(source, node_id, location, flags, keyword_loc, do_keyword_loc, closing_loc, predicate, statements) end |
#when_node(source: default_source, node_id: 0, location: default_location, flags: 0, keyword_loc: location, conditions: [], then_keyword_loc: nil, statements: nil) ⇒ Object
Create a new WhenNode node.
815 816 817 |
# File 'lib/prism/dsl.rb', line 815 def when_node(source: default_source, node_id: 0, location: default_location, flags: 0, keyword_loc: location, conditions: [], then_keyword_loc: nil, statements: nil) WhenNode.new(source, node_id, location, flags, keyword_loc, conditions, then_keyword_loc, statements) end |
#while_node(source: default_source, node_id: 0, location: default_location, flags: 0, keyword_loc: location, do_keyword_loc: nil, closing_loc: nil, predicate: default_node(source, location), statements: nil) ⇒ Object
Create a new WhileNode node.
820 821 822 |
# File 'lib/prism/dsl.rb', line 820 def while_node(source: default_source, node_id: 0, location: default_location, flags: 0, keyword_loc: location, do_keyword_loc: nil, closing_loc: nil, predicate: default_node(source, location), statements: nil) WhileNode.new(source, node_id, location, flags, keyword_loc, do_keyword_loc, closing_loc, predicate, statements) end |
#x_string_node(source: default_source, node_id: 0, location: default_location, flags: 0, opening_loc: location, content_loc: location, closing_loc: location, unescaped: "") ⇒ Object
Create a new XStringNode node.
825 826 827 |
# File 'lib/prism/dsl.rb', line 825 def x_string_node(source: default_source, node_id: 0, location: default_location, flags: 0, opening_loc: location, content_loc: location, closing_loc: location, unescaped: "") XStringNode.new(source, node_id, location, flags, opening_loc, content_loc, closing_loc, unescaped) end |
#yield_node(source: default_source, node_id: 0, location: default_location, flags: 0, keyword_loc: location, lparen_loc: nil, arguments: nil, rparen_loc: nil) ⇒ Object
Create a new YieldNode node.
830 831 832 |
# File 'lib/prism/dsl.rb', line 830 def yield_node(source: default_source, node_id: 0, location: default_location, flags: 0, keyword_loc: location, lparen_loc: nil, arguments: nil, rparen_loc: nil) YieldNode.new(source, node_id, location, flags, keyword_loc, lparen_loc, arguments, rparen_loc) end |