Possible MWEL parser bugs

mil's Avatar

mil

29 Jun, 2020 02:05 PM

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

  1. Support Staff 1 Posted by Christopher Sta... on 29 Jun, 2020 07:50 PM

    Christopher Stawarz's Avatar

    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

  2. Christopher Stawarz closed this discussion on 06 Jul, 2020 02:01 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac