xpathparser.cpp revision d2ac881b8a3bc4613547b9173681ff1752eaa0e2
4b6d620057c6cbaf072607eda6d18a7934fc19c8johanengelen * Phoebe DOM Implementation.
4b6d620057c6cbaf072607eda6d18a7934fc19c8johanengelen * This is a C++ approximation of the W3C DOM model, which follows
4b6d620057c6cbaf072607eda6d18a7934fc19c8johanengelen * fairly closely the specifications in the various .idl files, copies of
4b6d620057c6cbaf072607eda6d18a7934fc19c8johanengelen * which are provided for reference. Most important is this one:
4b6d620057c6cbaf072607eda6d18a7934fc19c8johanengelen * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/idl-definitions.html
4b6d620057c6cbaf072607eda6d18a7934fc19c8johanengelen * Bob Jamison
6c3e745a94ef6b25a4ef9f018d350a7535aa45afTed Gould * Copyright (C) 2006-2007 Bob Jamison
4b6d620057c6cbaf072607eda6d18a7934fc19c8johanengelen * This library is free software; you can redistribute it and/or
4b6d620057c6cbaf072607eda6d18a7934fc19c8johanengelen * modify it under the terms of the GNU Lesser General Public
6c3e745a94ef6b25a4ef9f018d350a7535aa45afTed Gould * License as published by the Free Software Foundation; either
4b6d620057c6cbaf072607eda6d18a7934fc19c8johanengelen * version 2.1 of the License, or (at your option) any later version.
4b6d620057c6cbaf072607eda6d18a7934fc19c8johanengelen * This library is distributed in the hope that it will be useful,
4b6d620057c6cbaf072607eda6d18a7934fc19c8johanengelen * but WITHOUT ANY WARRANTY; without even the implied warranty of
4b6d620057c6cbaf072607eda6d18a7934fc19c8johanengelen * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
6c3e745a94ef6b25a4ef9f018d350a7535aa45afTed Gould * Lesser General Public License for more details.
4b6d620057c6cbaf072607eda6d18a7934fc19c8johanengelen * You should have received a copy of the GNU Lesser General Public
4b6d620057c6cbaf072607eda6d18a7934fc19c8johanengelen * License along with this library; if not, write to the Free Software
4b6d620057c6cbaf072607eda6d18a7934fc19c8johanengelen * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
6c3e745a94ef6b25a4ef9f018d350a7535aa45afTed Gould//#########################################################################
6c3e745a94ef6b25a4ef9f018d350a7535aa45afTed Gould//# M E S S A G E S
6c3e745a94ef6b25a4ef9f018d350a7535aa45afTed Gould//#########################################################################
4b6d620057c6cbaf072607eda6d18a7934fc19c8johanengelen //Print location in string
4b6d620057c6cbaf072607eda6d18a7934fc19c8johanengelen for (int i=0 ; i<position ; i++)
if (!debug)
for (int i=0 ; i<indent ; i++)
return tok;
return lexicalTokens[p];
if (p >= parselen)
position = p;
return parsebuf[p] ;
if (p >= parselen)
position = p;
return parsebuf[p];
int p = p0;
while (p < parselen)
int p = p0;
while (p < parselen)
while (*str)
if (p >= parselen)
p++; str++;
int p = p0;
if (p >= parselen)
bool isdouble = false;
bool seen_dot = false;
bool seen_e = false;
bool seen_eminus = false;
while (i < parselen)
if (seen_dot)
return p0;
seen_dot = true;
isdouble = true;
return p0;
seen_e = true;
return p0;
seen_eminus = true;
return p0;
if (isdouble)
char *end;
return p0;
char *end;
return p0;
int p = p0;
int quotechar = 0;
return p0;
if (p >= parselen)
int p = p0;
return p0;
while (p < parselen)
int p = p0;
if (p2 <= p)
return p0;
p = p2;
if (p2 <= p)
return p0;
p = p2;
int p2 = p;
while (p < parselen)
p = p2;
bool selected = false;
if (p2 > p)
p = p2;
selected = true;
if (selected)
if (p2 > p)
p = p2;
selected = true;
p = p2;
selected = true;
if (selected)
if (p2 > p)
p = p2;
selected = true;
if (selected)
if (p2 > p)
p = p2;
selected = true;
if (selected)
if (p2 > p)
p = p2;
selected = true;
if (selected)
if (p2 > p)
p = p2;
selected = true;
if (selected)
double numval;
if (p2 > p)
p = p2;
selected = true;
if (selected)
if (p2 > p)
p = p2;
selected = true;
if (selected)
int p = p0;
p = skipwhite(p);
if (p2 > p)
return p2;
if (p2 > p)
return p2;
return p0;
int p = p0;
if (p2 <= p)
p = p2;
if (p2 <= p)
p = p2;
return p0;
int p = p0;
if (p2 < 0)
if (p2 > p)
p = p2;
if (p2 < 0)
p = p2;
if (p2 < 0)
p = p2;
return p0;
int p = p0;
if (p2 < 0)
p = p2;
if (p2 < 0)
if (p2 > p)
p = p2;
if (p2 < 0)
p = p2;
return p0;
int p = p0;
switch (axisType)
case ANCESTOR_OR_SELF:
case ANCESTOR:
case ATTRIBUTE:
case CHILD:
case DESCENDANT_OR_SELF:
case DESCENDANT:
case FOLLOWING_SIBLING:
case FOLLOWING:
case NAMESPACE:
case PARENT:
case PRECEDING_SIBLING:
case PRECEDING:
case SELF:
return p0;
return p0;
int p = p0;
return p0;
int p = p0;
return p0;
if (p2 <= p)
p = p2;
int p = p0;
if (p2 < 0)
p = p2;
return p0;
return p0;
return p0;
return p0;
int p = p0;
if (p2 < 0)
p = p2;
int p = p0;
int p2 = p;
if (p2 <= p)
p += p2;
if (p2 < 0)
if (p2 > p)
p = p2;
return p0;
int p = p0;
return p0;
return p0;
if (p2 < 0)
if (p2 > p)
p = p2;
if (p2 <= p)
if (p2 > p)
argCount++;
p = p2;
// Function names from http://www.w3.org/TR/xpath#NT-FunctionName
int p = p0;
if (p2 < 0)
p = p2;
int p = p0;
if (p2 < 0)
p = p2;
if (p2 < 0)
p = p2;
int p = p0;
int p2;
if (p2 < 0)
if (p2 > p)
p = p2;
if (p2 < 0)
if (p2 <= p)
return p0;
p = p2;
if (p2 < 0)
p = p2;
if (p2 < 0)
p = p2;
int p = p0;
if (p2 < 0)
if (p2 > p)
p = p2;
if (p2 < 0)
if (p2 > p)
p = p2;
return p0;
int p = p0;
if (p2 < 0)
if (p2 > p)
p = p2;
if (p2 <= p)
p = p2;
return p0;
int p = p0;
if (p2 < 0)
if (p2 > p)
p = p2;
if (p2 <= p)
p = p2;
return p0;
int p = p0;
if (p2 < 0)
if (p2 > p)
p = p2;
if (p2 <= p)
p = p2;
if (p2 <= p)
p = p2;
return p0;
int p = p0;
if (p2 < 0)
if (p2 > p)
p = p2;
if (p2 <= p)
p = p2;
if (p2 <= p)
p = p2;
if (p2 <= p)
p = p2;
if (p2 <= p)
p = p2;
return p0;
int p = p0;
if (p2 < 0)
if (p2 > p)
p = p2;
if (p2 <= p)
p = p2;
if (p2 <= p)
p = p2;
return p0;
int p = p0;
if (p2 < 0)
if (p2 > p)
p = p2;
if (p2 <= p)
p = p2;
if (p2 <= p)
p = p2;
if (p2 <= p)
p = p2;
return p0;
int p = p0;
if (p2 < 0)
if (p2 > p)
p = p2;
if (p2 < 0)
p = p2;
return p0;
return p0;
return p0;
return p0;
return p0;
return p0;
return p0;
return p0;
return p0;
return p0;
return p0;
return p0;
return p0;
int p0 = 0;
position = 0;
lexicalScan();
parselen = 0;
if (p <= p0)
return list;
if (debug)
return results;