PageRenderTime 34ms CodeModel.GetById 19ms app.highlight 10ms RepoModel.GetById 1ms app.codeStats 0ms

/parser.h

http://github.com/fizx/parsley
C Header | 223 lines | 161 code | 26 blank | 36 comment | 2 complexity | 5bef5bc7c8e5b7e049a9dc2dd94ac8e2 MD5 | raw file
  1/* A Bison parser, made by GNU Bison 2.3.  */
  2
  3/* Skeleton interface for Bison GLR parsers in C
  4
  5   Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
  6
  7   This program is free software; you can redistribute it and/or modify
  8   it under the terms of the GNU General Public License as published by
  9   the Free Software Foundation; either version 2, or (at your option)
 10   any later version.
 11
 12   This program is distributed in the hope that it will be useful,
 13   but WITHOUT ANY WARRANTY; without even the implied warranty of
 14   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 15   GNU General Public License for more details.
 16
 17   You should have received a copy of the GNU General Public License
 18   along with this program; if not, write to the Free Software
 19   Foundation, Inc., 51 Franklin Street, Fifth Floor,
 20   Boston, MA 02110-1301, USA.  */
 21
 22/* As a special exception, you may create a larger work that contains
 23   part or all of the Bison parser skeleton and distribute that work
 24   under terms of your choice, so long as that work isn't itself a
 25   parser generator using the skeleton or a modified version thereof
 26   as a parser skeleton.  Alternatively, if you modify or redistribute
 27   the parser skeleton itself, you may (at your option) remove this
 28   special exception, which will cause the skeleton and the resulting
 29   Bison output files to be licensed under the GNU General Public
 30   License without this special exception.
 31
 32   This special exception was added by the Free Software Foundation in
 33   version 2.2 of Bison.  */
 34
 35/* Tokens.  */
 36#ifndef YYTOKENTYPE
 37# define YYTOKENTYPE
 38   /* Put the tokens into the symbol table, so that GDB and other debuggers
 39      know about them.  */
 40   enum yytokentype {
 41     NUMBER = 258,
 42     S = 259,
 43     AT = 260,
 44     LPAREN = 261,
 45     RPAREN = 262,
 46     PIPE = 263,
 47     LT = 264,
 48     SLASH = 265,
 49     DBLSLASH = 266,
 50     BANG = 267,
 51     COLON = 268,
 52     DBLCOLON = 269,
 53     QUERY = 270,
 54     HASH = 271,
 55     COMMA = 272,
 56     DOT = 273,
 57     DBLDOT = 274,
 58     GT = 275,
 59     LBRA = 276,
 60     RBRA = 277,
 61     TILDE = 278,
 62     SPLAT = 279,
 63     PLUS = 280,
 64     DASH = 281,
 65     EQ = 282,
 66     LTE = 283,
 67     GTE = 284,
 68     DOLLAR = 285,
 69     BSLASHLIT = 286,
 70     OTHER = 287,
 71     XANCESTOR = 288,
 72     XANCESTORSELF = 289,
 73     XATTR = 290,
 74     XCHILD = 291,
 75     XDESC = 292,
 76     XDESCSELF = 293,
 77     XFOLLOW = 294,
 78     XFOLLOWSIB = 295,
 79     XNS = 296,
 80     XPARENT = 297,
 81     XPRE = 298,
 82     XPRESIB = 299,
 83     XSELF = 300,
 84     XOR = 301,
 85     XAND = 302,
 86     XDIV = 303,
 87     XMOD = 304,
 88     XCOMMENT = 305,
 89     XTEXT = 306,
 90     XPI = 307,
 91     XNODE = 308,
 92     CXEQUATION = 309,
 93     CXOPHE = 310,
 94     CXOPNE = 311,
 95     CXOPSTARTEQ = 312,
 96     CXOPENDEQ = 313,
 97     CXOPCONTAINS = 314,
 98     CXOPCONTAINS2 = 315,
 99     CXFIRST = 316,
100     CXLAST = 317,
101     CXNOT = 318,
102     CXEVEN = 319,
103     CXODD = 320,
104     CXEQ = 321,
105     CXGT = 322,
106     CXLT = 323,
107     CXCONTENT = 324,
108     CXHEADER = 325,
109     CXCONTAINS = 326,
110     CXEMPTY = 327,
111     CXHAS = 328,
112     CXPARENT = 329,
113     CXNTHCH = 330,
114     CXNTHLASTCH = 331,
115     CXNTHTYPE = 332,
116     CXNTHLASTTYPE = 333,
117     CXFIRSTCH = 334,
118     CXLASTCH = 335,
119     CXFIRSTTYPE = 336,
120     CXLASTTYPE = 337,
121     CXONLYCH = 338,
122     CXONLYTYPE = 339,
123     CXINPUT = 340,
124     CXTEXT = 341,
125     CXPASSWORD = 342,
126     CXRADIO = 343,
127     CXCHECKBOX = 344,
128     CXSUBMIT = 345,
129     CXIMAGE = 346,
130     CXRESET = 347,
131     CXBUTTON = 348,
132     CXFILE = 349,
133     CXENABLED = 350,
134     CXDISABLED = 351,
135     CXCHECKED = 352,
136     CXSELECTED = 353,
137     NAME = 354,
138     STRING = 355
139   };
140#endif
141
142
143/* Copy the first part of user declarations.  */
144#line 1 "parser.y"
145
146#include <math.h>
147#include <stdio.h>
148#include <stdlib.h>
149#include <string.h>
150#include "parsed_xpath.h"
151#include <libxml/hash.h>
152
153#ifndef PARSER_Y_H_INCLUDED
154#define PARSER_Y_H_INCLUDED
155
156static pxpathPtr parsed_answer;
157
158int yylex (void);
159void yyerror (char const *);
160
161void prepare_parse(char*);
162void cleanup_parse(void);
163void start_debugging(void);
164
165static xmlHashTablePtr alias_hash;
166
167char* xpath_alias(char*);
168void init_xpath_alias();
169
170int yyparse(void);
171pxpathPtr myparse(char*);
172void answer(pxpathPtr);
173
174#define LIT_BIN_OP(A, B, C)           pxpath_cat_literals(3, A, LIT(B), C)
175#define BIN_OP(A, B, C)               pxpath_cat_paths(3, A, OP(B), C)
176#define PREP_OP(A, B)                 pxpath_cat_paths(2, OP(A), B)
177#define PXP(A)                        pxpath_new_path(1, A)
178#define LIT(A)                        pxpath_new_literal(1, A)
179#define OP(A)   	                    pxpath_new_operator(1, A)
180#define APPEND(A, S)                  pxpath_cat_paths(2, A, PXP(S)); 
181#define PREPEND(A, S)                 pxpath_cat_paths(2, PXP(S), A); 
182#define PXPWRAP(A, B, C)              pxpath_cat_paths(3, PXP(A), B, PXP(C))
183#define P4E(A, B, C, D)               pxpath_cat_paths(4, A, PXP(B), C, PXP(D))
184#define P4O(A, B, C, D)               pxpath_cat_paths(4, PXP(A), B, PXP(C), D)
185#define P6E(A, B, C, D, E, F)         pxpath_cat_paths(6, A, PXP(B), C, PXP(D), E, PXP(F));
186#define INPUT_TYPE(A, S)              APPEND(A, "[lower-case(name())='input' and lower-case(@type)='" #S "']")
187#define TRACE(A, B)                   fprintf(stderr, "trace(%s): ", A); fprintf(stderr, "%s\n", pxpath_to_string(B));
188
189#endif
190  
191
192
193#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
194typedef union YYSTYPE 
195#line 53 "parser.y"
196{
197  int empty;
198	char* string;
199  pxpathPtr node;
200}
201/* Line 2616 of glr.c.  */
202#line 203 "parser.h"
203	YYSTYPE;
204# define YYSTYPE_IS_DECLARED 1
205# define YYSTYPE_IS_TRIVIAL 1
206#endif
207
208#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
209typedef struct YYLTYPE
210{
211
212  char yydummy;
213
214} YYLTYPE;
215# define YYLTYPE_IS_DECLARED 1
216# define YYLTYPE_IS_TRIVIAL 1
217#endif
218
219
220extern YYSTYPE yylval;
221
222
223