parser.cpp

来自「konqueror3 embedded版本, KDE环境下的当家浏览器的嵌入式版」· C++ 代码 · 共 2,076 行 · 第 1/5 页

CPP
2,076
字号
/* A Bison parser, made by GNU Bison 1.875a.  *//* Skeleton parser for Yacc-like parsing with Bison,   Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.   This program is free software; you can redistribute it and/or modify   it under the terms of the GNU General Public License as published by   the Free Software Foundation; either version 2, or (at your option)   any later version.   This program is distributed in the hope that it will be useful,   but WITHOUT ANY WARRANTY; without even the implied warranty of   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the   GNU General Public License for more details.   You should have received a copy of the GNU General Public License   along with this program; if not, write to the Free Software   Foundation, Inc., 51 Franklin Street, Fifth Floor,   Boston, MA 02110-1301, USA.  *//* As a special exception, when this file is copied by Bison into a   Bison output file, you may use that output file without restriction.   This special exception was added by the Free Software Foundation   in version 1.24 of Bison.  *//* Written by Richard Stallman by simplifying the original so called   ``semantic'' parser.  *//* All symbols defined below should begin with yy or YY, to avoid   infringing on user name space.  This should be done even for local   variables, as they might otherwise be expanded by user macros.   There are some unavoidable exceptions within include files to   define necessary library symbols; they are noted "INFRINGES ON   USER NAME SPACE" below.  *//* Identify Bison output.  */#define YYBISON 1/* Skeleton name.  */#define YYSKELETON_NAME "yacc.c"/* Pure parsers.  */#define YYPURE 1/* Using locations.  */#define YYLSP_NEEDED 0/* If NAME_PREFIX is specified substitute the variables and functions   names.  */#define yyparse cssyyparse#define yylex   cssyylex#define yyerror cssyyerror#define yylval  cssyylval#define yychar  cssyychar#define yydebug cssyydebug#define yynerrs cssyynerrs/* Tokens.  */#ifndef YYTOKENTYPE# define YYTOKENTYPE   /* Put the tokens into the symbol table, so that GDB and other debuggers      know about them.  */   enum yytokentype {     UNIMPORTANT_TOK = 258,     S = 259,     SGML_CD = 260,     INCLUDES = 261,     DASHMATCH = 262,     BEGINSWITH = 263,     ENDSWITH = 264,     CONTAINS = 265,     STRING = 266,     IDENT = 267,     NTH = 268,     HASH = 269,     IMPORT_SYM = 270,     PAGE_SYM = 271,     MEDIA_SYM = 272,     FONT_FACE_SYM = 273,     CHARSET_SYM = 274,     NAMESPACE_SYM = 275,     KHTML_RULE_SYM = 276,     KHTML_DECLS_SYM = 277,     KHTML_VALUE_SYM = 278,     IMPORTANT_SYM = 279,     QEMS = 280,     EMS = 281,     EXS = 282,     PXS = 283,     CMS = 284,     MMS = 285,     INS = 286,     PTS = 287,     PCS = 288,     DEGS = 289,     RADS = 290,     GRADS = 291,     MSECS = 292,     SECS = 293,     HERZ = 294,     KHERZ = 295,     DIMEN = 296,     PERCENTAGE = 297,     NUMBER = 298,     URI = 299,     FUNCTION = 300,     NOTFUNCTION = 301,     UNICODERANGE = 302   };#endif#define UNIMPORTANT_TOK 258#define S 259#define SGML_CD 260#define INCLUDES 261#define DASHMATCH 262#define BEGINSWITH 263#define ENDSWITH 264#define CONTAINS 265#define STRING 266#define IDENT 267#define NTH 268#define HASH 269#define IMPORT_SYM 270#define PAGE_SYM 271#define MEDIA_SYM 272#define FONT_FACE_SYM 273#define CHARSET_SYM 274#define NAMESPACE_SYM 275#define KHTML_RULE_SYM 276#define KHTML_DECLS_SYM 277#define KHTML_VALUE_SYM 278#define IMPORTANT_SYM 279#define QEMS 280#define EMS 281#define EXS 282#define PXS 283#define CMS 284#define MMS 285#define INS 286#define PTS 287#define PCS 288#define DEGS 289#define RADS 290#define GRADS 291#define MSECS 292#define SECS 293#define HERZ 294#define KHERZ 295#define DIMEN 296#define PERCENTAGE 297#define NUMBER 298#define URI 299#define FUNCTION 300#define NOTFUNCTION 301#define UNICODERANGE 302/* Copy the first part of user declarations.  *//* *  This file is part of the KDE libraries *  Copyright (C) 2002-2003 Lars Knoll (knoll@kde.org) *  Copyright (c) 2003 Apple Computer *  Copyright (C) 2003 Dirk Mueller (mueller@kde.org) * *  This library is free software; you can redistribute it and/or *  modify it under the terms of the GNU Lesser General Public *  License as published by the Free Software Foundation; either *  version 2 of the License, or (at your option) any later version. * *  This library is distributed in the hope that it will be useful, *  but WITHOUT ANY WARRANTY; without even the implied warranty of *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU *  Lesser General Public License for more details. * *  You should have received a copy of the GNU Lesser General Public *  License along with this library; if not, write to the Free Software *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA * */#ifdef HAVE_CONFIG_H#include <config.h>#endif#include <string.h>#include <stdlib.h>#include <dom/dom_string.h>#include <xml/dom_docimpl.h>#include <css/css_ruleimpl.h>#include <css/css_stylesheetimpl.h>#include <css/css_valueimpl.h>#include <misc/htmlhashes.h>#include "cssparser.h"#include <assert.h>#include <kdebug.h>//#define CSS_DEBUGusing namespace DOM;//// The following file defines the function//     const struct props *findProp(const char *word, int len)//// with 'props->id' a CSS property in the range from CSS_PROP_MIN to// (and including) CSS_PROP_TOTAL-1// turn off inlining to void warning with newer gcc#undef __inline#define __inline#include "cssproperties.c"#include "cssvalues.c"#undef __inlineint DOM::getPropertyID(const char *tagStr, int len){    const struct props *propsPtr = findProp(tagStr, len);    if (!propsPtr)        return 0;    return propsPtr->id;}static inline int getValueID(const char *tagStr, int len){    const struct css_value *val = findValue(tagStr, len);    if (!val)        return 0;    return val->id;}#define YYDEBUG 0#define YYMAXDEPTH 0#define YYPARSE_PARAM parser/* Enabling traces.  */#ifndef YYDEBUG# define YYDEBUG 0#endif/* Enabling verbose error messages.  */#ifdef YYERROR_VERBOSE# undef YYERROR_VERBOSE# define YYERROR_VERBOSE 1#else# define YYERROR_VERBOSE 0#endif#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)typedef union YYSTYPE {    CSSRuleImpl *rule;    CSSSelector *selector;    QPtrList<CSSSelector> *selectorList;    bool ok;    MediaListImpl *mediaList;    CSSMediaRuleImpl *mediaRule;    CSSRuleListImpl *ruleList;    ParseString string;    float val;    int prop_id;    unsigned int attribute;    unsigned int element;    unsigned int ns;    CSSSelector::Relation relation;    CSSSelector::Match match;    bool b;    char tok;    Value value;    ValueList *valueList;} YYSTYPE;/* Line 191 of yacc.c.  */# define yystype YYSTYPE /* obsolescent; will be withdrawn */# define YYSTYPE_IS_DECLARED 1# define YYSTYPE_IS_TRIVIAL 1#endif/* Copy the second part of user declarations.  */static inline int cssyyerror(const char *x ){#ifdef CSS_DEBUG    qDebug( "%s", x );#else    Q_UNUSED( x );#endif    return 1;}static int cssyylex( YYSTYPE *yylval ) {    return CSSParser::current()->lex( yylval );}#define null 1/* Line 214 of yacc.c.  */#if ! defined (yyoverflow) || YYERROR_VERBOSE/* The parser invokes alloca or malloc; define the necessary symbols.  */# if YYSTACK_USE_ALLOCA#  define YYSTACK_ALLOC alloca# else#  ifndef YYSTACK_USE_ALLOCA#   if defined (alloca) || defined (_ALLOCA_H)#    define YYSTACK_ALLOC alloca#   else#    ifdef __GNUC__#     define YYSTACK_ALLOC __builtin_alloca#    endif#   endif#  endif# endif# ifdef YYSTACK_ALLOC   /* Pacify GCC's `empty if-body' warning. */#  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)# else#  if defined (__STDC__) || defined (__cplusplus)#   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */#   define YYSIZE_T size_t#  endif#  define YYSTACK_ALLOC malloc#  define YYSTACK_FREE free# endif#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */#if (! defined (yyoverflow) \     && (! defined (__cplusplus) \	 || (YYSTYPE_IS_TRIVIAL)))/* A type that is properly aligned for any stack member.  */union yyalloc{  short yyss;  YYSTYPE yyvs;  };/* The size of the maximum gap between one aligned stack and the next.  */# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)/* The size of an array large to enough to hold all stacks, each with   N elements.  */# define YYSTACK_BYTES(N) \     ((N) * (sizeof (short) + sizeof (YYSTYPE))				\      + YYSTACK_GAP_MAXIMUM)/* Copy COUNT objects from FROM to TO.  The source and destination do   not overlap.  */# ifndef YYCOPY#  if 1 < __GNUC__#   define YYCOPY(To, From, Count) \      __builtin_memcpy (To, From, (Count) * sizeof (*(From)))#  else#   define YYCOPY(To, From, Count)		\      do					\	{					\	  register YYSIZE_T yyi;		\	  for (yyi = 0; yyi < (Count); yyi++)	\	    (To)[yyi] = (From)[yyi];		\	}					\      while (0)#  endif# endif/* Relocate STACK from its old location to the new one.  The   local variables YYSIZE and YYSTACKSIZE give the old and new number of   elements in the stack, and YYPTR gives the new location of the   stack.  Advance YYPTR to a properly aligned location for the next   stack.  */# define YYSTACK_RELOCATE(Stack)					\    do									\      {									\	YYSIZE_T yynewbytes;						\	YYCOPY (&yyptr->Stack, Stack, yysize);				\	Stack = &yyptr->Stack;						\	yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \	yyptr += yynewbytes / sizeof (*yyptr);				\      }									\    while (0)#endif#if defined (__STDC__) || defined (__cplusplus)   typedef signed char yysigned_char;#else   typedef short yysigned_char;#endif/* YYFINAL -- State number of the termination state. */#define YYFINAL  16/* YYLAST -- Last index in YYTABLE.  */#define YYLAST   447/* YYNTOKENS -- Number of terminals. */#define YYNTOKENS  66/* YYNNTS -- Number of nonterminals. */

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?