Repository navigation
Clause renames - #624
Merged
Merged
Clause renames#624
Conversation
Frees 'title' from colliding with the upcoming TITLE clause keyword: 'TITLE title => ...' would lex the second word as the keyword. 'main' and 'sub' read naturally beside 'caption'.
The LABEL clause sets (sub)titles, captions and axis/legend titles, so TITLE is the more natural name — freeing LABEL for a future clause that actually sets break labels. Grammar nodes rename accordingly (title_clause, title_assignment, title_type), the shared Labels struct becomes Titles (src/titles.rs, Plot.titles, Table.titles), and the doc pages move to syntax/clause/title.qmd and title-tabulate.qmd.
The SCALE/FORMAT subclause that maps values to display labels is now LABEL, made available by the titles clause taking the TITLE name. The Format AST field follows Scale::label_spec as Format::label_spec.
The TITLE main line is one column shorter than the LABEL title line it replaced, shifting every token after it; the assertion carets moved with it.
teunbrand
marked this pull request as ready for review
November 30, 2026 12:14
thomasp85
approved these changes
Dec 1, 2026
thomasp85
left a comment
Collaborator
There was a problem hiding this comment.
This is mostly ready to ship. Once the following is addressed, merge at your discretion:
- No changelog (this is a large breaking change)
- We perhaps need to provide slightly better error messages for the old syntax rather than a generic syntax error
syntax/clause/label→titlebreaks external doc links — consider a Quartoaliases:redirect- From Kimi: Highlighters: ggsql.tmLanguage.json:356 colors the aesthetic in
SCALE labelas a keyword (rule order); line 388 FACET highlights aLABELkeyword that FACET doesn't have; doc/ggsql.xml:540 has the mirror-image problem (LABELcolored as aesthetic), and thelabel_propertieslist (line 250) now holdsmain/subunder the old name.
The old forms fail to parse and used to get the generic fallback: - LABEL as a clause and RENAMING as a SCALE/FORMAT subclause head an ERROR node with the old keyword; check_dead_clauses() in SourceTree::validate() recognises them and names the replacement (TITLE, LABEL). - TITLE title => ... lexes title as a second TITLE keyword, leaving the assignment name missing; the same check points at main. - TITLE subtitle => ... parses cleanly, so check_dead_keywords() in build_titles rejects the key and points at sub. Quoting the name opts out, for a column genuinely named title or subtitle. A specific SourceTree message now wins over validate()'s generic VISUALISE-side recovery guess. The shims are marked for removal before the post-beta release in src/AGENTS.md.
Collaborator
Author
|
Addressed most of the comments, with the exception:
This is the grammatical ambiguity I noted previously. The ambiguity gets resolved by position as soon as other subclauses is involved, which would be any non trivial label scale. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR aims to fix an issue discussed off-github.
Essentially
LABEL title => 'foo', subtitle => 'bar'becomesTITLE main => 'foo', sub => 'bar'.Then,
SCALE RENAMINGandFORMAT RENAMINGbecomeSCALE LABELc.q.FORMAT LABEL.In terms of grammar, it becomes more ambiguous to do
SCALE label: is the label the label-clause or the label-aesthetic?However, we hardcode null/identity scales in the vegalite path and any actual use of a label scale will likely include other subclauses to distinguish these by position.