1// Copyright 2016 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef V8_REGEXP_REGEXP_PARSER_H_
6#define V8_REGEXP_REGEXP_PARSER_H_
7
8#include "src/common/assert-scope.h"
9#include "src/handles/handles.h"
10#include "src/regexp/regexp-flags.h"
11
12namespace v8 {
13namespace internal {
14
15class String;
16class Zone;
17
18struct RegExpCompileData;
19
20class V8_EXPORT_PRIVATE RegExpParser : public AllStatic {
21 public:
22  static bool ParseRegExpFromHeapString(Isolate* isolate, Zone* zone,
23                                        Handle<String> input, RegExpFlags flags,
24                                        RegExpCompileData* result);
25
26  template <class CharT>
27  static bool VerifyRegExpSyntax(Zone* zone, uintptr_t stack_limit,
28                                 const CharT* input, int input_length,
29                                 RegExpFlags flags, RegExpCompileData* result,
30                                 const DisallowGarbageCollection& no_gc);
31
32  // Used by the SpiderMonkey embedding of irregexp.
33  static bool VerifyRegExpSyntax(Isolate* isolate, Zone* zone,
34                                 Handle<String> input, RegExpFlags flags,
35                                 RegExpCompileData* result,
36                                 const DisallowGarbageCollection& no_gc);
37};
38
39}  // namespace internal
40}  // namespace v8
41
42#endif  // V8_REGEXP_REGEXP_PARSER_H_
43