Fix diagram navigation and token highlighting
This commit is contained in:
1 parent
7ed885f0d1
commit
7aa729d41e
6 files changed
+354
-63
No files matched your search
@@ -187,11 +187,22 @@ opens it for you. It is a local web app that edits **real files on disk**:
|
||||
listed under *Problems*; ANTLR tool errors are marked in the grammar at the
|
||||
reported line. Click a problem to jump to it. Hovering or clicking a node in
|
||||
the diagram, or a row in *Tokens*, highlights its text in the input.
|
||||
- **Diagram** with zoom (wheel), pan (drag), *Fit*, and SVG / PNG export. *Tree*
|
||||
shows the LISP form (indented or on one line, with Copy), *Tokens* the token
|
||||
table.
|
||||
- **Editor niceties:** grammar syntax colors, line numbers, auto-indent,
|
||||
`Tab` / `Shift+Tab` indent, `Ctrl+/` comment, `Ctrl+F` find and replace.
|
||||
- **Diagram** with zoom (wheel, `+` / `-`), pan (drag; it never selects text),
|
||||
*Fit* (double-click or `0`), and SVG / PNG export. **Click or select text in
|
||||
the input** and the diagram glides to the matching node (the smallest one that
|
||||
covers the text, a token rather than a rule when both match) and outlines it.
|
||||
*Tree* shows the LISP form (indented or on one line, with Copy), *Tokens* the
|
||||
token table.
|
||||
- **Editor niceties:** grammar syntax colors, line numbers, `Ctrl+/` comment,
|
||||
`Ctrl+F` find and replace, and indentation with **hard tabs** (shown 4 columns
|
||||
wide; `Tab` / `Shift+Tab` also indent and outdent a selection). A line that is
|
||||
already indented with spaces keeps getting spaces, so a line never mixes both.
|
||||
`Enter` auto-indents: it keeps the current indentation, adds a level after
|
||||
`(` `[` `{`, and between a pair like `{|}` opens a block with the closer on its
|
||||
own line. In grammars it also indents after a rule name or a `:`, and starts
|
||||
the next line at column 0 after the `;` that ends a rule. A whitespace-only
|
||||
line is emptied when you press `Enter` on it, and typing `}` `)` or `]` first
|
||||
on an indented line steps it back one level.
|
||||
- Panels close with their `x` and come back from the View menu; the splitters
|
||||
drag. Layout, theme (system / light / dark) and text size are remembered, and
|
||||
so are the open files per workspace.
|
||||
@@ -223,6 +234,10 @@ Opening a file larger than 5 MB or an input larger than 4 MB is refused.
|
||||
|
||||
### Changing the UI
|
||||
|
||||
The wheel zoom speed is the `ZOOM` object near the top of the diagram code in
|
||||
`web/40-views.js` (`wheel` is the rate per scrolled pixel, `maxStep` caps the
|
||||
change of one event).
|
||||
|
||||
The browser code lives in `web/` (plain HTML, CSS and JavaScript, no build
|
||||
tools or libraries). After editing it, run `python3 tools/embed_web.py` to
|
||||
regenerate `src/webui_assets.hpp`, which is checked in, so building antlrlab
|
||||
|
||||
Reference in new issue
Block a user