Skip to content

Releases: 1c-syntax/codemirror-lang-bsl

v0.3.1 — Real-world parse rate hits 92% / 100%

29 May 10:25

Choose a tag to compare

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 (Процедура Выполнить()).
    SubName now uses the same dotIdentifier rule that
    PropertyAccess/CallAccess already 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)+constValue now matches
    String+ for the same reason.
  • Comma-skipped arguments (Метод(a,,b), Метод(,a),
    Метод(a,), Метод(,)). Modelled after ANTLR's
    callParam : expression? — empty slots are real callArg nodes
    with no expression child. The with-expression alternative carries
    @dynamicPrecedence=1 so the GLR engine still resolves
    f(g(x)) as one nested call rather than f applied to g and
    (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 (via indentWithTab) 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-bsl

Full changelog: v0.3.0...v0.3.1

v0.3.0 — Grammar gaps closed, real-world hardening, named lexemes

29 May 09:44

Choose a tag to compare

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
    stmtSemi precedence 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 nested BraceGroup instead 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 new MdoRef { MdoKw (Dot Identifier)* } rule collects whole
    metadata paths, and only the Identifier components 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 as propertyName so methods named after keywords don't render
    in keyword colour.
  • SDBL MdoRef/Identifiert.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 via NodeProp.mounted),
  • sample picker dropdown (module / query / preprocessor / 1С-style
    method description),
  • drag-and-drop a .bsl/.os file onto the editor to load it,
  • ?sample=<id> and ?theme=light URL 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

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-eslint recommended ruleset and
    type-checked rules on src/ via projectService. Wired into CI as a
    separate lint job.
  • noEmitOnError: true on both rollup typescript() invocations — the
    earlier astUpdateField regression that shipped a broken bundle would
    now fail the build at the source.
  • npm Trusted Publishing (OIDC)NPM_TOKEN is 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
    upstream 1c-syntax/bsl-parser ANTLR convention. The tree shape
    changes accordingly: BinaryExpr(Identifier, CmpOp(Assign), Number)
    instead of BinaryExpr(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-bsl

Full changelog: v0.2.1...v0.3.0

v0.2.1 — Switch to npm Trusted Publishing

28 May 13:04

Choose a tag to compare

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

28 May 12:54

Choose a tag to compare

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/УНИЧТОЖИТЬ/DROP get 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-server SemanticTokensProvider — 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-bsl

Limitations

See README → Limitations.