Skip to content

HTTPS clone URL

Subversion checkout URL

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