diff options
author | athenian200 <athenian200@outlook.com> | 2020-01-27 22:59:08 -0600 |
---|---|---|
committer | athenian200 <athenian200@outlook.com> | 2020-01-27 22:59:08 -0600 |
commit | 3c4f414db74b84f7d2a6fb13fd888a47a153699b (patch) | |
tree | ea81fca559849967a79d598a6f460830762ec9ea /js/src/irregexp/RegExpAST.h | |
parent | 1f8d508258ac5d7d57fc4eb35cac90f28bc8ca03 (diff) | |
parent | c4b0715baaffc541670fd1158557aa7e61e521d3 (diff) | |
download | UXP-3c4f414db74b84f7d2a6fb13fd888a47a153699b.tar UXP-3c4f414db74b84f7d2a6fb13fd888a47a153699b.tar.gz UXP-3c4f414db74b84f7d2a6fb13fd888a47a153699b.tar.lz UXP-3c4f414db74b84f7d2a6fb13fd888a47a153699b.tar.xz UXP-3c4f414db74b84f7d2a6fb13fd888a47a153699b.zip |
Merge branch 'master' of https://github.com/MoonchildProductions/UXP into form-disabled-issue
Diffstat (limited to 'js/src/irregexp/RegExpAST.h')
-rw-r--r-- | js/src/irregexp/RegExpAST.h | 33 |
1 files changed, 10 insertions, 23 deletions
diff --git a/js/src/irregexp/RegExpAST.h b/js/src/irregexp/RegExpAST.h index 6f59842bc..7bda6fc7e 100644 --- a/js/src/irregexp/RegExpAST.h +++ b/js/src/irregexp/RegExpAST.h @@ -360,7 +360,6 @@ class RegExpCapture : public RegExpTree virtual int min_match() { return body_->min_match(); } virtual int max_match() { return body_->max_match(); } RegExpTree* body() { return body_; } - void set_body(RegExpTree* body) { body_ = body; } int index() { return index_; } static int StartRegister(int index) { return index * 2; } static int EndRegister(int index) { return index * 2 + 1; } @@ -370,29 +369,25 @@ class RegExpCapture : public RegExpTree int index_; }; -class RegExpLookaround : public RegExpTree +class RegExpLookahead : public RegExpTree { public: - enum Type { LOOKAHEAD, LOOKBEHIND }; - - RegExpLookaround(RegExpTree* body, - bool is_positive, - int capture_count, - int capture_from, - Type type) + RegExpLookahead(RegExpTree* body, + bool is_positive, + int capture_count, + int capture_from) : body_(body), is_positive_(is_positive), capture_count_(capture_count), - capture_from_(capture_from), - type_(type) + capture_from_(capture_from) {} virtual void* Accept(RegExpVisitor* visitor, void* data); virtual RegExpNode* ToNode(RegExpCompiler* compiler, RegExpNode* on_success); - virtual RegExpLookaround* AsLookaround(); + virtual RegExpLookahead* AsLookahead(); virtual Interval CaptureRegisters(); - virtual bool IsLookaround(); + virtual bool IsLookahead(); virtual bool IsAnchoredAtStart(); virtual int min_match() { return 0; } virtual int max_match() { return 0; } @@ -400,14 +395,12 @@ class RegExpLookaround : public RegExpTree bool is_positive() { return is_positive_; } int capture_count() { return capture_count_; } int capture_from() { return capture_from_; } - Type type() { return type_; } private: RegExpTree* body_; bool is_positive_; int capture_count_; int capture_from_; - Type type_; }; typedef InfallibleVector<RegExpCapture*, 1> RegExpCaptureVector; @@ -424,14 +417,8 @@ class RegExpBackReference : public RegExpTree RegExpNode* on_success); virtual RegExpBackReference* AsBackReference(); virtual bool IsBackReference(); - virtual int min_match() override { return 0; } - // The capture may not be completely parsed yet, if the reference occurs - // before the capture. In the ordinary case, nothing has been captured yet, - // so the back reference must have the length 0. If the back reference is - // inside a lookbehind, effectively making it a forward reference, we return - virtual int max_match() override { - return capture_->body() ? capture_->max_match() : 0; - } + virtual int min_match() { return 0; } + virtual int max_match() { return capture_->max_match(); } int index() { return capture_->index(); } RegExpCapture* capture() { return capture_; } private: |