@nowline/core 0.2.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/LICENSE +190 -0
- package/README.md +84 -0
- package/dist/generated/ast.d.ts +958 -0
- package/dist/generated/ast.d.ts.map +1 -0
- package/dist/generated/ast.js +795 -0
- package/dist/generated/ast.js.map +1 -0
- package/dist/generated/grammar.d.ts +7 -0
- package/dist/generated/grammar.d.ts.map +1 -0
- package/dist/generated/grammar.js +2509 -0
- package/dist/generated/grammar.js.map +1 -0
- package/dist/generated/module.d.ts +14 -0
- package/dist/generated/module.d.ts.map +1 -0
- package/dist/generated/module.js +21 -0
- package/dist/generated/module.js.map +1 -0
- package/dist/i18n/codes.d.ts +3 -0
- package/dist/i18n/codes.d.ts.map +1 -0
- package/dist/i18n/codes.js +54 -0
- package/dist/i18n/codes.js.map +1 -0
- package/dist/i18n/index.d.ts +17 -0
- package/dist/i18n/index.d.ts.map +1 -0
- package/dist/i18n/index.js +82 -0
- package/dist/i18n/index.js.map +1 -0
- package/dist/i18n/messages.en.d.ts +96 -0
- package/dist/i18n/messages.en.d.ts.map +1 -0
- package/dist/i18n/messages.en.js +57 -0
- package/dist/i18n/messages.en.js.map +1 -0
- package/dist/i18n/messages.fr-CA.d.ts +3 -0
- package/dist/i18n/messages.fr-CA.d.ts.map +1 -0
- package/dist/i18n/messages.fr-CA.js +11 -0
- package/dist/i18n/messages.fr-CA.js.map +1 -0
- package/dist/i18n/messages.fr-FR.d.ts +3 -0
- package/dist/i18n/messages.fr-FR.d.ts.map +1 -0
- package/dist/i18n/messages.fr-FR.js +11 -0
- package/dist/i18n/messages.fr-FR.js.map +1 -0
- package/dist/i18n/messages.fr.d.ts +3 -0
- package/dist/i18n/messages.fr.d.ts.map +1 -0
- package/dist/i18n/messages.fr.js +55 -0
- package/dist/i18n/messages.fr.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/language/include-resolver.d.ts +46 -0
- package/dist/language/include-resolver.d.ts.map +1 -0
- package/dist/language/include-resolver.js +306 -0
- package/dist/language/include-resolver.js.map +1 -0
- package/dist/language/nowline-module.d.ts +18 -0
- package/dist/language/nowline-module.d.ts.map +1 -0
- package/dist/language/nowline-module.js +63 -0
- package/dist/language/nowline-module.js.map +1 -0
- package/dist/language/nowline-validator.d.ts +65 -0
- package/dist/language/nowline-validator.d.ts.map +1 -0
- package/dist/language/nowline-validator.js +1654 -0
- package/dist/language/nowline-validator.js.map +1 -0
- package/package.json +37 -0
- package/src/generated/ast.ts +1178 -0
- package/src/generated/grammar.ts +2511 -0
- package/src/generated/module.ts +25 -0
- package/src/i18n/codes.ts +102 -0
- package/src/i18n/index.ts +102 -0
- package/src/i18n/messages.en.ts +86 -0
- package/src/i18n/messages.fr-CA.ts +13 -0
- package/src/i18n/messages.fr-FR.ts +13 -0
- package/src/i18n/messages.fr.ts +91 -0
- package/src/index.ts +22 -0
- package/src/language/include-resolver.ts +470 -0
- package/src/language/nowline-module.ts +114 -0
- package/src/language/nowline-validator.ts +1991 -0
- package/src/language/nowline.langium +217 -0
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
grammar Nowline
|
|
2
|
+
|
|
3
|
+
entry NowlineFile:
|
|
4
|
+
(directive=NowlineDirective)?
|
|
5
|
+
(includes+=IncludeDeclaration)*
|
|
6
|
+
(hasConfig?='config'
|
|
7
|
+
configEntries+=ConfigEntry*)?
|
|
8
|
+
(roadmapDecl=RoadmapDeclaration)?
|
|
9
|
+
(roadmapEntries+=RoadmapEntry)*;
|
|
10
|
+
|
|
11
|
+
NowlineDirective:
|
|
12
|
+
'nowline' version=ID
|
|
13
|
+
(properties+=BlockProperty)*;
|
|
14
|
+
|
|
15
|
+
IncludeDeclaration:
|
|
16
|
+
'include' path=STRING
|
|
17
|
+
(options+=IncludeOption)*;
|
|
18
|
+
|
|
19
|
+
IncludeOption:
|
|
20
|
+
key=INCLUDE_OPTION_KEY value=ID;
|
|
21
|
+
|
|
22
|
+
// --- Config Entries ---
|
|
23
|
+
|
|
24
|
+
ConfigEntry:
|
|
25
|
+
ScaleBlock | CalendarBlock | StyleDeclaration | SymbolDeclaration | DefaultDeclaration;
|
|
26
|
+
|
|
27
|
+
ScaleBlock:
|
|
28
|
+
'scale'
|
|
29
|
+
(INDENT properties+=BlockProperty+ DEDENT)?;
|
|
30
|
+
|
|
31
|
+
CalendarBlock:
|
|
32
|
+
'calendar'
|
|
33
|
+
(INDENT properties+=BlockProperty+ DEDENT)?;
|
|
34
|
+
|
|
35
|
+
BlockPropertyValue returns string:
|
|
36
|
+
ID | INTEGER | STRING | DURATION_LITERAL;
|
|
37
|
+
|
|
38
|
+
StyleDeclaration:
|
|
39
|
+
'style' (name=ID)? (title=STRING)?
|
|
40
|
+
(INDENT properties+=StyleProperty+ DEDENT)?;
|
|
41
|
+
|
|
42
|
+
SymbolDeclaration:
|
|
43
|
+
'symbol' (name=ID)? (title=STRING)?
|
|
44
|
+
(properties+=EntityProperty)*
|
|
45
|
+
(INDENT description=DescriptionDirective DEDENT)?;
|
|
46
|
+
|
|
47
|
+
// 'person' appears here as an explicit alternative because it is also a declaration
|
|
48
|
+
// keyword (PersonDeclaration / PersonMemberRef), and Langium's lexer tokenizes it as
|
|
49
|
+
// the keyword in preference to ID. Without the alternation, `capacity-icon:person`
|
|
50
|
+
// (a built-in capacity-icon name) would fail to parse. Other built-in icon names
|
|
51
|
+
// (`none`, `multiplier`, `people`, `points`, `time`, `shield`, `warning`, `lock`)
|
|
52
|
+
// are not grammar keywords and therefore lex as ID without help.
|
|
53
|
+
StylePropertyValue returns string:
|
|
54
|
+
ID | COLOR_HEX | STRING | 'person';
|
|
55
|
+
|
|
56
|
+
DefaultDeclaration:
|
|
57
|
+
'default' entityType=DefaultEntityType
|
|
58
|
+
(properties+=EntityProperty)*;
|
|
59
|
+
|
|
60
|
+
DefaultEntityType returns string:
|
|
61
|
+
'item' | 'label' | 'swimlane' | 'roadmap' | 'milestone' |
|
|
62
|
+
'footnote' | 'anchor' | 'parallel' | 'group';
|
|
63
|
+
|
|
64
|
+
// --- Roadmap ---
|
|
65
|
+
|
|
66
|
+
RoadmapDeclaration:
|
|
67
|
+
'roadmap' (name=ID)? (title=STRING)?
|
|
68
|
+
(properties+=EntityProperty)*;
|
|
69
|
+
|
|
70
|
+
RoadmapEntry:
|
|
71
|
+
PersonDeclaration | TeamDeclaration | AnchorDeclaration |
|
|
72
|
+
LabelDeclaration | SizeDeclaration | StatusDeclaration |
|
|
73
|
+
SwimlaneDeclaration | MilestoneDeclaration | FootnoteDeclaration;
|
|
74
|
+
|
|
75
|
+
PersonDeclaration:
|
|
76
|
+
'person' (name=ID)? (title=STRING)?
|
|
77
|
+
(properties+=EntityProperty)*
|
|
78
|
+
(INDENT description=DescriptionDirective DEDENT)?;
|
|
79
|
+
|
|
80
|
+
TeamDeclaration:
|
|
81
|
+
'team' (name=ID)? (title=STRING)?
|
|
82
|
+
(properties+=EntityProperty)*
|
|
83
|
+
(INDENT content+=TeamContent+ DEDENT)?;
|
|
84
|
+
|
|
85
|
+
TeamContent:
|
|
86
|
+
DescriptionDirective | PersonMemberRef | TeamDeclaration;
|
|
87
|
+
|
|
88
|
+
PersonMemberRef:
|
|
89
|
+
'person' ref=ID;
|
|
90
|
+
|
|
91
|
+
AnchorDeclaration:
|
|
92
|
+
'anchor' (name=ID)? (title=STRING)?
|
|
93
|
+
(properties+=EntityProperty)*
|
|
94
|
+
(INDENT description=DescriptionDirective DEDENT)?;
|
|
95
|
+
|
|
96
|
+
LabelDeclaration:
|
|
97
|
+
'label' (name=ID)? (title=STRING)?
|
|
98
|
+
(properties+=EntityProperty)*
|
|
99
|
+
(INDENT description=DescriptionDirective DEDENT)?;
|
|
100
|
+
|
|
101
|
+
SizeDeclaration:
|
|
102
|
+
'size' (name=ID)? (title=STRING)?
|
|
103
|
+
(properties+=EntityProperty)*
|
|
104
|
+
(INDENT description=DescriptionDirective DEDENT)?;
|
|
105
|
+
|
|
106
|
+
StatusDeclaration:
|
|
107
|
+
'status' (name=ID)? (title=STRING)?
|
|
108
|
+
(properties+=EntityProperty)*
|
|
109
|
+
(INDENT description=DescriptionDirective DEDENT)?;
|
|
110
|
+
|
|
111
|
+
SwimlaneDeclaration:
|
|
112
|
+
'swimlane' (name=ID)? (title=STRING)?
|
|
113
|
+
(properties+=EntityProperty)*
|
|
114
|
+
(INDENT content+=SwimlaneContent+ DEDENT)?;
|
|
115
|
+
|
|
116
|
+
SwimlaneContent:
|
|
117
|
+
DescriptionDirective | ItemDeclaration | ParallelBlock | GroupBlock;
|
|
118
|
+
|
|
119
|
+
ItemDeclaration:
|
|
120
|
+
'item' (name=ID)? (title=STRING)?
|
|
121
|
+
(properties+=EntityProperty)*
|
|
122
|
+
(INDENT description=DescriptionDirective DEDENT)?;
|
|
123
|
+
|
|
124
|
+
ParallelBlock:
|
|
125
|
+
'parallel' (name=ID)? (title=STRING)?
|
|
126
|
+
(properties+=EntityProperty)*
|
|
127
|
+
INDENT content+=ParallelContent+ DEDENT;
|
|
128
|
+
|
|
129
|
+
ParallelContent:
|
|
130
|
+
DescriptionDirective | ItemDeclaration | GroupBlock;
|
|
131
|
+
|
|
132
|
+
GroupBlock:
|
|
133
|
+
'group' (name=ID)? (title=STRING)?
|
|
134
|
+
(properties+=EntityProperty)*
|
|
135
|
+
INDENT content+=GroupContent+ DEDENT;
|
|
136
|
+
|
|
137
|
+
GroupContent:
|
|
138
|
+
DescriptionDirective | ItemDeclaration | ParallelBlock | GroupBlock;
|
|
139
|
+
|
|
140
|
+
MilestoneDeclaration:
|
|
141
|
+
'milestone' (name=ID)? (title=STRING)?
|
|
142
|
+
(properties+=EntityProperty)*
|
|
143
|
+
(INDENT description=DescriptionDirective DEDENT)?;
|
|
144
|
+
|
|
145
|
+
FootnoteDeclaration:
|
|
146
|
+
'footnote' (name=ID)? (title=STRING)?
|
|
147
|
+
(properties+=EntityProperty)*
|
|
148
|
+
(INDENT description=DescriptionDirective DEDENT)?;
|
|
149
|
+
|
|
150
|
+
DescriptionDirective:
|
|
151
|
+
'description' text=STRING;
|
|
152
|
+
|
|
153
|
+
// --- Properties ---
|
|
154
|
+
|
|
155
|
+
// EntityProperty uses a single "key:" token so that keywords like `status`, `size`,
|
|
156
|
+
// `label`, `style`, etc. still parse unambiguously as property keys when followed by `:`.
|
|
157
|
+
// The validator strips the trailing `:` and validates the key text.
|
|
158
|
+
EntityProperty:
|
|
159
|
+
key=PROPERTY_KEY_WITH_COLON (
|
|
160
|
+
value=PropertyAtom |
|
|
161
|
+
'[' values+=PropertyAtom (',' values+=PropertyAtom)* ']'
|
|
162
|
+
);
|
|
163
|
+
|
|
164
|
+
BlockProperty:
|
|
165
|
+
key=PROPERTY_KEY_WITH_COLON value=BlockPropertyValue;
|
|
166
|
+
|
|
167
|
+
StyleProperty:
|
|
168
|
+
key=PROPERTY_KEY_WITH_COLON value=StylePropertyValue;
|
|
169
|
+
|
|
170
|
+
// 'person' appears here for the same reason as in StylePropertyValue — it is a
|
|
171
|
+
// declaration keyword that the lexer prefers over ID, but it must also be accepted
|
|
172
|
+
// as a property-atom value (e.g. `default swimlane capacity-icon:person`).
|
|
173
|
+
PropertyAtom returns string:
|
|
174
|
+
ID | STRING | DURATION_LITERAL | PERCENTAGE | URL | DATE_LITERAL | COLOR_HEX | DECIMAL | INTEGER | 'person';
|
|
175
|
+
|
|
176
|
+
// --- Terminals ---
|
|
177
|
+
// INDENT/DEDENT must be declared before ID to avoid Chevrotain unreachable-token errors.
|
|
178
|
+
// Their patterns are placeholders — IndentationAwareTokenBuilder replaces the matchers at runtime.
|
|
179
|
+
|
|
180
|
+
terminal INDENT: /\x01/;
|
|
181
|
+
terminal DEDENT: /\x02/;
|
|
182
|
+
|
|
183
|
+
// INCLUDE_OPTION_KEY matches "config:" or "roadmap:" as a single token so the parser can
|
|
184
|
+
// distinguish include options from top-level config/roadmap section markers without lookahead.
|
|
185
|
+
terminal INCLUDE_OPTION_KEY: /(config|roadmap):/;
|
|
186
|
+
|
|
187
|
+
// URL must precede ID so that https://... isn't tokenized as "https" + ":" + error.
|
|
188
|
+
terminal URL: /https?:\/\/[^\s\[\],]+/;
|
|
189
|
+
terminal STRING: /"([^"\\]|\\.)*"/;
|
|
190
|
+
terminal DATE_LITERAL: /\d{4}-\d{2}-\d{2}/;
|
|
191
|
+
terminal DURATION_LITERAL: /\d+(\.\d+)?[dwmqy]/;
|
|
192
|
+
terminal PERCENTAGE: /\d+(\.\d+)?%/;
|
|
193
|
+
terminal COLOR_HEX: /#[0-9a-fA-F]{3,8}/;
|
|
194
|
+
// DECIMAL must precede INTEGER so that "0.5" lexes as one token (max-munch handles this,
|
|
195
|
+
// but ordering keeps the grammar's intent obvious to readers). Requires both a leading and
|
|
196
|
+
// trailing digit to avoid colliding with integer-then-property-value patterns.
|
|
197
|
+
terminal DECIMAL: /\d+\.\d+/;
|
|
198
|
+
terminal INTEGER: /\d+/;
|
|
199
|
+
// PROPERTY_KEY_WITH_COLON matches `name:` as a single token. Because it is longer than any
|
|
200
|
+
// bare keyword, the lexer prefers it over keywords when a colon immediately follows — letting
|
|
201
|
+
// us use `size:`, `status:`, `label:`, `style:` etc. as property keys without shadowing
|
|
202
|
+
// those words as declaration keywords. (`duration:` is also a property key — literal-only —
|
|
203
|
+
// even though no `duration` declaration keyword exists.)
|
|
204
|
+
terminal PROPERTY_KEY_WITH_COLON: /[a-zA-Z_][a-zA-Z0-9_-]*:/;
|
|
205
|
+
terminal ID: /[a-zA-Z_][a-zA-Z0-9_-]*/;
|
|
206
|
+
|
|
207
|
+
hidden terminal WS: /[\t ]+/;
|
|
208
|
+
hidden terminal NL: /[\r\n]+/;
|
|
209
|
+
hidden terminal SL_COMMENT: /\/\/[^\r\n]*/;
|
|
210
|
+
hidden terminal ML_COMMENT: /\/\*[\s\S]*?\*\//;
|
|
211
|
+
// Joins a property line with the next physical line. The backslash, the newline,
|
|
212
|
+
// and the next line's leading whitespace are all swallowed, so the continuation
|
|
213
|
+
// line attaches to the previous logical token stream and IndentationAwareLexer
|
|
214
|
+
// does not emit INDENT/DEDENT for it. See specs/dsl.md "Line Continuation".
|
|
215
|
+
// Tolerates trailing whitespace between `\` and the newline so invisible spaces
|
|
216
|
+
// don't silently break a continuation.
|
|
217
|
+
hidden terminal LINE_CONTINUATION: /\\[ \t]*\r?\n[ \t]*/;
|