If you think a bug might affect users in the 57 release, please set the correct tracking and status flags for Release Management.

abstract out scanning and error reporting in parser

NEW
Assigned to

Status

()

Core
JavaScript Engine
8 years ago
8 years ago

People

(Reporter: dherman, Assigned: dherman)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Assignee)

Description

8 years ago
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.
(Assignee)

Comment 2

8 years ago
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
You need to log in before you can comment on or make changes to this bug.