-
Notifications
You must be signed in to change notification settings - Fork 77
Expand file tree
/
Copy pathliquid-html.ohm
More file actions
620 lines (505 loc) · 21.8 KB
/
liquid-html.ohm
File metadata and controls
620 lines (505 loc) · 21.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
Helpers {
Node = TextNode*
TextNode = AnyExceptPlus<openControl>
openControl = end
empty = /* nothing */
anyExcept<lit> = (~ lit any)
anyExceptStar<lit> = (~ lit any)*
anyExceptPlus<lit> = (~ lit any)+
AnyExcept<lit> = (~ lit any)
AnyExceptPlus<lit> = (~ lit any)+
AnyExceptStar<lit> = (~ lit any)*
identifierCharacter = alnum | "_" | "-"
orderedListOf<a, b, sep> =
| nonemptyOrderedListOf<a, b, sep>
| emptyListOf<a, sep>
nonemptyOrderedListOf<a, b, sep> =
| nonemptyListOf<b, sep>
| nonemptyOrderedListOfBoth<a, b, sep>
| nonemptyListOf<a, sep>
nonemptyOrderedListOfBoth<a, b, sep> =
nonemptyListOf<a, sep> (sep nonemptyListOf<b, sep>)
singleQuote = "'" | "‘" | "’"
doubleQuote = "\"" | "“" | "”"
controls = "\u{007F}".."\u{009F}"
noncharacters = "\u{FDD0}".."\u{FDEF}"
newline = "\r"? "\n"
}
Liquid <: Helpers {
Node := (liquidNode | TextNode)*
openControl := "{{" | "{%"
endOfTagName = &("-%}" | "-}}" | "%}" | "}}")
endOfVarName = ~identifierCharacter
endOfIdentifier = endOfTagName | endOfVarName
liquidNode =
| liquidDoc
| liquidBlockComment
| liquidRawTag
| liquidDrop
| liquidTagClose
| liquidTagOpen
| liquidTag
| liquidInlineComment
liquidTagStrict =
| liquidTagAssign
| liquidTagBreak
| liquidTagContinue
| liquidTagCycle
| liquidTagContentFor
| liquidTagDecrement
| liquidTagEcho
| liquidTagElse
| liquidTagElsif
| liquidTagInclude
| liquidTagIncrement
| liquidTagLayout
| liquidTagLiquid
| liquidTagRender
| liquidTagSection
| liquidTagSections
| liquidTagWhen
liquidTag =
| liquidTagStrict
| liquidTagBaseCase
liquidTagOpenStrict =
| liquidTagOpenCase
| liquidTagOpenCapture
| liquidTagOpenForm
| liquidTagOpenFor
| liquidTagOpenTablerow
| liquidTagOpenIf
| liquidTagOpenPaginate
| liquidTagOpenUnless
liquidTagOpen =
| liquidTagOpenStrict
| liquidTagOpenBaseCase
liquidTagClose = "{%" "-"? space* "end" blockName space* tagMarkup "-"? "%}"
// These two are the same but transformed differently
liquidTagRule<name, markup> =
"{%" "-"? space* (name endOfIdentifier) space* markup "-"? "%}"
liquidTagOpenRule<name, markup> =
"{%" "-"? space* (name endOfIdentifier) space* markup "-"? "%}"
liquidTagBaseCase = liquidTagRule<liquidTagName, tagMarkup>
liquidTagEcho = liquidTagRule<"echo", liquidTagEchoMarkup>
liquidTagEchoMarkup = liquidVariable<delimTag>
liquidTagAssign = liquidTagRule<"assign", liquidTagAssignMarkup>
liquidTagAssignMarkup = variableSegment space* "=" space* liquidVariable<delimTag>
liquidTagCycle = liquidTagRule<"cycle", liquidTagCycleMarkup>
liquidTagCycleMarkup = (liquidExpression<delimTag> ":")? space* nonemptyListOf<liquidExpression<delimTag>, argumentSeparator> space*
liquidTagIncrement = liquidTagRule<"increment", variableSegmentAsLookupMarkup>
liquidTagDecrement = liquidTagRule<"decrement", variableSegmentAsLookupMarkup>
liquidTagOpenCapture = liquidTagOpenRule<"capture", variableSegmentAsLookupMarkup>
variableSegmentAsLookupMarkup = variableSegmentAsLookup space*
liquidTagSection = liquidTagRule<"section", liquidTagSectionMarkup>
liquidTagSectionMarkup = liquidString<delimTag> space*
liquidTagSections = liquidTagRule<"sections", liquidTagSectionsMarkup>
liquidTagSectionsMarkup = liquidString<delimTag> space*
liquidTagLayout = liquidTagRule<"layout", liquidTagLayoutMarkup>
liquidTagLayoutMarkup = liquidExpression<delimTag> space*
// We'll black hole the statement and switch parser in the cst builder
// We do this because it's technically the same grammar (with minor redefinitions)
// and it would be a huge chore and maintenance hell to rewrite all the rules with
// hspace = " " | "\t"
//
// The alternative is that this grammar parses the {% liquid tagMarkup %} as its own string,
// and then we switch to the LiquidStatement grammar that
// redefines liquidTagOpenRule, liquidTagRule, and space.
liquidTagLiquid = liquidTagRule<"liquid", liquidTagLiquidMarkup>
liquidTagLiquidMarkup = tagMarkup
liquidTagContentFor = liquidTagRule<"content_for", liquidTagContentForMarkup>
liquidTagContentForMarkup =
contentForType (argumentSeparatorOptionalComma contentForTagArgument) (space* ",")? space*
contentForTagArgument = listOf<contentForNamedArgument<delimTag>, argumentSeparatorOptionalComma>
completionModeContentForTagArgument = listOf<contentForNamedArgument<delimTag>, argumentSeparatorOptionalComma> (argumentSeparator? (liquidVariableLookup<delimTag>))?
contentForNamedArgument<delim> = (variableSegment ("." variableSegment)*) space* ":" space* (liquidExpression<delim>)
contentForType = liquidString<delimTag>
liquidTagInclude = liquidTagRule<"include", liquidTagRenderMarkup>
liquidTagRender = liquidTagRule<"render", liquidTagRenderMarkup>
liquidTagRenderMarkup =
snippetExpression renderVariableExpression? renderAliasExpression? renderArguments
renderArguments = (argumentSeparatorOptionalComma tagArguments) (space* ",")? space*
completionModeRenderArguments = (argumentSeparatorOptionalComma tagArguments) (space* ",")? space* (argumentSeparator? liquidVariableLookup<delimTag> space*)?
snippetExpression = liquidString<delimTag> | variableSegmentAsLookup
renderVariableExpression = space+ ("for" | "with") space+ liquidExpression<delimTag>
renderAliasExpression = space+ "as" space+ variableSegment
liquidTagOpenBaseCase = liquidTagOpenRule<blockName, tagMarkup>
liquidTagOpenForm = liquidTagOpenRule<"form", liquidTagOpenFormMarkup>
liquidTagOpenFormMarkup = arguments<delimTag> (space* ",")? space*
liquidTagOpenFor = liquidTagOpenRule<"for", liquidTagOpenForMarkup>
liquidTagOpenForMarkup =
variableSegment space* "in" space* liquidExpression<delimTag>
(space* "reversed")? argumentSeparatorOptionalComma
tagArguments (space* ",")? space*
// It's the same, the difference is support for different named arguments<delim>
liquidTagOpenTablerow = liquidTagOpenRule<"tablerow", liquidTagOpenForMarkup>
liquidTagOpenCase = liquidTagOpenRule<"case", liquidTagOpenCaseMarkup>
liquidTagOpenCaseMarkup = liquidExpression<delimTag> space*
liquidTagWhen = liquidTagRule<"when", liquidTagWhenMarkup>
liquidTagWhenMarkup = nonemptyListOf<liquidExpression<delimTag>, whenMarkupSep> space*
whenMarkupSep = space* ("," | "or" ~identifier) space*
liquidTagOpenIf = liquidTagOpenRule<"if", liquidTagOpenConditionalMarkup>
liquidTagOpenUnless = liquidTagOpenRule<"unless", liquidTagOpenConditionalMarkup>
liquidTagElsif = liquidTagRule<"elsif", liquidTagOpenConditionalMarkup>
liquidTagBreak = liquidTagRule<"break", empty>
liquidTagContinue = liquidTagRule<"continue", empty>
liquidTagElse = liquidTagRule<"else", empty>
liquidTagOpenConditionalMarkup = nonemptyListOf<condition<delimTag>, conditionSeparator> space*
conditionSeparator = &logicalOperator
condition<delim> = logicalOperator? space* (comparison<delim> | liquidExpression<delim>) space*
logicalOperator = ("and" | "or") ~identifier
comparison<delim> = liquidExpression<delim> space* comparator space* liquidExpression<delim>
comparator =
( "=="
| "!="
| ">="
| "<="
| ">"
| "<")
| ("contains" ~identifier)
liquidTagOpenPaginate = liquidTagOpenRule<"paginate", liquidTagOpenPaginateMarkup>
liquidTagOpenPaginateMarkup =
liquidExpression<delimTag> space+ "by" space+ liquidExpression<delimTag> argumentSeparatorOptionalComma tagArguments (space* ",")? space*
liquidDrop = "{{" "-"? space* liquidDropCases "-"? "}}"
liquidDropCases = liquidVariable<delimVO> | liquidDropBaseCase
liquidDropBaseCase = anyExceptStar<delimVO>
liquidInlineComment = "{%" "-"? space* "#" space? tagMarkup "-"? "%}"
liquidRawTag =
| liquidRawTagImpl<"raw">
| liquidRawTagImpl<"javascript">
| liquidRawTagImpl<"schema">
| liquidRawTagImpl<"stylesheet">
| liquidRawTagImpl<"style">
liquidRawTagImpl<name> =
"{%" "-"? space* (name endOfIdentifier) space* tagMarkup "-"? "%}"
anyExceptStar<liquidRawTagClose<name>>
"{%" "-"? space* "end" (name endOfIdentifier) space* "-"? "%}"
liquidRawTagClose<name> =
"{%" "-"? space* "end" (name endOfIdentifier) space* "-"? "%}"
liquidBlockComment =
commentBlockStart
(liquidBlockComment | anyExceptPlus<(commentBlockStart | commentBlockEnd)>)*
commentBlockEnd
commentBlockStart = "{%" "-"? space* ("comment" endOfIdentifier) space* tagMarkup "-"? "%}"
commentBlockEnd = "{%" "-"? space* ("endcomment" endOfIdentifier) space* tagMarkup "-"? "%}"
liquidDoc =
liquidDocStart
liquidDocBody
liquidDocEnd
liquidDocStart = "{%" "-"? space* ("doc" endOfIdentifier) space* tagMarkup "-"? "%}"
liquidDocEnd = "{%" "-"? space* ("enddoc" endOfIdentifier) space* tagMarkup "-"? "%}"
liquidDocBody = anyExceptStar<(liquidDocStart | liquidDocEnd)>
// In order for the grammar to "fallback" to the base case, this
// rule must pass if and only if we support what we parse. This
// implies that—since we don't support filters yet—we have a
// positive lookahead on "-}}" or "}}" in the rule. We do this
// because we'd otherwise positively match the following string
// instead of falling back to the other rule:
// {{ 'string' | some_filter }}
liquidVariable<delim> = liquidComplexExpression<delim> liquidFilter<delim>* space* &delim
liquidExpression<delim> =
| liquidString<delim>
| liquidNumber
| liquidLiteral
| liquidRange<delim>
| liquidVariableLookup<delim>
liquidComplexExpression<delim> =
| liquidBooleanExpression<delim>
| liquidExpression<delim>
liquidBooleanExpression<delim> = booleanExpressionCondition<delim> listOf<booleanExpressionSubsequentCondition<delim>, conditionSeparator>
// This might over-capture things since the conditions below can contain any `liquidExpression`s.
// We will need to clean this up in CST. If we restrict the conditions to only contain comparisons and
// variable lookups, we can't support "truthy" expressions like `{{ some_var and 'this' }}`
booleanExpressionSubsequentCondition<delim> = space* logicalOperator space* (comparison<delim> | liquidExpression<delim>) space*
booleanExpressionCondition<delim> = comparison<delim> | liquidExpression<delim>
liquidString<delim> = liquidSingleQuotedString<delim> | liquidDoubleQuotedString<delim>
liquidSingleQuotedString<delim> = "'" anyExceptStar<("'"| delim)> "'"
liquidDoubleQuotedString<delim> = "\"" anyExceptStar<("\""| delim)> "\""
liquidNumber = liquidFloat | liquidInteger
liquidInteger = "-"? digit+
liquidFloat = "-"? digit+ "." digit+
liquidLiteral =
( "true"
| "false"
| "blank"
| "empty"
| "nil"
| "null"
) endOfIdentifier
liquidRange<delim> =
"(" space* liquidExpression<delim> space* ".." space* liquidExpression<delim> space* ")"
liquidVariableLookup<delim> =
| variableSegment lookup<delim>*
| empty lookup<delim>+
lookup<delim> =
| indexLookup<delim>
| dotLookup
indexLookup<delim> = space* "[" space* liquidExpression<delim> space* "]"
dotLookup = space* "." space* identifier
liquidFilter<delim> = space* "|" space* identifier (space* ":" space* arguments<delim> (space* ",")?)?
arguments<delim> = nonemptyOrderedListOf<positionalArgument<delim>, namedArgument<delim>, argumentSeparator>
argumentSeparator = space* "," space*
argumentSeparatorOptionalComma = space* ","? space*
positionalArgument<delim> = liquidExpression<delim> ~(space* ":")
namedArgument<delim> = variableSegment space* ":" space* liquidExpression<delim>
tagArguments = listOf<namedArgument<delimTag>, argumentSeparatorOptionalComma>
filterArguments<delim> =
| complexArguments<delim>
| simpleArgument<delim>
complexArguments<delim> = arguments<delim> (space* "," space* simpleArgument<delim>)?
simpleArgument<delim> = liquidVariableLookup<delim>
variableSegment = (letter | "_") (~endOfTagName identifierCharacter)*
variableSegmentAsLookup = variableSegment
identifier = variableSegment "?"?
tagMarkup = anyExceptStar<delimTag>
liquidTagName =
letter (alnum | "_")*
blockName =
// Shopify blocks
( "form"
| "paginate"
// Base blocks
| "capture"
| "case"
| "for"
| "ifchanged"
| "if"
| "unless"
| "tablerow"
) endOfIdentifier
delimTag = "-%}" | "%}"
delimVO = "-}}" | "}}"
}
LiquidStatement <: Liquid {
Node := listOf<LiquidStatement, statementSep> (space | newline)*
// This is the big brains moment: we redefine space to exclude newlines.
//
// Which means that all our other Liquid rules can be reused
// without modification(!)
//
// We don't need to maintain rules like this:
// - liquidVariable<space>
// - liquidExpression<space>
// - variableLookup<space>
// - ... long list of stuff that takes space as param
// - liquidString<space>
//
// All we need is this little, VERY IMPORTANT, part right here that
// make it so we can parse the same way in Liquid tags.
//
// I'm putting in this huge comment so that it's more obvious.
space := " " | "\t"
LiquidStatement =
| liquidBlockComment
| liquidRawTag
| liquidTagClose
| liquidTagOpen
| liquidTag
| liquidInlineComment
liquidTagOpenRule<name, markup>
:= (name ~identifierCharacter) space* markup &liquidStatementEnd
liquidTagRule<name, markup>
:= (name ~identifierCharacter) space* markup &liquidStatementEnd
liquidTagClose
:= "end" (blockName ~identifierCharacter) space* tagMarkup &liquidStatementEnd
liquidRawTagImpl<name>
:= (name ~identifierCharacter) space* tagMarkup newline
anyExceptStar<liquidRawTagClose<name>>
"end" name space* &liquidStatementEnd
liquidRawTagClose<name>
:= "end" name space* &liquidStatementEnd
liquidBlockComment :=
commentBlockStart statementSep
(listOf<liquidCommentBlockStatement, statementSep> statementSep)?
commentBlockEnd
liquidCommentBlockStatement =
| liquidBlockComment
| nonTerminalCommentLine
commentBlockStart
:= ("comment" ~identifierCharacter) space* tagMarkup
commentBlockEnd
:= ("endcomment" ~identifierCharacter) space* tagMarkup
nonTerminalCommentLine
= ~commentBlockEnd anyExceptPlus<newline>
liquidInlineComment
:= "#" space? tagMarkup &liquidStatementEnd
tagMarkup := anyExceptStar<liquidStatementEnd>
// trailing whitespace, newline, + anything else before the next tag
statementSep = space* newline (space | newline)*
liquidStatementEnd = newline | end
delimTag := liquidStatementEnd
}
LiquidDoc <: Helpers {
Node := ImplicitDescription (LiquidDocNode | TextNode)*
LiquidDocNode =
| paramNode
| exampleNode
| descriptionNode
| promptNode
| fallbackNode
endOfDescription = strictSpace* openControl
descriptionContent = anyExceptStar<endOfDescription>
ImplicitDescription = descriptionContent
// By default, space matches new lines as well. We override it here to make writing rules easier.
strictSpace = " " | "\t"
// We use this as an escape hatch to stop matching TextNode and try again when one of these characters is encountered
openControl:= strictSpace* ("@" | end)
// List of supported tags we use to identify boundaries
supportedTags = "@prompt" | "@example" | "@description" | "@param"
paramNode = "@param" strictSpace* paramType? strictSpace* (optionalParamName | paramName) (strictSpace* "-")? strictSpace* paramDescription
paramType = "{" strictSpace* paramTypeContent strictSpace* "}"
paramTypeContent = anyExceptStar<("}"| strictSpace)>
paramName = textValue
optionalParamName = "[" strictSpace* textValue strictSpace* "]"
textValue = identifierCharacter+
paramDescription = (~"]" anyExceptStar<endOfParam>)
endOfParam = strictSpace* (newline | end)
// Prompt node is system-controlled, so we don't strip the leading spaces to maintain indentation
promptNode = "@prompt" multilineTextContent
exampleNode = "@example" space* multilineTextContent
descriptionNode = "@description" space* multilineTextContent
// We want multilineTextContent to be free-form, so instead of terminating the match at "@" we explicitly look for a suppported tag
// This means that malformed tags will be considered part of the multilineTextContent
multilineTextContent = anyExceptStar<endOfMultilineText>
endOfMultilineText = strictSpace* (supportedTags | end)
fallbackNode = "@" anyExceptStar<endOfParam>
}
LiquidHTML <: Liquid {
Node := yamlFrontmatter? (HtmlNode | liquidNode | TextNode)*
openControl += "<"
yamlFrontmatter =
"---" newline anyExceptStar<"---"> "---" newline
HtmlNode =
| HtmlDoctype
| HtmlComment
| HtmlRawTag
| HtmlVoidElement
| HtmlSelfClosingElement
| HtmlTagClose
| HtmlTagOpen
// https://html.spec.whatwg.org/multipage/syntax.html#the-doctype
HtmlDoctype =
#("<!" caseInsensitive<"doctype"> space+ caseInsensitive<"html">) legacyDoctypeString? ">"
legacyDoctypeString
= anyExceptPlus<">">
HtmlComment = "<!--" #(anyExceptStar<"-->"> "-->")
// These are black holes, we'll ignore what's in them
HtmlRawTag =
| HtmlRawTagImpl<"script">
| HtmlRawTagImpl<"style">
| HtmlRawTagImpl<"svg">
HtmlRawTagImpl<name> =
TagStart<name>
(HtmlRawTagImpl<name> | AnyExceptPlus<(TagStart<name> | TagEnd<name>)>)*
TagEnd<name>
TagStart<name> = "<" name AttrList ">"
TagEnd<name> = "</" name ">"
HtmlVoidElement =
#("<" voidElementName &(space | "/" | ">")) AttrList "/"? ">"
HtmlSelfClosingElement =
#("<" tagName) AttrList "/>"
HtmlTagOpen =
#("<" tagName) AttrList ">"
HtmlTagClose =
#("</" tagName) ">"
tagName = leadingTagNamePart trailingTagNamePart*
// The difference here is that the first text part must start
// with a letter, but trailing text parts don't have that
// requirement
leadingTagNamePart =
| liquidDrop
| leadingTagNameTextNode
trailingTagNamePart =
| liquidDrop
| trailingTagNameTextNode
leadingTagNameTextNode = letter (alnum | "-" | ":")*
trailingTagNameTextNode = (alnum | "-" | ":")+
AttrList = Attr*
Attr =
AttrSingleQuoted | AttrDoubleQuoted | AttrUnquoted | liquidNode | attrEmpty
attrEmpty = attrName
AttrUnquoted = attrName "=" attrUnquotedValue
AttrSingleQuoted = attrName "=" singleQuote #(attrSingleQuotedValue singleQuote)
AttrDoubleQuoted = attrName "=" doubleQuote #(attrDoubleQuotedValue doubleQuote)
attrName = (liquidDrop | attrNameTextNode)+
// https://html.spec.whatwg.org/#attributes-2
attrNameTextNode = anyExceptPlus<(space | quotes | "=" | ">" | "/>" | "{{" | "{%" | controls | noncharacters)>
attrUnquotedValue = (liquidDrop | attrUnquotedTextNode)*
attrSingleQuotedValue = (liquidNode | attrSingleQuotedTextNode)*
attrDoubleQuotedValue = (liquidNode | attrDoubleQuotedTextNode)*
attrUnquotedTextNode = anyExceptPlus<(space | quotes | "=" | "<" | ">" | "`" | "{{" | "{%")>
attrSingleQuotedTextNode = anyExceptPlus<(singleQuote | "{{" | "{%")>
attrDoubleQuotedTextNode = anyExceptPlus<(doubleQuote | "{{" | "{%")>
quotes = singleQuote | doubleQuote
// https://www.w3.org/TR/2011/WD-html-markup-20110113/syntax.html#void-element
voidElementName =
( caseInsensitive<"area">
| caseInsensitive<"base">
| caseInsensitive<"br">
| caseInsensitive<"col">
| caseInsensitive<"command">
| caseInsensitive<"embed">
| caseInsensitive<"hr">
| caseInsensitive<"img">
| caseInsensitive<"input">
| caseInsensitive<"keygen">
| caseInsensitive<"link">
| caseInsensitive<"meta">
| caseInsensitive<"param">
| caseInsensitive<"source">
| caseInsensitive<"track">
| caseInsensitive<"wbr">
) ~identifierCharacter
}
StrictLiquid <: Liquid {
liquidTag := liquidTagStrict
liquidTagOpen := liquidTagOpenStrict
}
StrictLiquidStatement <: LiquidStatement {
liquidTag := liquidTagStrict
liquidTagOpen := liquidTagOpenStrict
}
StrictLiquidHTML <: LiquidHTML {
liquidTag := liquidTagStrict
liquidTagOpen := liquidTagOpenStrict
}
WithPlaceholderLiquid <: Liquid {
liquidFilter<delim> := space* "|" space* identifier (space* ":" space* filterArguments<delim> (space* ",")?)?
liquidTagContentForMarkup :=
contentForType (argumentSeparatorOptionalComma completionModeContentForTagArgument) (space* ",")? space*
liquidTagRenderMarkup :=
snippetExpression renderVariableExpression? renderAliasExpression? completionModeRenderArguments
liquidTagName := (letter | "█") (alnum | "_")*
variableSegment := (letter | "_" | "█") (identifierCharacter | "█")*
liquidDoc :=
liquidDocStart
liquidDocBody
liquidDocEnd?
}
WithPlaceholderLiquidStatement <: LiquidStatement {
liquidFilter<delim> := space* "|" space* identifier (space* ":" space* filterArguments<delim> (space* ",")?)?
liquidTagContentForMarkup :=
contentForType (argumentSeparatorOptionalComma completionModeContentForTagArgument) (space* ",")? space*
liquidTagRenderMarkup :=
snippetExpression renderVariableExpression? renderAliasExpression? completionModeRenderArguments
liquidTagName := (letter | "█") (alnum | "_")*
variableSegment := (letter | "_" | "█") (identifierCharacter | "█")*
liquidDoc :=
liquidDocStart
liquidDocBody
liquidDocEnd?
}
WithPlaceholderLiquidHTML <: LiquidHTML {
liquidFilter<delim> := space* "|" space* identifier (space* ":" space* filterArguments<delim> (space* ",")?)?
liquidTagContentForMarkup :=
contentForType (argumentSeparatorOptionalComma completionModeContentForTagArgument) (space* ",")? space*
liquidTagRenderMarkup :=
snippetExpression renderVariableExpression? renderAliasExpression? completionModeRenderArguments
liquidTagName := (letter | "█") (alnum | "_")*
variableSegment := (letter | "_" | "█") (identifierCharacter | "█")*
leadingTagNameTextNode := (letter | "█") (alnum | "-" | ":" | "█")*
trailingTagNameTextNode := (alnum | "-" | ":" | "█")+
liquidDoc :=
liquidDocStart
liquidDocBody
liquidDocEnd?
}