Ignore:
Timestamp:
Dec 8, 2008, 11:24:05 PM (17 years ago)
Author:
[email protected]
Message:

2008-12-08 Geoffrey Garen <[email protected]>

Reviewed by Oliver Hunt.


Implemented more of the relaxed and somewhat weird rules for deciding
how to interpret a non-pattern-character.


  • wrec/Escapes.h: (JSC::WREC::Escape::): (JSC::WREC::Escape::Escape): Eliminated Escape::None because it was unused. If you see an '
    ', it's either a valid escape or an error.
  • wrec/Quantifier.h: (JSC::WREC::Quantifier::Quantifier):
  • wrec/WRECGenerator.cpp: (JSC::WREC::Generator::generateNonGreedyQuantifier): (JSC::WREC::Generator::generateGreedyQuantifier): Renamed "noMaxSpecified" to "Infinity", since that's what it means.
  • wrec/WRECParser.cpp: (JSC::WREC::Parser::consumeGreedyQuantifier): Re-wrote {n,m} parsing rules because they were too strict before. Added support for backtracking in the case where the {n,m} fails to parse as a quantifier, and yet is not a syntax error.

(JSC::WREC::Parser::parseCharacterClass):
(JSC::WREC::Parser::parseNonCharacterEscape): Eliminated Escape::None,
as above.

(JSC::WREC::Parser::consumeEscape): Don't treat ASCII and _ escapes
as syntax errors. See fast/regex/non-pattern-characters.html.


  • wrec/WRECParser.h: (JSC::WREC::Parser::SavedState::SavedState): (JSC::WREC::Parser::SavedState::restore): Added a state backtracker, since parsing {n,m} forms requires backtracking if the form turns out not to be a quantifier.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/wrec/WRECGenerator.cpp

    r39061 r39130  
    181181    pop(index);
    182182    // (3.2) if there is a limit, and we have reached it, game over.
    183     if (max != Quantifier::noMaxSpecified) {
     183    if (max != Quantifier::Infinity) {
    184184        je32(repeatCount, Imm32(max), quantifierFailed);
    185185    }
     
    231231    functor.generateAtom(this, doneReadingAtoms);
    232232    add32(Imm32(1), repeatCount);
    233     if (max == Quantifier::noMaxSpecified)
     233    if (max == Quantifier::Infinity)
    234234        jump(readAnAtom);
    235235    else if (max == 1)
Note: See TracChangeset for help on using the changeset viewer.