v0.3.0 — Grammar gaps closed, real-world hardening, named lexemes
Highlights
Real-world parse rate jumped from ~50% to 85% on a representative sample drawn from
1c-syntax/bsl-language-server
and 1c-syntax/vsc-language-1c-bsl
fixtures. Zero hard failures across 67 files.
Grammar gaps closed
- UTF-8 BOM at the start of a file is now treated as whitespace. Real
1C:Enterprise configuration modules are always saved with a leading BOM —
before this fix every config file landed an error token at offset 0
(29% → 88% clean on configuration code alone). - Local
Перемinside a procedure/function body is now parsed. - Bare
~Метка:at the end of a body parses without erroring. #Удаление/#КонецУдаленияand#Вставка/#КонецВставки—
configuration-extension preprocessor markers are recognised and tagged as
macros.- Optional trailing
;after flat statements (Возврат,Прервать,
assignment, call). Was Limitation #1 in v0.2 — closed via the new
stmtSemiprecedence that biases shift over reduce. - BSL keywords used as method/property names after
.
(Запрос.Выполнить(),Объект.Значение) parse without error and render
with property-name colouring.
SDBL
{...}configuration blocks (data-composition-system parameters)
parse as a nestedBraceGroupinstead of producing error tokens.&НачалоПериода/&Имяparameters now render&and the name
in the same colour, and the name is allowed to be a category-keyword
word (началопериода→ BEGINOFPERIOD specialisation no longer breaks the
parameter rule).- Virtual-table highlighting is structural, not lexical. Words like
Остатки/СрезПоследних/Оборотыno longer get globally tagged as
VtKw. The newMdoRef { MdoKw (Dot Identifier)* }rule collects whole
metadata paths, and only theIdentifiercomponents inside that
structure get the class colour. Query aliases keep the variableName
colour as they should.
Style mapping
&НаКлиентеand#Областьnow render as one unified visual block —
the&and#punctuation share the parent directive's colour
instead of being painted as ordinary punctuation.- After a
., every BSL keyword (.Выполнить,.Значение, etc.) is
re-tagged aspropertyNameso methods named after keywords don't render
in keyword colour. - SDBL
MdoRef/Identifier→t.className, the actual virtual-table
highlighter from v0.2 in a structural form.
Live demo
The page at https://1c-syntax.github.io/codemirror-lang-bsl/ was reworked:
- single editor on the left, live AST viewer on the right (clicking a
node selects its range in the editor; descends into mounted SDBL
overlays viaNodeProp.mounted), - sample picker dropdown (module / query / preprocessor / 1С-style
method description), - drag-and-drop a
.bsl/.osfile onto the editor to load it, ?sample=<id>and?theme=lightURL parameters for shareable links,- bundle name now content-hashed (
bundle-[hash].js) so each deploy is
visible immediately instead of waiting out the 10-minute Pages CDN TTL.
Documentation
- TypeDoc-generated API reference published at
https://1c-syntax.github.io/codemirror-lang-bsl/api/. - Beefed-up JSDoc on
bsl(),bslLanguage,sdblLanguagewith
@exampleblocks and external symbol mappings to upstream CodeMirror
docs.
Tooling
- Dependabot monitors npm + github-actions weekly, grouped by family
(@codemirror/*,@lezer/*,@rollup/*, test-tooling) to keep PR
noise down. Already merged four upstream action-version bumps. - ESLint flat config with
typescript-eslintrecommended ruleset and
type-checked rules onsrc/viaprojectService. Wired into CI as a
separatelintjob. noEmitOnError: trueon both rollup typescript() invocations — the
earlierastUpdateFieldregression that shipped a broken bundle would
now fail the build at the source.- npm Trusted Publishing (OIDC) —
NPM_TOKENis no longer required.
The publish workflow exchanges its GitHub Actions OIDC token for a
short-lived credential at publish time, with sigstore provenance
attached to the artefact (verify via
npm view @1c-syntax/codemirror-lang-bsl provenance).
Breaking changes
This is a 0.x release so technically nothing is locked, but the change
most likely to break downstream code is:
- Every punctuation and operator literal is now a named token
(Ampersand,Hash,Dot,LParen,Comma,Semicolon,
Plus,Mul,Assign,NotEqual, …) — matching the
upstream1c-syntax/bsl-parserANTLR convention. The tree shape
changes accordingly:BinaryExpr(Identifier, CmpOp(Assign), Number)
instead ofBinaryExpr(Identifier, CmpOp, Number). Highlight
consumers don't have to do anything; tree walkers may need updates.
Upstream references pinned
| Project | Tag | Commit |
|---|---|---|
1c-syntax/bsl-parser |
v0.34.1 | a30f8169 |
1c-syntax/vsc-language-1c-bsl |
v1.33.1 | 30e6c799 |
1c-syntax/bsl-language-server |
develop | be49fcbf |
Install
npm install @1c-syntax/codemirror-lang-bslFull changelog: v0.2.1...v0.3.0