summaryrefslogtreecommitdiff
path: root/dice-lang/src/bjc/dicelang/CompilerTweaker.java
diff options
context:
space:
mode:
authorbjculkin <bjculkin@mix.wvu.edu>2017-04-11 17:51:13 -0400
committerbjculkin <bjculkin@mix.wvu.edu>2017-04-11 17:51:13 -0400
commit40858cee415643769ee5f6216b0cd4335996ff2f (patch)
tree86b1c334fa2e5b79cddc16984f5ad43c3c72e41f /dice-lang/src/bjc/dicelang/CompilerTweaker.java
parent767ca1b248da19b754d42a814b71b43ef16090be (diff)
General cleanup and fixes
Diffstat (limited to 'dice-lang/src/bjc/dicelang/CompilerTweaker.java')
-rw-r--r--dice-lang/src/bjc/dicelang/CompilerTweaker.java194
1 files changed, 100 insertions, 94 deletions
diff --git a/dice-lang/src/bjc/dicelang/CompilerTweaker.java b/dice-lang/src/bjc/dicelang/CompilerTweaker.java
index e04f054..f622518 100644
--- a/dice-lang/src/bjc/dicelang/CompilerTweaker.java
+++ b/dice-lang/src/bjc/dicelang/CompilerTweaker.java
@@ -1,94 +1,100 @@
-package bjc.dicelang;
-
-import bjc.utils.parserutils.splitter.SimpleTokenSplitter;
-
-/**
- * Contains methods for customizing the DiceLang and SCL compilers.
- *
- * @author Ben Culkin
- */
-public class CompilerTweaker {
- /*
- * Bits of the compiler necessary
- */
- private DiceLangEngine eng;
- private SimpleTokenSplitter opExpander;
-
- public CompilerTweaker(DiceLangEngine eng) {
- this.eng = eng;
-
- this.opExpander = eng.opExpander;
- }
-
- /**
- * Add a string literal to the compiler's internal banks.
- *
- * @param val
- * The string literal to add.
- *
- * @return The key into the string literal table for this string.
- */
- public int addStringLiteral(String val) {
- eng.addStringLiteral(eng.nextLiteral, val);
-
- eng.nextLiteral += 1;
- return eng.nextLiteral;
- }
-
- /**
- * Add a line defn to the compiler.
- *
- * @param dfn
- * The defn to add.
- */
- public void addLineDefine(Define dfn) {
- eng.addLineDefine(dfn);
- }
-
- /**
- * Add a token defn to the compiler.
- *
- * @param dfn
- * The defn to add.
- */
- public void addTokenDefine(Define dfn) {
- eng.addTokenDefine(dfn);
- }
-
- /**
- * Adds a delimiter that is expanded from tokens.
- *
- * @param delim
- * The delimiter to expand on.
- */
- public void addDelimiter(String delim) {
- opExpander.addDelimiter(delim);
- }
-
- /**
- * Adds a multi-character delimiter that is expanded from tokens.
- *
- * @param delim
- * The multi-character delimiter to expand on.
- */
- public void addMultiDelimiter(String delim) {
- opExpander.addMultiDelimiter(delim);
- }
-
- /**
- * Make delimiter changes visible to the compiler.
- */
- public void compile() {
- opExpander.compile();
- }
-
- /**
- * Change the max no. of times defines are allowed to recur.
- *
- * @param times
- * The number of times to allow defines to recur.
- */
- public static void setDefineRecurLimit(int times) {
- Define.MAX_RECURS = times;
- }
-}
+package bjc.dicelang;
+
+import bjc.utils.parserutils.splitter.ConfigurableTokenSplitter;
+
+/**
+ * Contains methods for customizing the DiceLang and SCL compilers.
+ *
+ * @author Ben Culkin
+ */
+public class CompilerTweaker {
+ /*
+ * Bits of the compiler necessary
+ */
+ private DiceLangEngine eng;
+ private ConfigurableTokenSplitter opExpander;
+
+ /**
+ * Create a new compiler tweaker.
+ *
+ * @param eng
+ * The engine to tweak.
+ */
+ public CompilerTweaker(DiceLangEngine eng) {
+ this.eng = eng;
+
+ this.opExpander = eng.opExpander;
+ }
+
+ /**
+ * Add a string literal to the compiler's internal banks.
+ *
+ * @param val
+ * The string literal to add.
+ *
+ * @return The key into the string literal table for this string.
+ */
+ public int addStringLiteral(String val) {
+ eng.addStringLiteral(eng.nextLiteral, val);
+
+ eng.nextLiteral += 1;
+ return eng.nextLiteral;
+ }
+
+ /**
+ * Add a line defn to the compiler.
+ *
+ * @param dfn
+ * The defn to add.
+ */
+ public void addLineDefine(Define dfn) {
+ eng.addLineDefine(dfn);
+ }
+
+ /**
+ * Add a token defn to the compiler.
+ *
+ * @param dfn
+ * The defn to add.
+ */
+ public void addTokenDefine(Define dfn) {
+ eng.addTokenDefine(dfn);
+ }
+
+ /**
+ * Adds delimiters that are expanded from tokens.
+ *
+ * @param delims
+ * The delimiters to expand on.
+ */
+ public void addDelimiter(String... delims) {
+ opExpander.addSimpleDelimiters(delims);
+ }
+
+ /**
+ * Adds multi-character delimiters that are expanded from tokens.
+ *
+ * @param delims
+ * The multi-character delimiters to expand on.
+ */
+ public void addMultiDelimiter(String... delims) {
+ opExpander.addMultiDelimiters(delims);
+ }
+
+ /**
+ * Make delimiter changes visible to the compiler.
+ */
+ public void compile() {
+ opExpander.compile();
+ }
+
+ /**
+ * Change the max no. of times defines are allowed to recur.
+ *
+ * @param times
+ * The number of times to allow defines to recur.
+ */
+ public static void setDefineRecurLimit(int times) {
+ Define.MAX_RECURS = times;
+ }
+}