1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 : * vim: set ts=8 sw=4 et tw=99 ft=cpp:
3 : *
4 : * ***** BEGIN LICENSE BLOCK *****
5 : * Copyright (C) 2011 Apple Inc. All rights reserved.
6 : *
7 : * Redistribution and use in source and binary forms, with or without
8 : * modification, are permitted provided that the following conditions
9 : * are met:
10 : * 1. Redistributions of source code must retain the above copyright
11 : * notice, this list of conditions and the following disclaimer.
12 : * 2. Redistributions in binary form must reproduce the above copyright
13 : * notice, this list of conditions and the following disclaimer in the
14 : * documentation and/or other materials provided with the distribution.
15 : *
16 : * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
17 : * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 : * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19 : * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
20 : * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
21 : * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
22 : * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
23 : * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
24 : * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 : * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 : * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 : *
28 : * ***** END LICENSE BLOCK ***** */
29 :
30 : #include "YarrSyntaxChecker.h"
31 :
32 : #include "YarrParser.h"
33 :
34 : namespace JSC { namespace Yarr {
35 :
36 : class SyntaxChecker {
37 : public:
38 8609 : void assertionBOL() {}
39 6404 : void assertionEOL() {}
40 549 : void assertionWordBoundary(bool) {}
41 242098 : void atomPatternCharacter(UChar) {}
42 10641 : void atomBuiltInCharacterClass(BuiltInCharacterClassID, bool) {}
43 18389 : void atomCharacterClassBegin(bool = false) {}
44 30607 : void atomCharacterClassAtom(UChar) {}
45 25262 : void atomCharacterClassRange(UChar, UChar) {}
46 882 : void atomCharacterClassBuiltIn(BuiltInCharacterClassID, bool) {}
47 18333 : void atomCharacterClassEnd() {}
48 12159 : void atomParenthesesSubpatternBegin(bool = true) {}
49 72 : void atomParentheticalAssertionBegin(bool = false) {}
50 12231 : void atomParenthesesEnd() {}
51 18 : void atomBackReference(unsigned) {}
52 28692 : void quantifyAtom(unsigned, unsigned, bool) {}
53 5339 : void disjunction() {}
54 : };
55 :
56 39808 : ErrorCode checkSyntax(const UString& pattern)
57 : {
58 : SyntaxChecker syntaxChecker;
59 39808 : return parse(syntaxChecker, pattern);
60 : }
61 :
62 : }} // JSC::YARR
|