Closed Bug 639365 Opened 10 years ago Closed 3 years ago

Lexer: Single line comment script issue

Categories

(Other Applications Graveyard :: Narcissus, defect)

x86
Windows XP
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: dmitry.soshnikov, Unassigned)

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; ru; rv:1.9.2.15) Gecko/20110303 Firefox/3.6.15
Build Identifier: 

If the last (or the only one) line of script contains a single line comment and there is not newline after that, lexer fails.

Reproduce:

Script containing //[NoNewLineHere]

A quick fix in `skip` method in `jslex.js`:

} else if (ch === '/' && next === '/') {
    this.cursor++;
    for (;;) {
        ch = input[this.cursor++];
        if (ch === undefined) {
            this.cursor--; // FIX IS HERE, just decrease the cursor
            return;
        }

        if (ch === '\n') {
            this.lineno++;
            break;
        }
    }
}

Then the lexer stops correctly in `get` method on:

if (this.cursor === input.length)
    return token.type = END;

Dmitry.

Reproducible: Always

Actual Results:  
Fails to parse.

Expected Results:  
Parsed normally.
Closing as Narcissus isn't maintained anymore.
Status: UNCONFIRMED → RESOLVED
Closed: 3 years ago
Resolution: --- → WONTFIX
Product: Other Applications → Other Applications Graveyard
You need to log in before you can comment on or make changes to this bug.