diff options
| author | bculkin2442 <bjculkin@mix.wvu.edu> | 2017-04-06 05:46:27 -0400 |
|---|---|---|
| committer | bculkin2442 <bjculkin@mix.wvu.edu> | 2017-04-06 05:46:27 -0400 |
| commit | ee8ab3464bdfe423c8b09b3f9a403899127f1078 (patch) | |
| tree | bf80416aa42ae6799f0c1f490e18210e86fae0e1 /JPratt | |
| parent | 0b79409b36e0d14ce9c772a728c534dfb9c6f3be (diff) | |
Add unicode superscripts
Diffstat (limited to 'JPratt')
| -rw-r--r-- | JPratt/.gitignore | 1 | ||||
| -rw-r--r-- | JPratt/input.txt | 1 | ||||
| -rw-r--r-- | JPratt/src/examples/java/bjc/pratt/examples/PrattParserTest.java | 9 |
3 files changed, 9 insertions, 2 deletions
diff --git a/JPratt/.gitignore b/JPratt/.gitignore index 09e3bc9..3f4e69e 100644 --- a/JPratt/.gitignore +++ b/JPratt/.gitignore @@ -1,2 +1,3 @@ /bin/ /target/ +HTML/ diff --git a/JPratt/input.txt b/JPratt/input.txt new file mode 100644 index 0000000..f51ea5e --- /dev/null +++ b/JPratt/input.txt @@ -0,0 +1 @@ +x := -b ± (sqrt b^2 - 4*a*c) / 2*a diff --git a/JPratt/src/examples/java/bjc/pratt/examples/PrattParserTest.java b/JPratt/src/examples/java/bjc/pratt/examples/PrattParserTest.java index afb3e40..7e94326 100644 --- a/JPratt/src/examples/java/bjc/pratt/examples/PrattParserTest.java +++ b/JPratt/src/examples/java/bjc/pratt/examples/PrattParserTest.java @@ -46,7 +46,9 @@ public class PrattParserTest { */ Set<String> ops = new LinkedHashSet<>(); - ops.addAll(Arrays.asList("->")); + ops.add("!!!"); + + ops.addAll(Arrays.asList("->", "=>")); ops.add(":="); ops.addAll(Arrays.asList("||", "&&")); ops.addAll(Arrays.asList("<=", ">=")); @@ -73,7 +75,7 @@ public class PrattParserTest { TwoLevelSplitter split = new TwoLevelSplitter(); - split.addCompoundDelim("->"); + split.addCompoundDelim("->", "=>"); split.addCompoundDelim(":="); split.addCompoundDelim("||", "&&"); split.addCompoundDelim("<=", ">="); @@ -84,6 +86,7 @@ public class PrattParserTest { split.addSimpleDelim("+", "-", "*", "/"); split.addSimpleDelim("^", "!"); + split.addSimpleMulti("!"); split.addSimpleMulti("\\(", "\\)"); split.addSimpleMulti("\\[", "\\]"); split.addSimpleMulti("\\{", "\\}"); @@ -186,6 +189,8 @@ public class PrattParserTest { PrattParser<String, String, TestContext> parser = new PrattParser<>(); + parser.addNonInitialCommand("!!!", postfix(0)); + parser.addNonInitialCommand(":", infixNon(3)); parser.addNonInitialCommand("if", ternary(5, 0, "else", litToken("cond"), false)); |
