@formulavize/lezer-fiz 2.2.0 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -5,10 +5,10 @@ var highlight = require('@lezer/highlight');
5
5
 
6
6
  // This file was generated by lezer-generator. You probably shouldn't edit it.
7
7
  const Unit = 1,
8
- cssIdentifier = 47,
9
- insertSemi = 48,
10
- spaces = 50,
11
- newline = 51,
8
+ cssIdentifier = 49,
9
+ insertSemi = 50,
10
+ spaces = 52,
11
+ newline = 53,
12
12
  LineComment = 2,
13
13
  BlockComment = 3;
14
14
 
@@ -99,7 +99,8 @@ const fizHighlighting = highlight.styleTags({
99
99
  Unit: highlight.tags.unit,
100
100
  StyleTag: highlight.tags.tagName,
101
101
  Namespace: highlight.tags.namespace,
102
- "RendererDirective/Identifier": highlight.tags.annotation,
102
+ "RendererDirective/Identifier": highlight.tags.processingInstruction,
103
+ "AboutNote/Identifier": highlight.tags.annotation,
103
104
  "( )": highlight.tags.paren,
104
105
  "{ }": highlight.tags.brace,
105
106
  "[ ]": highlight.tags.squareBracket,
@@ -111,24 +112,24 @@ const fizHighlighting = highlight.styleTags({
111
112
  // This file was generated by lezer-generator. You probably shouldn't edit it.
112
113
  const parser = lr.LRParser.deserialize({
113
114
  version: 14,
114
- states: ",`Q`QSOOO!]QdO'#CgOOQ`'#Cf'#CfO!jQSO'#CzO!qQdO'#CwO#PQSO'#C{O#UQSO'#CtO#^QSO'#C}O#cQSO'#DOO#hQSO'#DQO#mQSO'#DSO#rQdO'#DbOOQO'#DU'#DUQ`QSOOO#zQSO'#DVO$PQfO,59RO$nQSO'#CeO$vQUO'#CkO%UQdO,58{OOQO,59a,59aO%gQdO,59cO%uQSO,59gOOQ`,59f,59fO%zQSO,59fOOQ`,59c,59cO%jQdO,59cOOQ`,59g,59gO&RQSO'#DZO&WQSO,59`O&`QSO,59`O&kQSO,59iO&kQSO,59jO&kQSO,59lO&kQ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[^O]ZXeZXgZX!PZX~OP!rO!QdX!WdX![dX~O!QrO!W!sO![rO~O!S!TU!T~",
116
- goto: "&c![PPPPP!]PPP!m!]!xPPP#V#t#xPP#|P#tP$Q$WP$aPP$m$aP$Q$QP$QP$QP$y%T%^%d%j%pPPPPPP%v%|P&SP&YWZOR]gSx`!bQ!]mR!k!ZUbPw![QiSR!Td`QOR]`gm!Z!bR!g}ScP!WQhSQ!RbS!SdiQ!^nQ!_oQ!`pQ!aqR!j!TT!Oa!PT|a!PT!p!e!sXZOR]gWUOR]gR!XkWZOR]gQ!]mR!k!Z[SOR]gm!ZTdP![Q]OQgRTt]gW_Pw![!fRv_Q!czR!m!cQ!PaR!h!PQ!t!qR!w!tQlUR!YlX[OR]gQz`R!l!bQ!q!eR!v!sQsZQ!u!qR!x!t",
117
- nodeNames: "⚠ Unit LineComment BlockComment Recipe Call Identifier ) ( ArgList RhsVariable QualifiableIdentifier . } { StyleArgList StyleDeclaration PropertyName : ColorLiteral NumberLiteral StringLiteral StyleTag # Assignment LhsVariable Eq Namespace ] [ StatementList Import @ StyleTagDeclaration StyleBinding % GlobalStyleBinding * RendererDirective ^",
118
- maxTerm: 58,
115
+ states: ",xQ`QSOOO!`QdO'#CgOOQ`'#Cf'#CfO!mQSO'#CzO!tQdO'#CwO#SQSO'#C{O#XQSO'#CtO#aQSO'#C}O#fQSO'#DOO#kQSO'#DQO#pQSO'#DSO#uQSO'#DUO#}QdO'#DdOOQO'#DW'#DWQ`QSOOO$VQSO'#DXO$[QfO,59RO$yQSO'#CeO%RQUO'#CkO%aQdO,58{OOQO,59a,59aO%rQdO,59cO&QQSO,59gOOQ`,59f,59fO&VQSO,59fOOQ`,59c,59cO%uQdO,59cOOQ`,59g,59gO&^QSO'#D]O&cQSO,59`O&kQSO,59`O#xQSO,59iO#xQSO,59jO#xQSO,59lO#xQSO,59nOOQ`,59p,59pO#xQSO,59pOOQQ'#Di'#DiOOQO,5:O,5:OOOQO-E7U-E7UOOQb,59s,59s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ZX~OP!vO!SdX!YdX!^dX~O!SuO!Y!wO!^uO~O!U!VU!V~",
117
+ goto: "&k!^PPPPP!_PPP!o!_!zPPP#X#|$QPP$UP#|P$Y$`P$iPP$u$iP$Y$YP$YP$YP$YP%R%]%f%l%r%xPPPPPP&O&UP&[P&bW[OR^hS{a!fQ!`nR!o!^UcPz!_QjSR!We`QOR^ahn!^!fR!k!QSdP!ZQiSQsZQ!UcS!VejQ!aoQ!bpQ!cqQ!drQ!etR!n!WT!Rb!ST!Pb!ST!t!i!wX[OR^hWUOR^hR![lW[OR^hQ!`nR!o!^[SOR^hn!^TeP!_Q^OQhRTw^hW`Pz!_!jRy`Q!g}R!q!gQ!SbR!l!SQ!x!uR!{!xQmUR!]mX]OR^hQ}aR!p!fQ!u!iR!z!wQv[Q!y!uR!|!x",
118
+ nodeNames: "⚠ Unit LineComment BlockComment Recipe Call Identifier ) ( ArgList RhsVariable QualifiableIdentifier . } { StyleArgList StyleDeclaration PropertyName : ColorLiteral NumberLiteral StringLiteral StyleTag # Assignment LhsVariable Eq Namespace ] [ StatementList Import @ StyleTagDeclaration StyleBinding % GlobalStyleBinding * RendererDirective ^ AboutNote ~",
119
+ maxTerm: 60,
119
120
  context: trackNewline,
120
121
  nodeProps: [
121
- ["group", -2,5,10,"Statement Value",-3,19,20,21,"StyleValue",-7,24,27,31,33,34,36,38,"Statement"],
122
+ ["group", -2,5,10,"Statement Value",-3,19,20,21,"StyleValue",-8,24,27,31,33,34,36,38,40,"Statement"],
122
123
  ["openedBy", 7,"(",13,"{",28,"["],
123
124
  ["closedBy", 8,")",14,"}",29,"]"]
124
125
  ],
125
126
  propSources: [fizHighlighting],
126
127
  skippedNodes: [0,2,3],
127
128
  repeatNodeCount: 6,
128
- tokenData: "3X~R!SXY$_YZ%SZ[$_]^%Spq$_rs%Xst&{tu)^uv*Rwx*Wxy+uyz+zz{,P{|,U|}-p}!O,U!O!P-u!P!Q-}!Q![-_![!]/v!]!^/{!_!`0Q!b!c0V!c!})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$g;'S)a;'S;=`*O<%lO)a",
129
130
  tokenizers: [unitToken, cssIdentifierToken, 0, 1, insertSemicolon],
130
131
  topRules: {"Recipe":[0,4]},
131
- tokenPrec: 396
132
+ tokenPrec: 402
132
133
  });
133
134
 
134
135
  exports.parser = parser;
package/dist/index.es.js CHANGED
@@ -3,10 +3,10 @@ import { styleTags, tags } from '@lezer/highlight';
3
3
 
4
4
  // This file was generated by lezer-generator. You probably shouldn't edit it.
5
5
  const Unit = 1,
6
- cssIdentifier = 47,
7
- insertSemi = 48,
8
- spaces = 50,
9
- newline = 51,
6
+ cssIdentifier = 49,
7
+ insertSemi = 50,
8
+ spaces = 52,
9
+ newline = 53,
10
10
  LineComment = 2,
11
11
  BlockComment = 3;
12
12
 
@@ -97,7 +97,8 @@ const fizHighlighting = styleTags({
97
97
  Unit: tags.unit,
98
98
  StyleTag: tags.tagName,
99
99
  Namespace: tags.namespace,
100
- "RendererDirective/Identifier": tags.annotation,
100
+ "RendererDirective/Identifier": tags.processingInstruction,
101
+ "AboutNote/Identifier": tags.annotation,
101
102
  "( )": tags.paren,
102
103
  "{ }": tags.brace,
103
104
  "[ ]": tags.squareBracket,
@@ -109,24 +110,24 @@ const fizHighlighting = styleTags({
109
110
  // This file was generated by lezer-generator. You probably shouldn't edit it.
110
111
  const parser = LRParser.deserialize({
111
112
  version: 14,
112
- states: ",`Q`QSOOO!]QdO'#CgOOQ`'#Cf'#CfO!jQSO'#CzO!qQdO'#CwO#PQSO'#C{O#UQSO'#CtO#^QSO'#C}O#cQSO'#DOO#hQSO'#DQO#mQSO'#DSO#rQdO'#DbOOQO'#DU'#DUQ`QSOOO#zQSO'#DVO$PQfO,59RO$nQSO'#CeO$vQUO'#CkO%UQdO,58{OOQO,59a,59aO%gQdO,59cO%uQSO,59gOOQ`,59f,59fO%zQSO,59fOOQ`,59c,59cO%jQdO,59cOOQ`,59g,59gO&RQSO'#DZO&WQSO,59`O&`QSO,59`O&kQSO,59iO&kQSO,59jO&kQSO,59l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oO~O[^O]ZXeZXgZX!PZX~OP!rO!QdX!WdX![dX~O!QrO!W!sO![rO~O!S!TU!T~",
114
- goto: "&c![PPPPP!]PPP!m!]!xPPP#V#t#xPP#|P#tP$Q$WP$aPP$m$aP$Q$QP$QP$QP$y%T%^%d%j%pPPPPPP%v%|P&SP&YWZOR]gSx`!bQ!]mR!k!ZUbPw![QiSR!Td`QOR]`gm!Z!bR!g}ScP!WQhSQ!RbS!SdiQ!^nQ!_oQ!`pQ!aqR!j!TT!Oa!PT|a!PT!p!e!sXZOR]gWUOR]gR!XkWZOR]gQ!]mR!k!Z[SOR]gm!ZTdP![Q]OQgRTt]gW_Pw![!fRv_Q!czR!m!cQ!PaR!h!PQ!t!qR!w!tQlUR!YlX[OR]gQz`R!l!bQ!q!eR!v!sQsZQ!u!qR!x!t",
115
- nodeNames: "⚠ Unit LineComment BlockComment Recipe Call Identifier ) ( ArgList RhsVariable QualifiableIdentifier . } { StyleArgList StyleDeclaration PropertyName : ColorLiteral NumberLiteral StringLiteral StyleTag # Assignment LhsVariable Eq Namespace ] [ StatementList Import @ StyleTagDeclaration StyleBinding % GlobalStyleBinding * RendererDirective ^",
116
- maxTerm: 58,
113
+ states: ",xQ`QSOOO!`QdO'#CgOOQ`'#Cf'#CfO!mQSO'#CzO!tQdO'#CwO#SQSO'#C{O#XQSO'#CtO#aQSO'#C}O#fQSO'#DOO#kQSO'#DQO#pQSO'#DSO#uQSO'#DUO#}QdO'#DdOOQO'#DW'#DWQ`QSOOO$VQSO'#DXO$[QfO,59RO$yQSO'#CeO%RQUO'#CkO%aQdO,58{OOQO,59a,59aO%rQdO,59cO&QQSO,59gOOQ`,59f,59fO&VQSO,59fOOQ`,59c,59cO%uQdO,59cOOQ`,59g,59gO&^QSO'#D]O&cQSO,59`O&kQSO,59`O#xQSO,59iO#xQSO,59jO#xQSO,59lO#xQSO,59nOOQ`,59p,59pO#xQSO,59pOOQQ'#Di'#DiOOQO,5:O,5:OOOQO-E7U-E7UOOQb,59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ZX!RZX~OP!vO!SdX!YdX!^dX~O!SuO!Y!wO!^uO~O!U!VU!V~",
115
+ goto: "&k!^PPPPP!_PPP!o!_!zPPP#X#|$QPP$UP#|P$Y$`P$iPP$u$iP$Y$YP$YP$YP$YP%R%]%f%l%r%xPPPPPP&O&UP&[P&bW[OR^hS{a!fQ!`nR!o!^UcPz!_QjSR!We`QOR^ahn!^!fR!k!QSdP!ZQiSQsZQ!UcS!VejQ!aoQ!bpQ!cqQ!drQ!etR!n!WT!Rb!ST!Pb!ST!t!i!wX[OR^hWUOR^hR![lW[OR^hQ!`nR!o!^[SOR^hn!^TeP!_Q^OQhRTw^hW`Pz!_!jRy`Q!g}R!q!gQ!SbR!l!SQ!x!uR!{!xQmUR!]mX]OR^hQ}aR!p!fQ!u!iR!z!wQv[Q!y!uR!|!x",
116
+ nodeNames: "⚠ Unit LineComment BlockComment Recipe Call Identifier ) ( ArgList RhsVariable QualifiableIdentifier . } { StyleArgList StyleDeclaration PropertyName : ColorLiteral NumberLiteral StringLiteral StyleTag # Assignment LhsVariable Eq Namespace ] [ StatementList Import @ StyleTagDeclaration StyleBinding % GlobalStyleBinding * RendererDirective ^ AboutNote ~",
117
+ maxTerm: 60,
117
118
  context: trackNewline,
118
119
  nodeProps: [
119
- ["group", -2,5,10,"Statement Value",-3,19,20,21,"StyleValue",-7,24,27,31,33,34,36,38,"Statement"],
120
+ ["group", -2,5,10,"Statement Value",-3,19,20,21,"StyleValue",-8,24,27,31,33,34,36,38,40,"Statement"],
120
121
  ["openedBy", 7,"(",13,"{",28,"["],
121
122
  ["closedBy", 8,")",14,"}",29,"]"]
122
123
  ],
123
124
  propSources: [fizHighlighting],
124
125
  skippedNodes: [0,2,3],
125
126
  repeatNodeCount: 6,
126
- tokenData: "3X~R!SXY$_YZ%SZ[$_]^%Spq$_rs%Xst&{tu)^uv*Rwx*Wxy+uyz+zz{,P{|,U|}-p}!O,U!O!P-u!P!Q-}!Q![-_![!]/v!]!^/{!_!`0Q!b!c0V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#o)a$g;'S)a;'S;=`*O<%lO)a",
127
128
  tokenizers: [unitToken, cssIdentifierToken, 0, 1, insertSemicolon],
128
129
  topRules: {"Recipe":[0,4]},
129
- tokenPrec: 396
130
+ tokenPrec: 402
130
131
  });
131
132
 
132
133
  export { parser };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formulavize/lezer-fiz",
3
- "version": "2.2.0",
3
+ "version": "2.3.0",
4
4
  "description": "fiz grammar for lezer",
5
5
  "main": "dist/index.cjs",
6
6
  "type": "module",
@@ -27,6 +27,13 @@
27
27
  "node": ">=26.0",
28
28
  "pnpm": ">=11"
29
29
  },
30
+ "repository": {
31
+ "type": "git",
32
+ "url": "git+https://github.com/formulavize/lezer-fiz.git"
33
+ },
34
+ "author": "anthologen",
35
+ "license": "MIT",
36
+ "homepage": "https://github.com/formulavize/lezer-fiz#readme",
30
37
  "scripts": {
31
38
  "preinstall": "npx only-allow pnpm",
32
39
  "build": "rollup -c",
@@ -36,12 +43,5 @@
36
43
  "format": "prettier . --write",
37
44
  "dev": "run-p *:watch",
38
45
  "all": "run-s build test"
39
- },
40
- "repository": {
41
- "type": "git",
42
- "url": "git+https://github.com/formulavize/lezer-fiz.git"
43
- },
44
- "author": "anthologen",
45
- "license": "MIT",
46
- "homepage": "https://github.com/formulavize/lezer-fiz#readme"
47
- }
46
+ }
47
+ }
package/src/fiz.grammar CHANGED
@@ -9,6 +9,7 @@ statement[@isGroup=Statement] {
9
9
  StyleBinding |
10
10
  GlobalStyleBinding |
11
11
  RendererDirective |
12
+ AboutNote |
12
13
  Namespace |
13
14
  Import
14
15
  )
@@ -56,6 +57,8 @@ GlobalStyleBinding { "*" Identifier StyleArgList }
56
57
 
57
58
  RendererDirective { "^" Identifier StyleArgList }
58
59
 
60
+ AboutNote { "~" Identifier? StyleArgList }
61
+
59
62
  StatementList { "[" statement* "]" }
60
63
 
61
64
  Namespace { Identifier? StatementList ArgList? StyleArgList? }
@@ -116,6 +119,8 @@ Import { Identifier? "@" StringLiteral }
116
119
 
117
120
  "^"
118
121
 
122
+ "~"
123
+
119
124
  "(" ")" "{" "}" "[" "]"
120
125
 
121
126
  }
package/src/highlight.js CHANGED
@@ -12,7 +12,8 @@ export const fizHighlighting = styleTags({
12
12
  Unit: t.unit,
13
13
  StyleTag: t.tagName,
14
14
  Namespace: t.namespace,
15
- "RendererDirective/Identifier": t.annotation,
15
+ "RendererDirective/Identifier": t.processingInstruction,
16
+ "AboutNote/Identifier": t.annotation,
16
17
  "( )": t.paren,
17
18
  "{ }": t.brace,
18
19
  "[ ]": t.squareBracket,
package/test/about.txt ADDED
@@ -0,0 +1,188 @@
1
+ # Empty About Note
2
+
3
+ ~about{}
4
+
5
+ ==>
6
+
7
+ Recipe(
8
+ AboutNote(Identifier, StyleArgList())
9
+ )
10
+
11
+ # Unnamed About Note
12
+
13
+ ~{}
14
+
15
+ ==>
16
+
17
+ Recipe(
18
+ AboutNote(StyleArgList())
19
+ )
20
+
21
+ # Unnamed About Note with StringLiteral
22
+
23
+ ~{ "unkeyed description" }
24
+
25
+ ==>
26
+
27
+ Recipe(
28
+ AboutNote(StyleArgList(StringLiteral))
29
+ )
30
+
31
+ # About Note with Style Declarations
32
+
33
+ ~about{
34
+ author: "anthologen"
35
+ version: 1.2
36
+ license: "MIT"
37
+ }
38
+
39
+ ==>
40
+
41
+ Recipe(
42
+ AboutNote(
43
+ Identifier,
44
+ StyleArgList(
45
+ StyleDeclaration(PropertyName, StringLiteral),
46
+ StyleDeclaration(PropertyName, NumberLiteral),
47
+ StyleDeclaration(PropertyName, StringLiteral)
48
+ )
49
+ )
50
+ )
51
+
52
+ # About Note with StyleTags
53
+
54
+ ~about{
55
+ #meta #draft
56
+ }
57
+
58
+ ==>
59
+
60
+ Recipe(
61
+ AboutNote(
62
+ Identifier,
63
+ StyleArgList(
64
+ StyleTag(QualifiableIdentifier(Identifier)),
65
+ StyleTag(QualifiableIdentifier(Identifier))
66
+ )
67
+ )
68
+ )
69
+
70
+ # About Note with Qualified StyleTag
71
+
72
+ ~about{ #provenance.internal }
73
+
74
+ ==>
75
+
76
+ Recipe(
77
+ AboutNote(
78
+ Identifier,
79
+ StyleArgList(
80
+ StyleTag(QualifiableIdentifier(Identifier, Identifier))
81
+ )
82
+ )
83
+ )
84
+
85
+ # About Note Mixed Content
86
+
87
+ ~about{
88
+ #draft
89
+ author: "anthologen"
90
+ "free form description"
91
+ }
92
+
93
+ ==>
94
+
95
+ Recipe(
96
+ AboutNote(
97
+ Identifier,
98
+ StyleArgList(
99
+ StyleTag(QualifiableIdentifier(Identifier)),
100
+ StyleDeclaration(PropertyName, StringLiteral),
101
+ StringLiteral
102
+ )
103
+ )
104
+ )
105
+
106
+ # About Note with Semicolons
107
+
108
+ ~about{ author: "anthologen"; license: "MIT" };
109
+
110
+ ==>
111
+
112
+ Recipe(
113
+ AboutNote(
114
+ Identifier,
115
+ StyleArgList(
116
+ StyleDeclaration(PropertyName, StringLiteral),
117
+ StyleDeclaration(PropertyName, StringLiteral)
118
+ )
119
+ )
120
+ )
121
+
122
+ # Multiple About Notes
123
+
124
+ ~about{ version: 1 }
125
+ ~provenance{ source: "upstream" }
126
+ ~{ "unnamed" }
127
+
128
+ ==>
129
+
130
+ Recipe(
131
+ AboutNote(
132
+ Identifier,
133
+ StyleArgList(StyleDeclaration(PropertyName, NumberLiteral))
134
+ )
135
+ AboutNote(
136
+ Identifier,
137
+ StyleArgList(StyleDeclaration(PropertyName, StringLiteral))
138
+ )
139
+ AboutNote(StyleArgList(StringLiteral))
140
+ )
141
+
142
+ # About Note Alongside Other Statements
143
+
144
+ ~about{ author: "anthologen" }
145
+ *node{ color: #abc }
146
+ ^cytoscape{ rankDir: "LR" }
147
+ f(x)
148
+
149
+ ==>
150
+
151
+ Recipe(
152
+ AboutNote(
153
+ Identifier,
154
+ StyleArgList(StyleDeclaration(PropertyName, StringLiteral))
155
+ )
156
+ GlobalStyleBinding(
157
+ Identifier,
158
+ StyleArgList(StyleDeclaration(PropertyName, ColorLiteral))
159
+ )
160
+ RendererDirective(
161
+ Identifier,
162
+ StyleArgList(StyleDeclaration(PropertyName, StringLiteral))
163
+ )
164
+ Call(
165
+ Identifier,
166
+ ArgList(RhsVariable(QualifiableIdentifier(Identifier)))
167
+ )
168
+ )
169
+
170
+ # About Note in a StatementList
171
+
172
+ ns[
173
+ ~about{ scope: "inner" }
174
+ ]
175
+
176
+ ==>
177
+
178
+ Recipe(
179
+ Namespace(
180
+ Identifier,
181
+ StatementList(
182
+ AboutNote(
183
+ Identifier,
184
+ StyleArgList(StyleDeclaration(PropertyName, StringLiteral))
185
+ )
186
+ )
187
+ )
188
+ )
@@ -1,517 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>fiz Grammar — Railroad Diagrams</title>
7
- <style>
8
- body {
9
- font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
10
- max-width: 1200px;
11
- margin: 0 auto;
12
- padding: 2rem;
13
- background: #fafafa;
14
- color: #222;
15
- }
16
- h1 { margin-bottom: 0.25rem; }
17
- h1 + p { color: #666; margin-top: 0; }
18
- .toc { margin: 1rem 0 2rem; columns: 3; column-gap: 2rem; }
19
- .toc a { font-family: "SF Mono", "Fira Code", monospace; font-size: 0.9rem; display: block; margin-bottom: 0.3rem; }
20
- section { margin-bottom: 2.5rem; scroll-margin-top: 1rem; }
21
- h2 {
22
- font-size: 1.1rem;
23
- font-family: "SF Mono", "Fira Code", "Cascadia Code", monospace;
24
- background: #e8e8e8;
25
- display: inline-block;
26
- padding: 0.2rem 0.6rem;
27
- border-radius: 4px;
28
- margin-bottom: 0.5rem;
29
- }
30
- .note {
31
- font-size: 0.85rem;
32
- color: #666;
33
- margin-top: 0.25rem;
34
- font-style: italic;
35
- }
36
- svg { display: block; margin: 0.5rem 0; border: 1px solid #ddd; border-radius: 6px; background: #fff; }
37
- </style>
38
- </head>
39
- <body>
40
-
41
- <h1>fiz Grammar — Railroad Diagrams</h1>
42
- <p>Auto-generated from <code>lezer-fiz/src/fiz.grammar</code></p>
43
-
44
- <div id="toc" class="toc"></div>
45
- <div id="diagrams"></div>
46
-
47
- <script>
48
- // ── Minimal railroad diagram renderer ──────────────────────────
49
- // Generates SVG railroad/syntax diagrams without any dependencies.
50
-
51
- const FONT = '13px "SF Mono","Fira Code","Cascadia Code",monospace';
52
- const PAD = 6; // text padding inside boxes
53
- const H = 24; // box height
54
- const R = 10; // arc radius
55
- const GAP = 10; // horizontal gap between elements
56
- const VGAP = 8; // vertical gap between choice branches
57
- const ARROW = 8; // arrowhead size
58
-
59
- // Measure text width (approximate, works offline)
60
- const _canvas = document.createElement("canvas");
61
- const _ctx = _canvas.getContext("2d");
62
- _ctx.font = FONT;
63
- function tw(text) { return _ctx.measureText(text).width; }
64
-
65
- // SVG helpers
66
- function svgEl(tag, attrs, ...children) {
67
- const el = document.createElementNS("http://www.w3.org/2000/svg", tag);
68
- for (const [k, v] of Object.entries(attrs || {})) el.setAttribute(k, v);
69
- for (const c of children) {
70
- if (typeof c === "string") el.appendChild(document.createTextNode(c));
71
- else if (c) el.appendChild(c);
72
- }
73
- return el;
74
- }
75
-
76
- function path(d) { return svgEl("path", { d, fill: "none", stroke: "#333", "stroke-width": "2" }); }
77
-
78
- // ── Node types ──────────────────────────────────────────────────
79
-
80
- class Terminal {
81
- constructor(text) { this.text = text; this.w = tw(text) + PAD * 2 + 8; this.h = H; this.label = null; }
82
- render(x, y) {
83
- const g = svgEl("g");
84
- const r = 6;
85
- g.appendChild(svgEl("rect", { x, y: y - this.h / 2, width: this.w, height: this.h, rx: r, ry: r, fill: "#ddf4ff", stroke: "#333", "stroke-width": "1.5" }));
86
- g.appendChild(svgEl("text", { x: x + this.w / 2, y: y + 4.5, "text-anchor": "middle", fill: "#222", style: `font: ${FONT}` }, this.text));
87
- return g;
88
- }
89
- }
90
-
91
- class NonTerminal {
92
- constructor(text) { this.text = text; this.w = tw(text) + PAD * 2 + 8; this.h = H; this.label = null; }
93
- render(x, y) {
94
- const g = svgEl("g");
95
- g.appendChild(svgEl("rect", { x, y: y - this.h / 2, width: this.w, height: this.h, fill: "#fff3cd", stroke: "#333", "stroke-width": "1.5" }));
96
- g.appendChild(svgEl("text", { x: x + this.w / 2, y: y + 4.5, "text-anchor": "middle", fill: "#222", style: `font: ${FONT}` }, this.text));
97
- return g;
98
- }
99
- }
100
-
101
- class Seq {
102
- constructor(items) {
103
- this.items = items;
104
- this.h = Math.max(...items.map(i => i.h));
105
- this.w = items.reduce((s, i) => s + i.w, 0) + GAP * (items.length - 1);
106
- this.label = null;
107
- }
108
- render(x, y) {
109
- const g = svgEl("g");
110
- let cx = x;
111
- for (let i = 0; i < this.items.length; i++) {
112
- const item = this.items[i];
113
- g.appendChild(item.render(cx, y));
114
- cx += item.w;
115
- if (i < this.items.length - 1) {
116
- g.appendChild(path(`M${cx},${y} h${GAP}`));
117
- cx += GAP;
118
- }
119
- }
120
- return g;
121
- }
122
- }
123
-
124
- function measureBranches(items) {
125
- // For each item, measure height above and below center
126
- const above = [];
127
- const below = [];
128
- for (const item of items) {
129
- above.push(item.h / 2);
130
- below.push(item.h / 2);
131
- }
132
- return { above, below };
133
- }
134
-
135
- class ChoiceNode {
136
- constructor(defaultIdx, items) {
137
- this.defaultIdx = defaultIdx;
138
- this.items = items;
139
- const maxW = Math.max(...items.map(i => i.w));
140
- this.innerW = maxW;
141
- this.w = maxW + R * 4 + GAP * 2;
142
-
143
- // Calculate total height
144
- let totalH = 0;
145
- for (let i = 0; i < items.length; i++) {
146
- totalH += items[i].h;
147
- if (i < items.length - 1) totalH += VGAP;
148
- }
149
- this.h = totalH;
150
- this.label = null;
151
-
152
- // Pre-calculate y offsets for each branch (relative to center of default branch)
153
- this.branchY = [];
154
- let accum = 0;
155
- for (let i = 0; i < items.length; i++) {
156
- this.branchY.push(accum + items[i].h / 2);
157
- accum += items[i].h + VGAP;
158
- }
159
- const defaultCenter = this.branchY[defaultIdx];
160
- for (let i = 0; i < this.branchY.length; i++) this.branchY[i] -= defaultCenter;
161
- }
162
- render(x, y) {
163
- const g = svgEl("g");
164
- const midX = x + this.w / 2;
165
- for (let i = 0; i < this.items.length; i++) {
166
- const item = this.items[i];
167
- const by = y + this.branchY[i];
168
- const itemX = midX - item.w / 2;
169
- // Left connector
170
- if (i === this.defaultIdx) {
171
- g.appendChild(path(`M${x},${y} H${itemX}`));
172
- } else {
173
- const goDown = by > y;
174
- if (goDown) {
175
- g.appendChild(path(`M${x},${y} v${by - y - R} a${R},${R} 0 0,0 ${R},${R} H${itemX}`));
176
- } else {
177
- g.appendChild(path(`M${x},${y} v${by - y + R} a${R},${R} 0 0,1 ${R},-${R} H${itemX}`));
178
- }
179
- }
180
- g.appendChild(item.render(itemX, by));
181
- // Right connector
182
- const rightEnd = x + this.w;
183
- const itemRight = itemX + item.w;
184
- if (i === this.defaultIdx) {
185
- g.appendChild(path(`M${itemRight},${by} H${rightEnd}`));
186
- } else {
187
- const goUp = by > y;
188
- if (goUp) {
189
- g.appendChild(path(`M${itemRight},${by} H${rightEnd - R} a${R},${R} 0 0,0 ${R},-${R} V${y}`));
190
- } else {
191
- g.appendChild(path(`M${itemRight},${by} H${rightEnd - R} a${R},${R} 0 0,1 ${R},${R} V${y}`));
192
- }
193
- }
194
- }
195
- return g;
196
- }
197
- }
198
-
199
- class LoopNode {
200
- // item going forward, rep going backward (optional)
201
- constructor(item, rep, skipAllowed) {
202
- this.item = item;
203
- this.rep = rep;
204
- this.skipAllowed = skipAllowed;
205
- this.w = Math.max(item.w, rep ? rep.w : 0) + R * 4 + GAP * 2;
206
- const repH = rep ? rep.h : H * 0.6;
207
- this.h = item.h + repH + VGAP;
208
- this.label = null;
209
- }
210
- render(x, y) {
211
- const g = svgEl("g");
212
- const midX = x + this.w / 2;
213
- const itemX = midX - this.item.w / 2;
214
- const loopY = y + this.item.h / 2 + VGAP + (this.rep ? this.rep.h / 2 : 4);
215
-
216
- if (this.skipAllowed) {
217
- // Draw skip path above
218
- const skipY = y - this.item.h / 2 - VGAP;
219
- g.appendChild(path(`M${x},${y} v${skipY - y + R} a${R},${R} 0 0,1 ${R},-${R} H${x + this.w - R} a${R},${R} 0 0,1 ${R},${R} V${y}`));
220
- }
221
-
222
- // Forward path
223
- g.appendChild(path(`M${x},${y} H${itemX}`));
224
- g.appendChild(this.item.render(itemX, y));
225
- g.appendChild(path(`M${itemX + this.item.w},${y} H${x + this.w}`));
226
-
227
- // Loop-back path
228
- const repX = this.rep ? midX - this.rep.w / 2 : midX;
229
- // Right side going down
230
- g.appendChild(path(`M${x + this.w - R},${y} a${R},${R} 0 0,1 ${R},${R} V${loopY - R} a${R},${R} 0 0,1 -${R},${R}`));
231
- if (this.rep) {
232
- g.appendChild(path(`M${x + this.w - R},${loopY} H${repX + this.rep.w}`));
233
- g.appendChild(this.rep.render(repX, loopY));
234
- g.appendChild(path(`M${repX},${loopY} H${x + R}`));
235
- } else {
236
- // Just a line with arrow
237
- g.appendChild(path(`M${x + this.w - R},${loopY} H${x + R}`));
238
- // Arrow in middle pointing left
239
- const arrowX = midX;
240
- g.appendChild(svgEl("polygon", { points: `${arrowX + 4},${loopY - 4} ${arrowX - 4},${loopY} ${arrowX + 4},${loopY + 4}`, fill: "#333", stroke: "none" }));
241
- }
242
- // Left side going up
243
- g.appendChild(path(`M${x + R},${loopY} a${R},${R} 0 0,1 -${R},-${R} V${y + R} a${R},${R} 0 0,1 ${R},-${R}`));
244
-
245
- return g;
246
- }
247
- }
248
-
249
- class OptNode {
250
- constructor(item) {
251
- this.item = item;
252
- this.w = item.w + R * 4 + GAP * 2;
253
- this.h = item.h + VGAP + R * 2;
254
- this.label = null;
255
- }
256
- render(x, y) {
257
- const g = svgEl("g");
258
- const midX = x + this.w / 2;
259
- const itemX = midX - this.item.w / 2;
260
-
261
- // Main path through item
262
- g.appendChild(path(`M${x},${y} H${itemX}`));
263
- g.appendChild(this.item.render(itemX, y));
264
- g.appendChild(path(`M${itemX + this.item.w},${y} H${x + this.w}`));
265
-
266
- // Skip path (below)
267
- const skipY = y + this.item.h / 2 + VGAP;
268
- g.appendChild(path(`M${x},${y} v${skipY - y - R} a${R},${R} 0 0,0 ${R},${R} H${x + this.w - R} a${R},${R} 0 0,0 ${R},-${R} V${y}`));
269
-
270
- return g;
271
- }
272
- }
273
-
274
- // ── Builder functions ───────────────────────────────────────────
275
-
276
- function T(text) { return new Terminal(text); }
277
- function NT(text) { return new NonTerminal(text); }
278
- function Seq_(...items) { return items.length === 1 ? items[0] : new Seq(items); }
279
- function Choice(defaultIdx, ...items) { return items.length === 1 ? items[0] : new ChoiceNode(defaultIdx, items); }
280
- function Opt(item) { return new OptNode(item); }
281
- function ZeroOrMore(item, rep) { return new LoopNode(item, rep || null, true); }
282
- function OneOrMore(item, rep) { return new LoopNode(item, rep || null, false); }
283
-
284
- function renderDiagram(node) {
285
- const padX = 20;
286
- const padY = 20;
287
- const totalW = node.w + padX * 2 + 30; // extra for entry/exit lines
288
- const totalH = node.h + padY * 2;
289
-
290
- const svg = svgEl("svg", {
291
- width: totalW,
292
- height: totalH,
293
- viewBox: `0 0 ${totalW} ${totalH}`,
294
- class: "railroad-diagram",
295
- });
296
-
297
- const centerY = totalH / 2;
298
- const startX = padX;
299
- const nodeX = padX + 15;
300
-
301
- // Entry line
302
- svg.appendChild(path(`M${startX},${centerY} H${nodeX}`));
303
- // Entry circle
304
- svg.appendChild(svgEl("circle", { cx: startX, cy: centerY, r: 3, fill: "#333" }));
305
-
306
- // Main content
307
- svg.appendChild(node.render(nodeX, centerY));
308
-
309
- // Exit line
310
- const exitStart = nodeX + node.w;
311
- const exitEnd = exitStart + 15;
312
- svg.appendChild(path(`M${exitStart},${centerY} H${exitEnd}`));
313
- // Exit double line
314
- svg.appendChild(svgEl("circle", { cx: exitEnd, cy: centerY, r: 3, fill: "#333" }));
315
- svg.appendChild(svgEl("circle", { cx: exitEnd, cy: centerY, r: 6, fill: "none", stroke: "#333", "stroke-width": "1.5" }));
316
-
317
- return svg;
318
- }
319
-
320
- // ── Grammar definitions ─────────────────────────────────────────
321
-
322
- const rules = [];
323
- function def(name, node, note) { rules.push({ name, node, note }); }
324
-
325
- // Recipe (top-level)
326
- def("Recipe",
327
- ZeroOrMore(NT("statement"))
328
- );
329
-
330
- // statement
331
- def("statement",
332
- Seq_(
333
- Choice(0,
334
- NT("Call"),
335
- NT("RhsVariable"),
336
- NT("Assignment"),
337
- NT("StyleTagDeclaration"),
338
- NT("StyleBinding"),
339
- NT("GlobalStyleBinding"),
340
- NT("Namespace"),
341
- NT("Import"),
342
- ),
343
- NT("semi"),
344
- )
345
- );
346
-
347
- // semi
348
- def("semi",
349
- Choice(0, T(";"), T("\u23CE auto-insert")),
350
- "Semicolons are automatically inserted at newlines (ASI)"
351
- );
352
-
353
- // QualifiableIdentifier
354
- def("QualifiableIdentifier",
355
- Seq_(T("Identifier"), ZeroOrMore(Seq_(T("."), T("Identifier"))))
356
- );
357
-
358
- // Call
359
- def("Call",
360
- Seq_(T("Identifier"), NT("ArgList"), Opt(NT("StyleArgList")))
361
- );
362
-
363
- // ArgList
364
- def("ArgList",
365
- Seq_(T("("), Opt(Seq_(NT("value"), ZeroOrMore(Seq_(T(","), NT("value"))))), T(")"))
366
- );
367
-
368
- // value
369
- def("value",
370
- Choice(0, NT("RhsVariable"), NT("Call")),
371
- "Namespace and Import are disallowed inside ArgList for readability"
372
- );
373
-
374
- // RhsVariable
375
- def("RhsVariable",
376
- NT("QualifiableIdentifier")
377
- );
378
-
379
- // LhsVariable
380
- def("LhsVariable",
381
- Seq_(T("Identifier"), Opt(NT("StyleArgList")))
382
- );
383
-
384
- // Assignment
385
- def("Assignment",
386
- Seq_(
387
- NT("LhsVariable"),
388
- ZeroOrMore(Seq_(T(","), NT("LhsVariable"))),
389
- T("="),
390
- Choice(0, NT("Call"), NT("RhsVariable"), NT("Namespace"), NT("Import")),
391
- )
392
- );
393
-
394
- // Namespace
395
- def("Namespace",
396
- Seq_(Opt(T("Identifier")), NT("StatementList"), Opt(NT("ArgList")), Opt(NT("StyleArgList")))
397
- );
398
-
399
- // StatementList
400
- def("StatementList",
401
- Seq_(T("["), ZeroOrMore(NT("statement")), T("]"))
402
- );
403
-
404
- // Import
405
- def("Import",
406
- Seq_(Opt(T("Identifier")), T("@"), T("StringLiteral")),
407
- "StringLiteral is a path-like resource identifier"
408
- );
409
-
410
- // StyleTagDeclaration
411
- def("StyleTagDeclaration",
412
- Seq_(T("#"), T("Identifier"), NT("StyleArgList"))
413
- );
414
-
415
- // StyleTag
416
- def("StyleTag",
417
- Seq_(T("#"), NT("QualifiableIdentifier"))
418
- );
419
-
420
- // StyleArgList
421
- def("StyleArgList",
422
- Seq_(T("{"), ZeroOrMore(Choice(0, NT("StyleDeclaration"), NT("StyleTag"), T("StringLiteral"))), T("}"))
423
- );
424
-
425
- // StyleDeclaration
426
- def("StyleDeclaration",
427
- Seq_(NT("PropertyName"), T(":"), NT("styleValue"), ZeroOrMore(Seq_(T(","), NT("styleValue"))), NT("semi"))
428
- );
429
-
430
- // styleValue
431
- def("styleValue",
432
- Choice(0, T("ColorLiteral"), NT("NumberLiteral"), T("StringLiteral"))
433
- );
434
-
435
- // StyleBinding
436
- def("StyleBinding",
437
- Seq_(T("%"), T("Identifier"), NT("StyleArgList"))
438
- );
439
-
440
- // GlobalStyleBinding
441
- def("GlobalStyleBinding",
442
- Seq_(T("*"), T("Identifier"), NT("StyleArgList"))
443
- );
444
-
445
- // NumberLiteral
446
- def("NumberLiteral",
447
- Seq_(T("number"), Opt(T("Unit")))
448
- );
449
-
450
- // PropertyName
451
- def("PropertyName",
452
- T("cssIdentifier")
453
- );
454
-
455
- // Identifier (token)
456
- def("Identifier",
457
- Seq_(T("letter | _ | $"), ZeroOrMore(T("letter | digit | _ | $"))),
458
- "Token rule — also allows Unicode \\u00A1+"
459
- );
460
-
461
- // ColorLiteral (token)
462
- def("ColorLiteral",
463
- Seq_(T("#"), T("hex\u00D7 3"), Opt(Seq_(T("hex"), Opt(Seq_(T("hex\u00D7 2"), Opt(T("hex\u00D7 2"))))))),
464
- "Supports #RGB, #RGBA, #RRGGBB, #RRGGBBAA"
465
- );
466
-
467
- // StringLiteral (token)
468
- def("StringLiteral",
469
- Choice(0,
470
- Seq_(T('"'), ZeroOrMore(Choice(0, T("char"), Seq_(T("\\"), T("any")))), T('"')),
471
- Seq_(T("'"), ZeroOrMore(Choice(0, T("char"), Seq_(T("\\"), T("any")))), T("'")),
472
- ),
473
- "Double or single quoted with backslash escapes"
474
- );
475
-
476
- // ── Render all ──────────────────────────────────────────────────
477
-
478
- const container = document.getElementById("diagrams");
479
- const tocEl = document.getElementById("toc");
480
-
481
- for (const { name, node, note } of rules) {
482
- const id = "rule-" + name;
483
-
484
- // TOC entry
485
- const a = document.createElement("a");
486
- a.href = "#" + id;
487
- a.textContent = name;
488
- tocEl.appendChild(a);
489
-
490
- // Section
491
- const section = document.createElement("section");
492
- section.id = id;
493
- const heading = document.createElement("h2");
494
- heading.textContent = name;
495
- section.appendChild(heading);
496
-
497
- try {
498
- section.appendChild(renderDiagram(node));
499
- } catch (e) {
500
- const err = document.createElement("pre");
501
- err.style.color = "red";
502
- err.textContent = "Error rendering: " + e.message;
503
- section.appendChild(err);
504
- }
505
-
506
- if (note) {
507
- const p = document.createElement("p");
508
- p.className = "note";
509
- p.textContent = note;
510
- section.appendChild(p);
511
- }
512
-
513
- container.appendChild(section);
514
- }
515
- </script>
516
- </body>
517
- </html>