Module

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(
  [
    Prism::IntegerNode.new(
      Prism::IntegerBaseFlags::DECIMAL,
      1,
      Prism::Location.new(source, 1, 1),
      source
    )
  ],
  Prism::Location.new(source, 0, 1),
  Prism::Location.new(source, 2, 1),
  source
)

you could instead write:

source = Prism::Source.for("[1]")

ArrayNode(
  IntegerNode(Prism::IntegerBaseFlags::DECIMAL, 1, Location(source, 1, 1)), source),
  Location(source, 0, 1),
  Location(source, 2, 1),
  source
)

This is mostly helpful in the context of writing tests, but can also be used to generate trees programmatically.

Instance Methods

Create a new AliasGlobalVariableNode node

Create a new AliasMethodNode node

Create a new AlternationPatternNode node

Create a new AndNode node

Create a new ArgumentsNode node

Create a new ArrayNode node

Create a new ArrayPatternNode node

Create a new AssocNode node

Create a new AssocSplatNode node

Create a new BackReferenceReadNode node

Create a new BeginNode node

Create a new BlockArgumentNode node

Create a new BlockLocalVariableNode node

Create a new BlockNode node

Create a new BlockParameterNode node

Create a new BlockParametersNode node

Create a new BreakNode node

Create a new CallAndWriteNode node

Create a new CallNode node

Create a new CallOperatorWriteNode node

Create a new CallOrWriteNode node

Create a new CallTargetNode node

Create a new CapturePatternNode node

Create a new CaseMatchNode node

Create a new CaseNode node

Create a new ClassNode node

Create a new ClassVariableAndWriteNode node

Create a new ClassVariableOperatorWriteNode node

Create a new ClassVariableOrWriteNode node

Create a new ClassVariableReadNode node

Create a new ClassVariableTargetNode node

Create a new ClassVariableWriteNode node

Create a new ConstantAndWriteNode node

Create a new ConstantOperatorWriteNode node

Create a new ConstantOrWriteNode node

Create a new ConstantPathAndWriteNode node

Create a new ConstantPathNode node

Create a new ConstantPathOperatorWriteNode node

Create a new ConstantPathOrWriteNode node

Create a new ConstantPathTargetNode node

Create a new ConstantPathWriteNode node

Create a new ConstantReadNode node

Create a new ConstantTargetNode node

Create a new ConstantWriteNode node

Create a new DefNode node

Create a new DefinedNode node

Create a new ElseNode node

Create a new EmbeddedStatementsNode node

Create a new EmbeddedVariableNode node

Create a new EnsureNode node

Create a new FalseNode node

Create a new FindPatternNode node

Create a new FlipFlopNode node

Create a new FloatNode node

Create a new ForNode node

Create a new ForwardingArgumentsNode node

Create a new ForwardingParameterNode node

Create a new ForwardingSuperNode node

Create a new GlobalVariableAndWriteNode node

Create a new GlobalVariableOrWriteNode node

Create a new GlobalVariableReadNode node

Create a new GlobalVariableTargetNode node

Create a new GlobalVariableWriteNode node

Create a new HashNode node

Create a new HashPatternNode node

Create a new IfNode node

Create a new ImaginaryNode node

Create a new ImplicitNode node

Create a new ImplicitRestNode node

Create a new InNode node

Create a new IndexAndWriteNode node

Create a new IndexOperatorWriteNode node

Create a new IndexOrWriteNode node

Create a new IndexTargetNode node

Create a new InstanceVariableAndWriteNode node

Create a new InstanceVariableOrWriteNode node

Create a new InstanceVariableReadNode node

Create a new InstanceVariableTargetNode node

Create a new InstanceVariableWriteNode node

Create a new IntegerNode node

Create a new InterpolatedMatchLastLineNode node

Create a new InterpolatedStringNode node

Create a new InterpolatedSymbolNode node

Create a new InterpolatedXStringNode node

Create a new ItParametersNode node

Create a new KeywordHashNode node

Create a new KeywordRestParameterNode node

Create a new LambdaNode node

Create a new LocalVariableAndWriteNode node

Create a new LocalVariableOperatorWriteNode node

Create a new LocalVariableOrWriteNode node

Create a new LocalVariableReadNode node

Create a new LocalVariableTargetNode node

Create a new LocalVariableWriteNode node

Create a new Location object

Create a new MatchLastLineNode node

Create a new MatchPredicateNode node

Create a new MatchRequiredNode node

Create a new MatchWriteNode node

Create a new MissingNode node

Create a new ModuleNode node

Create a new MultiTargetNode node

Create a new MultiWriteNode node

Create a new NextNode node

Create a new NilNode node

Create a new NoKeywordsParameterNode node

Create a new NumberedParametersNode node

Create a new NumberedReferenceReadNode node

Create a new OptionalKeywordParameterNode node

Create a new OptionalParameterNode node

Create a new OrNode node

Create a new ParametersNode node

Create a new ParenthesesNode node

Create a new PinnedExpressionNode node

Create a new PinnedVariableNode node

Create a new PostExecutionNode node

Create a new PreExecutionNode node

Create a new ProgramNode node

Create a new RangeNode node

Create a new RationalNode node

Create a new RedoNode node

Create a new RegularExpressionNode node

Create a new RequiredKeywordParameterNode node

Create a new RequiredParameterNode node

Create a new RescueModifierNode node

Create a new RescueNode node

Create a new RestParameterNode node

Create a new RetryNode node

Create a new ReturnNode node

Create a new SelfNode node

Create a new ShareableConstantNode node

Create a new SingletonClassNode node

Create a new SourceEncodingNode node

Create a new SourceFileNode node

Create a new SourceLineNode node

Create a new SplatNode node

Create a new StatementsNode node

Create a new StringNode node

Create a new SuperNode node

Create a new SymbolNode node

Create a new TrueNode node

Create a new UndefNode node

Create a new UnlessNode node

Create a new UntilNode node

Create a new WhenNode node

Create a new WhileNode node

Create a new XStringNode node

Create a new YieldNode node