]>
git.saurik.com Git - iphone-api.git/blob - WebCore/Tokenizer.h
2 * This file is part of the DOM implementation for KDE.
4 * Copyright (C) 2000 Peter Kelly (pmk@post.com)
5 * Copyright (C) 2005, 2006 Apple Computer, Inc.
6 * Copyright (C) 2007 Samuel Weinig (sam@webkit.org)
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.
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.
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.
30 class SegmentedString
;
34 virtual ~Tokenizer() { }
36 // Script output must be prepended, while new data
37 // received during executing a script must be appended, hence the
38 // extra bool to be able to distinguish between both cases.
39 // document.write() always uses false, while the loader uses true.
40 virtual bool write(const SegmentedString
&, bool appendData
) = 0;
41 virtual void finish() = 0;
42 virtual bool isWaitingForScripts() const = 0;
43 virtual void stopParsing() { m_parserStopped
= true; }
44 virtual bool processingData() const { return false; }
45 virtual int executingScript() const { return 0; }
47 virtual bool wantsRawData() const { return false; }
48 virtual bool writeRawData(const char* /*data*/, int /*length*/) { return false; }
50 bool inViewSourceMode() const { return m_inViewSourceMode
; }
51 void setInViewSourceMode(bool mode
) { m_inViewSourceMode
= mode
; }
53 virtual bool wellFormed() const { return true; }
55 virtual int lineNumber() const { return -1; }
56 virtual int columnNumber() const { return -1; }
58 virtual void executeScriptsWaitingForStylesheets() {}
60 virtual bool isHTMLTokenizer() const { return false; }
62 virtual void parsePending() { }
65 Tokenizer(bool viewSourceMode
= false)
66 : m_parserStopped(false)
67 , m_inViewSourceMode(viewSourceMode
)
71 // The tokenizer has buffers, so parsing may continue even after
72 // it stops receiving data. We use m_parserStopped to stop the tokenizer
73 // even when it has buffered data.
75 bool m_inViewSourceMode
;
78 } // namespace WebCore