Automatically close comments at the end of input instead of throwing a "Syntax Error on line 1"

This commit is contained in:
Konstantin Käfer 2011-01-17 15:31:15 -05:00
parent 8e615e549f
commit 1fbcaf2164

View File

@ -193,7 +193,7 @@ mess.Parser = function Parser(env) {
chunks = (function (chunks) {
var j = 0,
skip = /[^"'`\{\}\/]+/g,
comment = /\/\*(?:[^*]|\*+[^\/*])*\*+\/|\/\/.*/g,
comment = /\/\*(?:[^*]|\*+[^\/*])*(?:\*+\/\n?|\**$)|\/\/.*/g,
level = 0,
match,
chunk = chunks[0],
@ -435,7 +435,7 @@ mess.Parser = function Parser(env) {
if (input.charAt(i + 1) === '/') {
return new(tree.Comment)($(/^\/\/.*/), true);
} else if (comment = $(/^\/\*(?:[^*]|\*+[^\/*])*\*+\/\n?/)) {
} else if (comment = $(/^\/\*(?:[^*]|\*+[^\/*])*(?:\*+\/\n?|\**$)/)) {
return new(tree.Comment)(comment);
}
},