This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 17435 - WebIDL: Bug in definition of whitespace terminal?
Summary: WebIDL: Bug in definition of whitespace terminal?
Status: RESOLVED FIXED
Alias: None
Product: WebAppsWG
Classification: Unclassified
Component: WebIDL (show other bugs)
Version: unspecified
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: Cameron McCormack
QA Contact: public-webapps-bugzilla
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-06-07 10:40 UTC by Wolfgang Keller
Modified: 2012-06-22 06:31 UTC (History)
2 users (show)

See Also:


Attachments

Description Wolfgang Keller 2012-06-07 10:40:49 UTC
In the definition of the terminals in section "A. IDL grammar" you'll find the following definition of the whitespace terminal:

whitespace = [\t\n\r ]+|[\t\n\r ]*((//.*|/\*.*?\*/)[\t\n\r ]*)+

Let's look at its part specific to block comments ("/* ... */"):

/\*.*?\*/

What does this regular expression look for (see the referenced document http://search.cpan.org/dist/perl/pod/perlre.pod for details):

a string '/*'
followed by 0 or more "any character (except newline)", not greedily (the latter one follows by using '*?' instead of '*')
followed by the string '*/'.

What consequence does this have? The answer is that block comments can't contain newline characters between the block comment delimiters - I don't believe this is what you intend.

Thus I believe, the regular expression has to be fixed. I propose the following fix, but better check it thrice for correctness:

We change the part

/\*.*?\*/
to
/\*[.\n]*?\*/

Thus the complete definition of the whitespace terminal changes to
whitespace = [\t\n\r ]+|[\t\n\r ]*((//.*|/\*[.\n]*?\*/)[\t\n\r ]*)+
Comment 1 Cameron McCormack 2012-06-22 06:31:58 UTC
You are right, although this needs to be written as (.|\n) rather than [.\n].  Fixed now:

http://dev.w3.org/cvsweb/2006/webapi/WebIDL/Overview.xml.diff?r1=1.541;r2=1.542;f=h