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