Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

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