Compare commits
1 Commits
master
...
line-symbo
Author | SHA1 | Date | |
---|---|---|---|
|
de2522c28c |
1
.gitignore
vendored
1
.gitignore
vendored
@ -3,4 +3,3 @@ out/
|
||||
*.zip
|
||||
prg/**/*.ast
|
||||
prg/**/*.out
|
||||
prg/**/*.pins25
|
4
prg/test.pins25
Normal file
4
prg/test.pins25
Normal file
@ -0,0 +1,4 @@
|
||||
fun putint(n)
|
||||
|
||||
fun main() =
|
||||
putint(__LINE__)
|
@ -148,7 +148,11 @@ public record Token(Report.Location location, Symbol symbol, String lexeme) impl
|
||||
/**
|
||||
* Simbol {@code )}.
|
||||
*/
|
||||
RPAREN;
|
||||
RPAREN,
|
||||
/**
|
||||
* Simbol {@code __LINE__}.
|
||||
*/
|
||||
LINE
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -319,6 +319,7 @@ public class LexAn implements AutoCloseable {
|
||||
case "let" -> Token.Symbol.LET;
|
||||
case "in" -> Token.Symbol.IN;
|
||||
case "end" -> Token.Symbol.END;
|
||||
case "__LINE__" -> Token.Symbol.LINE;
|
||||
default -> null;
|
||||
};
|
||||
}
|
||||
@ -451,6 +452,15 @@ public class LexAn implements AutoCloseable {
|
||||
symbol = Token.Symbol.IDENTIFIER;
|
||||
}
|
||||
|
||||
if (symbol == Token.Symbol.LINE) {
|
||||
buffToken = new Token(
|
||||
new Report.Location(startLocation, endLocation),
|
||||
Token.Symbol.INTCONST,
|
||||
Integer.toString(startLocation.begLine())
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
buffToken = new Token(
|
||||
new Report.Location(startLocation, endLocation),
|
||||
symbol,
|
||||
|
Loading…
x
Reference in New Issue
Block a user