Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 * vim: set ts=8 sts=4 et sw=4 tw=99:
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef builtin_RegExp_h
8 #define builtin_RegExp_h
10 #include "vm/RegExpObject.h"
12 JSObject *
13 js_InitRegExpClass(JSContext *cx, js::HandleObject obj);
15 /*
16 * The following builtin natives are extern'd for pointer comparison in
17 * other parts of the engine.
18 */
20 namespace js {
22 // Whether RegExp statics should be updated with the input and results of a
23 // regular expression execution.
24 enum RegExpStaticsUpdate { UpdateRegExpStatics, DontUpdateRegExpStatics };
26 RegExpRunStatus
27 ExecuteRegExp(JSContext *cx, HandleObject regexp, HandleString string,
28 MatchConduit &matches, RegExpStaticsUpdate staticsUpdate);
30 /*
31 * Legacy behavior of ExecuteRegExp(), which is baked into the JSAPI.
32 *
33 * |res| may be nullptr if the RegExpStatics are not to be updated.
34 * |input| may be nullptr if there is no JSString corresponding to
35 * |chars| and |length|.
36 */
37 bool
38 ExecuteRegExpLegacy(JSContext *cx, RegExpStatics *res, RegExpObject &reobj,
39 Handle<JSLinearString*> input, const jschar *chars, size_t length,
40 size_t *lastIndex, bool test, MutableHandleValue rval);
42 /* Translation from MatchPairs to a JS array in regexp_exec()'s output format. */
43 bool
44 CreateRegExpMatchResult(JSContext *cx, HandleString input, const MatchPairs &matches,
45 MutableHandleValue rval);
47 extern bool
48 regexp_exec_raw(JSContext *cx, HandleObject regexp, HandleString input, MutableHandleValue output);
50 extern bool
51 regexp_exec(JSContext *cx, unsigned argc, Value *vp);
53 bool
54 regexp_test_raw(JSContext *cx, HandleObject regexp, HandleString input, bool *result);
56 extern bool
57 regexp_test(JSContext *cx, unsigned argc, Value *vp);
59 /*
60 * The following functions are for use by self-hosted code.
61 */
63 /*
64 * Behaves like regexp.exec(string), but doesn't set RegExp statics.
65 *
66 * Usage: match = regexp_exec_no_statics(regexp, string)
67 */
68 extern bool
69 regexp_exec_no_statics(JSContext *cx, unsigned argc, Value *vp);
71 /*
72 * Behaves like regexp.test(string), but doesn't set RegExp statics.
73 *
74 * Usage: does_match = regexp_test_no_statics(regexp, string)
75 */
76 extern bool
77 regexp_test_no_statics(JSContext *cx, unsigned argc, Value *vp);
79 } /* namespace js */
81 #endif /* builtin_RegExp_h */