@formulavize/lezer-fiz 2.1.1 → 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 = 45,
9
- insertSemi = 46,
10
- spaces = 48,
11
- newline = 49,
8
+ cssIdentifier = 49,
9
+ insertSemi = 50,
10
+ spaces = 52,
11
+ newline = 53,
12
12
  LineComment = 2,
13
13
  BlockComment = 3;
14
14
 
@@ -99,6 +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.processingInstruction,
103
+ "AboutNote/Identifier": highlight.tags.annotation,
102
104
  "( )": highlight.tags.paren,
103
105
  "{ }": highlight.tags.brace,
104
106
  "[ ]": highlight.tags.squareBracket,
@@ -110,24 +112,24 @@ const fizHighlighting = highlight.styleTags({
110
112
  // This file was generated by lezer-generator. You probably shouldn't edit it.
111
113
  const parser = lr.LRParser.deserialize({
112
114
  version: 14,
113
- states: "+|Q`QSOOO!YQdO'#CgOOQ`'#Cf'#CfO!gQSO'#CzO!nQdO'#CwO!|QSO'#C{O#RQSO'#CtO#ZQSO'#C}O#`QSO'#DOO#eQSO'#DQO#jQdO'#D`OOQO'#DS'#DSQ`QSOOO#rQSO'#DTO#wQfO,59RO$fQSO'#CeO$nQUO'#CkO$|QdO,58{OOQO,59a,59aO%_QdO,59cO%mQSO,59gOOQ`,59f,59fO%rQSO,59fOOQ`,59c,59cO%bQdO,59cOOQ`,59g,59gO%yQSO'#DXO&OQSO,59`O&WQSO,59`O&cQSO,59iO&cQSO,59jO&cQSO,59lOOQQ'#De'#DeOOQO,59z,59zOOQO-E7Q-E7QOOQb,59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: "&^!YPPPPP!ZPPP!k!Z!vPPP#T#o#sPP#wP#oP#{$RP$[PP$h$[P#{#{P#{P$t%O%X%_%e%kPPPPPP%q%wP%}P&TWYOR[fSv_!_Q!ZlR!h!XUaPu!YQhSR!Rc`QOR[_fl!X!_R!d{SbP!UQgSQ!PaS!QchQ![mQ!]nQ!^oR!g!RT|`}Tz`}T!m!b!pXYOR[fWUOR[fR!VjWYOR[fQ!ZlR!h!X[SOR[fl!XTcP!YQ[OQfRTr[fW^Pu!Y!cRt^Q!`xR!j!`Q}`R!e}Q!q!nR!t!qQkUR!WkXZOR[fQx_R!i!_Q!n!bR!s!pQqYQ!r!nR!u!q",
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 *",
117
- maxTerm: 56,
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,59sOOQb-E7V-E7VO&vQSO'#CgOOQO'#De'#DeOOQ`,59P,59PO'UQSO,59POOQO'#Cm'#CmO'^QSO'#ClO'cQSO'#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$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,
118
120
  context: trackNewline,
119
121
  nodeProps: [
120
- ["group", -2,5,10,"Statement Value",-3,19,20,21,"StyleValue",-6,24,27,31,33,34,36,"Statement"],
122
+ ["group", -2,5,10,"Statement Value",-3,19,20,21,"StyleValue",-8,24,27,31,33,34,36,38,40,"Statement"],
121
123
  ["openedBy", 7,"(",13,"{",28,"["],
122
124
  ["closedBy", 8,")",14,"}",29,"]"]
123
125
  ],
124
126
  propSources: [fizHighlighting],
125
127
  skippedNodes: [0,2,3],
126
128
  repeatNodeCount: 6,
127
- tokenData: "3P~R!RXY$[YZ%PZ[$[]^%Ppq$[rs%Ust&xtu)Zuv*Owx*Txy+ryz+wz{+|{|,R|}-m}!O,R!O!P-r!P!Q-z!Q![-[![!]/s!]!^/x!_!`/}!b!c0S!c!})Z!}#O0X#P#Q0^#R#S)Z#T#o)Z#o#p0c#q#r0h$f$g$[$g#BY)Z#BY#BZ0m#BZ$IS)Z$IS$I_0m$I_$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insertSemicolon],
129
131
  topRules: {"Recipe":[0,4]},
130
- tokenPrec: 388
132
+ tokenPrec: 402
131
133
  });
132
134
 
133
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 = 45,
7
- insertSemi = 46,
8
- spaces = 48,
9
- newline = 49,
6
+ cssIdentifier = 49,
7
+ insertSemi = 50,
8
+ spaces = 52,
9
+ newline = 53,
10
10
  LineComment = 2,
11
11
  BlockComment = 3;
12
12
 
@@ -97,6 +97,8 @@ const fizHighlighting = styleTags({
97
97
  Unit: tags.unit,
98
98
  StyleTag: tags.tagName,
99
99
  Namespace: tags.namespace,
100
+ "RendererDirective/Identifier": tags.processingInstruction,
101
+ "AboutNote/Identifier": tags.annotation,
100
102
  "( )": tags.paren,
101
103
  "{ }": tags.brace,
102
104
  "[ ]": tags.squareBracket,
@@ -108,24 +110,24 @@ const fizHighlighting = styleTags({
108
110
  // This file was generated by lezer-generator. You probably shouldn't edit it.
109
111
  const parser = LRParser.deserialize({
110
112
  version: 14,
111
- states: "+|Q`QSOOO!YQdO'#CgOOQ`'#Cf'#CfO!gQSO'#CzO!nQdO'#CwO!|QSO'#C{O#RQSO'#CtO#ZQSO'#C}O#`QSO'#DOO#eQSO'#DQO#jQdO'#D`OOQO'#DS'#DSQ`QSOOO#rQSO'#DTO#wQfO,59RO$fQSO'#CeO$nQUO'#CkO$|QdO,58{OOQO,59a,59aO%_QdO,59cO%mQSO,59gOOQ`,59f,59fO%rQSO,59fOOQ`,59c,59cO%bQdO,59cOOQ`,59g,59gO%yQSO'#DXO&OQSO,59`O&WQSO,59`O&cQSO,59iO&cQSO,59jO&cQSO,59lOOQQ'#De'#DeOOQO,59z,59zOOQO-E7Q-E7QOOQb,59o,59oOOQb-E7R-E7RO&hQSO'#CgOOQO'#Da'#DaOOQ`,59P,59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PP$h$[P#{#{P#{P$t%O%X%_%e%kPPPPPP%q%wP%}P&TWYOR[fSv_!_Q!ZlR!h!XUaPu!YQhSR!Rc`QOR[_fl!X!_R!d{SbP!UQgSQ!PaS!QchQ![mQ!]nQ!^oR!g!RT|`}Tz`}T!m!b!pXYOR[fWUOR[fR!VjWYOR[fQ!ZlR!h!X[SOR[fl!XTcP!YQ[OQfRTr[fW^Pu!Y!cRt^Q!`xR!j!`Q}`R!e}Q!q!nR!t!qQkUR!WkXZOR[fQx_R!i!_Q!n!bR!s!pQqYQ!r!nR!u!q",
114
- 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 *",
115
- maxTerm: 56,
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,59s,59sOOQb-E7V-E7VO&vQSO'#CgOOQO'#De'#DeOOQ`,59P,59PO'UQSO,59POOQO'#Cm'#CmO'^QSO'#ClO'cQSO'#CrOOQQ'#DZ'#DZO'hQUO,59VOOQ`,59V,59VOOQ`1G.g1G.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%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,
116
118
  context: trackNewline,
117
119
  nodeProps: [
118
- ["group", -2,5,10,"Statement Value",-3,19,20,21,"StyleValue",-6,24,27,31,33,34,36,"Statement"],
120
+ ["group", -2,5,10,"Statement Value",-3,19,20,21,"StyleValue",-8,24,27,31,33,34,36,38,40,"Statement"],
119
121
  ["openedBy", 7,"(",13,"{",28,"["],
120
122
  ["closedBy", 8,")",14,"}",29,"]"]
121
123
  ],
122
124
  propSources: [fizHighlighting],
123
125
  skippedNodes: [0,2,3],
124
126
  repeatNodeCount: 6,
125
- tokenData: "3P~R!RXY$[YZ%PZ[$[]^%Ppq$[rs%Ust&xtu)Zuv*Owx*Txy+ryz+wz{+|{|,R|}-m}!O,R!O!P-r!P!Q-z!Q![-[![!]/s!]!^/x!_!`/}!b!c0S!c!})Z!}#O0X#P#Q0^#R#S)Z#T#o)Z#o#p0c#q#r0h$f$g$[$g#BY)Z#BY#BZ0m#BZ$IS)Z$IS$I_0m$I_$I|)Z$I|$I}2`$I}$JO2`$JO$JT)Z$JT$JU0m$JU$KV)Z$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 tokenPrec: 402
129
131
  });
130
132
 
131
133
  export { parser };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formulavize/lezer-fiz",
3
- "version": "2.1.1",
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
@@ -8,6 +8,8 @@ statement[@isGroup=Statement] {
8
8
  StyleTagDeclaration |
9
9
  StyleBinding |
10
10
  GlobalStyleBinding |
11
+ RendererDirective |
12
+ AboutNote |
11
13
  Namespace |
12
14
  Import
13
15
  )
@@ -53,6 +55,10 @@ StyleBinding { "%" Identifier StyleArgList }
53
55
 
54
56
  GlobalStyleBinding { "*" Identifier StyleArgList }
55
57
 
58
+ RendererDirective { "^" Identifier StyleArgList }
59
+
60
+ AboutNote { "~" Identifier? StyleArgList }
61
+
56
62
  StatementList { "[" statement* "]" }
57
63
 
58
64
  Namespace { Identifier? StatementList ArgList? StyleArgList? }
@@ -111,6 +117,10 @@ Import { Identifier? "@" StringLiteral }
111
117
 
112
118
  "*"
113
119
 
120
+ "^"
121
+
122
+ "~"
123
+
114
124
  "(" ")" "{" "}" "[" "]"
115
125
 
116
126
  }
package/src/highlight.js CHANGED
@@ -12,6 +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.processingInstruction,
16
+ "AboutNote/Identifier": t.annotation,
15
17
  "( )": t.paren,
16
18
  "{ }": t.brace,
17
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
+ )
@@ -0,0 +1,154 @@
1
+ # Empty Renderer Directive
2
+
3
+ ^cytoscape{}
4
+
5
+ ==>
6
+
7
+ Recipe(
8
+ RendererDirective(Identifier, StyleArgList())
9
+ )
10
+
11
+ # Renderer Directive with Style Declarations
12
+
13
+ ^cytoscape{
14
+ rankDir: "LR"
15
+ background-color: #ff0000
16
+ }
17
+
18
+ ==>
19
+
20
+ Recipe(
21
+ RendererDirective(
22
+ Identifier,
23
+ StyleArgList(
24
+ StyleDeclaration(PropertyName, StringLiteral),
25
+ StyleDeclaration(PropertyName, ColorLiteral)
26
+ )
27
+ )
28
+ )
29
+
30
+ # Renderer Directive with StyleTags
31
+
32
+ ^cytoscape{
33
+ #compact #dark
34
+ }
35
+
36
+ ==>
37
+
38
+ Recipe(
39
+ RendererDirective(
40
+ Identifier,
41
+ StyleArgList(
42
+ StyleTag(QualifiableIdentifier(Identifier)),
43
+ StyleTag(QualifiableIdentifier(Identifier))
44
+ )
45
+ )
46
+ )
47
+
48
+ # Renderer Directive with Qualified StyleTag
49
+
50
+ ^cytoscape{ #themes.compact }
51
+
52
+ ==>
53
+
54
+ Recipe(
55
+ RendererDirective(
56
+ Identifier,
57
+ StyleArgList(
58
+ StyleTag(QualifiableIdentifier(Identifier, Identifier))
59
+ )
60
+ )
61
+ )
62
+
63
+ # Renderer Directive Mixed Content
64
+
65
+ ^cytoscape{
66
+ #base
67
+ rankDir: "TB"
68
+ "note"
69
+ }
70
+
71
+ ==>
72
+
73
+ Recipe(
74
+ RendererDirective(
75
+ Identifier,
76
+ StyleArgList(
77
+ StyleTag(QualifiableIdentifier(Identifier)),
78
+ StyleDeclaration(PropertyName, StringLiteral),
79
+ StringLiteral
80
+ )
81
+ )
82
+ )
83
+
84
+ # Multiple Renderer Directives
85
+
86
+ ^cytoscape{ rankDir: "LR" }
87
+ ^minimal{ x: "y" }
88
+
89
+ ==>
90
+
91
+ Recipe(
92
+ RendererDirective(
93
+ Identifier,
94
+ StyleArgList(StyleDeclaration(PropertyName, StringLiteral))
95
+ )
96
+ RendererDirective(
97
+ Identifier,
98
+ StyleArgList(StyleDeclaration(PropertyName, StringLiteral))
99
+ )
100
+ )
101
+
102
+ # Renderer Directive Alongside Global Style Binding
103
+
104
+ *node{ color: #abc }
105
+ ^cytoscape{ rankDir: "RL" }
106
+
107
+ ==>
108
+
109
+ Recipe(
110
+ GlobalStyleBinding(
111
+ Identifier,
112
+ StyleArgList(StyleDeclaration(PropertyName, ColorLiteral))
113
+ )
114
+ RendererDirective(
115
+ Identifier,
116
+ StyleArgList(StyleDeclaration(PropertyName, StringLiteral))
117
+ )
118
+ )
119
+
120
+ # Renderer Directive with Semicolons
121
+
122
+ ^cytoscape{ rankDir: "LR"; background-color: "#fff" };
123
+
124
+ ==>
125
+
126
+ Recipe(
127
+ RendererDirective(
128
+ Identifier,
129
+ StyleArgList(
130
+ StyleDeclaration(PropertyName, StringLiteral),
131
+ StyleDeclaration(PropertyName, StringLiteral)
132
+ )
133
+ )
134
+ )
135
+
136
+ # Renderer Directive in a StatementList
137
+
138
+ ns[
139
+ ^cytoscape{ rankDir: "LR" }
140
+ ]
141
+
142
+ ==>
143
+
144
+ Recipe(
145
+ Namespace(
146
+ Identifier,
147
+ StatementList(
148
+ RendererDirective(
149
+ Identifier,
150
+ StyleArgList(StyleDeclaration(PropertyName, StringLiteral))
151
+ )
152
+ )
153
+ )
154
+ )
@@ -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>