-
Notifications
You must be signed in to change notification settings - Fork 78
Description
I mistakenly wrote @ifdeg DEBUG
instead of @ifdef DEBUG
, and then I got an error.
Of course, this typo was my mistake. And I understood that by an error.
But, in some other cases, any error isn't thrown and we might not find own mistake, because the regexp in regexrules.js
has no \b
.
That is, a @(ifndef|ifdef|if)[ \t]*([^\n*]*)
matches to @ifdeg DEBUG
as a @if
and a deg DEBUG
. A ([^\n*]*)
eats deg DEBUG
.
A @(ifndef|ifdef|if)\b[ \t]*([^\n*]*)
will work correctly.
For example, @ifprocess.exit()
make the script stop (of course nobody writes this). Or, @ifdev
and the context that has dev
(it means "develop") will make unexpected result.
I think that \\b
as \b
should be inserted at right side of all directives except a @include(?!-)
, like @exclude\\b
. Or [ \t]+
instead of [ \t]*
, because the taken separater must be inserted.
And, I can't understand some patterns... Those have some reason?
- I think that
(?:[ \t]*)?
should be[ \t]*
, because*
matches to zero-length string.(...)?
is meaningless operation. - I think that
(?:/\\*)
should be/\\*
.(?:...)
is meaningless operation. - I think that
(?://)
should be//
.(?:...)
is meaningless operation. - I think that
(?:\\*(?:\\*|/))
should be\\*(?:\\*|/)
. The outer(?:...)
is meaningless operation.(?:\\*(?:\\*|/))?
is ok. - I think that
<!--[ \t]*@directive[ \t]*([^\n]*?)[ \t]*(?:-->|!>)
should be<!--\\s*@directive\\b\\s*([^\n]*?)\\s*(?:-->|!>)
, because<!--...-->
can include\n
. - I think that
[\n]
should be\n
.[...]
is meaningless operation. - Some directives use a
([^\n]*?)
to get a parameter, and some directives use(.*?)
. These work the same, because.
doesn't match to\n
. I think that(.*?)
should be used. But,(.+?)
should be used for required parameter. - I think that
(?:/\\*)[ \t]*@directive[ \t]*([^\n]*?)[ \t]*(?:\\*(?:\\*|/))
should be(?:/\\*)\\s*@directive\\s*([^\n]*?)\\s*(?:\\*(?:\\*|/))
, because/*...*/
can include\n
. - I think that
(?:[ \t]*)
should be[ \t]*
.(?:...)
is meaningless operation. - I think that
(?:#+)
should be#+
.(?:...)
is meaningless operation. - I think that
\t
and\n
as special characters should be\\t
and\\n
as patterns for unified code.
BTW, why is the ###...###
of CoffeeScript not supported?