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 Tokenizer(bool viewSourceMode
= false)
35 : m_parserStopped(false)
36 , m_inViewSourceMode(viewSourceMode
)
40 virtual ~Tokenizer() { }
42 // Script output must be prepended, while new data
43 // received during executing a script must be appended, hence the
44 // extra bool to be able to distinguish between both cases.
45 // document.write() always uses false, while the loader uses true.
46 virtual bool write(const SegmentedString
&, bool appendData
) = 0;
47 virtual void finish() = 0;
48 virtual bool isWaitingForScripts() const = 0;
49 virtual void stopParsing() { m_parserStopped
= true; }
50 virtual bool processingData() const { return false; }
51 virtual int executingScript() const { return 0; }
53 virtual bool wantsRawData() const { return false; }
54 virtual bool writeRawData(const char* data
, int len
) { return false; }
56 bool inViewSourceMode() const { return m_inViewSourceMode
; }
57 void setInViewSourceMode(bool mode
) { m_inViewSourceMode
= mode
; }
59 virtual bool wellFormed() const { return true; }
61 virtual int lineNumber() const { return -1; }
62 virtual int columnNumber() const { return -1; }
64 virtual void executeScriptsWaitingForStylesheets() {}
66 virtual bool isHTMLTokenizer() const { return false; }
69 // The tokenizer has buffers, so parsing may continue even after
70 // it stops receiving data. We use m_parserStopped to stop the tokenizer
71 // even when it has buffered data.
73 bool m_inViewSourceMode
;
76 } // namespace WebCore