Skip to content

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

Choose a tag to compare

@nixel2007 nixel2007 released this 29 May 09:44
· 5 commits to main since this release

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