summaryrefslogtreecommitdiffstats
path: root/js/src/irregexp/RegExpParser.h
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/irregexp/RegExpParser.h')
-rw-r--r--js/src/irregexp/RegExpParser.h19
1 files changed, 3 insertions, 16 deletions
diff --git a/js/src/irregexp/RegExpParser.h b/js/src/irregexp/RegExpParser.h
index ee57f0436..a58800a91 100644
--- a/js/src/irregexp/RegExpParser.h
+++ b/js/src/irregexp/RegExpParser.h
@@ -229,7 +229,7 @@ class RegExpParser
bool simple() { return simple_; }
bool contains_anchor() { return contains_anchor_; }
void set_contains_anchor() { contains_anchor_ = true; }
- int captures_started() { return captures_started_; }
+ int captures_started() { return captures_ == nullptr ? 0 : captures_->length(); }
const CharT* position() { return next_pos_ - 1; }
static const int kMaxCaptures = 1 << 16;
@@ -239,8 +239,8 @@ class RegExpParser
enum SubexpressionType {
INITIAL,
CAPTURE, // All positive values represent captures.
- POSITIVE_LOOKAROUND,
- NEGATIVE_LOOKAROUND,
+ POSITIVE_LOOKAHEAD,
+ NEGATIVE_LOOKAHEAD,
GROUPING
};
@@ -249,12 +249,10 @@ class RegExpParser
RegExpParserState(LifoAlloc* alloc,
RegExpParserState* previous_state,
SubexpressionType group_type,
- RegExpLookaround::Type lookaround_type,
int disjunction_capture_index)
: previous_state_(previous_state),
builder_(alloc->newInfallible<RegExpBuilder>(alloc)),
group_type_(group_type),
- lookaround_type_(lookaround_type),
disjunction_capture_index_(disjunction_capture_index)
{}
// Parser state of containing expression, if any.
@@ -264,16 +262,11 @@ class RegExpParser
RegExpBuilder* builder() { return builder_; }
// Type of regexp being parsed (parenthesized group or entire regexp).
SubexpressionType group_type() { return group_type_; }
- // Lookahead or Lookbehind.
- RegExpLookaround::Type lookaround_type() { return lookaround_type_; }
// Index in captures array of first capture in this sub-expression, if any.
// Also the capture index of this sub-expression itself, if group_type
// is CAPTURE.
int capture_index() { return disjunction_capture_index_; }
- // Check whether the parser is inside a capture group with the given index.
- bool IsInsideCaptureGroup(int index);
-
private:
// Linked list implementation of stack of states.
RegExpParserState* previous_state_;
@@ -281,15 +274,10 @@ class RegExpParser
RegExpBuilder* builder_;
// Stored disjunction type (capture, look-ahead or grouping), if any.
SubexpressionType group_type_;
- // Stored read direction.
- RegExpLookaround::Type lookaround_type_;
// Stored disjunction's capture index (if any).
int disjunction_capture_index_;
};
- // Return the 1-indexed RegExpCapture object, allocate if necessary.
- RegExpCapture* GetCapture(int index);
-
widechar current() { return current_; }
bool has_more() { return has_more_; }
bool has_next() { return next_pos_ < end_; }
@@ -306,7 +294,6 @@ class RegExpParser
const CharT* next_pos_;
const CharT* end_;
widechar current_;
- int captures_started_;
// The capture count is only valid after we have scanned for captures.
int capture_count_;
bool has_more_;