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