Compare commits
1 Commits
multiline-
...
times-init
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d64e597414 |
@@ -69,6 +69,10 @@ public record Token(Report.Location location, Symbol symbol, String lexeme) impl
|
|||||||
* Kljucna beseda {@code in}.
|
* Kljucna beseda {@code in}.
|
||||||
*/
|
*/
|
||||||
IN,
|
IN,
|
||||||
|
/**
|
||||||
|
* Kljucna beseda {@code times}.
|
||||||
|
*/
|
||||||
|
TIMES,
|
||||||
/**
|
/**
|
||||||
* Kljucna beseda {@code end}.
|
* Kljucna beseda {@code end}.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -247,37 +247,8 @@ public class LexAn implements AutoCloseable {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
nextChar();
|
while (buffChar != '\n' && buffChar != -1) {
|
||||||
if (buffChar == '{') {
|
|
||||||
int depth = 1;
|
|
||||||
|
|
||||||
nextChar();
|
nextChar();
|
||||||
while (depth > 0) {
|
|
||||||
switch (buffChar) {
|
|
||||||
case '}':
|
|
||||||
nextChar();
|
|
||||||
if (buffChar != '/') continue;
|
|
||||||
nextChar();
|
|
||||||
if (buffChar != '/') continue;
|
|
||||||
depth--;
|
|
||||||
break;
|
|
||||||
case '/':
|
|
||||||
nextChar();
|
|
||||||
if (buffChar != '/') continue;
|
|
||||||
nextChar();
|
|
||||||
if (buffChar != '{') continue;
|
|
||||||
depth++;
|
|
||||||
break;
|
|
||||||
case -1:
|
|
||||||
throw new Report.Error(currentLocation(), "Unterminated multiline comment");
|
|
||||||
default:
|
|
||||||
nextChar();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
while (buffChar != '\n' && buffChar != -1) {
|
|
||||||
nextChar();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nextToken();
|
nextToken();
|
||||||
@@ -348,6 +319,7 @@ public class LexAn implements AutoCloseable {
|
|||||||
case "let" -> Token.Symbol.LET;
|
case "let" -> Token.Symbol.LET;
|
||||||
case "in" -> Token.Symbol.IN;
|
case "in" -> Token.Symbol.IN;
|
||||||
case "end" -> Token.Symbol.END;
|
case "end" -> Token.Symbol.END;
|
||||||
|
case "times" -> Token.Symbol.TIMES;
|
||||||
default -> null;
|
default -> null;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -360,9 +360,9 @@ public class SynAn implements AutoCloseable {
|
|||||||
|
|
||||||
private AST.AtomExpr parseIntegerConstantMultiplier() {
|
private AST.AtomExpr parseIntegerConstantMultiplier() {
|
||||||
Token token = lexAn.peekToken();
|
Token token = lexAn.peekToken();
|
||||||
if (token.symbol() == Token.Symbol.MUL) {
|
if (token.symbol() == Token.Symbol.TIMES) {
|
||||||
// intconstmult -> MUL const
|
// intconstmult -> TIMES const
|
||||||
check(Token.Symbol.MUL);
|
check(Token.Symbol.TIMES);
|
||||||
return parseConstant();
|
return parseConstant();
|
||||||
}
|
}
|
||||||
// intconstmult -> ε
|
// intconstmult -> ε
|
||||||
|
|||||||
Reference in New Issue
Block a user