From 1bbfc754a6c6cecca5d58f080f3b9f4278e1ef89 Mon Sep 17 00:00:00 2001 From: bculkin2442 Date: Fri, 10 Mar 2017 10:07:09 -0500 Subject: Cleanliness --- dice-lang/src/bjc/dicelang/Tokenizer.java | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'dice-lang/src/bjc/dicelang/Tokenizer.java') 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 litTokens; @@ -105,7 +107,7 @@ public class Tokenizer { private Token tokenizeLiteral(String token, IMap 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)); -- cgit v1.2.3