1print <<END; 2/* 3 * This file is part of the DOM implementation for KDE. 4 * 5 * Copyright (C) 2003 Lars Knoll (knoll\@kde.org) 6 * 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/* This file is mostly data generated by flex. Unfortunately flex 25 can't handle 16bit strings directly, so we just copy the part of 26 the code we need and modify it to our needs. 27 28 Most of the defines below are to make sure we can easily use the 29 flex generated code, using as little editing as possible. 30 31 The flex syntax to generate the lexer are more or less directly 32 copied from the CSS2.1 specs, with some fixes for comments and 33 the important symbol. 34 35 To regenerate, run flex on tokenizer.flex. After this, copy the 36 data tables and the YY_DECL method over to this file. Remove the 37 init code from YY_DECL and change the YY_END_OF_BUFFER to only call 38 yyterminate(). 39 40*/ 41 42// --------- begin generated code ------------------- 43 44END 45 46{ 47print<<END 48 49#include "CSSGrammar.h" 50 51#define INITIAL 0 52#define mediaquery 1 53#define forkeyword 2 54 55/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */ 56 57#if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L 58#include <inttypes.h> 59typedef int8_t flex_int8_t; 60typedef uint8_t flex_uint8_t; 61typedef int16_t flex_int16_t; 62typedef uint16_t flex_uint16_t; 63typedef int32_t flex_int32_t; 64typedef uint32_t flex_uint32_t; 65#else 66typedef signed char flex_int8_t; 67typedef short int flex_int16_t; 68typedef int flex_int32_t; 69typedef unsigned char flex_uint8_t; 70typedef unsigned short int flex_uint16_t; 71typedef unsigned int flex_uint32_t; 72#endif /* ! C99 */ 73END 74} 75 76 77while (<>) { 78 last if /YY_NUM_RULES/; 79} 80 81print; 82while (<>) { 83 last if /yy_last_accepting/; 84 print; 85} 86 87# media query, tokenizer state support 88while (<>) { 89 last if /yytext/; 90} 91while (<>) { 92 last if not (/define/ || /line/) ; 93 print; 94} 95 96while (<>) { 97 last if /^YY_DECL/; 98} 99 100print; 101while (<>) { 102 s/char/UChar/; 103 print; 104 last if /yy_act/; 105} 106 107while (<>) { 108 last if /while \( 1 \)/; 109} 110 111print; 112while (<>) { 113 next if /^yy_match:/; 114 next if /^do_action:/; 115 last if /YY_END_OF_BUFFER/; 116 print; 117 print "case YY_END_OF_BUFFER:\n" if /^case YY_STATE_EOF\(INITIAL\):/; 118} 119 120while (<>) { 121 last if /default:/; 122} 123 124print; 125while (<>) { 126 print; 127 last if /end of yylex/; 128} 129 130# We don't want the remainder of flex's output. 131# However, flex may choke with "flex: error writing output file <stdout>" 132# if its stdout is unexpectedly closed on it. 133# Consume the remaining output. 134while (<>) { 135} 136