File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -287,7 +287,14 @@ func (l *lexer) run() {
287
287
// state functions
288
288
func lexText (l * lexer ) stateFn {
289
289
for {
290
- if i := strings .IndexByte (l .input [l .pos :], l .leftDelim [0 ]); i == - 1 {
290
+ // without breaking the API, this seems like a reasonable workaround to correctly parse comments
291
+ i := strings .IndexByte (l .input [l .pos :], l .leftDelim [0 ]) // index of suspected left delimiter
292
+ ic := strings .IndexByte (l .input [l .pos :], leftComment [0 ]) // index of suspected left comment marker
293
+ if ic > - 1 && ic < i { // use whichever is lower for future lexing
294
+ i = ic
295
+ }
296
+ // if no tokn is found, skip till the end of template
297
+ if i == - 1 {
291
298
l .pos = Pos (len (l .input ))
292
299
break
293
300
} else {
Original file line number Diff line number Diff line change 1
- [[ . ]]
1
+ {* comment *} [[ . ]]
2
2
[[ singleValue ]]
3
3
[[ nil ]]
4
4
[[ "" ]]
You can’t perform that action at this time.
0 commit comments