Compare commits
1 Commits
2025-predr
...
comment-le
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b325647ad9 |
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 +1,2 @@
|
|||||||
// line1 --
|
//1234567890
|
||||||
line2 -----x
|
//12345678901
|
||||||
line3
|
|
||||||
|
|
||||||
fun main() = 0
|
|
||||||
@@ -246,14 +246,14 @@ public class LexAn implements AutoCloseable {
|
|||||||
buffToken = new Token(start, Token.Symbol.DIV, "/");
|
buffToken = new Token(start, Token.Symbol.DIV, "/");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
nextChar();
|
||||||
|
|
||||||
StringBuilder builder = new StringBuilder();
|
int length = 0;
|
||||||
|
while (buffChar != '\n' && buffChar != -1) {
|
||||||
while (buffChar != -1) {
|
length++;
|
||||||
if (buffChar == '\n' && !builder.toString().endsWith("--")) {
|
if (length > 10) {
|
||||||
break;
|
throw new Report.Error(currentLocation(), "Comments can only be 10 characters long");
|
||||||
}
|
}
|
||||||
builder.append((char) buffChar);
|
|
||||||
nextChar();
|
nextChar();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user