Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public byte getValue() {
*
* NOTE: positions should match PM_OPTIONS_COMMAND_LINE_* constants values
*/
public enum CommandLine { A, E, L, N, P, X };
public enum CommandLine { A, E, L, N, P, X }

/**
* The forwarding options for a given scope in the parser.
Expand All @@ -57,7 +57,7 @@ public enum Forwarding {
public byte getValue() {
return (byte) value;
}
};
}

/**
* Represents a scope in the parser.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ import java.lang.Short;
import java.math.BigInteger;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.Locale;

// GENERATED BY <%= File.basename(__FILE__) %>
// @formatter:off
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Arrays;

Expand Down Expand Up @@ -321,6 +320,7 @@ public abstract class Nodes {
}
<%- end -%>

@Override
public <T> void visitChildNodes(AbstractNodeVisitor<T> visitor) {
<%- node.semantic_fields.each do |field| -%>
<%- case field -%>
Expand All @@ -338,6 +338,7 @@ public abstract class Nodes {
<%- end -%>
}

@Override
public Node[] childNodes() {
<%- if node.semantic_fields.none?(Prism::Template::NodeListField) and node.semantic_fields.none?(Prism::Template::NodeKindField) -%>
return EMPTY_ARRAY;
Expand All @@ -359,6 +360,7 @@ public abstract class Nodes {
<%- end -%>
}

@Override
public <T> T accept(AbstractNodeVisitor<T> visitor) {
return visitor.visit<%= node.name -%>(this);
}
Expand All @@ -371,11 +373,13 @@ public abstract class Nodes {
builder.append("[Li]");
}
builder.append('\n');
<%- unless [*node.flags, *node.semantic_fields].empty? -%>
String nextIndent = indent + " ";
<%- end -%>
<%- if node.fields.any?(Prism::Template::NodeListField) or node.fields.any?(Prism::Template::ConstantListField) -%>
String nextNextIndent = nextIndent + " ";
<%- end -%>
<%- [*node.flags, *node.fields.grep_v(Prism::Template::LocationField).grep_v(Prism::Template::OptionalLocationField)].each do |field| -%>
<%- [*node.flags, *node.semantic_fields].each do |field| -%>
builder.append(nextIndent);
builder.append("<%= field.name %>: ");
<%- case field -%>
Expand Down