summaryrefslogtreecommitdiff
path: root/dice-lang/src/bjc/dicelang/v2/Token.java
diff options
context:
space:
mode:
authorbculkin2442 <bjculkin@mix.wvu.edu>2017-02-24 04:15:20 -0500
committerbculkin2442 <bjculkin@mix.wvu.edu>2017-02-24 04:15:20 -0500
commit5e246adccf986af9dd032d6e8645ddd5d2a577d4 (patch)
tree96cc49b43b32f1b38e4d848419d2b23a4c74b217 /dice-lang/src/bjc/dicelang/v2/Token.java
parenta942114b89013732a2be3092cdb65cafc4566fe0 (diff)
Work on unary operators
Specifically, the coercive operator for allowing mixing floats and ints
Diffstat (limited to 'dice-lang/src/bjc/dicelang/v2/Token.java')
-rw-r--r--dice-lang/src/bjc/dicelang/v2/Token.java37
1 files changed, 24 insertions, 13 deletions
diff --git a/dice-lang/src/bjc/dicelang/v2/Token.java b/dice-lang/src/bjc/dicelang/v2/Token.java
index e6f22a5..ed5ee8b 100644
--- a/dice-lang/src/bjc/dicelang/v2/Token.java
+++ b/dice-lang/src/bjc/dicelang/v2/Token.java
@@ -20,24 +20,41 @@ public class Token {
INT_LIT, FLOAT_LIT, STRING_LIT,
VREF,
DICE_LIT, DICEGROUP, DICECONCAT, DICELIST,
- LET, BIND,
+ LET, BIND, COERCE,
OPAREN, CPAREN,
OBRACKET, CBRACKET,
OBRACE, CBRACE,
+
// Synthetic tokens
// These are produced when needed
- NIL, PRESHUNT, GROUPSEP,
- TOKGROUP
+ NIL, GROUPSEP, TOKGROUP,
+ TAGOP, TAGOPR,
+
+ // Tag tokens
+ // These are used for the TAG* tokens
+
}
- public final Type type;
+ public final Type type;
- // At most one of these is valid
- // based on the token type
+ // This is used for the following token types
+ // INT_LIT (int value)
+ // STRING_LIT (index into string table)
+ // VREF (index into sym table)
+ // O* and C* (sym-count of current token)
public long intValue;
+
+ // This is used for the following token types
+ // FLOAT_LIT (float value)
public double floatValue;
- public String stringValue;
+
+ // This is used for the following token types
+ // DICE_LIT (dice value)
public DiceBox.DieExpression diceValue;
+
+ // This is used for the following token types
+ // TOKGROUP (the tokens in the group)
+ // TAG* (the tagged construct)
public IList<Token> tokenValues;
public Token(Type typ) {
@@ -56,12 +73,6 @@ public class Token {
floatValue = val;
}
- public Token(Type typ, String val) {
- this(typ);
-
- stringValue = val;
- }
-
public Token(Type typ, DiceBox.DieExpression val) {
this(typ);