diff options
| author | Benjamin J. Culkin <bjculkin@mix.wvu.edu> | 2017-07-23 22:58:58 -0300 |
|---|---|---|
| committer | Benjamin J. Culkin <bjculkin@mix.wvu.edu> | 2017-07-23 22:58:58 -0300 |
| commit | c74cb8eaf454d9243b75e3770001d8d128356b28 (patch) | |
| tree | 899197afc0b7c382aa37c778053357e0e9b56c26 /dice-lang/src/bjc/dicelang/Shunter.java | |
| parent | 57f9a3bfdad20bead5b35ee540e8790e80a6b9a4 (diff) | |
Format
Diffstat (limited to 'dice-lang/src/bjc/dicelang/Shunter.java')
| -rw-r--r-- | dice-lang/src/bjc/dicelang/Shunter.java | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/dice-lang/src/bjc/dicelang/Shunter.java b/dice-lang/src/bjc/dicelang/Shunter.java index ffe730b..d9025c1 100644 --- a/dice-lang/src/bjc/dicelang/Shunter.java +++ b/dice-lang/src/bjc/dicelang/Shunter.java @@ -73,19 +73,19 @@ public class Shunter { /** * Precedence for math operators. */ - public final int MATH_PREC = 30; + public final int MATH_PREC = 30; /** * Precedence for dice operators. */ - public final int DICE_PREC = 20; + public final int DICE_PREC = 20; /** * Precedence for string operators. */ - public final int STR_PREC = 10; + public final int STR_PREC = 10; /** * Precedence for expression operators. */ - public final int EXPR_PREC = 0; + public final int EXPR_PREC = 0; /** * Create a new shunter. @@ -168,8 +168,9 @@ public class Shunter { return true; } - private boolean shuntToken(final Token tk, final Deque<Token> opStack, final Deque<Token> unaryStack, - final Deque<Token> currReturned, final Deque<Token> feed) { + private boolean shuntToken(final Token tk, final Deque<Token> opStack, + final Deque<Token> unaryStack, + final Deque<Token> currReturned, final Deque<Token> feed) { if (unaryStack.size() != 0) { if (isUnary(tk)) { unaryStack.add(tk); @@ -247,9 +248,11 @@ public class Shunter { case CPAREN: matching = new Token(OPAREN, tk.intValue); break; + case CBRACE: matching = new Token(OBRACE, tk.intValue); break; + default: Errors.inst.printError(EK_SHUNT_NOGROUP); return false; @@ -330,9 +333,13 @@ public class Shunter { final Token.Type ty = tk.type; if (ops.containsKey(ty)) return true; + if (unaryAdjectives.contains(ty)) return true; + if (unaryAdverbs.contains(ty)) return true; + if (unaryGerunds.contains(ty)) return true; + if (ty == TAGOPR) return true; return false; @@ -342,7 +349,9 @@ public class Shunter { final Token.Type ty = tk.type; if (unaryAdjectives.contains(ty)) return true; + if (unaryAdverbs.contains(ty)) return true; + if (unaryGerunds.contains(ty)) return true; return false; |
