mirror of
https://github.com/apple/pkl.git
synced 2026-01-11 22:30:54 +01:00
remove stacking of block comments (#1022)
This commit is contained in:
@@ -575,11 +575,11 @@ public class Lexer {
|
||||
private void lexBlockComment() {
|
||||
if (lookahead == EOF) throw unexpectedEndOfFile();
|
||||
var prev = nextChar();
|
||||
// block comments in Pkl can stack
|
||||
var stack = 1;
|
||||
while (stack > 0 && lookahead != EOF) {
|
||||
if (prev == '*' && lookahead == '/') stack--;
|
||||
if (prev == '/' && lookahead == '*') stack++;
|
||||
while (lookahead != EOF) {
|
||||
if (prev == '*' && lookahead == '/') {
|
||||
nextChar();
|
||||
break;
|
||||
}
|
||||
prev = nextChar();
|
||||
}
|
||||
if (lookahead == EOF) throw unexpectedEndOfFile();
|
||||
|
||||
@@ -3,11 +3,10 @@ x = 10 // end-of-line comment
|
||||
y = 20 /*
|
||||
multi
|
||||
line
|
||||
/* nested */
|
||||
comment
|
||||
*/ z = 30
|
||||
|
||||
/// documentation comment
|
||||
function myFun() = 0
|
||||
|
||||
a = 20 // single-line comment running until EOF rather than newline
|
||||
a = 20 // single-line comment running until EOF rather than newline
|
||||
|
||||
Reference in New Issue
Block a user