Compare commits
1 Commits
times-init
...
comment-le
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b325647ad9 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -3,4 +3,3 @@ out/
|
||||
*.zip
|
||||
prg/**/*.ast
|
||||
prg/**/*.out
|
||||
prg/**/*.pins25
|
||||
2
prg/test.pins25
Normal file
2
prg/test.pins25
Normal file
@@ -0,0 +1,2 @@
|
||||
//1234567890
|
||||
//12345678901
|
||||
@@ -69,10 +69,6 @@ public record Token(Report.Location location, Symbol symbol, String lexeme) impl
|
||||
* Kljucna beseda {@code in}.
|
||||
*/
|
||||
IN,
|
||||
/**
|
||||
* Kljucna beseda {@code times}.
|
||||
*/
|
||||
TIMES,
|
||||
/**
|
||||
* Kljucna beseda {@code end}.
|
||||
*/
|
||||
|
||||
@@ -246,8 +246,14 @@ public class LexAn implements AutoCloseable {
|
||||
buffToken = new Token(start, Token.Symbol.DIV, "/");
|
||||
return;
|
||||
}
|
||||
nextChar();
|
||||
|
||||
int length = 0;
|
||||
while (buffChar != '\n' && buffChar != -1) {
|
||||
length++;
|
||||
if (length > 10) {
|
||||
throw new Report.Error(currentLocation(), "Comments can only be 10 characters long");
|
||||
}
|
||||
nextChar();
|
||||
}
|
||||
|
||||
@@ -319,7 +325,6 @@ public class LexAn implements AutoCloseable {
|
||||
case "let" -> Token.Symbol.LET;
|
||||
case "in" -> Token.Symbol.IN;
|
||||
case "end" -> Token.Symbol.END;
|
||||
case "times" -> Token.Symbol.TIMES;
|
||||
default -> null;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -360,9 +360,9 @@ public class SynAn implements AutoCloseable {
|
||||
|
||||
private AST.AtomExpr parseIntegerConstantMultiplier() {
|
||||
Token token = lexAn.peekToken();
|
||||
if (token.symbol() == Token.Symbol.TIMES) {
|
||||
// intconstmult -> TIMES const
|
||||
check(Token.Symbol.TIMES);
|
||||
if (token.symbol() == Token.Symbol.MUL) {
|
||||
// intconstmult -> MUL const
|
||||
check(Token.Symbol.MUL);
|
||||
return parseConstant();
|
||||
}
|
||||
// intconstmult -> ε
|
||||
|
||||
Reference in New Issue
Block a user