Parser: 91.7% of the corpus, operator symbols and #code statements

operatorSymbol now tries multi-token forms first, so 'operator *[]' is no longer
cut short by the bare '*'. '#code'/'#insert' take a whole statement, and a
statement that already consumed its ';' satisfies the enclosing declaration.

Ratchet 650/714.
This commit is contained in:
hgranthorner
2026-08-04 12:40:20 -04:00
parent dc53033898
commit 47a2c5805e
7 changed files with 143 additions and 85 deletions

View File

@@ -237,8 +237,9 @@ object JaiParserUtil : GeneratedParserUtilBase() {
/**
* True if the previous token already closes a construct, so no `;` is needed:
* `}` ends a block, struct or enum body, and a here-string ends on its own
* terminator line (`BODY :: #string DONE … DONE`).
* `}` ends a block, struct or enum body, a here-string ends on its own terminator
* line (`BODY :: #string DONE … DONE`), and a `;` was already taken by a nested
* statement (`code :: #code a := 1;`).
*/
@JvmStatic
fun prevEndsConstruct(
@@ -249,7 +250,7 @@ object JaiParserUtil : GeneratedParserUtilBase() {
while (true) {
val t: IElementType = b.rawLookup(i) ?: return false
if (t !== TokenType.WHITE_SPACE && t !== T.LINE_COMMENT && t !== T.BLOCK_COMMENT) {
return t === T.RBRACE || t === T.HERE_STRING
return t === T.RBRACE || t === T.HERE_STRING || t === T.SEMICOLON
}
i--
}