From 8c289f05ca36c3def6a4e4ab2414b7469c03339e Mon Sep 17 00:00:00 2001 From: "Benjamin J. Culkin" Date: Sun, 21 Jul 2019 16:24:47 -0300 Subject: Refactor front-end error-handling This refactors the front-end to use a tree for capturing errors, instead of throwing exceptions. This has the benefit that you will receive notifications about all of the error messages you have, instead of only the first. I'm a bit fuzzy on the details, since it's been a while since I wrote these changes. --- .../parser/templates/LiteralTemplateElement.java | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'src/main/java/bjc/rgens/parser/templates/LiteralTemplateElement.java') diff --git a/src/main/java/bjc/rgens/parser/templates/LiteralTemplateElement.java b/src/main/java/bjc/rgens/parser/templates/LiteralTemplateElement.java index ca4b32f..2f0a571 100644 --- a/src/main/java/bjc/rgens/parser/templates/LiteralTemplateElement.java +++ b/src/main/java/bjc/rgens/parser/templates/LiteralTemplateElement.java @@ -1,16 +1,33 @@ package bjc.rgens.parser.templates; +import bjc.utils.data.ITree; + import bjc.rgens.parser.GenerationState; +/** + * Represents a literal text element. + * + * @author Ben Culkin + */ public class LiteralTemplateElement extends TemplateElement { + /** + * The literal value of the element. + */ public final String val; - public LiteralTemplateElement(String val) { + /** + * Create a new literal template element. + * + * @param val + * The string to insert. + */ + public LiteralTemplateElement(String val, ITree errs) { super(true); this.val = val; } + @Override public void generate(GenerationState state) { state.appendContents(val); } -- cgit v1.2.3