Skip to content

Commit e320878

Browse files
nixel2007claude
andcommitted
Two more grammar gaps from the v0.3.0 sample run
1. SubName accepts any BSL keyword as the sub name, not just Identifier. 'Процедура Выполнить()' is a real-world pattern — methods named after keywords appear in configuration code. Same root cause as the PropertyAccess/CallAccess keyword-after-dot fix, just in declaration position; reusing the existing dotIdentifier rule covers it cleanly. 2. constValue accepts String+ (one or more adjacent strings) instead of a single String. ANTLR's BSL grammar has 'string : (STRING | multilineString)+' for the same reason: code routinely concatenates string segments by juxtaposition — '"" "Выбрать" "Валюты.Код"' is one logical literal made of three tokens. Sample-set numbers move from 84%/88% to 88%/88% (lsl/vsc). Remaining 8 degraded files are: 4 source-level errors (intentional *ParseError* test inputs or real typos like 'Неопределенно' / 'Функция Пример3' without parens), 3 comma-skipping in argument lists (documented Limitation), 1 multi-line string edge case with adjacent tabs and '""escape""' patterns inside a string concatenation. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 20a977b commit e320878

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

src/bsl.grammar

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,12 @@ FunctionDecl {
9696
EndFunction
9797
}
9898

99-
SubName { Identifier }
99+
// Procedure/function names — same problem as PropertyAccess/CallAccess: a
100+
// method named after a BSL keyword (`Процедура Выполнить()` is a real,
101+
// observed pattern) globally specializes to the keyword term and SubName
102+
// would reject it. dotIdentifier already covers Identifier OR any BSL
103+
// keyword, so we reuse it here.
104+
SubName { dotIdentifier }
100105

101106
paramList { Param (Comma Param)* }
102107

@@ -310,11 +315,16 @@ lvalue { refHead accessChain }
310315

311316
constValue {
312317
Number |
313-
String |
318+
String+ |
314319
Date |
315320
True | False | Undefined | Null
316321
}
317322

323+
// ANTLR allows `string : (STRING | multilineString)+` — adjacent string
324+
// literals are implicitly concatenated. Real codebases use this to break a
325+
// long query across several `"…"` segments without writing `+` between
326+
// them; without `String+` we error out at the second String token.
327+
318328
unaryConstValue {
319329
UnaryOp? constValue
320330
}

0 commit comments

Comments
 (0)