source: webkit/trunk/JavaScriptCore/kjs/Parser.h@ 28479

Last change on this file since 28479 was 27844, checked in by [email protected], 18 years ago

2007-11-15 Mark Rowe <[email protected]>

Qt build fix.

  • kjs/Parser.h:
  • Property svn:eol-style set to native
File size: 2.2 KB
Line 
1// -*- c-basic-offset: 4 -*-
2/*
3 * This file is part of the KDE libraries
4 * Copyright (C) 1999-2001 Harri Porten ([email protected])
5 * Copyright (C) 2001 Peter Kelly ([email protected])
6 * Copyright (C) 2003, 2006, 2007 Apple Inc.
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
12 *
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Library General Public License for more details.
17 *
18 * You should have received a copy of the GNU Library General Public License
19 * along with this library; see the file COPYING.LIB. If not, write to
20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 * Boston, MA 02110-1301, USA.
22 *
23 */
24
25#ifndef Parser_h
26#define Parser_h
27
28#include <wtf/Forward.h>
29#include <wtf/Noncopyable.h>
30#include <wtf/RefPtr.h>
31
32namespace KJS {
33
34 class FunctionBodyNode;
35 class ProgramNode;
36 class UString;
37
38 struct UChar;
39
40 class Parser : Noncopyable {
41 public:
42 PassRefPtr<ProgramNode> parseProgram(const UString& sourceURL, int startingLineNumber,
43 const UChar* code, unsigned length,
44 int* sourceId = 0, int* errLine = 0, UString* errMsg = 0);
45
46 PassRefPtr<FunctionBodyNode> parseFunctionBody(const UString& sourceURL, int startingLineNumber,
47 const UChar* code, unsigned length,
48 int* sourceId = 0, int* errLine = 0, UString* errMsg = 0);
49
50 int sourceId() { return m_sourceId; }
51
52 void didFinishParsing(PassRefPtr<ProgramNode>);
53
54 private:
55 friend Parser& parser();
56
57 Parser(); // Use parser() instead.
58 void parse(const UString& sourceURL, int startingLineNumber,
59 const UChar* code, unsigned length,
60 int* sourceId = 0, int* errLine = 0, UString* errMsg = 0);
61
62 int m_sourceId;
63 RefPtr<ProgramNode> m_progNode;
64 };
65
66 Parser& parser(); // Returns the singleton JavaScript parser.
67
68} // namespace KJS
69
70#endif // Parser_h
Note: See TracBrowser for help on using the repository browser.