diff options
| author | bculkin2442 <bjculkin@mix.wvu.edu> | 2017-03-10 10:07:09 -0500 |
|---|---|---|
| committer | bculkin2442 <bjculkin@mix.wvu.edu> | 2017-03-10 10:07:09 -0500 |
| commit | 1bbfc754a6c6cecca5d58f080f3b9f4278e1ef89 (patch) | |
| tree | c78c6cae493d0afc1ffbb259f31493431b9eda57 /dice-lang/src/bjc/dicelang/Tokenizer.java | |
| parent | 8bbe036d2b3cb6b8f65d9b417285665eaf23c202 (diff) | |
Cleanliness
Diffstat (limited to 'dice-lang/src/bjc/dicelang/Tokenizer.java')
| -rw-r--r-- | dice-lang/src/bjc/dicelang/Tokenizer.java | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/dice-lang/src/bjc/dicelang/Tokenizer.java b/dice-lang/src/bjc/dicelang/Tokenizer.java index f13023c..6bb4f86 100644 --- a/dice-lang/src/bjc/dicelang/Tokenizer.java +++ b/dice-lang/src/bjc/dicelang/Tokenizer.java @@ -1,16 +1,18 @@ package bjc.dicelang;
-import static bjc.dicelang.Errors.ErrorKey.*;
-import static bjc.dicelang.Token.Type.*;
-
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
import bjc.dicelang.dice.DiceBox;
+
import bjc.utils.funcdata.FunctionalMap;
import bjc.utils.funcdata.IMap;
import bjc.utils.funcutils.StringUtils;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import static bjc.dicelang.Errors.ErrorKey.*;
+import static bjc.dicelang.Token.Type.*;
+
+
public class Tokenizer {
// Literal tokens for tokenization
private IMap<String, Token.Type> litTokens;
@@ -105,7 +107,7 @@ public class Tokenizer { private Token tokenizeLiteral(String token, IMap<String, String> stringLts) {
Token tk = Token.NIL_TOKEN;
- if(intMatcher.matcher(token).matches()) {
+ if(StringUtils.isInt(token)) {
tk = new Token(INT_LIT, Long.parseLong(token));
} else if(hexadecimalMatcher.matcher(token).matches()) {
String newToken = token.substring(0, 1) + token.substring(token.indexOf('x'));
@@ -127,7 +129,7 @@ public class Tokenizer { Errors.inst.printError(EK_TOK_INVFLEX, flexNum, Integer.toString(parseBase));
return Token.NIL_TOKEN;
}
- } else if(DoubleMatcher.floatingLiteral.matcher(token).matches()) {
+ } else if(StringUtils.isDouble(token)) {
tk = new Token(FLOAT_LIT, Double.parseDouble(token));
} else if(DiceBox.isValidExpression(token)) {
tk = new Token(DICE_LIT, DiceBox.parseExpression(token));
|
