summaryrefslogtreecommitdiffstats
path: root/js/src/irregexp/RegExpParser.h
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@wolfbeast.com>2020-01-19 14:38:36 +0100
committerwolfbeast <mcwerewolf@wolfbeast.com>2020-01-19 14:39:14 +0100
commite0baeba546f8f45bc1ec981a60b615a28f4142af (patch)
treea71ec1879c612c55f22fae35d4f2eb767bf45e42 /js/src/irregexp/RegExpParser.h
parentb1abb9aebe9de3507c93f31cf1b7ffff3432e481 (diff)
downloadUXP-e0baeba546f8f45bc1ec981a60b615a28f4142af.tar
UXP-e0baeba546f8f45bc1ec981a60b615a28f4142af.tar.gz
UXP-e0baeba546f8f45bc1ec981a60b615a28f4142af.tar.lz
UXP-e0baeba546f8f45bc1ec981a60b615a28f4142af.tar.xz
UXP-e0baeba546f8f45bc1ec981a60b615a28f4142af.zip
Issue #1362 - Revert "Implement regular expression lookbehind"
This reverts commit fa473930f424bf17a9e545b601c84dd2e61364e3.
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_;