Releases: 1c-syntax/codemirror-lang-bsl
v0.3.1 — Real-world parse rate hits 92% / 100%
Bug-fix and grammar-tightening release on top of v0.3.0. Headline:
vsc-language-1c-bsl real configuration fixtures now parse 100% clean
(up from 88%); bsl-language-server test fixtures move from 84% to
92%. The four remaining degraded files in the bsl-language-server set
are all intentionally malformed (*ParseError* tests, or source
typos like Неопределенно and Функция Пример3 written without
parentheses).
Grammar fixes
- Methods named after BSL keywords (
Процедура Выполнить()).
SubNamenow uses the samedotIdentifierrule that
PropertyAccess/CallAccessalready used, so a sub name that
globally specializes to a keyword still parses cleanly. Real
configuration code uses this freely; v0.3.0 errored out at the sub
declaration. - Implicit string concatenation by juxtaposition
(\"\" \"Выбрать\" \"Валюты.Код\"is one logical literal made of
three tokens). Mirrors ANTLR's
string : (STRING | multilineString)+—constValuenow matches
String+for the same reason. - Comma-skipped arguments (
Метод(a,,b),Метод(,a),
Метод(a,),Метод(,)). Modelled after ANTLR's
callParam : expression?— empty slots are realcallArgnodes
with noexpressionchild. The with-expression alternative carries
@dynamicPrecedence=1so the GLR engine still resolves
f(g(x))as one nested call rather thanfapplied togand
(x)separately. This was the previously documented Limitation
#2 and is now closed. - Multi-line strings with blank rows between
|-continued
segments. Configurations routinely split long queries across
paragraphs; the v0.3.0 regex required exactly one newline before each
|and errored on blank-line separators. The token now accepts a
run of newlines, matching ANTLR's token-stream
STRINGPART/STRINGTAIL approach.
Live demo
- Editor uses real tab characters at a 4-column display width.
Tab key inserts a tab (viaindentWithTab) instead of moving focus
out of the editor.
Numbers
| Sample set | v0.3.0 clean | v0.3.1 clean |
|---|---|---|
| bsl-language-server fixtures (50) | 84% | 92% |
| vsc-language-1c-bsl real config (17) | 88% | 100% |
| Hard failures | 0 | 0 |
Install
npm install @1c-syntax/codemirror-lang-bslFull changelog: v0.3.0...v0.3.1
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
v0.2.1 — Switch to npm Trusted Publishing
Infrastructure-only release: validates the publish pipeline now that npm Trusted Publishing (OIDC) is configured and NPM_TOKEN has been removed.
No source code changes vs v0.2.0 — same grammar, same tests, same dist. The artefact attached to this release is built and published by GitHub Actions via short-lived OIDC credential exchange with npmjs.org, attested by sigstore.
v0.2.0 — Initial release
Initial public release of @1c-syntax/codemirror-lang-bsl: CodeMirror 6 language support for 1C:Enterprise (BSL) / OneScript with embedded SDBL query language highlighting.
What's included
- BSL grammar (Lezer): module-level declarations, procedures and functions (incl.
АСИНХ), variable declarations, control flow (Если/Пока/Для/Попытка), expressions with proper precedence, compiler directive annotations (&НаКлиентеetc.), preprocessor directives (#Если/#Иначе/#КонецЕсли/#Область/#Использовать), regions, labels and goto, line and doc comments (//////), string literals (single-line and multi-line with|continuation), date literals. - SDBL grammar: ~100 keywords across 8 categories (statement / operator / function / type / metadata-object / virtual-table / field + literals), Russian and English variants recognised identically.
- parseMixed integration: query string literals starting with
ВЫБРАТЬ/SELECT/УНИЧТОЖИТЬ/DROPget an SDBL overlay tree, so the query body lights up with category-specific colours alongside the surrounding BSL. - styleTags mapped from
1c-syntax/bsl-language-serverSemanticTokensProvider — decorators for annotations, namespaces for#Область/#Использовать/ SDBL metadata-object roots, macros for preprocessor directives, separate tags for control flow / definition keywords / boolean / null / operators / etc.
Upstream references pinned
| Project | Commit |
|---|---|
1c-syntax/bsl-parser |
a30f8169 (v0.34.1) |
1c-syntax/vsc-language-1c-bsl |
30e6c799 (v1.33.1) |
1c-syntax/bsl-language-server |
be49fcbf (develop) |
Demo
https://1c-syntax.github.io/codemirror-lang-bsl/
Install
npm install @1c-syntax/codemirror-lang-bslLimitations
See README → Limitations.