Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

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