Fixes
This commit is contained in:
parent
56facf7372
commit
5ed3016bfd
1
.idea/misc.xml
generated
1
.idea/misc.xml
generated
@ -1,4 +1,3 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_23" default="true" project-jdk-name="homebrew-23" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
|
@ -1,2 +1,16 @@
|
||||
var test = "1234" // hello world
|
||||
var something = 33
|
||||
1234567890
|
||||
= , && || ! == != > < >= <= + - * / % ^ ( )
|
||||
=,&&||!==!=><>=<=+-*/%^()
|
||||
_a_0_ A0312 asd312 a_132asdnmznkjNAJDKNSJKDF
|
||||
fun var if then else while do let in end
|
||||
_fun_ _var_ _if_ _then_ _else_ _while_ _do_ _let_ _in_ _end_
|
||||
infun invar inif inthen inelse inwhile indo inlet inin inend
|
||||
funin varin ifin thenin elsein whilein doin letin endin
|
||||
// == * 1248129 d8as90d8as9d asdkal //
|
||||
1234567890='a' // 1+2
|
||||
-1/asd*'x'+""
|
||||
'a' '\'' '\\' '\0a' "\\ 1231 \n \ff _-ads"
|
||||
"BESEDNJAKKKK" "0\" 0123" 0=XYZ 123+3+2+1(SSS) 4_bese
|
||||
|
||||
|
||||
dica beseder_3456
|
@ -240,13 +240,14 @@ public class LexAn implements AutoCloseable {
|
||||
return;
|
||||
|
||||
case '/':
|
||||
start = currentLocation();
|
||||
nextChar();
|
||||
if (buffChar != '/') {
|
||||
buffToken = new Token(currentLocation(), Token.Symbol.DIV, null);
|
||||
buffToken = new Token(start, Token.Symbol.DIV, null);
|
||||
return;
|
||||
}
|
||||
|
||||
while (buffChar != '\n') {
|
||||
while (buffChar != '\n' && buffChar != -1) {
|
||||
nextChar();
|
||||
}
|
||||
|
||||
@ -399,10 +400,24 @@ public class LexAn implements AutoCloseable {
|
||||
nextChar();
|
||||
|
||||
while (buffChar != '"') {
|
||||
if (buffChar == -1) {
|
||||
if (buffChar == '\n' || buffChar == -1) {
|
||||
throw new Report.Error(currentLocation(), "Unterminated string.");
|
||||
}
|
||||
if (!isChar()) {
|
||||
|
||||
if (buffChar == '\\') {
|
||||
lexeme.append((char) buffChar);
|
||||
nextChar();
|
||||
if (buffChar == 'n' || buffChar == '\\' || buffChar == '"') {
|
||||
} else if (isHex()) {
|
||||
nextChar();
|
||||
lexeme.append((char) buffChar);
|
||||
if (!isHex()) {
|
||||
throw new Report.Error(currentLocation(), "Invalid ascii code '" + (char) buffChar + "'.");
|
||||
}
|
||||
} else {
|
||||
throw new Report.Error(currentLocation(), "Invalid escaped character '" + (char) buffChar + "'.");
|
||||
}
|
||||
} else if (!isChar()) {
|
||||
throw new Report.Error(currentLocation(), "Invalid character '" + (char) buffChar + "'.");
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user