summaryrefslogtreecommitdiff
path: root/deps/v8/src/regexp/interpreter-irregexp.h
blob: a57d40854ede1976191d18f110a251fa0e9665fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// Copyright 2011 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// A simple interpreter for the Irregexp byte code.

#ifndef V8_REGEXP_INTERPRETER_IRREGEXP_H_
#define V8_REGEXP_INTERPRETER_IRREGEXP_H_

#include "src/regexp/jsregexp.h"

namespace v8 {
namespace internal {

class V8_EXPORT_PRIVATE IrregexpInterpreter {
 public:
  enum Result { RETRY = -2, EXCEPTION = -1, FAILURE = 0, SUCCESS = 1 };
  STATIC_ASSERT(EXCEPTION == static_cast<int>(RegExpImpl::RE_EXCEPTION));
  STATIC_ASSERT(FAILURE == static_cast<int>(RegExpImpl::RE_FAILURE));
  STATIC_ASSERT(SUCCESS == static_cast<int>(RegExpImpl::RE_SUCCESS));

  // The caller is responsible for initializing registers before each call.
  static Result Match(Isolate* isolate, Handle<ByteArray> code_array,
                      Handle<String> subject_string, int* registers,
                      int start_position);
};

}  // namespace internal
}  // namespace v8

#endif  // V8_REGEXP_INTERPRETER_IRREGEXP_H_