Skip to content

Claude/update jsonic library gj8 zb#4

Merged
rjrodger merged 2 commits into
mainfrom
claude/update-jsonic-library-GJ8Zb
Apr 19, 2026
Merged

Claude/update jsonic library gj8 zb#4
rjrodger merged 2 commits into
mainfrom
claude/update-jsonic-library-GJ8Zb

Conversation

@rjrodger
Copy link
Copy Markdown
Contributor

No description provided.

claude added 2 commits April 18, 2026 22:23
- Build a declarative GrammarSpec encoding open-rule mods, close-rule
  mods and the directive rule's own alts
- Apply via jsonic.grammar(spec, { rule: { alt: { g: 'directive' } } })
  so every generated alt gets 'directive' appended to its group tags
- Keep jsonic.rule(name, ...) solely for rs.clear()/bo/bc hooks which
  aren't expressible in a GrammarSpec
- All 9 tests pass
- Build a declarative GrammarSpec for all rule modifications plus the
  directive rule's own alts
- Wire bo/bc state actions via auto-resolved FuncRefs (@<name>-bo,
  @<name>-bc) registered in the GrammarSpec.Ref map
- Register per-rule condition closures as AltCond FuncRefs to support
  rulemod C predicates in open/close grammar alts
- Apply via j.Grammar(gs, &GrammarSetting{Rule:{Alt:{G:"directive"}}})
  so every alt auto-gets the 'directive' group tag
- Resolve shared close tokens by looking up the existing TinName so
  the grammar spec references the correct registered token
- All 5 Go tests pass
@rjrodger rjrodger merged commit f914ce2 into main Apr 19, 2026
11 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: 10cb72e471

ℹ️ 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/directive.ts
Object.entries(rules.close).forEach((entry: any[]) => {
const [rulename, rulespec] = entry
const r = ruleFor(rulename)
r.close = [
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Merge close alts for overlapping open/close rules

This assignment overwrites any close alternatives already collected for the same rule in the rules.open pass. If a user config puts the same rule in both rules.open and rules.close, the earlier fallback [{s:[CLOSE], b:1, g:'end'}] alt is dropped, which changes behavior from the previous implementation where both rs.close(...) additions coexisted. That regression can break custom directives that rely on overlapping rule sets (especially when rules.close[r].c is restrictive), so r.close needs to be merged instead of replaced.

Useful? React with 👍 / 👎.

Comment thread go/plugin.go
rs.PrependClose(closeAlt, commaCloseAlt)
})
r := ruleFor(rn)
r.Close = closeAlts
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve prior close alts when building Go grammar spec

Setting r.Close here replaces the close alt inserted earlier for the same rule in the open-rules loop. In the pre-refactor Go code, both were added via PrependClose, so overlapping Open/Close rule configs retained all close paths; now one set is silently discarded. For custom configurations where a rule is present in both maps, this can prevent valid directive termination paths from being installed.

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