Possible MWEL parser bugs

Hey Chris, I noticed a few small bugs(?) that have I can easily work around, but wanted to just let you know about it:

Bug 1: cannot use multiple filenames calls when initializing a variable


// This works:
var image_manifest = {
‘category1’:filenames(‘../path_to_cat1/*.png’),
‘category2’:[‘foo.png’, ‘bar.png’]
}

// This causes opening the MWEL file to hang:
var image_manifest = {
‘category1’:filenames(‘../path_to_cat1/*.png’),
‘category2’: filenames(‘../path_to_cat2/*.png’)
}

Bug 2: “/*” string misinterpreted as start of multiline comment


/*
This is a comment.
var image_paths = filenames(‘./*.png’)
*/

Causes the following error:
Unterminated multiline comment

Hi Michael,

cannot use multiple filenames calls when initializing a variable

This is definitely a bug, although not in MWEL. Thanks for reporting it!

“/*” string misinterpreted as start of multiline comment

This is not a bug. MWEL supports nested multiline comments. In the context of a multiline comment, the parser interprets the characters /* as the beginning of a nested comment and will expect a corresponding */ to close the comment. It doesn’t know that your /* is part of a string literal, because the contents of comments aren’t parsed. (Swift, which also supports nested multiline comments, handles this situation the same way, flagging it as an unterminated comment.)

The workaround is to use single-line comments:

// This is a comment. 
// var image_paths = filenames(‘./*.png’) 

Cheers,
Chris