From 05c9922b30cd0dcd2a452673c2e155215d074b19 Mon Sep 17 00:00:00 2001 From: "Benjamin J. Culkin" Date: Tue, 5 Jun 2018 22:09:23 -0300 Subject: Templates pt. 3 Templates should now work, though there is no syntax to reference them from rules yet In addition, several internal things have been changed so as to improve code quality --- .../rgens/parser/templates/TemplateElement.java | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 src/main/java/bjc/rgens/parser/templates/TemplateElement.java (limited to 'src/main/java/bjc/rgens/parser/templates/TemplateElement.java') diff --git a/src/main/java/bjc/rgens/parser/templates/TemplateElement.java b/src/main/java/bjc/rgens/parser/templates/TemplateElement.java new file mode 100644 index 0000000..dc123f3 --- /dev/null +++ b/src/main/java/bjc/rgens/parser/templates/TemplateElement.java @@ -0,0 +1,27 @@ +package bjc.rgens.parser.templates; + +import bjc.rgens.parser.GenerationState; + +public abstract class TemplateElement { + public static enum ElementType { + LITERAL(true), + TEMPLATE(true), + PRAGMA(false); + + public final boolean spacing; + + private ElementType(boolean spacing) { + this.spacing = spacing; + } + } + + public final ElementType type; + + public GrammarTemplate belongsTo; + + protected TemplateElement(ElementType type) { + this.type = type; + } + + public abstract void generate(GenerationState state); +} -- cgit v1.2.3