📄 parser.cpp
字号:
/* A Bison parser, made from parser.y by GNU Bison version 1.28 */#define YYBISON 1 /* Identify Bison output. */#define yyparse cssyyparse#define yylex cssyylex#define yyerror cssyyerror#define yylval cssyylval#define yychar cssyychar#define yydebug cssyydebug#define yynerrs cssyynerrs#define WHITESPACE 257#define SGML_CD 258#define INCLUDES 259#define DASHMATCH 260#define BEGINSWITH 261#define ENDSWITH 262#define CONTAINS 263#define STRING 264#define IDENT 265#define HASH 266#define IMPORT_SYM 267#define PAGE_SYM 268#define MEDIA_SYM 269#define FONT_FACE_SYM 270#define CHARSET_SYM 271#define NAMESPACE_SYM 272#define KHTML_RULE_SYM 273#define KHTML_DECLS_SYM 274#define KHTML_VALUE_SYM 275#define IMPORTANT_SYM 276#define QEMS 277#define EMS 278#define EXS 279#define PXS 280#define CMS 281#define MMS 282#define INS 283#define PTS 284#define PCS 285#define DEGS 286#define RADS 287#define GRADS 288#define MSECS 289#define SECS 290#define HERZ 291#define KHERZ 292#define DIMEN 293#define PERCENTAGE 294#define NUMBER 295#define URI 296#define FUNCTION 297#define UNICODERANGE 298#line 1 "parser.y"/* * This file is part of the KDE libraries * Copyright (C) 2002-2003 Lars Knoll (knoll@kde.org) * Copyright (C) 2004 Apple Computer, Inc. * * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 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 "xml_namespace_table.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#line 86 "parser.y"typedef union { CSSRuleImpl *rule; CSSSelector *selector; bool ok; MediaListImpl *mediaList; CSSMediaRuleImpl *mediaRule; CSSRuleListImpl *ruleList; ParseString string; float val; int prop_id; int attribute; int element; CSSSelector::Relation relation; bool b; char tok; Value value; ValueList *valueList;} YYSTYPE;#line 105 "parser.y"static inline int cssyyerror(const char *x ) {#ifdef CSS_DEBUG qDebug( x );#else Q_UNUSED( x );#endif return 1;}static int cssyylex( YYSTYPE *yylval ) { return CSSParser::current()->lex( yylval );}#include <stdio.h>#ifndef __cplusplus#ifndef __STDC__#define const#endif#endif#define YYFINAL 310#define YYFLAG -32768#define YYNTBASE 63#define YYTRANSLATE(x) ((unsigned)(x) <= 298 ? yytranslate[x] : 116)static const char yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 61, 2, 2, 2, 2, 2, 59, 55, 52, 51, 54, 14, 60, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 13, 50, 2, 58, 53, 2, 62, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 15, 2, 57, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 48, 56, 49, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47};#if YYDEBUG != 0static const short yyprhs[] = { 0, 0, 6, 9, 12, 15, 22, 28, 34, 35, 38, 39, 42, 45, 46, 52, 56, 60, 61, 65, 66, 70, 71, 75, 77, 79, 81, 83, 85, 87, 94, 98, 102, 109, 113, 117, 118, 121, 123, 125, 126, 128, 129, 131, 136, 139, 147, 148, 152, 155, 159, 163, 167, 171, 174, 177, 178, 180, 182, 188, 190, 195, 198, 200, 204, 207, 208, 210, 212, 215, 219, 222, 227, 233, 238, 240, 242, 244, 247, 250, 252, 254, 256, 258, 261, 264, 269, 278, 285, 296, 298, 300, 302, 304, 306, 308, 310, 312, 315, 319, 326, 328, 331, 333, 337, 339, 343, 348, 352, 358, 363, 368, 375, 381, 384, 391, 393, 397, 400, 403, 404, 406, 410, 413, 416, 419, 420, 422, 425, 428, 431, 434, 438, 441, 444, 446, 449, 451, 454, 457, 460, 463, 466, 469, 472, 475, 478, 481, 484, 487, 490, 493, 496, 499, 502, 505, 511, 515, 518, 522, 526, 529, 535, 539, 541};static const short yyrhs[] = { 69, 68, 70, 71, 72, 0, 64, 67, 0, 65, 67, 0, 66, 67, 0, 22, 48, 67, 87, 67, 49, 0, 23, 48, 67, 101, 49, 0, 24, 48, 67, 106, 49, 0, 0, 67, 3, 0, 0, 68, 4, 0, 68, 3, 0, 0, 20, 67, 10, 67, 50, 0, 20, 1, 114, 0, 20, 1, 50, 0, 0, 70, 74, 68, 0, 0, 71, 75, 68, 0, 0, 72, 73, 68, 0, 87, 0, 80, 0, 83, 0, 84, 0, 113, 0, 112, 0, 16, 67, 77, 67, 78, 50, 0, 16, 1, 114, 0, 16, 1, 50, 0, 21, 67, 76, 77, 67, 50, 0, 21, 1, 114, 0, 21, 1, 50, 0, 0, 11, 3, 0, 10, 0, 45, 0, 0, 79, 0, 0, 82, 0, 79, 51, 67, 82, 0, 79, 1, 0, 18, 67, 79, 48, 67, 81, 49, 0, 0, 81, 87, 67, 0, 11, 67, 0, 17, 1, 114, 0, 17, 1, 50, 0, 19, 1, 114, 0, 19, 1, 50, 0, 52, 67, 0, 53, 67, 0, 0, 54, 0, 52, 0, 88, 48, 67, 101, 49, 0, 89, 0, 88, 51, 67, 89, 0, 88, 1, 0, 91, 0, 89, 85, 91, 0, 89, 1, 0, 0, 55, 0, 11, 0, 92, 67, 0, 92, 93, 67, 0, 93, 67, 0, 90, 56, 92, 67, 0, 90, 56, 92, 93, 67, 0, 90, 56, 93, 67, 0, 11, 0, 55, 0, 94, 0, 93, 94, 0, 93, 1, 0, 12, 0, 95, 0, 97, 0, 100, 0, 14, 11, 0, 11, 67, 0, 15, 67, 96, 57, 0, 15, 67, 96, 98, 67, 99, 67, 57, 0, 15, 67, 90, 56, 96, 57, 0, 15, 67, 90, 56, 96, 98, 67, 99, 67, 57, 0, 58, 0, 5, 0, 6, 0, 7, 0, 8, 0, 9, 0, 11, 0, 10, 0, 13, 11, 0, 13, 13, 11, 0, 13, 46, 67, 91, 67, 59, 0, 103, 0, 102, 103, 0, 102, 0, 1, 115, 1, 0, 1, 0, 103, 50, 67, 0, 103, 115, 50, 67, 0, 1, 50, 67, 0, 1, 115, 1, 50, 67, 0, 102, 103, 50, 67, 0, 102, 1, 50, 67, 0, 102, 1, 115, 1, 50, 67, 0, 104, 13, 67, 106, 105, 0, 104, 1, 0, 104, 13, 67, 1, 106, 105, 0, 105, 0, 104, 13, 67, 0, 11, 67, 0, 25, 67, 0, 0, 108, 0, 106, 107, 108, 0, 106, 1, 0, 60, 67, 0, 51, 67, 0, 0, 109, 0, 86, 109, 0, 10, 67, 0, 11, 67, 0, 42, 67, 0, 86, 42, 67, 0, 45, 67, 0, 47, 67, 0, 111, 0, 61, 67, 0, 110, 0, 44, 67, 0, 43, 67, 0, 29, 67, 0, 30, 67, 0, 31, 67, 0, 32, 67, 0, 33, 67, 0, 34, 67, 0, 35, 67, 0, 36, 67, 0, 37, 67, 0, 38, 67, 0, 39, 67, 0, 40, 67, 0, 41, 67, 0, 27, 67, 0, 26, 67, 0, 28, 67, 0, 46, 67, 106, 59, 67, 0, 46, 67, 1, 0, 12, 67, 0, 62, 1, 114, 0, 62, 1, 50, 0, 1, 114, 0, 48, 1, 115, 1, 49, 0, 48, 1, 49, 0, 114, 0, 115, 1, 114, 0};#endif#if YYDEBUG != 0static const short yyrline[] = { 0, 236, 238, 239, 240, 243, 250, 256, 281, 283, 286, 288, 289, 292, 294, 299, 300, 303, 305, 315, 317, 320, 322, 332, 334, 335, 336, 337, 338, 341, 354, 357, 362, 371, 372, 375, 377, 380, 382, 385, 389, 393, 397, 401, 406, 412, 426, 428, 437, 459, 463, 468, 472, 477, 479, 480, 483, 485, 488, 507, 519, 533, 539, 543, 572, 578, 580, 581, 584, 589, 594, 599, 606, 615, 626, 643, 648, 652, 662, 668, 678, 679, 680, 683, 695, 715, 721, 727, 735, 746, 750, 753, 756, 759, 762, 767, 769, 772, 786, 793, 802, 806, 811, 814, 820, 828, 832, 835, 841, 847, 852, 858, 866, 889, 893, 901, 906, 913, 920, 922, 925, 930, 943, 949, 953, 956, 961, 963, 964, 965, 972, 973, 974, 975, 976, 977, 979, 984, 986, 987, 988, 989, 990, 991, 992, 993, 994, 995, 996, 997, 998, 999, 1000, 1001, 1002, 1006, 1014, 1029, 1036, 1043, 1051, 1077, 1079, 1082, 1084};#endif#if YYDEBUG != 0 || defined (YYERROR_VERBOSE)static const char * const yytname[] = { "$","error","$undefined.","WHITESPACE","SGML_CD","INCLUDES","DASHMATCH","BEGINSWITH","ENDSWITH","CONTAINS","STRING","IDENT","HASH","':'","'.'","'['","IMPORT_SYM","PAGE_SYM","MEDIA_SYM","FONT_FACE_SYM","CHARSET_SYM","NAMESPACE_SYM","KHTML_RULE_SYM","KHTML_DECLS_SYM","KHTML_VALUE_SYM","IMPORTANT_SYM","QEMS","EMS","EXS","PXS","CMS","MMS","INS","PTS","PCS","DEGS","RADS","GRADS","MSECS","SECS","HERZ","KHERZ","DIMEN","PERCENTAGE","NUMBER","URI","FUNCTION","UNICODERANGE","'{'","'}'","';'","','","'+'","'>'","'-'","'*'","'|'","']'","'='","')'","'/'","'#'","'@'","stylesheet","khtml_rule","khtml_decls","khtml_value","maybe_space","maybe_sgml","maybe_charset","import_list","namespace_list","rule_list","rule","import","namespace","maybe_ns_prefix","string_or_uri","maybe_media_list","media_list","media","ruleset_list","medium","page","font_face","combinator","unary_operator","ruleset","selector_list","selector","namespace_selector","simple_selector","element_name","specifier_list","specifier","class","attrib_id","attrib","match","ident_or_string","pseudo","declaration_list","decl_list","declaration","property","prio","expr","operator","term","unary_term","function","hexcolor","invalid_at","invalid_rule","invalid_block","invalid_block_list", NULL};#endifstatic const short yyr1[] = { 0, 63, 63, 63, 63, 64, 65, 66, 67, 67, 68, 68, 68, 69, 69, 69, 69, 70, 70, 71, 71, 72, 72, 73, 73, 73, 73, 73, 73, 74, 74, 74, 75, 75, 75, 76, 76, 77, 77, 78, 78, 79, 79, 79, 79, 80, 81, 81, 82, 83, 83, 84, 84, 85, 85, 85, 86, 86, 87, 88, 88, 88, 89, 89, 89, 90, 90, 90, 91, 91, 91, 91, 91, 91, 92, 92, 93, 93, 93, 94, 94, 94, 94, 95, 96, 97, 97, 97, 97, 98, 98, 98, 98, 98, 98, 99, 99, 100, 100, 100, 101, 101, 101, 101, 101, 102, 102, 102, 102, 102, 102, 102, 103, 103, 103, 103, 103, 104, 105, 105, 106, 106, 106, 107, 107, 107, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 110, 110, 111, 112, 112, 113, 114, 114, 115, 115};static const short yyr2[] = { 0, 5, 2, 2, 2, 6, 5, 5, 0, 2, 0, 2, 2, 0, 5, 3, 3, 0, 3, 0, 3, 0, 3, 1, 1, 1, 1, 1, 1, 6, 3, 3, 6, 3, 3, 0, 2, 1, 1, 0, 1, 0, 1, 4, 2, 7, 0, 3, 2, 3, 3, 3, 3, 2, 2, 0, 1, 1, 5, 1, 4, 2, 1, 3, 2, 0, 1, 1, 2, 3, 2, 4, 5, 4, 1, 1, 1, 2, 2, 1, 1, 1, 1, 2, 2, 4, 8, 6, 10, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 6, 1, 2, 1, 3, 1, 3, 4, 3, 5, 4, 4, 6, 5, 2, 6, 1, 3, 2, 2, 0, 1, 3, 2, 2, 2, 0, 1, 2, 2, 2, 2, 3, 2, 2, 1, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 5, 3, 2, 3, 3, 2, 5, 3, 1, 3};static const short yydefact[] = { 13, 0, 0, 0, 0, 8, 8, 8, 10, 0, 0, 8, 8, 8, 2, 3, 4, 17, 0, 16, 15, 9, 8, 65, 0, 0, 12, 11, 19, 0, 0, 74, 79, 0, 0, 8, 75, 8, 0, 0, 0, 62, 8, 0, 76, 80, 81, 82, 104, 8, 8, 0, 0, 100, 0, 115, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -