Compare commits
1 Commits
2025-predr
...
multiline-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
30fbde8c31 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -3,3 +3,4 @@ out/
|
|||||||
*.zip
|
*.zip
|
||||||
prg/**/*.ast
|
prg/**/*.ast
|
||||||
prg/**/*.out
|
prg/**/*.out
|
||||||
|
prg/**/*.pins25
|
||||||
24
grammar.txt
24
grammar.txt
@@ -70,27 +70,3 @@ initializer -> INTCONST intconstmult | CHARCONST | STRINGCONST .
|
|||||||
intconstmult -> MUL const | .
|
intconstmult -> MUL const | .
|
||||||
|
|
||||||
const -> INTCONST | CHARCONST | STRINGCONST .
|
const -> INTCONST | CHARCONST | STRINGCONST .
|
||||||
|
|
||||||
|
|
||||||
--------------------------------------------------------------------
|
|
||||||
|
|
||||||
//LEFT ASOC.
|
|
||||||
exp0 = exp0 op other | other
|
|
||||||
|
|
||||||
|
|
|
||||||
v
|
|
||||||
|
|
||||||
exp0 = other exp0'
|
|
||||||
exp0' = op other exp0' | .
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//RIGHT ASOC.
|
|
||||||
exp0 = other op exp0 | other
|
|
||||||
|
|
||||||
|
|
|
||||||
v
|
|
||||||
|
|
||||||
exp0 = other exp0'
|
|
||||||
exp0' = op exp0 | .
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
// line1 --
|
|
||||||
line2 -----x
|
|
||||||
line3
|
|
||||||
|
|
||||||
fun main() = 0
|
|
||||||
@@ -247,14 +247,37 @@ public class LexAn implements AutoCloseable {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
StringBuilder builder = new StringBuilder();
|
|
||||||
|
|
||||||
while (buffChar != -1) {
|
|
||||||
if (buffChar == '\n' && !builder.toString().endsWith("--")) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
builder.append((char) buffChar);
|
|
||||||
nextChar();
|
nextChar();
|
||||||
|
if (buffChar == '{') {
|
||||||
|
int depth = 1;
|
||||||
|
|
||||||
|
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();
|
||||||
|
|||||||
Reference in New Issue
Block a user