Skip to content
Snippets Groups Projects

Dominicsbranch

Merged Dominic Daniel Krämer requested to merge dominicsbranch into main
1 file
+ 4
4
Compare changes
  • Side-by-side
  • Inline
+ 4
4
@@ -84,7 +84,7 @@ public class Parser {
//parses a list of tokens into a value
private Optional<Expression> parseValue(List<Lexer.Token> ts) throws ParserException {
if (ts.isEmpty()) {
throw new ParserException("SyntaxError: expected a number");
throw new ParserException("RuntimeException: empty token list");
}
if (ts.get(0).getType() != Lexer.TokenType.NUMBER) {
return Optional.empty();
@@ -114,13 +114,13 @@ public class Parser {
//parses a decimal of a list of tokens & a string
private Expression parseDecimal(List<Lexer.Token> ts, String data) throws ParserException {
if(ts.size()<1) {
throw new ParserException("SyntaxError: ");
throw new ParserException("RuntimeException: empty token list");
}
if(ts.get(0).getType() != Lexer.TokenType.SPECIAL) {
throw new ParserException("");
throw new ParserException("SyntaxException: expected a comma");
}
if(ts.get(1).getType() != Lexer.TokenType.NUMBER) {
throw new ParserException("");
throw new ParserException("SyntaxException: expected a number after a comma");
}
Number beforeDot = (Number) parseNumber(data);
ts.remove(0);
Loading