Description
Base scenario: Use HelloWorld.spl as a starting point. Then, duplicate the HelloWorld
composite and give it a unique name (e.g. HelloWorld2
). The application looks like this:
composite HelloWorld {
...
} // End of HelloWorld composite.
composite HelloWorld2 {
...
} // End of HelloWorld2 composite.
- If you comment out the
HelloWorld2
composite with//
and then try to build, the available composite options areHelloWorld
and.
. The.
comes from the// End of HelloWorld composite.
comment.
composite HelloWorld {
...
} // End of HelloWorld composite.
// composite HelloWorld2 {
// ...
// } // End of HelloWorld2 composite.
- If you comment out the
HelloWorld2
composite with/* ... */
and then try to build, the available composite options areHelloWorld
andHelloWorld2
.
composite HelloWorld {
...
} // End of HelloWorld composite.
/* composite HelloWorld2 {
...
} // End of HelloWorld2 composite. */
For both scenarios, I would expect that there is only one composite available to build (HelloWorld
), and thus the composite selector should not show up.
The current regex is this:
/.*?(?:\bcomposite\b)(?:\s*|\/\/.*?|\/\*.*?\*\/)+([a-z|A-Z|0-9|\.|\_]+)(?:\s*|\/\/.*?|\/\*.*?\*\/)*\{/gm
I think we should be detecting the start of the line using ^
, and only match whitespace characters at the beginning of lines using /s
rather than matching all characters .
. Something like this:
/^\s*(?:\bcomposite\b)(?:\s*|\/\/.*?|\/\*.*?\*\/)+([a-z|A-Z|0-9|\.|\_]+)(?:\s*|\/\/.*?|\/\*.*?\*\/)*\{/gm