source: webkit/trunk/JavaScriptCore/kjs/lexer.h@ 2740

Last change on this file since 2740 was 1623, checked in by darin, 23 years ago

JavaScriptCore:

  • kjs/*: Roll KDE 3.0.2 changes in. Also switch to not using APPLE_CHANGES for some of the changes that we definitely want to contribute upstream.

WebCore:

  • khtml/*: Roll KDE 3.0.2 changes in. Also switch to not using APPLE_CHANGES for some of the changes that we definitely want to contribute upstream.
  • WebCore.pbproj/project.pbxproj: Add KWQStyle.mm, remove KWQStyle.h, moving contents into qstyle.h.
  • kwq/KWQApplication.mm: (QApplication::globalStrut): Remove _logNotYetImplemented().
  • kwq/KWQButton.mm: (QButton::QButton): Use plain release, not autorelease.
  • kwq/KWQComboBox.mm: (QComboBox::init): Use plain release, not autorelease.
  • kwq/KWQListBox.mm: (QListBox::QListBox): Use plain release, not autorelease.
  • kwq/KWQPainter.mm: (QPainter::drawArc): Use plain release, not autorelease.
  • kwq/KWQKHTMLPartBrowserExtension.mm: Remove import of KWQKHTMLPartImpl.h, now that it's always part of khtml_part.h.
  • kwq/KWQKHTMLPartImpl.cpp: Simplify.
  • kwq/KWQKHTMLPartImpl.h: Add wrapper to allow multiple inclusion. Don't include khtml_part.h any more, since that file now includes this one to minimize changes to KDE code that needs to get to functions in here.
  • kwq/KWQKHTMLPartImpl.mm: (KHTMLPart::onURL), (KHTMLPart::nodeActivated), (KHTMLPart::setStatusBarText): Moved here from khtml_part.cpp.
  • kwq/KWQLoaderImpl.mm: Include khtml_part.h instead of KWQKHTMLPartImpl.h.
  • kwq/KWQPushButton.mm: (buttonFontMetrics), (QPushButton::fontMetrics): Added. Used by the form code to size buttons.
  • kwq/KWQStyle.mm: Added. (QStyle::sizeFromContents): Added. Used by the form code to size buttons.
  • kwq/KWQStyle.h: Removed.
  • kwq/qt/qstyle.h: Moved contents of KWQStyle.h in here.
  • kwq/qt/qwidget.h: Include <qstyle.h> rather than KWQStyle.h.
  • kwq/WebCoreBridge.mm: (-[WebCoreBridge isFrameSet]): Call straight to impl.
  • kwq/kdeui/klineedit.h: Add KLineEdit::frameWidth().
  • kwq/qt/qnamespace.h: Remove GUIStyle, MacStyle, and WindowsStyle.
  • kwq/qt/qpaintdevice.h: Add QInternal, QInternal::Printer, and QPaintDevice::devType().
  • kwq/qt/qpainter.h: Add QPainter::device().
  • kwq/qt/qpushbutton.h: Add QPushButton::fontMetrics().
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.8 KB
Line 
1// -*- c-basic-offset: 2 -*-
2/*
3 * This file is part of the KDE libraries
4 * Copyright (C) 1999-2000 Harri Porten ([email protected])
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
15 *
16 * You should have received a copy of the GNU Library General Public License
17 * along with this library; see the file COPYING.LIB. If not, write to
18 * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 * Boston, MA 02111-1307, USA.
20 *
21 */
22
23#ifndef _KJSLEXER_H_
24#define _KJSLEXER_H_
25
26#include "ustring.h"
27
28namespace KJS {
29
30 class RegExp;
31
32 class Lexer {
33 public:
34 Lexer();
35 ~Lexer();
36 static Lexer *curr();
37
38 void setCode(const UChar *c, unsigned int len);
39 int lex();
40
41 int lineNo() const { return yylineno + 1; }
42
43 bool prevTerminator() const { return terminator; }
44
45 enum State { Start,
46 Identifier,
47 InIdentifier,
48 InSingleLineComment,
49 InMultiLineComment,
50 InNum,
51 InNum0,
52 InHex,
53 InOctal,
54 InDecimal,
55 InExponentIndicator,
56 InExponent,
57 Hex,
58 Octal,
59 Number,
60 String,
61 Eof,
62 InString,
63 InEscapeSequence,
64 InHexEscape,
65 InUnicodeEscape,
66 Other,
67 Bad };
68
69 bool scanRegExp();
70 UString pattern, flags;
71
72 private:
73 int yylineno;
74 bool done;
75 char *buffer8;
76 UChar *buffer16;
77 unsigned int size8, size16;
78 unsigned int pos8, pos16;
79 bool terminator;
80 bool restrKeyword;
81 // encountered delimiter like "'" and "}" on last run
82 bool delimited;
83 bool skipLF;
84 bool skipCR;
85 bool eatNextIdentifier;
86 int stackToken;
87 int lastToken;
88
89 State state;
90 void setDone(State s);
91 unsigned int pos;
92 void shift(unsigned int p);
93 void nextLine();
94 int lookupKeyword(const char *);
95
96 bool isWhiteSpace() const;
97 bool isLineTerminator();
98 bool isHexDigit(unsigned short c) const;
99 bool isOctalDigit(unsigned short c) const;
100
101 int matchPunctuator(unsigned short c1, unsigned short c2,
102 unsigned short c3, unsigned short c4);
103 unsigned short singleEscape(unsigned short c) const;
104 unsigned short convertOctal(unsigned short c1, unsigned short c2,
105 unsigned short c3) const;
106 public:
107 static unsigned char convertHex(unsigned short c1);
108 static unsigned char convertHex(unsigned short c1, unsigned short c2);
109 static UChar convertUnicode(unsigned short c1, unsigned short c2,
110 unsigned short c3, unsigned short c4);
111 static bool isIdentLetter(unsigned short c);
112 static bool isDecimalDigit(unsigned short c);
113
114#ifdef KJS_DEBUG_MEM
115 /**
116 * Clear statically allocated resources
117 */
118 static void globalClear();
119#endif
120 private:
121
122 void record8(unsigned short c);
123 void record16(UChar c);
124
125 const UChar *code;
126 unsigned int length;
127 int yycolumn;
128#ifndef KJS_PURE_ECMA
129 int bol; // begin of line
130#endif
131
132 // current and following unicode characters
133 unsigned short current, next1, next2, next3;
134
135 // for future extensions
136 class LexerPrivate;
137 LexerPrivate *priv;
138 };
139
140}; // namespace
141
142#endif
Note: See TracBrowser for help on using the repository browser.