Skip to content

tree-sitter grammar: tokenize logic/relational keywords (schema/defr/rel/solve/explain/forall/exists/query) #75

Description

@hierophantos

Follow-up from the font-lock fix (b336931).

These Prologos keywords have no rules in editors/tree-sitter-prologos/grammar.jstop_level (grammar.js:52-79) has no schema_form/defr_form, and expression (:506) has no solve/explain/query/rel/forall/exists. They currently highlight only via prologos-ts-mode's identifier-regex fallback (rule 2), which is fragile (matches any identifier with those names) and gives them no structural support (navigation/imenu/indent).

Making them proper forms:

  • schema — top-level declaration schema Name / :field Type …. Add schema_form to top_level (low conflict, mirrors spec_form).
  • defr — top-level relation def with || fact blocks and &> rule clauses. Needs new ||/&> operator tokens the grammar lacks.
  • rel / solve / explain / query / forall / exists — expressions that appear inside (…). Adding seq('solve', …)-style rules to expression conflicts with the generic application rule (grammar.js:608) — needs explicit precedence / conflicts entries.

Scope: real grammar-authoring + test/ corpus updates + rebuild via install.sh. Do it as one tested change. Until then the regex fallback keeps them highlighted.

After landing, move these from the mode's rule-2 regex into rule 1's token list (and verify against node-types.json so the query still compiles under Emacs 31).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions