Closed Bug 551072 Opened 14 years ago Closed 2 years ago

abstract out scanning and error reporting in parser

Categories

(Core :: JavaScript Engine, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: dherman, Unassigned)

Details

A number of common patterns in the parser could be abstracted out at probably zero performance cost with a few inline function definitions:

- CURRENT_TOKEN
- js_MatchToken, js_PeekToken, js_GetToken, js_UngetToken
- js_ReportCompilerErrorNumber, js_ReportErrorNumber

This should improve readability and maintainability.

Dave
Is this a duplicate of bug 549658?

We might be able to clean up error reporting more, but I think it's a method of the token stream after that patch, which isn't too bad.
Intended to add a few additional abstractions, e.g. replacing patterns like:

    tokenStream.flags |= TCF_OPERAND;
    tt = js_PeekToken(&tokenStream);
    tokenStream.flags &= ~TCF_OPERAND;

with e.g.:

    tokenStream.peekTokenAs(TCF_OPERAND);

But some of these (such as the above) belong in jsscan so I'll wait on this till you and I have a chance to sync up and merge our work.

Dave
Feel free to strip TCF_ and similar prefixes by moving enums into classes or structs, as we do elsewhere now that C++ is here to stay.

/be

The bug assignee didn't login in Bugzilla in the last 7 months.
:sdetar, could you have a look please?
For more information, please visit auto_nag documentation.

Assignee: david.herman → nobody
Flags: needinfo?(sdetar)
Status: NEW → RESOLVED
Closed: 2 years ago
Flags: needinfo?(sdetar)
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.