Fixes
This commit is contained in:
parent
b8545a143b
commit
ffcb50c707
@ -1 +1,2 @@
|
||||
var
|
||||
fun a() =
|
||||
1 +
|
@ -1,7 +1,5 @@
|
||||
package pins25.common;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
* Leksikalni simbol.
|
||||
*
|
||||
@ -152,7 +150,8 @@ public record Token(Report.Location location, Symbol symbol, String lexeme) impl
|
||||
*/
|
||||
RPAREN;
|
||||
|
||||
public String prettyPrint() {
|
||||
@Override
|
||||
public String toString() {
|
||||
return switch (this) {
|
||||
case INTCONST -> "integer constant";
|
||||
case CHARCONST -> "character constant";
|
||||
@ -192,7 +191,6 @@ public record Token(Report.Location location, Symbol symbol, String lexeme) impl
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
String lexeme = switch (symbol) {
|
||||
|
@ -130,7 +130,7 @@ public class LexAn implements AutoCloseable {
|
||||
Report.Location start = currentLocation();
|
||||
switch (buffChar) {
|
||||
case -1: // EOF
|
||||
buffToken = new Token(start, Token.Symbol.EOF, null);
|
||||
buffToken = new Token(start, Token.Symbol.EOF, "EOF");
|
||||
return;
|
||||
|
||||
case '\'':
|
||||
|
@ -38,7 +38,7 @@ public class SynAn implements AutoCloseable {
|
||||
private Token check(Token.Symbol symbol) {
|
||||
final Token token = lexAn.takeToken();
|
||||
if (token.symbol() != symbol)
|
||||
throw new Report.Error(token, "Unexpected symbol '" + token.lexeme() + "', expected " + symbol.prettyPrint() + ".");
|
||||
throw new Report.Error(token, "Unexpected symbol '" + token.lexeme() + "', expected " + symbol + ".");
|
||||
return token;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user