Skip to content

Commit 0597eee

Browse files
Victorystickmarijnh
authored andcommitted
[soy mode] Don't require colon in @params
1 parent ee05b5b commit 0597eee

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

mode/soy/soy.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,8 @@
152152
return null;
153153

154154
case "param-def":
155-
if (match = stream.match(/^([\w]+)(?=:)/)) {
156-
state.variables = prepend(state.variables, match[1]);
155+
if (match = stream.match(/^\w+/)) {
156+
state.variables = prepend(state.variables, match[0]);
157157
state.soyState.pop();
158158
state.soyState.push("param-type");
159159
return "def";

mode/soy/test.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,4 +92,13 @@
9292
' [tag&bracket </][tag div][tag&bracket >]',
9393
'[keyword {/template}]',
9494
'');
95+
96+
MT('allow-missing-colon-in-@param',
97+
'[keyword {template] [def .foo][keyword }]',
98+
' [keyword {@param] [def showThing] [variable-3 bool][keyword }]',
99+
' [keyword {if] [variable-2 $showThing][keyword }]',
100+
' Yo!',
101+
' [keyword {/if}]',
102+
'[keyword {/template}]',
103+
'');
95104
})();

0 commit comments

Comments
 (0)