Skip to content

Add the KeY 3 migration guide and improve code highlighting - #64

Merged
wadoon merged 13 commits into
masterfrom
docs/key3-migration-guide
Nov 16, 2026
Merged

wadoon merged 13 commits into
masterfrom
docs/key3-migration-guide

Conversation

@wadoon

@wadoon wadoon commented Nov 16, 2026 •

Copy link
Copy Markdown
Member

Summary

Adds the KeY 2.13 → KeY 3.0 migration guide from the KeY wiki, together with the syntax-highlighting fixes needed to render its examples.

Migration guide

  • New page content/user/migration-key-3.md: contract/field naming, parametric sorts and functions, saved proofs, stricter JML rules, and the known class-modifier issue.
  • Linked from the User Guide index and the 3.0.0 release notes.
  • Adapted to the site's authoring conventions (front matter, no extra # heading, correct fences, typo fixes).

Prism / code highlighting

  • JML: Java snippets containing JML use jml fences. /*@ … */ annotations get a darker background, delimiters are styled, and multi-line annotations fill the whole area between the delimiters.
  • Diffs: vendored Prism's diff language and diff-highlight plugin. diff-<language> fences highlight added/removed lines while keeping the inner language's syntax colours; documented with a rendered example. The guide uses diff-json and diff-key.
  • Languages: the bundle now includes all default Prism languages (markup, CSS, C-like, JavaScript) plus Lisp, with lisp/elisp and diff-lisp/diff-elisp fences.
  • KeY grammar: expanded from KeYLexer.g4 / JavaKeYLexer.g4 (taclet, declaration, settings and varcond keywords, modalities, <=!=>, schema variables, TRUE/FALSE). JML and KeY remain separate languages: JML keywords are handled by the JML grammar and do not leak into top-level Key keywords.

Closes #53.

Latest tweak

  • Darkened the JML annotation background for better contrast in light and dark mode.

Verification

  • make build passes
  • make check passes (0 link errors)
  • JML, diff and Lisp highlighting checked in a headless browser/Prism render
  • go.mod / go.sum unchanged

Port the KeY wiki migration guide to the user documentation. It covers
contract and field naming changes, parametric sorts and functions, saved
proofs, and the stricter JML placement rules of KeY 3.

Link the new page from the User Guide index and the 3.0.0 release notes.

Fixes #53
The Java examples contain JML annotations, so fence them as jml rather
than java.
Vendor the Prism diff language and diff-highlight plugin and wire up
`diff-<language>` fences, so added and removed lines are coloured while the
unchanged text keeps the inner language's highlighting.

Use `diff-json` for the proof-obligation diffs and `diff-key` for the saved
proof example in the migration guide. Document the new fences and add
light/dark styles for deleted and inserted lines.
The JML grammar recognised `/*@` but not the plain `*/` closing delimiter,
so Prism's Java operator token swallowed `*/` and rendered it bold.

Match `*/` as a delimiter (keeping `@*/` for the older form), give the
whole annotation a subtle background, and style both delimiters with
their own colour and background. Apply the same treatment in dark mode.
Document `diff-<language>` fences with a proof-obligation example and its
rendered result, so authors can copy the syntax.
Add prism-javascript so the bundle contains the complete default Prism
language set (markup, CSS, C-like and JavaScript). Wire up the `javascript`
and `js` fences and document them.
Expand the JML keyword lists from JmlLexer.g4 and make the KeY grammar
understand taclet, declaration, settings and varcond keywords from
KeYLexer.g4 and JavaKeYLexer.g4. JML clauses and modifiers are also
highlighted at the top level of key blocks, sharing the vocabulary in
prism-jml.js.

Add the remaining modality keywords, `<=!=>` sequent arrows and the JavaDL
literals TRUE/FALSE.
`requires` is both a JML clause and a Java keyword (module declarations).
Match JML clauses before Java keywords, but keep modifiers after them so
`public`, `final` and friends retain their Java colour.
Prism tokenises a `/*@ ... */` annotation as one inline span, so its
background only covered the text on each line. After highlighting, make
multi-line annotations inline-block and offset them so the background
fills the whole area between the delimiters while the original
indentation is preserved.

Strengthen the annotation and delimiter colours so the highlighted area
is distinct from the code block background in light and dark mode.
`jml` and `key` are distinct languages. Stop sharing the JML keyword
lists with Key and do not treat JML clauses/modifiers as top-level Key
keywords. JML annotations in Key files still use the inherited JML
grammar; the Key keywords come from KeYLexer.g4 and JavaKeYLexer.g4.
Add prism-lisp and wire up `lisp`, `elisp`, `emacs` and matching
`diff-lisp`/`diff-elisp` fences.
@wadoon wadoon changed the title Add the KeY 3 migration guide Add the KeY 3 migration guide and improve code highlighting Nov 16, 2026
@wadoon
wadoon merged commit 6661096 into master Nov 16, 2026
2 checks passed
@wadoon
wadoon deleted the docs/key3-migration-guide branch November 16, 2026 21:23
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.

Add the KeY3 Migration Guide

1 participant