1 // -*- c-basic-offset: 2 -*-
3 * This file is part of the KDE libraries
4 * Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
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.
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.
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., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
41 void setCode(const UString &sourceURL, int startingLineNumber, const UChar *c, unsigned int len);
44 int lineNo() const { return yylineno; }
45 UString sourceURL() const { return m_sourceURL; }
47 bool prevTerminator() const { return terminator; }
52 InIdentifierOrKeyword,
54 InIdentifierUnicodeEscapeStart,
55 InIdentifierUnicodeEscape,
78 UString pattern, flags;
86 unsigned int size8, size16;
87 unsigned int pos8, pos16;
90 // encountered delimiter like "'" and "}" on last run
94 bool eatNextIdentifier;
101 void shift(unsigned int p);
103 int lookupKeyword(const char *);
105 bool isWhiteSpace() const;
106 bool isLineTerminator();
107 static bool isOctalDigit(int);
109 int matchPunctuator(int c1, int c2, int c3, int c4);
110 static unsigned short singleEscape(unsigned short);
111 static unsigned short convertOctal(int c1, int c2, int c3);
113 static unsigned char convertHex(int);
114 static unsigned char convertHex(int c1, int c2);
115 static UChar convertUnicode(int c1, int c2, int c3, int c4);
116 static bool isIdentStart(int);
117 static bool isIdentPart(int);
118 static bool isHexDigit(int);
122 * Clear statically allocated resources
124 static void globalClear();
127 bool sawError() const { return error; }
134 void record16(UChar);
136 KJS::Identifier *makeIdentifier(UChar *buffer, unsigned int pos);
137 UString *makeUString(UChar *buffer, unsigned int pos);
142 #ifndef KJS_PURE_ECMA
143 int bol; // begin of line
147 // current and following unicode characters (int to allow for -1 for end-of-file marker)
148 int current, next1, next2, next3;
151 unsigned int numStrings;
152 unsigned int stringsCapacity;
154 KJS::Identifier **identifiers;
155 unsigned int numIdentifiers;
156 unsigned int identifiersCapacity;
158 // for future extensions