Skip to content
Newer
Older
100644 408 lines (338 sloc) 13.9 KB
9213d0f @kaos add customized yeccpre.hrl file.
kaos authored
1 %%% -*- mode: erlang -*- ------------------------------------------------------------------
f84b2a8 @rsaccon initial commit
rsaccon authored
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
2baffee @kaos Cleanup filter code to make it more generic.
kaos authored
45 FilterArg
46
7bd6d35 @evanmiller New tags: ssi, filter, templatetag, and widthratio
evanmiller authored
47 AutoEscapeBlock
48 AutoEscapeBraced
49 EndAutoEscapeBraced
873b0ef @rsaccon monster commit: integrated Evan's changes (much improved everything)
rsaccon authored
50
51 BlockBlock
52 BlockBraced
53 EndBlockBraced
54
55 CommentBlock
56 CommentBraced
57 EndCommentBraced
58
b67188e @evanmiller Support for "cycle" tag. Patch from Hunter Morris.
evanmiller authored
59 CycleTag
60 CycleNames
61 CycleNamesCompat
62
7bd6d35 @evanmiller New tags: ssi, filter, templatetag, and widthratio
evanmiller authored
63 ExtendsTag
64 IncludeTag
65 NowTag
66
50080db @asonge Adding firstof functionality
asonge authored
67 FirstofTag
68
7bd6d35 @evanmiller New tags: ssi, filter, templatetag, and widthratio
evanmiller authored
69 FilterBlock
70 FilterBraced
71 EndFilterBraced
72 Filters
73
873b0ef @rsaccon monster commit: integrated Evan's changes (much improved everything)
rsaccon authored
74 ForBlock
75 ForBraced
25abda5 @evanmiller Support for {% empty %} block in for loops.
evanmiller authored
76 EmptyBraced
873b0ef @rsaccon monster commit: integrated Evan's changes (much improved everything)
rsaccon authored
77 EndForBraced
78 ForExpression
79 ForGroup
80
81 IfBlock
82 IfBraced
9f074aa @psyeugenic Add support for {% elif Expr %} syntax
psyeugenic authored
83 ElifBlock
84 ElifBraced
873b0ef @rsaccon monster commit: integrated Evan's changes (much improved everything)
rsaccon authored
85 IfExpression
86 ElseBraced
87 EndIfBraced
15fa5ce @rsaccon added ifequal tag
rsaccon authored
88
1b16fa0 Support for {% ifchanged %} tag
Evan Miller authored
89 IfChangedBlock
90 IfChangedBraced
91 EndIfChangedBraced
92
15fa5ce @rsaccon added ifequal tag
rsaccon authored
93 IfEqualBlock
94 IfEqualBraced
95 IfEqualExpression
7ebb7dd @rsaccon added ifnotequal tag
rsaccon authored
96 EndIfEqualBraced
97
98 IfNotEqualBlock
99 IfNotEqualBraced
100 IfNotEqualExpression
101 EndIfNotEqualBraced
873b0ef @rsaccon monster commit: integrated Evan's changes (much improved everything)
rsaccon authored
102
132ebf9 @rsaccon added load tag (not fully functional yet)
rsaccon authored
103 CustomTag
c065dc1 @kaos Fix django compatibility for custom tag arguments.
kaos authored
104 CustomArgs
e1c0e96 @rsaccon added call custom tag (based on patch from Jeremey Latt) - not comple…
rsaccon authored
105 Args
48fea22 Implement "trans" tag with support for .po files
Evan Miller authored
106
c624a50 Support for {% regroup %} tag.
Evan Miller authored
107 RegroupBlock
108 RegroupBraced
109 EndRegroupBraced
110
e26d23f @evanmiller New tag: spaceless
evanmiller authored
111 SpacelessBlock
112
7bd6d35 @evanmiller New tags: ssi, filter, templatetag, and widthratio
evanmiller authored
113 SSITag
114
694fc92 Preliminary blocktrans support
Evan Miller authored
115 BlockTransBlock
48fea22 Implement "trans" tag with support for .po files
Evan Miller authored
116 TransTag
117
7bd6d35 @evanmiller New tags: ssi, filter, templatetag, and widthratio
evanmiller authored
118 TemplatetagTag
119 Templatetag
120
121 WidthRatioTag
122
123 WithBlock
124 WithBraced
125 EndWithBraced
126
e1c0e96 @rsaccon added call custom tag (based on patch from Jeremey Latt) - not comple…
rsaccon authored
127 CallTag
b96dd0b @evanmiller Zotonic: Basic boolean operators in "if" clause
evanmiller authored
128 CallWithTag
129
130 Unot.
873b0ef @rsaccon monster commit: integrated Evan's changes (much improved everything)
rsaccon authored
131
132 Terminals
b96dd0b @evanmiller Zotonic: Basic boolean operators in "if" clause
evanmiller authored
133 and_keyword
c624a50 Support for {% regroup %} tag.
Evan Miller authored
134 as_keyword
873b0ef @rsaccon monster commit: integrated Evan's changes (much improved everything)
rsaccon authored
135 autoescape_keyword
136 block_keyword
694fc92 Preliminary blocktrans support
Evan Miller authored
137 blocktrans_keyword
c624a50 Support for {% regroup %} tag.
Evan Miller authored
138 by_keyword
e1c0e96 @rsaccon added call custom tag (based on patch from Jeremey Latt) - not comple…
rsaccon authored
139 call_keyword
873b0ef @rsaccon monster commit: integrated Evan's changes (much improved everything)
rsaccon authored
140 close_tag
141 close_var
142 comment_keyword
b67188e @evanmiller Support for "cycle" tag. Patch from Hunter Morris.
evanmiller authored
143 cycle_keyword
9f074aa @psyeugenic Add support for {% elif Expr %} syntax
psyeugenic authored
144 elif_keyword
873b0ef @rsaccon monster commit: integrated Evan's changes (much improved everything)
rsaccon authored
145 else_keyword
25abda5 @evanmiller Support for {% empty %} block in for loops.
evanmiller authored
146 empty_keyword
873b0ef @rsaccon monster commit: integrated Evan's changes (much improved everything)
rsaccon authored
147 endautoescape_keyword
148 endblock_keyword
694fc92 Preliminary blocktrans support
Evan Miller authored
149 endblocktrans_keyword
873b0ef @rsaccon monster commit: integrated Evan's changes (much improved everything)
rsaccon authored
150 endcomment_keyword
7bd6d35 @evanmiller New tags: ssi, filter, templatetag, and widthratio
evanmiller authored
151 endfilter_keyword
873b0ef @rsaccon monster commit: integrated Evan's changes (much improved everything)
rsaccon authored
152 endfor_keyword
153 endif_keyword
1b16fa0 Support for {% ifchanged %} tag
Evan Miller authored
154 endifchanged_keyword
15fa5ce @rsaccon added ifequal tag
rsaccon authored
155 endifequal_keyword
7ebb7dd @rsaccon added ifnotequal tag
rsaccon authored
156 endifnotequal_keyword
c624a50 Support for {% regroup %} tag.
Evan Miller authored
157 endregroup_keyword
e26d23f @evanmiller New tag: spaceless
evanmiller authored
158 endspaceless_keyword
7bd6d35 @evanmiller New tags: ssi, filter, templatetag, and widthratio
evanmiller authored
159 endwith_keyword
873b0ef @rsaccon monster commit: integrated Evan's changes (much improved everything)
rsaccon authored
160 extends_keyword
7bd6d35 @evanmiller New tags: ssi, filter, templatetag, and widthratio
evanmiller authored
161 filter_keyword
50080db @asonge Adding firstof functionality
asonge authored
162 firstof_keyword
873b0ef @rsaccon monster commit: integrated Evan's changes (much improved everything)
rsaccon authored
163 for_keyword
164 identifier
165 if_keyword
1b16fa0 Support for {% ifchanged %} tag
Evan Miller authored
166 ifchanged_keyword
15fa5ce @rsaccon added ifequal tag
rsaccon authored
167 ifequal_keyword
7ebb7dd @rsaccon added ifnotequal tag
rsaccon authored
168 ifnotequal_keyword
873b0ef @rsaccon monster commit: integrated Evan's changes (much improved everything)
rsaccon authored
169 in_keyword
170 include_keyword
1a719d9 @evanmiller Use a translation fun instead of translation dict.
evanmiller authored
171 noop_keyword
873b0ef @rsaccon monster commit: integrated Evan's changes (much improved everything)
rsaccon authored
172 not_keyword
48b9b5f @gardenia Added "now" tag and associated associated dateformat module.
gardenia authored
173 now_keyword
873b0ef @rsaccon monster commit: integrated Evan's changes (much improved everything)
rsaccon authored
174 number_literal
ab53409 @evanmiller Support "only" keyword with include
evanmiller authored
175 only_keyword
b96dd0b @evanmiller Zotonic: Basic boolean operators in "if" clause
evanmiller authored
176 or_keyword
873b0ef @rsaccon monster commit: integrated Evan's changes (much improved everything)
rsaccon authored
177 open_tag
178 open_var
fa28530 @evanmiller Change "include" tag to follow Django behavior
evanmiller authored
179 parsed_keyword
c624a50 Support for {% regroup %} tag.
Evan Miller authored
180 regroup_keyword
898fbae @evanmiller Support {% for .. in .. reversed %} syntax
evanmiller authored
181 reversed_keyword
e26d23f @evanmiller New tag: spaceless
evanmiller authored
182 spaceless_keyword
7bd6d35 @evanmiller New tags: ssi, filter, templatetag, and widthratio
evanmiller authored
183 ssi_keyword
873b0ef @rsaccon monster commit: integrated Evan's changes (much improved everything)
rsaccon authored
184 string_literal
4fb4176 @evanmiller Slightly nicer error messages.
evanmiller authored
185 string
7bd6d35 @evanmiller New tags: ssi, filter, templatetag, and widthratio
evanmiller authored
186 templatetag_keyword
694fc92 Preliminary blocktrans support
Evan Miller authored
187 openblock_keyword
188 closeblock_keyword
189 openvariable_keyword
190 closevariable_keyword
191 openbrace_keyword
192 closebrace_keyword
193 opencomment_keyword
194 closecomment_keyword
48fea22 Implement "trans" tag with support for .po files
Evan Miller authored
195 trans_keyword
7bd6d35 @evanmiller New tags: ssi, filter, templatetag, and widthratio
evanmiller authored
196 widthratio_keyword
b96dd0b @evanmiller Zotonic: Basic boolean operators in "if" clause
evanmiller authored
197 with_keyword
4fb4176 @evanmiller Slightly nicer error messages.
evanmiller authored
198 ',' '|' '=' ':' '.'
e66e38a @evanmiller More operators.
evanmiller authored
199 '==' '!='
200 '>=' '<='
201 '>' '<'
694fc92 Preliminary blocktrans support
Evan Miller authored
202 '(' ')'
203 '_'.
873b0ef @rsaccon monster commit: integrated Evan's changes (much improved everything)
rsaccon authored
204
205 Rootsymbol
206 Elements.
207
b96dd0b @evanmiller Zotonic: Basic boolean operators in "if" clause
evanmiller authored
208 %% Operator precedences for the E non terminal
209 Left 100 or_keyword.
210 Left 110 and_keyword.
e66e38a @evanmiller More operators.
evanmiller authored
211 Nonassoc 300 '==' '!=' '>=' '<=' '>' '<'.
b96dd0b @evanmiller Zotonic: Basic boolean operators in "if" clause
evanmiller authored
212 Unary 600 Unot.
213
873b0ef @rsaccon monster commit: integrated Evan's changes (much improved everything)
rsaccon authored
214 Elements -> '$empty' : [].
4fb4176 @evanmiller Slightly nicer error messages.
evanmiller authored
215 Elements -> Elements string : '$1' ++ ['$2'].
7bd6d35 @evanmiller New tags: ssi, filter, templatetag, and widthratio
evanmiller authored
216 Elements -> Elements AutoEscapeBlock : '$1' ++ ['$2'].
873b0ef @rsaccon monster commit: integrated Evan's changes (much improved everything)
rsaccon authored
217 Elements -> Elements BlockBlock : '$1' ++ ['$2'].
694fc92 Preliminary blocktrans support
Evan Miller authored
218 Elements -> Elements BlockTransBlock : '$1' ++ ['$2'].
7bd6d35 @evanmiller New tags: ssi, filter, templatetag, and widthratio
evanmiller authored
219 Elements -> Elements CallTag : '$1' ++ ['$2'].
220 Elements -> Elements CallWithTag : '$1' ++ ['$2'].
221 Elements -> Elements CommentBlock : '$1' ++ ['$2'].
222 Elements -> Elements CustomTag : '$1' ++ ['$2'].
223 Elements -> Elements CycleTag : '$1' ++ ['$2'].
224 Elements -> Elements ExtendsTag : '$1' ++ ['$2'].
225 Elements -> Elements FilterBlock : '$1' ++ ['$2'].
50080db @asonge Adding firstof functionality
asonge authored
226 Elements -> Elements FirstofTag : '$1' ++ ['$2'].
873b0ef @rsaccon monster commit: integrated Evan's changes (much improved everything)
rsaccon authored
227 Elements -> Elements ForBlock : '$1' ++ ['$2'].
228 Elements -> Elements IfBlock : '$1' ++ ['$2'].
15fa5ce @rsaccon added ifequal tag
rsaccon authored
229 Elements -> Elements IfEqualBlock : '$1' ++ ['$2'].
7ebb7dd @rsaccon added ifnotequal tag
rsaccon authored
230 Elements -> Elements IfNotEqualBlock : '$1' ++ ['$2'].
1b16fa0 Support for {% ifchanged %} tag
Evan Miller authored
231 Elements -> Elements IfChangedBlock : '$1' ++ ['$2'].
7bd6d35 @evanmiller New tags: ssi, filter, templatetag, and widthratio
evanmiller authored
232 Elements -> Elements IncludeTag : '$1' ++ ['$2'].
233 Elements -> Elements NowTag : '$1' ++ ['$2'].
c624a50 Support for {% regroup %} tag.
Evan Miller authored
234 Elements -> Elements RegroupBlock : '$1' ++ ['$2'].
e26d23f @evanmiller New tag: spaceless
evanmiller authored
235 Elements -> Elements SpacelessBlock : '$1' ++ ['$2'].
7bd6d35 @evanmiller New tags: ssi, filter, templatetag, and widthratio
evanmiller authored
236 Elements -> Elements SSITag : '$1' ++ ['$2'].
237 Elements -> Elements TemplatetagTag : '$1' ++ ['$2'].
238 Elements -> Elements TransTag : '$1' ++ ['$2'].
239 Elements -> Elements ValueBraced : '$1' ++ ['$2'].
240 Elements -> Elements WidthRatioTag : '$1' ++ ['$2'].
241 Elements -> Elements WithBlock : '$1' ++ ['$2'].
873b0ef @rsaccon monster commit: integrated Evan's changes (much improved everything)
rsaccon authored
242
b4bf177 @evanmiller 1. Can resolve variables from function calls to parameterized modules…
evanmiller authored
243 ValueBraced -> open_var Value close_var : '$2'.
873b0ef @rsaccon monster commit: integrated Evan's changes (much improved everything)
rsaccon authored
244
4fb4176 @evanmiller Slightly nicer error messages.
evanmiller authored
245 Value -> Value '|' Filter : {apply_filter, '$1', '$3'}.
8411bac @evanmiller More flexible "_" function
evanmiller authored
246 Value -> '_' '(' Value ')' : {trans, '$3'}.
b4bf177 @evanmiller 1. Can resolve variables from function calls to parameterized modules…
evanmiller authored
247 Value -> Variable : '$1'.
248 Value -> Literal : '$1'.
249
9646b5a @evanmiller Implement "iriencode" filter
evanmiller authored
250 Values -> Value : ['$1'].
2baffee @kaos Cleanup filter code to make it more generic.
kaos authored
251 Values -> Value Values : ['$1'|'$2'].
252
253 Filter -> identifier FilterArg : {'$1', '$2'}.
254
255 FilterArg -> '$empty' : [].
256 FilterArg -> ':' Variable : ['$2'].
257 FilterArg -> ':' Literal : ['$2'].
9646b5a @evanmiller Implement "iriencode" filter
evanmiller authored
258
b4bf177 @evanmiller 1. Can resolve variables from function calls to parameterized modules…
evanmiller authored
259 Variable -> identifier : {variable, '$1'}.
1a719d9 @evanmiller Use a translation fun instead of translation dict.
evanmiller authored
260 Variable -> Variable '.' identifier : {attribute, {'$3', '$1'}}.
c2aaf7d @kaos Support indexing tuple and list variable values.
kaos authored
261 Variable -> Variable '.' Literal : {attribute, {'$3', '$1'}}.
873b0ef @rsaccon monster commit: integrated Evan's changes (much improved everything)
rsaccon authored
262
2baffee @kaos Cleanup filter code to make it more generic.
kaos authored
263 Literal -> string_literal : '$1'.
264 Literal -> number_literal : '$1'.
265
7bd6d35 @evanmiller New tags: ssi, filter, templatetag, and widthratio
evanmiller authored
266 AutoEscapeBlock -> AutoEscapeBraced Elements EndAutoEscapeBraced : {autoescape, '$1', '$2'}.
267 AutoEscapeBraced -> open_tag autoescape_keyword identifier close_tag : '$3'.
268 EndAutoEscapeBraced -> open_tag endautoescape_keyword close_tag.
873b0ef @rsaccon monster commit: integrated Evan's changes (much improved everything)
rsaccon authored
269
270 BlockBlock -> BlockBraced Elements EndBlockBraced : {block, '$1', '$2'}.
271 BlockBraced -> open_tag block_keyword identifier close_tag : '$3'.
272 EndBlockBraced -> open_tag endblock_keyword close_tag.
273
7bd6d35 @evanmiller New tags: ssi, filter, templatetag, and widthratio
evanmiller authored
274 ExtendsTag -> open_tag extends_keyword string_literal close_tag : {extends, '$3'}.
fa28530 @evanmiller Change "include" tag to follow Django behavior
evanmiller authored
275
276 IncludeTag -> open_tag include_keyword string_literal close_tag : {include, '$3', []}.
277 IncludeTag -> open_tag include_keyword string_literal with_keyword Args close_tag : {include, '$3', '$5'}.
ab53409 @evanmiller Support "only" keyword with include
evanmiller authored
278 IncludeTag -> open_tag include_keyword string_literal only_keyword close_tag : {include_only, '$3', []}.
279 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
280
7bd6d35 @evanmiller New tags: ssi, filter, templatetag, and widthratio
evanmiller authored
281 NowTag -> open_tag now_keyword string_literal close_tag : {date, now, '$3'}.
282
873b0ef @rsaccon monster commit: integrated Evan's changes (much improved everything)
rsaccon authored
283 CommentBlock -> CommentBraced Elements EndCommentBraced : {comment, '$2'}.
284 CommentBraced -> open_tag comment_keyword close_tag.
285 EndCommentBraced -> open_tag endcomment_keyword close_tag.
286
b67188e @evanmiller Support for "cycle" tag. Patch from Hunter Morris.
evanmiller authored
287 CycleTag -> open_tag cycle_keyword CycleNamesCompat close_tag : {cycle_compat, '$3'}.
288 CycleTag -> open_tag cycle_keyword CycleNames close_tag : {cycle, '$3'}.
289
290 CycleNames -> Value : ['$1'].
291 CycleNames -> CycleNames Value : '$1' ++ ['$2'].
292
4fb4176 @evanmiller Slightly nicer error messages.
evanmiller authored
293 CycleNamesCompat -> identifier ',' : ['$1'].
294 CycleNamesCompat -> CycleNamesCompat identifier ',' : '$1' ++ ['$2'].
b67188e @evanmiller Support for "cycle" tag. Patch from Hunter Morris.
evanmiller authored
295 CycleNamesCompat -> CycleNamesCompat identifier : '$1' ++ ['$2'].
296
7bd6d35 @evanmiller New tags: ssi, filter, templatetag, and widthratio
evanmiller authored
297 FilterBlock -> FilterBraced Elements EndFilterBraced : {filter, '$1', '$2'}.
298 FilterBraced -> open_tag filter_keyword Filters close_tag : '$3'.
299 EndFilterBraced -> open_tag endfilter_keyword close_tag.
300
301 Filters -> Filter : ['$1'].
2baffee @kaos Cleanup filter code to make it more generic.
kaos authored
302 Filters -> Filter '|' Filters : ['$1'|'$3'].
7bd6d35 @evanmiller New tags: ssi, filter, templatetag, and widthratio
evanmiller authored
303
9646b5a @evanmiller Implement "iriencode" filter
evanmiller authored
304 FirstofTag -> open_tag firstof_keyword Values close_tag : {firstof, '$3'}.
50080db @asonge Adding firstof functionality
asonge authored
305
873b0ef @rsaccon monster commit: integrated Evan's changes (much improved everything)
rsaccon authored
306 ForBlock -> ForBraced Elements EndForBraced : {for, '$1', '$2'}.
25abda5 @evanmiller Support for {% empty %} block in for loops.
evanmiller authored
307 ForBlock -> ForBraced Elements EmptyBraced Elements EndForBraced : {for, '$1', '$2', '$4'}.
308 EmptyBraced -> open_tag empty_keyword close_tag.
873b0ef @rsaccon monster commit: integrated Evan's changes (much improved everything)
rsaccon authored
309 ForBraced -> open_tag for_keyword ForExpression close_tag : '$3'.
310 EndForBraced -> open_tag endfor_keyword close_tag.
d77195d @kaos for loop should be able to loop over values and filtered variables too.
kaos authored
311 ForExpression -> ForGroup in_keyword Value : {'in', '$1', '$3', false}.
312 ForExpression -> ForGroup in_keyword Value reversed_keyword : {'in', '$1', '$3', true}.
677116d @evanmiller * Support for unpacking tuples in a for loop.
evanmiller authored
313 ForGroup -> identifier : ['$1'].
4fb4176 @evanmiller Slightly nicer error messages.
evanmiller authored
314 ForGroup -> ForGroup ',' identifier : '$1' ++ ['$3'].
873b0ef @rsaccon monster commit: integrated Evan's changes (much improved everything)
rsaccon authored
315
9f074aa @psyeugenic Add support for {% elif Expr %} syntax
psyeugenic authored
316 IfBlock -> IfBraced Elements ElseBraced Elements EndIfBraced : {'ifelse', '$1', '$2', '$4'}.
873b0ef @rsaccon monster commit: integrated Evan's changes (much improved everything)
rsaccon authored
317 IfBlock -> IfBraced Elements EndIfBraced : {'if', '$1', '$2'}.
9f074aa @psyeugenic Add support for {% elif Expr %} syntax
psyeugenic authored
318 IfBlock -> IfBraced Elements ElifBlock : {'if', '$1', '$2', ['$3']}.
319 ElifBlock -> ElifBraced Elements ElseBraced Elements EndIfBraced : {'ifelse', '$1', '$2', '$4'}.
320 ElifBlock -> ElifBraced Elements EndIfBraced : {'if', '$1', '$2'}.
321 ElifBlock -> ElifBraced Elements ElifBlock : {'if', '$1', '$2', ['$3']}.
873b0ef @rsaccon monster commit: integrated Evan's changes (much improved everything)
rsaccon authored
322 IfBraced -> open_tag if_keyword IfExpression close_tag : '$3'.
9f074aa @psyeugenic Add support for {% elif Expr %} syntax
psyeugenic authored
323 ElifBraced -> open_tag elif_keyword IfExpression close_tag : '$3'.
b96dd0b @evanmiller Zotonic: Basic boolean operators in "if" clause
evanmiller authored
324 IfExpression -> Value in_keyword Value : {'expr', "in", '$1', '$3'}.
325 IfExpression -> Value not_keyword in_keyword Value : {'expr', "not", {'expr', "in", '$1', '$4'}}.
326 IfExpression -> Value '==' Value : {'expr', "eq", '$1', '$3'}.
e66e38a @evanmiller More operators.
evanmiller authored
327 IfExpression -> Value '!=' Value : {'expr', "ne", '$1', '$3'}.
328 IfExpression -> Value '>=' Value : {'expr', "ge", '$1', '$3'}.
329 IfExpression -> Value '<=' Value : {'expr', "le", '$1', '$3'}.
330 IfExpression -> Value '>' Value : {'expr', "gt", '$1', '$3'}.
331 IfExpression -> Value '<' Value : {'expr', "lt", '$1', '$3'}.
b96dd0b @evanmiller Zotonic: Basic boolean operators in "if" clause
evanmiller authored
332 IfExpression -> '(' IfExpression ')' : '$2'.
333 IfExpression -> Unot : '$1'.
334 IfExpression -> IfExpression or_keyword IfExpression : {'expr', "or", '$1', '$3'}.
335 IfExpression -> IfExpression and_keyword IfExpression : {'expr', "and", '$1', '$3'}.
b4bf177 @evanmiller 1. Can resolve variables from function calls to parameterized modules…
evanmiller authored
336 IfExpression -> Value : '$1'.
873b0ef @rsaccon monster commit: integrated Evan's changes (much improved everything)
rsaccon authored
337
b96dd0b @evanmiller Zotonic: Basic boolean operators in "if" clause
evanmiller authored
338 Unot -> not_keyword IfExpression : {expr, "not", '$2'}.
339
873b0ef @rsaccon monster commit: integrated Evan's changes (much improved everything)
rsaccon authored
340 ElseBraced -> open_tag else_keyword close_tag.
341 EndIfBraced -> open_tag endif_keyword close_tag.
342
11b4380 @thge Support {% ifchanged Expression(s) %} like Django does
thge authored
343 IfChangedBlock -> IfChangedBraced Elements ElseBraced Elements EndIfChangedBraced : {ifchangedelse, '$1', '$2', '$4'}.
344 IfChangedBlock -> IfChangedBraced Elements EndIfChangedBraced : {ifchanged, '$1', '$2'}.
1b16fa0 Support for {% ifchanged %} tag
Evan Miller authored
345 IfChangedBraced -> open_tag ifchanged_keyword close_tag.
165b1bf Support arbitrary number of arguments to ifchanged
Evan Miller authored
346 IfChangedBraced -> open_tag ifchanged_keyword Values close_tag : '$3'.
1b16fa0 Support for {% ifchanged %} tag
Evan Miller authored
347 EndIfChangedBraced -> open_tag endifchanged_keyword close_tag.
348
15fa5ce @rsaccon added ifequal tag
rsaccon authored
349 IfEqualBlock -> IfEqualBraced Elements ElseBraced Elements EndIfEqualBraced : {ifequalelse, '$1', '$2', '$4'}.
350 IfEqualBlock -> IfEqualBraced Elements EndIfEqualBraced : {ifequal, '$1', '$2'}.
b4bf177 @evanmiller 1. Can resolve variables from function calls to parameterized modules…
evanmiller authored
351 IfEqualBraced -> open_tag ifequal_keyword IfEqualExpression Value close_tag : ['$3', '$4'].
352 IfEqualExpression -> Value : '$1'.
15fa5ce @rsaccon added ifequal tag
rsaccon authored
353 EndIfEqualBraced -> open_tag endifequal_keyword close_tag.
354
7ebb7dd @rsaccon added ifnotequal tag
rsaccon authored
355 IfNotEqualBlock -> IfNotEqualBraced Elements ElseBraced Elements EndIfNotEqualBraced : {ifnotequalelse, '$1', '$2', '$4'}.
356 IfNotEqualBlock -> IfNotEqualBraced Elements EndIfNotEqualBraced : {ifnotequal, '$1', '$2'}.
b4bf177 @evanmiller 1. Can resolve variables from function calls to parameterized modules…
evanmiller authored
357 IfNotEqualBraced -> open_tag ifnotequal_keyword IfNotEqualExpression Value close_tag : ['$3', '$4'].
358 IfNotEqualExpression -> Value : '$1'.
7ebb7dd @rsaccon added ifnotequal tag
rsaccon authored
359 EndIfNotEqualBraced -> open_tag endifnotequal_keyword close_tag.
360
c624a50 Support for {% regroup %} tag.
Evan Miller authored
361 RegroupBlock -> RegroupBraced Elements EndRegroupBraced : {regroup, '$1', '$2'}.
e157b4d @garazdawi Extend the regroup syntax to support nested keys
garazdawi authored
362 RegroupBraced -> open_tag regroup_keyword Value by_keyword Value as_keyword identifier close_tag : {'$3', '$5', '$7'}.
c624a50 Support for {% regroup %} tag.
Evan Miller authored
363 EndRegroupBraced -> open_tag endregroup_keyword close_tag.
364
e26d23f @evanmiller New tag: spaceless
evanmiller authored
365 SpacelessBlock -> open_tag spaceless_keyword close_tag Elements open_tag endspaceless_keyword close_tag : {spaceless, '$4'}.
366
7bd6d35 @evanmiller New tags: ssi, filter, templatetag, and widthratio
evanmiller authored
367 SSITag -> open_tag ssi_keyword Value close_tag : {ssi, '$3'}.
fa28530 @evanmiller Change "include" tag to follow Django behavior
evanmiller authored
368 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
369
dc377d7 {% blocktrans %} no longer uses identifiers
Evan Miller authored
370 BlockTransBlock -> open_tag blocktrans_keyword close_tag Elements open_tag endblocktrans_keyword close_tag : {blocktrans, [], '$4'}.
371 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
372
7bd6d35 @evanmiller New tags: ssi, filter, templatetag, and widthratio
evanmiller authored
373 TemplatetagTag -> open_tag templatetag_keyword Templatetag close_tag : {templatetag, '$3'}.
374
375 Templatetag -> openblock_keyword : '$1'.
376 Templatetag -> closeblock_keyword : '$1'.
377 Templatetag -> openvariable_keyword : '$1'.
378 Templatetag -> closevariable_keyword : '$1'.
379 Templatetag -> openbrace_keyword : '$1'.
380 Templatetag -> closebrace_keyword : '$1'.
381 Templatetag -> opencomment_keyword : '$1'.
382 Templatetag -> closecomment_keyword : '$1'.
383
384 TransTag -> open_tag trans_keyword string_literal close_tag : {trans, '$3'}.
385 TransTag -> open_tag trans_keyword Variable close_tag : {trans, '$3'}.
386 TransTag -> open_tag trans_keyword string_literal noop_keyword close_tag : '$3'.
387 TransTag -> open_tag trans_keyword Variable noop_keyword close_tag : '$3'.
388
389 WidthRatioTag -> open_tag widthratio_keyword Value Value number_literal close_tag : {widthratio, '$3', '$4', '$5'}.
390
391 WithBlock -> WithBraced Elements EndWithBraced : {with, '$1', '$2'}.
392 WithBraced -> open_tag with_keyword Args close_tag : '$3'.
393 EndWithBraced -> open_tag endwith_keyword close_tag.
873b0ef @rsaccon monster commit: integrated Evan's changes (much improved everything)
rsaccon authored
394
c065dc1 @kaos Fix django compatibility for custom tag arguments.
kaos authored
395 CustomTag -> open_tag identifier CustomArgs close_tag : {tag, '$2', '$3'}.
396
397 CustomArgs -> '$empty' : [].
398 CustomArgs -> identifier '=' Value CustomArgs : [{'$1', '$3'}|'$4'].
399 CustomArgs -> Value CustomArgs : ['$1'|'$2'].
e1c0e96 @rsaccon added call custom tag (based on patch from Jeremey Latt) - not comple…
rsaccon authored
400
401 Args -> '$empty' : [].
4fb4176 @evanmiller Slightly nicer error messages.
evanmiller authored
402 Args -> Args identifier '=' Value : '$1' ++ [{'$2', '$4'}].
e1c0e96 @rsaccon added call custom tag (based on patch from Jeremey Latt) - not comple…
rsaccon authored
403
404 CallTag -> open_tag call_keyword identifier close_tag : {call, '$3'}.
b4bf177 @evanmiller 1. Can resolve variables from function calls to parameterized modules…
evanmiller authored
405 CallWithTag -> open_tag call_keyword identifier with_keyword Value close_tag : {call, '$3', '$5'}.
9f074aa @psyeugenic Add support for {% elif Expr %} syntax
psyeugenic authored
406
407 %% vim: syntax=erlang
Something went wrong with that request. Please try again.