Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100755 373 lines (308 sloc) 12.917 kB
f84b2a8 @rsaccon initial commit
rsaccon authored
1 %%%-------------------------------------------------------------------
2 %%% File: erlydtl_parser.erl
3 %%% @author Roberto Saccon <rsaccon@gmail.com> [http://rsaccon.com]
873b0ef @rsaccon monster commit: integrated Evan's changes (much improved everything)
rsaccon authored
4 %%% @author Evan Miller <emmiller@gmail.com>
5 %%% @copyright 2008 Roberto Saccon, Evan Miller
f84b2a8 @rsaccon initial commit
rsaccon authored
6 %%% @doc Template language grammar
7 %%% @reference See <a href="http://erlydtl.googlecode.com" target="_top">http://erlydtl.googlecode.com</a> for more information
8 %%% @end
9 %%%
10 %%% The MIT License
11 %%%
873b0ef @rsaccon monster commit: integrated Evan's changes (much improved everything)
rsaccon authored
12 %%% Copyright (c) 2007 Roberto Saccon, Evan Miller
f84b2a8 @rsaccon initial commit
rsaccon authored
13 %%%
14 %%% Permission is hereby granted, free of charge, to any person obtaining a copy
15 %%% of this software and associated documentation files (the "Software"), to deal
16 %%% in the Software without restriction, including without limitation the rights
17 %%% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
18 %%% copies of the Software, and to permit persons to whom the Software is
19 %%% furnished to do so, subject to the following conditions:
20 %%%
21 %%% The above copyright notice and this permission notice shall be included in
22 %%% all copies or substantial portions of the Software.
23 %%%
24 %%% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
25 %%% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26 %%% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
27 %%% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28 %%% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
29 %%% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
30 %%% THE SOFTWARE.
31 %%%
873b0ef @rsaccon monster commit: integrated Evan's changes (much improved everything)
rsaccon authored
32 %%% @since 2007-11-11 by Roberto Saccon, Evan Miller
f84b2a8 @rsaccon initial commit
rsaccon authored
33 %%%-------------------------------------------------------------------
34
873b0ef @rsaccon monster commit: integrated Evan's changes (much improved everything)
rsaccon authored
35 Nonterminals
f84b2a8 @rsaccon initial commit
rsaccon authored
36 Elements
873b0ef @rsaccon monster commit: integrated Evan's changes (much improved everything)
rsaccon authored
37 Literal
38
b4bf177 @evanmiller 1. Can resolve variables from function calls to parameterized modules…
evanmiller authored
39 ValueBraced
873b0ef @rsaccon monster commit: integrated Evan's changes (much improved everything)
rsaccon authored
40
7bd6d35 @evanmiller New tags: ssi, filter, templatetag, and widthratio
evanmiller authored
41 Value
9646b5a @evanmiller Implement "iriencode" filter
evanmiller authored
42 Values
7bd6d35 @evanmiller New tags: ssi, filter, templatetag, and widthratio
evanmiller authored
43 Variable
44 Filter
45
46 AutoEscapeBlock
47 AutoEscapeBraced
48 EndAutoEscapeBraced
873b0ef @rsaccon monster commit: integrated Evan's changes (much improved everything)
rsaccon authored
49
50 BlockBlock
51 BlockBraced
52 EndBlockBraced
53
54 CommentBlock
55 CommentBraced
56 EndCommentBraced
57
b67188e @evanmiller Support for "cycle" tag. Patch from Hunter Morris.
evanmiller authored
58 CycleTag
59 CycleNames
60 CycleNamesCompat
61
7bd6d35 @evanmiller New tags: ssi, filter, templatetag, and widthratio
evanmiller authored
62 ExtendsTag
63 IncludeTag
64 NowTag
65
50080db @asonge Adding firstof functionality
asonge authored
66 FirstofTag
67
7bd6d35 @evanmiller New tags: ssi, filter, templatetag, and widthratio
evanmiller authored
68 FilterBlock
69 FilterBraced
70 EndFilterBraced
71 Filters
72
873b0ef @rsaccon monster commit: integrated Evan's changes (much improved everything)
rsaccon authored
73 ForBlock
74 ForBraced
25abda5 @evanmiller Support for {% empty %} block in for loops.
evanmiller authored
75 EmptyBraced
873b0ef @rsaccon monster commit: integrated Evan's changes (much improved everything)
rsaccon authored
76 EndForBraced
77 ForExpression
78 ForGroup
79
80 IfBlock
81 IfBraced
82 IfExpression
83 ElseBraced
84 EndIfBraced
15fa5ce @rsaccon added ifequal tag
rsaccon authored
85
1b16fa0 Support for {% ifchanged %} tag
Evan Miller authored
86 IfChangedBlock
87 IfChangedBraced
88 EndIfChangedBraced
89
15fa5ce @rsaccon added ifequal tag
rsaccon authored
90 IfEqualBlock
91 IfEqualBraced
92 IfEqualExpression
7ebb7dd @rsaccon added ifnotequal tag
rsaccon authored
93 EndIfEqualBraced
94
95 IfNotEqualBlock
96 IfNotEqualBraced
97 IfNotEqualExpression
98 EndIfNotEqualBraced
873b0ef @rsaccon monster commit: integrated Evan's changes (much improved everything)
rsaccon authored
99
132ebf9 @rsaccon added load tag (not fully functional yet)
rsaccon authored
100 CustomTag
e1c0e96 @rsaccon added call custom tag (based on patch from Jeremey Latt) - not comple…
rsaccon authored
101 Args
48fea22 Implement "trans" tag with support for .po files
Evan Miller authored
102
e26d23f @evanmiller New tag: spaceless
evanmiller authored
103 SpacelessBlock
104
7bd6d35 @evanmiller New tags: ssi, filter, templatetag, and widthratio
evanmiller authored
105 SSITag
106
694fc92 Preliminary blocktrans support
Evan Miller authored
107 BlockTransBlock
48fea22 Implement "trans" tag with support for .po files
Evan Miller authored
108 TransTag
109
7bd6d35 @evanmiller New tags: ssi, filter, templatetag, and widthratio
evanmiller authored
110 TemplatetagTag
111 Templatetag
112
113 WidthRatioTag
114
115 WithBlock
116 WithBraced
117 EndWithBraced
118
e1c0e96 @rsaccon added call custom tag (based on patch from Jeremey Latt) - not comple…
rsaccon authored
119 CallTag
b96dd0b @evanmiller Zotonic: Basic boolean operators in "if" clause
evanmiller authored
120 CallWithTag
121
122 Unot.
873b0ef @rsaccon monster commit: integrated Evan's changes (much improved everything)
rsaccon authored
123
124 Terminals
b96dd0b @evanmiller Zotonic: Basic boolean operators in "if" clause
evanmiller authored
125 and_keyword
873b0ef @rsaccon monster commit: integrated Evan's changes (much improved everything)
rsaccon authored
126 autoescape_keyword
127 block_keyword
694fc92 Preliminary blocktrans support
Evan Miller authored
128 blocktrans_keyword
e1c0e96 @rsaccon added call custom tag (based on patch from Jeremey Latt) - not comple…
rsaccon authored
129 call_keyword
873b0ef @rsaccon monster commit: integrated Evan's changes (much improved everything)
rsaccon authored
130 close_tag
131 close_var
132 comment_keyword
b67188e @evanmiller Support for "cycle" tag. Patch from Hunter Morris.
evanmiller authored
133 cycle_keyword
873b0ef @rsaccon monster commit: integrated Evan's changes (much improved everything)
rsaccon authored
134 else_keyword
25abda5 @evanmiller Support for {% empty %} block in for loops.
evanmiller authored
135 empty_keyword
873b0ef @rsaccon monster commit: integrated Evan's changes (much improved everything)
rsaccon authored
136 endautoescape_keyword
137 endblock_keyword
694fc92 Preliminary blocktrans support
Evan Miller authored
138 endblocktrans_keyword
873b0ef @rsaccon monster commit: integrated Evan's changes (much improved everything)
rsaccon authored
139 endcomment_keyword
7bd6d35 @evanmiller New tags: ssi, filter, templatetag, and widthratio
evanmiller authored
140 endfilter_keyword
873b0ef @rsaccon monster commit: integrated Evan's changes (much improved everything)
rsaccon authored
141 endfor_keyword
142 endif_keyword
1b16fa0 Support for {% ifchanged %} tag
Evan Miller authored
143 endifchanged_keyword
15fa5ce @rsaccon added ifequal tag
rsaccon authored
144 endifequal_keyword
7ebb7dd @rsaccon added ifnotequal tag
rsaccon authored
145 endifnotequal_keyword
e26d23f @evanmiller New tag: spaceless
evanmiller authored
146 endspaceless_keyword
7bd6d35 @evanmiller New tags: ssi, filter, templatetag, and widthratio
evanmiller authored
147 endwith_keyword
873b0ef @rsaccon monster commit: integrated Evan's changes (much improved everything)
rsaccon authored
148 extends_keyword
7bd6d35 @evanmiller New tags: ssi, filter, templatetag, and widthratio
evanmiller authored
149 filter_keyword
50080db @asonge Adding firstof functionality
asonge authored
150 firstof_keyword
873b0ef @rsaccon monster commit: integrated Evan's changes (much improved everything)
rsaccon authored
151 for_keyword
152 identifier
153 if_keyword
1b16fa0 Support for {% ifchanged %} tag
Evan Miller authored
154 ifchanged_keyword
15fa5ce @rsaccon added ifequal tag
rsaccon authored
155 ifequal_keyword
7ebb7dd @rsaccon added ifnotequal tag
rsaccon authored
156 ifnotequal_keyword
873b0ef @rsaccon monster commit: integrated Evan's changes (much improved everything)
rsaccon authored
157 in_keyword
158 include_keyword
1a719d9 @evanmiller Use a translation fun instead of translation dict.
evanmiller authored
159 noop_keyword
873b0ef @rsaccon monster commit: integrated Evan's changes (much improved everything)
rsaccon authored
160 not_keyword
48b9b5f @gardenia Added "now" tag and associated associated dateformat module.
gardenia authored
161 now_keyword
873b0ef @rsaccon monster commit: integrated Evan's changes (much improved everything)
rsaccon authored
162 number_literal
ab53409 @evanmiller Support "only" keyword with include
evanmiller authored
163 only_keyword
b96dd0b @evanmiller Zotonic: Basic boolean operators in "if" clause
evanmiller authored
164 or_keyword
873b0ef @rsaccon monster commit: integrated Evan's changes (much improved everything)
rsaccon authored
165 open_tag
166 open_var
fa28530 @evanmiller Change "include" tag to follow Django behavior
evanmiller authored
167 parsed_keyword
e26d23f @evanmiller New tag: spaceless
evanmiller authored
168 spaceless_keyword
7bd6d35 @evanmiller New tags: ssi, filter, templatetag, and widthratio
evanmiller authored
169 ssi_keyword
873b0ef @rsaccon monster commit: integrated Evan's changes (much improved everything)
rsaccon authored
170 string_literal
4fb4176 @evanmiller Slightly nicer error messages.
evanmiller authored
171 string
7bd6d35 @evanmiller New tags: ssi, filter, templatetag, and widthratio
evanmiller authored
172 templatetag_keyword
694fc92 Preliminary blocktrans support
Evan Miller authored
173 openblock_keyword
174 closeblock_keyword
175 openvariable_keyword
176 closevariable_keyword
177 openbrace_keyword
178 closebrace_keyword
179 opencomment_keyword
180 closecomment_keyword
48fea22 Implement "trans" tag with support for .po files
Evan Miller authored
181 trans_keyword
7bd6d35 @evanmiller New tags: ssi, filter, templatetag, and widthratio
evanmiller authored
182 widthratio_keyword
b96dd0b @evanmiller Zotonic: Basic boolean operators in "if" clause
evanmiller authored
183 with_keyword
4fb4176 @evanmiller Slightly nicer error messages.
evanmiller authored
184 ',' '|' '=' ':' '.'
e66e38a @evanmiller More operators.
evanmiller authored
185 '==' '!='
186 '>=' '<='
187 '>' '<'
694fc92 Preliminary blocktrans support
Evan Miller authored
188 '(' ')'
189 '_'.
873b0ef @rsaccon monster commit: integrated Evan's changes (much improved everything)
rsaccon authored
190
191 Rootsymbol
192 Elements.
193
b96dd0b @evanmiller Zotonic: Basic boolean operators in "if" clause
evanmiller authored
194 %% Operator precedences for the E non terminal
195 Left 100 or_keyword.
196 Left 110 and_keyword.
e66e38a @evanmiller More operators.
evanmiller authored
197 Nonassoc 300 '==' '!=' '>=' '<=' '>' '<'.
b96dd0b @evanmiller Zotonic: Basic boolean operators in "if" clause
evanmiller authored
198 Unary 600 Unot.
199
873b0ef @rsaccon monster commit: integrated Evan's changes (much improved everything)
rsaccon authored
200 Elements -> '$empty' : [].
4fb4176 @evanmiller Slightly nicer error messages.
evanmiller authored
201 Elements -> Elements string : '$1' ++ ['$2'].
7bd6d35 @evanmiller New tags: ssi, filter, templatetag, and widthratio
evanmiller authored
202 Elements -> Elements AutoEscapeBlock : '$1' ++ ['$2'].
873b0ef @rsaccon monster commit: integrated Evan's changes (much improved everything)
rsaccon authored
203 Elements -> Elements BlockBlock : '$1' ++ ['$2'].
694fc92 Preliminary blocktrans support
Evan Miller authored
204 Elements -> Elements BlockTransBlock : '$1' ++ ['$2'].
7bd6d35 @evanmiller New tags: ssi, filter, templatetag, and widthratio
evanmiller authored
205 Elements -> Elements CallTag : '$1' ++ ['$2'].
206 Elements -> Elements CallWithTag : '$1' ++ ['$2'].
207 Elements -> Elements CommentBlock : '$1' ++ ['$2'].
208 Elements -> Elements CustomTag : '$1' ++ ['$2'].
209 Elements -> Elements CycleTag : '$1' ++ ['$2'].
210 Elements -> Elements ExtendsTag : '$1' ++ ['$2'].
211 Elements -> Elements FilterBlock : '$1' ++ ['$2'].
50080db @asonge Adding firstof functionality
asonge authored
212 Elements -> Elements FirstofTag : '$1' ++ ['$2'].
873b0ef @rsaccon monster commit: integrated Evan's changes (much improved everything)
rsaccon authored
213 Elements -> Elements ForBlock : '$1' ++ ['$2'].
214 Elements -> Elements IfBlock : '$1' ++ ['$2'].
15fa5ce @rsaccon added ifequal tag
rsaccon authored
215 Elements -> Elements IfEqualBlock : '$1' ++ ['$2'].
7ebb7dd @rsaccon added ifnotequal tag
rsaccon authored
216 Elements -> Elements IfNotEqualBlock : '$1' ++ ['$2'].
1b16fa0 Support for {% ifchanged %} tag
Evan Miller authored
217 Elements -> Elements IfChangedBlock : '$1' ++ ['$2'].
7bd6d35 @evanmiller New tags: ssi, filter, templatetag, and widthratio
evanmiller authored
218 Elements -> Elements IncludeTag : '$1' ++ ['$2'].
219 Elements -> Elements NowTag : '$1' ++ ['$2'].
e26d23f @evanmiller New tag: spaceless
evanmiller authored
220 Elements -> Elements SpacelessBlock : '$1' ++ ['$2'].
7bd6d35 @evanmiller New tags: ssi, filter, templatetag, and widthratio
evanmiller authored
221 Elements -> Elements SSITag : '$1' ++ ['$2'].
222 Elements -> Elements TemplatetagTag : '$1' ++ ['$2'].
223 Elements -> Elements TransTag : '$1' ++ ['$2'].
224 Elements -> Elements ValueBraced : '$1' ++ ['$2'].
225 Elements -> Elements WidthRatioTag : '$1' ++ ['$2'].
226 Elements -> Elements WithBlock : '$1' ++ ['$2'].
873b0ef @rsaccon monster commit: integrated Evan's changes (much improved everything)
rsaccon authored
227
b4bf177 @evanmiller 1. Can resolve variables from function calls to parameterized modules…
evanmiller authored
228 ValueBraced -> open_var Value close_var : '$2'.
873b0ef @rsaccon monster commit: integrated Evan's changes (much improved everything)
rsaccon authored
229
4fb4176 @evanmiller Slightly nicer error messages.
evanmiller authored
230 Value -> Value '|' Filter : {apply_filter, '$1', '$3'}.
b4bf177 @evanmiller 1. Can resolve variables from function calls to parameterized modules…
evanmiller authored
231 Value -> Variable : '$1'.
232 Value -> Literal : '$1'.
233
9646b5a @evanmiller Implement "iriencode" filter
evanmiller authored
234 Values -> Value : ['$1'].
235 Values -> Values Value : '$1' ++ ['$2'].
236
b4bf177 @evanmiller 1. Can resolve variables from function calls to parameterized modules…
evanmiller authored
237 Variable -> identifier : {variable, '$1'}.
1a719d9 @evanmiller Use a translation fun instead of translation dict.
evanmiller authored
238 Variable -> Variable '.' identifier : {attribute, {'$3', '$1'}}.
873b0ef @rsaccon monster commit: integrated Evan's changes (much improved everything)
rsaccon authored
239
7bd6d35 @evanmiller New tags: ssi, filter, templatetag, and widthratio
evanmiller authored
240 AutoEscapeBlock -> AutoEscapeBraced Elements EndAutoEscapeBraced : {autoescape, '$1', '$2'}.
241 AutoEscapeBraced -> open_tag autoescape_keyword identifier close_tag : '$3'.
242 EndAutoEscapeBraced -> open_tag endautoescape_keyword close_tag.
873b0ef @rsaccon monster commit: integrated Evan's changes (much improved everything)
rsaccon authored
243
244 BlockBlock -> BlockBraced Elements EndBlockBraced : {block, '$1', '$2'}.
245 BlockBraced -> open_tag block_keyword identifier close_tag : '$3'.
246 EndBlockBraced -> open_tag endblock_keyword close_tag.
247
7bd6d35 @evanmiller New tags: ssi, filter, templatetag, and widthratio
evanmiller authored
248 ExtendsTag -> open_tag extends_keyword string_literal close_tag : {extends, '$3'}.
fa28530 @evanmiller Change "include" tag to follow Django behavior
evanmiller authored
249
250 IncludeTag -> open_tag include_keyword string_literal close_tag : {include, '$3', []}.
251 IncludeTag -> open_tag include_keyword string_literal with_keyword Args close_tag : {include, '$3', '$5'}.
ab53409 @evanmiller Support "only" keyword with include
evanmiller authored
252 IncludeTag -> open_tag include_keyword string_literal only_keyword close_tag : {include_only, '$3', []}.
253 IncludeTag -> open_tag include_keyword string_literal with_keyword Args only_keyword close_tag : {include_only, '$3', '$5'}.
fa28530 @evanmiller Change "include" tag to follow Django behavior
evanmiller authored
254
7bd6d35 @evanmiller New tags: ssi, filter, templatetag, and widthratio
evanmiller authored
255 NowTag -> open_tag now_keyword string_literal close_tag : {date, now, '$3'}.
256
873b0ef @rsaccon monster commit: integrated Evan's changes (much improved everything)
rsaccon authored
257 CommentBlock -> CommentBraced Elements EndCommentBraced : {comment, '$2'}.
258 CommentBraced -> open_tag comment_keyword close_tag.
259 EndCommentBraced -> open_tag endcomment_keyword close_tag.
260
b67188e @evanmiller Support for "cycle" tag. Patch from Hunter Morris.
evanmiller authored
261 CycleTag -> open_tag cycle_keyword CycleNamesCompat close_tag : {cycle_compat, '$3'}.
262 CycleTag -> open_tag cycle_keyword CycleNames close_tag : {cycle, '$3'}.
263
264 CycleNames -> Value : ['$1'].
265 CycleNames -> CycleNames Value : '$1' ++ ['$2'].
266
4fb4176 @evanmiller Slightly nicer error messages.
evanmiller authored
267 CycleNamesCompat -> identifier ',' : ['$1'].
268 CycleNamesCompat -> CycleNamesCompat identifier ',' : '$1' ++ ['$2'].
b67188e @evanmiller Support for "cycle" tag. Patch from Hunter Morris.
evanmiller authored
269 CycleNamesCompat -> CycleNamesCompat identifier : '$1' ++ ['$2'].
270
7bd6d35 @evanmiller New tags: ssi, filter, templatetag, and widthratio
evanmiller authored
271 FilterBlock -> FilterBraced Elements EndFilterBraced : {filter, '$1', '$2'}.
272 FilterBraced -> open_tag filter_keyword Filters close_tag : '$3'.
273 EndFilterBraced -> open_tag endfilter_keyword close_tag.
274
275 Filters -> Filter : ['$1'].
276 Filters -> Filters '|' Filter : '$1' ++ ['$3'].
277
9646b5a @evanmiller Implement "iriencode" filter
evanmiller authored
278 FirstofTag -> open_tag firstof_keyword Values close_tag : {firstof, '$3'}.
50080db @asonge Adding firstof functionality
asonge authored
279
873b0ef @rsaccon monster commit: integrated Evan's changes (much improved everything)
rsaccon authored
280 ForBlock -> ForBraced Elements EndForBraced : {for, '$1', '$2'}.
25abda5 @evanmiller Support for {% empty %} block in for loops.
evanmiller authored
281 ForBlock -> ForBraced Elements EmptyBraced Elements EndForBraced : {for, '$1', '$2', '$4'}.
282 EmptyBraced -> open_tag empty_keyword close_tag.
873b0ef @rsaccon monster commit: integrated Evan's changes (much improved everything)
rsaccon authored
283 ForBraced -> open_tag for_keyword ForExpression close_tag : '$3'.
284 EndForBraced -> open_tag endfor_keyword close_tag.
79c30e5 @evanmiller 1. Support variable names in for expressions (e.g., for x in foo.bar)
evanmiller authored
285 ForExpression -> ForGroup in_keyword Variable : {'in', '$1', '$3'}.
677116d @evanmiller * Support for unpacking tuples in a for loop.
evanmiller authored
286 ForGroup -> identifier : ['$1'].
4fb4176 @evanmiller Slightly nicer error messages.
evanmiller authored
287 ForGroup -> ForGroup ',' identifier : '$1' ++ ['$3'].
873b0ef @rsaccon monster commit: integrated Evan's changes (much improved everything)
rsaccon authored
288
289 IfBlock -> IfBraced Elements ElseBraced Elements EndIfBraced : {ifelse, '$1', '$2', '$4'}.
290 IfBlock -> IfBraced Elements EndIfBraced : {'if', '$1', '$2'}.
291 IfBraced -> open_tag if_keyword IfExpression close_tag : '$3'.
b96dd0b @evanmiller Zotonic: Basic boolean operators in "if" clause
evanmiller authored
292 IfExpression -> Value in_keyword Value : {'expr', "in", '$1', '$3'}.
293 IfExpression -> Value not_keyword in_keyword Value : {'expr', "not", {'expr', "in", '$1', '$4'}}.
294 IfExpression -> Value '==' Value : {'expr', "eq", '$1', '$3'}.
e66e38a @evanmiller More operators.
evanmiller authored
295 IfExpression -> Value '!=' Value : {'expr', "ne", '$1', '$3'}.
296 IfExpression -> Value '>=' Value : {'expr', "ge", '$1', '$3'}.
297 IfExpression -> Value '<=' Value : {'expr', "le", '$1', '$3'}.
298 IfExpression -> Value '>' Value : {'expr', "gt", '$1', '$3'}.
299 IfExpression -> Value '<' Value : {'expr', "lt", '$1', '$3'}.
b96dd0b @evanmiller Zotonic: Basic boolean operators in "if" clause
evanmiller authored
300 IfExpression -> '(' IfExpression ')' : '$2'.
301 IfExpression -> Unot : '$1'.
302 IfExpression -> IfExpression or_keyword IfExpression : {'expr', "or", '$1', '$3'}.
303 IfExpression -> IfExpression and_keyword IfExpression : {'expr', "and", '$1', '$3'}.
b4bf177 @evanmiller 1. Can resolve variables from function calls to parameterized modules…
evanmiller authored
304 IfExpression -> Value : '$1'.
873b0ef @rsaccon monster commit: integrated Evan's changes (much improved everything)
rsaccon authored
305
b96dd0b @evanmiller Zotonic: Basic boolean operators in "if" clause
evanmiller authored
306 Unot -> not_keyword IfExpression : {expr, "not", '$2'}.
307
873b0ef @rsaccon monster commit: integrated Evan's changes (much improved everything)
rsaccon authored
308 ElseBraced -> open_tag else_keyword close_tag.
309 EndIfBraced -> open_tag endif_keyword close_tag.
310
1b16fa0 Support for {% ifchanged %} tag
Evan Miller authored
311 IfChangedBlock -> IfChangedBraced Elements ElseBraced Elements EndIfChangedBraced : {ifchangedelse, '$2', '$4'}.
312 IfChangedBlock -> IfChangedBraced Elements EndIfChangedBraced : {ifchanged, '$2'}.
313 IfChangedBraced -> open_tag ifchanged_keyword close_tag.
314 EndIfChangedBraced -> open_tag endifchanged_keyword close_tag.
315
15fa5ce @rsaccon added ifequal tag
rsaccon authored
316 IfEqualBlock -> IfEqualBraced Elements ElseBraced Elements EndIfEqualBraced : {ifequalelse, '$1', '$2', '$4'}.
317 IfEqualBlock -> IfEqualBraced Elements EndIfEqualBraced : {ifequal, '$1', '$2'}.
b4bf177 @evanmiller 1. Can resolve variables from function calls to parameterized modules…
evanmiller authored
318 IfEqualBraced -> open_tag ifequal_keyword IfEqualExpression Value close_tag : ['$3', '$4'].
319 IfEqualExpression -> Value : '$1'.
15fa5ce @rsaccon added ifequal tag
rsaccon authored
320 EndIfEqualBraced -> open_tag endifequal_keyword close_tag.
321
7ebb7dd @rsaccon added ifnotequal tag
rsaccon authored
322 IfNotEqualBlock -> IfNotEqualBraced Elements ElseBraced Elements EndIfNotEqualBraced : {ifnotequalelse, '$1', '$2', '$4'}.
323 IfNotEqualBlock -> IfNotEqualBraced Elements EndIfNotEqualBraced : {ifnotequal, '$1', '$2'}.
b4bf177 @evanmiller 1. Can resolve variables from function calls to parameterized modules…
evanmiller authored
324 IfNotEqualBraced -> open_tag ifnotequal_keyword IfNotEqualExpression Value close_tag : ['$3', '$4'].
325 IfNotEqualExpression -> Value : '$1'.
7ebb7dd @rsaccon added ifnotequal tag
rsaccon authored
326 EndIfNotEqualBraced -> open_tag endifnotequal_keyword close_tag.
327
e26d23f @evanmiller New tag: spaceless
evanmiller authored
328 SpacelessBlock -> open_tag spaceless_keyword close_tag Elements open_tag endspaceless_keyword close_tag : {spaceless, '$4'}.
329
7bd6d35 @evanmiller New tags: ssi, filter, templatetag, and widthratio
evanmiller authored
330 SSITag -> open_tag ssi_keyword Value close_tag : {ssi, '$3'}.
fa28530 @evanmiller Change "include" tag to follow Django behavior
evanmiller authored
331 SSITag -> open_tag ssi_keyword string_literal parsed_keyword close_tag : {ssi_parsed, '$3'}.
7bd6d35 @evanmiller New tags: ssi, filter, templatetag, and widthratio
evanmiller authored
332
dc377d7 {% blocktrans %} no longer uses identifiers
Evan Miller authored
333 BlockTransBlock -> open_tag blocktrans_keyword close_tag Elements open_tag endblocktrans_keyword close_tag : {blocktrans, [], '$4'}.
334 BlockTransBlock -> open_tag blocktrans_keyword with_keyword Args close_tag Elements open_tag endblocktrans_keyword close_tag : {blocktrans, '$4', '$6'}.
694fc92 Preliminary blocktrans support
Evan Miller authored
335
7bd6d35 @evanmiller New tags: ssi, filter, templatetag, and widthratio
evanmiller authored
336 TemplatetagTag -> open_tag templatetag_keyword Templatetag close_tag : {templatetag, '$3'}.
337
338 Templatetag -> openblock_keyword : '$1'.
339 Templatetag -> closeblock_keyword : '$1'.
340 Templatetag -> openvariable_keyword : '$1'.
341 Templatetag -> closevariable_keyword : '$1'.
342 Templatetag -> openbrace_keyword : '$1'.
343 Templatetag -> closebrace_keyword : '$1'.
344 Templatetag -> opencomment_keyword : '$1'.
345 Templatetag -> closecomment_keyword : '$1'.
346
347 TransTag -> open_tag trans_keyword string_literal close_tag : {trans, '$3'}.
348 TransTag -> open_tag trans_keyword Variable close_tag : {trans, '$3'}.
349 TransTag -> open_tag trans_keyword string_literal noop_keyword close_tag : '$3'.
350 TransTag -> open_tag trans_keyword Variable noop_keyword close_tag : '$3'.
351
352 WidthRatioTag -> open_tag widthratio_keyword Value Value number_literal close_tag : {widthratio, '$3', '$4', '$5'}.
353
354 WithBlock -> WithBraced Elements EndWithBraced : {with, '$1', '$2'}.
355 WithBraced -> open_tag with_keyword Args close_tag : '$3'.
356 EndWithBraced -> open_tag endwith_keyword close_tag.
873b0ef @rsaccon monster commit: integrated Evan's changes (much improved everything)
rsaccon authored
357
358 Filter -> identifier : ['$1'].
4fb4176 @evanmiller Slightly nicer error messages.
evanmiller authored
359 Filter -> identifier ':' Literal : ['$1', '$3'].
ae6bf4b @evanmiller Integrate new filters and tests from dgulino
evanmiller authored
360 Filter -> identifier ':' Variable : ['$1', '$3'].
873b0ef @rsaccon monster commit: integrated Evan's changes (much improved everything)
rsaccon authored
361
694fc92 Preliminary blocktrans support
Evan Miller authored
362 Literal -> '_' '(' string_literal ')' : {trans, '$3'}.
873b0ef @rsaccon monster commit: integrated Evan's changes (much improved everything)
rsaccon authored
363 Literal -> string_literal : '$1'.
677116d @evanmiller * Support for unpacking tuples in a for loop.
evanmiller authored
364 Literal -> number_literal : '$1'.
e1c0e96 @rsaccon added call custom tag (based on patch from Jeremey Latt) - not comple…
rsaccon authored
365
366 CustomTag -> open_tag identifier Args close_tag : {tag, '$2', '$3'}.
367
368 Args -> '$empty' : [].
4fb4176 @evanmiller Slightly nicer error messages.
evanmiller authored
369 Args -> Args identifier '=' Value : '$1' ++ [{'$2', '$4'}].
e1c0e96 @rsaccon added call custom tag (based on patch from Jeremey Latt) - not comple…
rsaccon authored
370
371 CallTag -> open_tag call_keyword identifier close_tag : {call, '$3'}.
b4bf177 @evanmiller 1. Can resolve variables from function calls to parameterized modules…
evanmiller authored
372 CallWithTag -> open_tag call_keyword identifier with_keyword Value close_tag : {call, '$3', '$5'}.
Something went wrong with that request. Please try again.