-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhandlebars.grammar
More file actions
122 lines (82 loc) · 2.33 KB
/
handlebars.grammar
File metadata and controls
122 lines (82 loc) · 2.33 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
@define noStrictParametricProductions true
// @section:Program
Program ::
ContentStatement
MustacheStatement
MustacheStatement[+Unescaped]
// @section:Content
ContentStatement ::
ContentCharacter ContentStatement?
ContentCharacter ::
NonMustacheStart
`\{{`
`\{{{`
NonMustacheStart ::
SourceCharacter but not one of MustacheStart or MustacheStart[+Unescaped]
SourceCharacter ::
> any Unicode code point
// @section:Mustaches
MustacheStatement[Unescaped] ::
MustacheStart[?Unescaped] MustacheContents MustacheEnd[?Unescaped]
MustacheStart[Unescaped] ::
[+Unescaped]`{{{`
[~Unescaped]`{{`
MustacheEnd[Unescaped] ::
[+Unescaped]`}}}`
[~Unescaped]`}}`
MustacheContents ::
WhitespaceControl? Whitespace? PathExpression MustacheParameters? Whitespace? WhitespaceControl?
WhitespaceControl :: `~`
Whitespace ::
WhitespaceChar Whitespace?
WhitespaceChar :: one of
`<SPACE>` `<TAB>` `<LF>` `<CR>`
// @section:PathExpressions
PathExpression ::
Id PathExpressionTail?
PathExpressionTail ::
`.` PathExpression
`/` PathExpression
Id ::
IdCharacter Id?
IdCharacter ::
SourceCharacter but not one of NonIdCharacter or Whitespace
NonIdCharacter :: one of
`!` `"` `#` `%` `&` `'` `(` `)` `*` `+` `,` `.` `/` `;` `<` `=` `>` `@` `[` `\` `]` `^` ``` `{` `|` `}` `~`
// @section:HelperParameters
MustacheParameters ::
Whitespace MustacheParameter MustacheParameters?
// Note: This production is ambiguous: A Literal like `true` or `123` is also a valid
// PathExpression. In this case, the parser prefers the Literal over
// the PathExpression.
MustacheParameter ::
Literal
PathExpression
SubExpression
// @section:LiteralExpressions
Literal ::
StringLiteral
NumberLiteral
BooleanLiteral
StringLiteral ::
`"` AnythingExceptDoubleQuote `"`
`'` AnythingExceptSingleQuote `'`
AnythingExceptDoubleQuote ::
SourceCharacter but not `"`
AnythingExceptSingleQuote ::
SourceCharacter but not `'`
NumberLiteral ::
Minus? Digits Fraction?
Minus ::
`-`
Digits ::
Digit Digits
Digit :: one of
`0` `1` `2` `3` `4` `5` `6` `7` `8` `9`
Fraction ::
`.` Digits
BooleanLiteral :: one of
`true` `false`
// @section:SubExpressions
SubExpression ::
`(` Whitespace? PathExpression MustacheParameters? Whitespace? `)`