Skip to content

Claude/update jsonic library 1s txf#8

Merged
rjrodger merged 3 commits into
mainfrom
claude/update-jsonic-library-1sTXF
Apr 19, 2026
Merged

Claude/update jsonic library 1s txf#8
rjrodger merged 3 commits into
mainfrom
claude/update-jsonic-library-1sTXF

Conversation

@rjrodger
Copy link
Copy Markdown
Contributor

No description provided.

claude added 3 commits April 18, 2026 22:06
Enables callers to use Exclude('yaml') (Go) / rule.exclude (TS) to
remove YAML-specific alternates when needed.

https://claude.ai/code/session_01SiXBTMzEYfyzgQg12Jg2K6
Mirrors the jsonicjs/ini pattern: the grammar spec (rule open/close
alts) lives in yaml-grammar.jsonic at the repo root and is embedded
verbatim into src/yaml.ts and go/grammar.go between BEGIN/END markers.
Run 'node embed-grammar.js' (or 'npm run embed') to re-sync after edits.

- Alt conditions/actions become @funcref strings resolved via a refs map
  defined in the plugin (so closures can capture per-parse state).
- State handlers (bo/ao/bc/ac) stay in code — they need closure access
  to anchors/pendingAnchors and aren't straightforwardly declarative.
- Added a guard (Decoration in Go, __yamlInstalled in TS) against
  re-entry during options()/SetOptions() plugin re-application, which
  otherwise double-installs grammar rules and BC handlers.

https://claude.ai/code/session_01SiXBTMzEYfyzgQg12Jg2K6
@rjrodger rjrodger merged commit fbde8db into main Apr 19, 2026
6 checks passed
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8815fdfc52

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/yaml.ts
Comment on lines +178 to +179
if ((jsonic as any).__yamlInstalled) return
;(jsonic as any).__yamlInstalled = true
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Remove permanent install guard from TS YAML plugin

This __yamlInstalled short-circuit turns the plugin into a one-shot initializer, so any later jsonic.options(...) call that triggers plugin re-application will skip YAML setup entirely. In flows that adjust options after use(Yaml), the YAML lexer/rule customizations from this plugin are no longer reasserted and parsing can regress to base Jsonic behavior. A re-entry guard should only suppress recursive re-entry during the current install, not permanently disable future re-applies.

Useful? React with 👍 / 👎.

Comment thread go/plugin.go
Comment on lines +15 to +18
if j.Decoration("yaml-installed") == true {
return nil
}
j.Decorate("yaml-installed", true)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Avoid permanently skipping Go plugin re-application

Using a persistent decoration flag here makes subsequent SetOptions-driven plugin re-application a no-op, even though this plugin later mutates lexer/config state (FixedTokens, checks, matcher wiring) that may need to be re-applied after config rebuilds. In applications that call SetOptions after installing YAML, this can leave the parser without YAML-specific behavior and produce incorrect parses.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants