Code

Patch from Lubomir Rintel: fixes for GCC 4.4
[inkscape.git] / src / dom / xpathtoken.h
index d595ad43c7aac9a3d4833607a954778064e91c14..8683b2ee14bcb10be4ebd9dd4adebb0aec42d40b 100644 (file)
-#ifndef __XPATHTOKEN_H__\r
-#define __XPATHTOKEN_H__\r
-\r
-/**\r
- * Phoebe DOM Implementation.\r
- *\r
- * This is a C++ approximation of the W3C DOM model, which follows\r
- * fairly closely the specifications in the various .idl files, copies of\r
- * which are provided for reference.  Most important is this one:\r
- *\r
- * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/idl-definitions.html\r
- *\r
- * Authors:\r
- *   Bob Jamison\r
- *\r
- * Copyright (C) 2006 Bob Jamison\r
- *\r
- *  This library is free software; you can redistribute it and/or\r
- *  modify it under the terms of the GNU Lesser General Public\r
- *  License as published by the Free Software Foundation; either\r
- *  version 2.1 of the License, or (at your option) any later version.\r
- *\r
- *  This library is distributed in the hope that it will be useful,\r
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\r
- *  Lesser General Public License for more details.\r
- *\r
- *  You should have received a copy of the GNU Lesser General Public\r
- *  License along with this library; if not, write to the Free Software\r
- *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA\r
- */\r
-\r
-\r
-#include "dom.h"\r
-\r
-#include <math.h>\r
-\r
-#include <vector>\r
-\r
-namespace org\r
-{\r
-namespace w3c\r
-{\r
-namespace dom\r
-{\r
-namespace xpath\r
-{\r
-\r
-typedef org::w3c::dom::DOMString DOMString;\r
-\r
-class Axis\r
-{\r
-public:\r
-    /**\r
-     *  Constructor\r
-     */\r
-    Axis();\r
-\r
-    /**\r
-     *  Constructor\r
-     */\r
-    Axis(int tokPos);\r
-\r
-    /**\r
-     *  Copy constructor\r
-     */\r
-    Axis(const Axis &other);\r
-\r
-    /**\r
-     *  Destructor\r
-     */\r
-    virtual ~Axis();\r
-\r
-    /**\r
-     *\r
-     */\r
-    Axis &operator=(const Axis &other);\r
-\r
-    /**\r
-     *\r
-     */\r
-    void init();\r
-\r
-    /**\r
-     *\r
-     */\r
-    void assign(const Axis &other);\r
-\r
-    /**\r
-     *\r
-     */\r
-    void setPosition(unsigned int val);\r
-\r
-    /**\r
-     *\r
-     */\r
-    unsigned int getPosition();\r
-\r
-    /**\r
-     *\r
-     */\r
-    void setNode(const Node *node);\r
-\r
-    /**\r
-     *\r
-     */\r
-    Node *getNode();\r
-\r
-private:\r
-\r
-    int tokenPosition;\r
-\r
-    Node *node;\r
-};\r
-\r
-\r
-/**\r
- * This represents a single value on the evaluation stack\r
- */\r
-class StackItem\r
-{\r
-public:\r
-\r
-    /**\r
-     *  Constructor\r
-     */\r
-    StackItem();\r
-\r
-    /**\r
-     *  Copy constructor\r
-     */\r
-    StackItem(const StackItem &other);\r
-\r
-    /**\r
-     *  Destructor\r
-     */\r
-    virtual ~StackItem();\r
-\r
-    /**\r
-     *\r
-     */\r
-    StackItem &operator=(const StackItem &other);\r
-\r
-    /**\r
-     *\r
-     */\r
-    void assign(const StackItem &other);\r
-\r
-\r
-    //treat the stack item like an union of string, integer, and double\r
-\r
-    /**\r
-     * String value\r
-     */\r
-    DOMString sval;\r
-\r
-    /**\r
-     * Integer value\r
-     */\r
-    long      ival;\r
-\r
-    /**\r
-     * Double value;\r
-     */\r
-    double    dval;\r
-\r
-};\r
-\r
-class TokenList;\r
-\r
-//########################################################################\r
-//# T O K E N    E X E C U T O R\r
-//########################################################################\r
-\r
-#define STACK_SIZE 1024\r
-\r
-/**\r
- * A token evaluator, with stack and axis context\r
- */\r
-class TokenExecutor\r
-{\r
-public:\r
-\r
-    /**\r
-     * Constructor\r
-     */\r
-    TokenExecutor();\r
-\r
-    /**\r
-     * Copy constructor\r
-     */\r
-    TokenExecutor(const TokenExecutor &other);\r
-\r
-    /**\r
-     * Destructor\r
-     */\r
-    virtual ~TokenExecutor();\r
-\r
-    /**\r
-     *  Assign our values to those of the other\r
-     */\r
-    virtual void assign(const TokenExecutor &other);\r
-\r
-    /**\r
-     * Reset the stack to its original settings\r
-     */\r
-    virtual void reset();\r
-\r
-    /**\r
-     * Push a stack item onto the stack\r
-     */\r
-    virtual void push(StackItem &item);\r
-\r
-    /**\r
-     * Pop a stack item from the stack\r
-     */\r
-    virtual StackItem pop();\r
-\r
-    /**\r
-     * Execute a token list on the stack\r
-     */\r
-    NodeList execute(const TokenList &list, const Node *node);\r
-\r
-    /**\r
-     *\r
-     */\r
-    Axis axis;\r
-\r
-    /**\r
-     *\r
-     */\r
-    std::vector<Axis> axisStack;\r
-\r
-private:\r
-\r
-    /**\r
-     * Contains the StackItem stack;\r
-     */\r
-    StackItem stack[STACK_SIZE];\r
-\r
-    /**\r
-     * Marks the head of the stack, for push() and pop()\r
-     */\r
-    int stackSize;\r
-\r
-    /**\r
-     *  Current list of nodes found by the expression\r
-     */\r
-    NodeList nodeList;\r
-\r
-\r
-};\r
-\r
-\r
-\r
-//########################################################################\r
-//# X P A T H    T O K E N\r
-//########################################################################\r
-\r
-\r
-\r
-/**\r
- *  This is a pseudocode-type class that executes itself on a stack,\r
- *  much like stack-oriented languages such as FORTH or Postscript.\r
- *  Each token can pop zero or more tokens off the stack, and push\r
- *  zero or one token back onto it.  When a list of tokens is completed,\r
- *  a single stack value should be left on the stack.\r
- */\r
-class Token\r
-{\r
-public:\r
-\r
-    /**\r
-     * Token types.  Look in xpathtoken.cpp's function table\r
-     * to see how these types map to their respective\r
-     * functionalities\r
-     */\r
-    typedef enum\r
-        {\r
-        //primitives\r
-        TOK_NOP = 0,\r
-        TOK_STR,\r
-        TOK_INT,\r
-        TOK_FLOAT,\r
-        //operators\r
-        TOK_AND,\r
-        TOK_OR,\r
-        TOK_MOD,\r
-        TOK_DIV,\r
-        TOK_MULTIPLY,\r
-        TOK_DOUBLE_SLASH,\r
-        TOK_SLASH,\r
-        TOK_PIPE,\r
-        TOK_PLUS,\r
-        TOK_MINUS,\r
-        TOK_NEG,\r
-        TOK_EQUALS,\r
-        TOK_NOT_EQUALS,\r
-        TOK_LESS_THAN_EQUALS,\r
-        TOK_LESS_THAN,\r
-        TOK_GREATER_THAN_EQUALS,\r
-        TOK_GREATER_THAN,\r
-        //path types\r
-        TOK_ABSOLUTE,\r
-        TOK_RELATIVE,\r
-        TOK_STEP,\r
-        TOK_NAME_TEST,\r
-        TOK_EXPR,\r
-        TOK_UNION,\r
-        //axis types\r
-        TOK_AXIS_ANCESTOR_OR_SELF,\r
-        TOK_AXIS_ANCESTOR,\r
-        TOK_AXIS_ATTRIBUTE,\r
-        TOK_AXIS_CHILD,\r
-        TOK_AXIS_DESCENDANT_OR_SELF,\r
-        TOK_AXIS_DESCENDANT,\r
-        TOK_AXIS_FOLLOWING_SIBLING,\r
-        TOK_AXIS_FOLLOWING,\r
-        TOK_AXIS_NAMESPACE,\r
-        TOK_AXIS_PARENT,\r
-        TOK_AXIS_PRECEDING_SIBLING,\r
-        TOK_AXIS_PRECEDING,\r
-        TOK_AXIS_SELF,\r
-        //function types\r
-        TOK_FUNC_LAST,\r
-        TOK_FUNC_POSITION,\r
-        TOK_FUNC_COUNT,\r
-        TOK_FUNC_ID,\r
-        TOK_FUNC_LOCAL_NAME,\r
-        TOK_FUNC_NAMESPACE_URI,\r
-        TOK_FUNC_NAME,\r
-        TOK_FUNC_STRING,\r
-        TOK_FUNC_CONCAT,\r
-        TOK_FUNC_STARTS_WITH,\r
-        TOK_FUNC_CONTAINS,\r
-        TOK_FUNC_SUBSTRING_BEFORE,\r
-        TOK_FUNC_SUBSTRING_AFTER,\r
-        TOK_FUNC_SUBSTRING,\r
-        TOK_FUNC_STRING_LENGTH,\r
-        TOK_FUNC_NORMALIZE_SPACE,\r
-        TOK_FUNC_TRANSLATE,\r
-        TOK_FUNC_BOOLEAN,\r
-        TOK_FUNC_NOT,\r
-        TOK_FUNC_TRUE,\r
-        TOK_FUNC_FALSE,\r
-        TOK_FUNC_LANG,\r
-        TOK_FUNC_NUMBER,\r
-        TOK_FUNC_SUM,\r
-        TOK_FUNC_FLOOR,\r
-        TOK_FUNC_CEILING,\r
-        TOK_FUNC_ROUND,\r
-        } TokenType;\r
-\r
-\r
-\r
-\r
-    /**\r
-     *  Constructor with a NOP default type\r
-     */\r
-    Token()\r
-        {\r
-        type     = TOK_NOP;\r
-        ival     = 0L;\r
-        dval     = 0.0;\r
-        }\r
-\r
-    /**\r
-     * Copy constructor\r
-     */\r
-    Token(const Token &other)\r
-        {\r
-        type     = other.type;\r
-        sval     = other.sval;\r
-        ival     = other.ival;\r
-        dval     = other.dval;\r
-        }\r
-\r
-    /**\r
-     * Destructor\r
-     */\r
-    virtual ~Token()\r
-        {}\r
-\r
-    /**\r
-     *  Return the enumerated TokenType of this token\r
-     */\r
-    virtual int getType()\r
-        { return type; }\r
-    /**\r
-     *  Return the string TokenType of this token\r
-     */\r
-    virtual DOMString getTypeString();\r
-\r
-    /**\r
-     *  Let this token execute itself on the given stack,\r
-     *  possibly adding Nodes to the node list.\r
-     */\r
-    virtual bool execute(TokenExecutor &stack)\r
-        { return true; }\r
-\r
-    /**\r
-     *  Print the contents of this token\r
-     */\r
-    virtual void dump()\r
-        {\r
-        printf("%s %s %f %ld\n",\r
-            getTypeString().c_str(), sval.c_str(), dval, ival);\r
-        }\r
-\r
-    //treat the token like an union of string, integer, and double\r
-\r
-    /**\r
-     * String value\r
-     */\r
-    DOMString sval;\r
-\r
-    /**\r
-     * Integer value\r
-     */\r
-    long ival;\r
-\r
-    /**\r
-     * Double value;\r
-     */\r
-    double dval;\r
-\r
-protected:\r
-\r
-    /**\r
-     * The enmerated token type\r
-     */\r
-    int type;\r
-\r
-\r
-private:\r
-\r
-\r
-};\r
-\r
-\r
-//########################################################################\r
-//# X P A T H    T O K E N    T Y P E S\r
-//########################################################################\r
-\r
-\r
-\r
-//###########################\r
-//# V A L U E S\r
-//###########################\r
-\r
-class TokStr : public Token\r
-{\r
-public:\r
-    TokStr(const DOMString &val)\r
-        {\r
-        type = TOK_STR;\r
-        sval = val;\r
-        }\r
-    virtual bool execute(TokenExecutor &exec)\r
-        {\r
-        StackItem item;\r
-        item.sval = sval;\r
-        exec.push(item);\r
-        return true;\r
-        }\r
-};\r
-\r
-class TokFloat : public Token\r
-{\r
-public:\r
-    TokFloat(double val)\r
-        {\r
-        type = TOK_FLOAT;\r
-        dval = val;\r
-        }\r
-    virtual bool execute(TokenExecutor &exec)\r
-        {\r
-        StackItem item;\r
-        item.dval = dval;\r
-        exec.push(item);\r
-        return true;\r
-        }\r
-};\r
-\r
-class TokInt : public Token\r
-{\r
-public:\r
-    TokInt(long val)\r
-        {\r
-        type = TOK_INT;\r
-        ival = val;\r
-        }\r
-    virtual bool execute(TokenExecutor &exec)\r
-        {\r
-        StackItem item;\r
-        item.ival = ival;\r
-        exec.push(item);\r
-        return true;\r
-        }\r
-};\r
-\r
-class TokAnd : public Token\r
-{\r
-public:\r
-    TokAnd()\r
-        {\r
-        type = TOK_AND;\r
-        }\r
-    virtual bool execute(TokenExecutor &exec)\r
-        {\r
-        StackItem item1 = exec.pop();\r
-        StackItem item2 = exec.pop();\r
-        item1.ival = item1.ival && item2.ival;\r
-        exec.push(item1);\r
-        return true;\r
-        }\r
-};\r
-\r
-class TokOr : public Token\r
-{\r
-public:\r
-    TokOr()\r
-        {\r
-        type = TOK_OR;\r
-        }\r
-    virtual bool execute(TokenExecutor &exec)\r
-        {\r
-        StackItem item1 = exec.pop();\r
-        StackItem item2 = exec.pop();\r
-        item1.ival = item1.ival || item2.ival;\r
-        exec.push(item1);\r
-        return true;\r
-        }\r
-};\r
-\r
-class TokMod : public Token\r
-{\r
-public:\r
-    TokMod()\r
-        {\r
-        type = TOK_MOD;\r
-        }\r
-    virtual bool execute(TokenExecutor &exec)\r
-        {\r
-        StackItem item1 = exec.pop();\r
-        StackItem item2 = exec.pop();\r
-        item1.dval = fmod(item1.dval, item2.dval);\r
-        exec.push(item1);\r
-        return true;\r
-        }\r
-};\r
-\r
-class TokDiv : public Token\r
-{\r
-public:\r
-    TokDiv()\r
-        {\r
-        type = TOK_DIV;\r
-        }\r
-    virtual bool execute(TokenExecutor &exec)\r
-        {\r
-        StackItem item1 = exec.pop();\r
-        StackItem item2 = exec.pop();\r
-        item1.dval /= item2.dval;\r
-        exec.push(item1);\r
-        return true;\r
-        }\r
-};\r
-\r
-class TokMul : public Token\r
-{\r
-public:\r
-    TokMul()\r
-        {\r
-        type = TOK_MULTIPLY;\r
-        }\r
-    virtual bool execute(TokenExecutor &exec)\r
-        {\r
-        StackItem item1 = exec.pop();\r
-        StackItem item2 = exec.pop();\r
-        item1.dval *= item2.dval;\r
-        exec.push(item1);\r
-        return true;\r
-        }\r
-};\r
-\r
-class TokPlus : public Token\r
-{\r
-public:\r
-    TokPlus()\r
-        {\r
-        type = TOK_PLUS;\r
-        }\r
-    virtual bool execute(TokenExecutor &exec)\r
-        {\r
-        StackItem item1 = exec.pop();\r
-        StackItem item2 = exec.pop();\r
-        item1.dval += item2.dval;\r
-        exec.push(item1);\r
-        return true;\r
-        }\r
-};\r
-\r
-class TokMinus : public Token\r
-{\r
-public:\r
-    TokMinus()\r
-        {\r
-        type = TOK_MINUS;\r
-        }\r
-    virtual bool execute(TokenExecutor &exec)\r
-        {\r
-        StackItem item1 = exec.pop();\r
-        StackItem item2 = exec.pop();\r
-        item1.dval -= item2.dval;\r
-        exec.push(item1);\r
-        return true;\r
-        }\r
-};\r
-\r
-class TokNeg : public Token\r
-{\r
-public:\r
-    TokNeg()\r
-        {\r
-        type = TOK_NEG;\r
-        }\r
-    virtual bool execute(TokenExecutor &exec)\r
-        {\r
-        StackItem item = exec.pop();\r
-        item.dval = -item.dval;\r
-        item.ival = -item.ival;\r
-        exec.push(item);\r
-        return true;\r
-        }\r
-};\r
-\r
-class TokEquals : public Token\r
-{\r
-public:\r
-    TokEquals()\r
-        {\r
-        type = TOK_EQUALS;\r
-        }\r
-    virtual bool execute(TokenExecutor &exec)\r
-        {\r
-        StackItem item1 = exec.pop();\r
-        StackItem item2 = exec.pop();\r
-        item1.ival = (item1.dval == item2.dval);\r
-        exec.push(item1);\r
-        return true;\r
-        }\r
-};\r
-\r
-class TokNotEquals : public Token\r
-{\r
-public:\r
-    TokNotEquals()\r
-        {\r
-        type = TOK_NOT_EQUALS;\r
-        }\r
-    virtual bool execute(TokenExecutor &exec)\r
-        {\r
-        StackItem item1 = exec.pop();\r
-        StackItem item2 = exec.pop();\r
-        item1.ival = (item1.dval != item2.dval);\r
-        exec.push(item1);\r
-        return true;\r
-        }\r
-};\r
-\r
-class TokLessThanEquals : public Token\r
-{\r
-public:\r
-    TokLessThanEquals()\r
-        {\r
-        type = TOK_LESS_THAN_EQUALS;\r
-        }\r
-    virtual bool execute(TokenExecutor &exec)\r
-        {\r
-        StackItem item1 = exec.pop();\r
-        StackItem item2 = exec.pop();\r
-        item1.ival = (item1.dval <= item2.dval);\r
-        exec.push(item1);\r
-        return true;\r
-        }\r
-};\r
-\r
-class TokLessThan : public Token\r
-{\r
-public:\r
-    TokLessThan()\r
-        {\r
-        type = TOK_LESS_THAN;\r
-        }\r
-    virtual bool execute(TokenExecutor &exec)\r
-        {\r
-        StackItem item1 = exec.pop();\r
-        StackItem item2 = exec.pop();\r
-        item1.ival = (item1.dval < item2.dval);\r
-        exec.push(item1);\r
-        return true;\r
-        }\r
-};\r
-\r
-class TokGreaterThanEquals : public Token\r
-{\r
-public:\r
-    TokGreaterThanEquals()\r
-        {\r
-        type = TOK_GREATER_THAN_EQUALS;\r
-        }\r
-    virtual bool execute(TokenExecutor &exec)\r
-        {\r
-        StackItem item1 = exec.pop();\r
-        StackItem item2 = exec.pop();\r
-        item1.ival = (item1.dval >= item2.dval);\r
-        exec.push(item1);\r
-        return true;\r
-        }\r
-};\r
-\r
-class TokGreaterThan : public Token\r
-{\r
-public:\r
-    TokGreaterThan()\r
-        {\r
-        type = TOK_GREATER_THAN;\r
-        }\r
-    virtual bool execute(TokenExecutor &exec)\r
-        {\r
-        StackItem item1 = exec.pop();\r
-        StackItem item2 = exec.pop();\r
-        item1.ival = (item1.dval > item2.dval);\r
-        exec.push(item1);\r
-        return true;\r
-        }\r
-};\r
-\r
-\r
-//###########################\r
-//# X P A T H    I T E M S\r
-//###########################\r
-\r
-class TokAbsolute : public Token\r
-{\r
-public:\r
-    TokAbsolute()\r
-        {\r
-        type = TOK_ABSOLUTE;\r
-        }\r
-    virtual bool execute(TokenExecutor &exec)\r
-        {\r
-        Node *n = exec.axis.getNode();\r
-        while (n->getParentNode())\r
-             n = n->getParentNode();\r
-        exec.axis.setNode(n);\r
-        return true;\r
-        }\r
-};\r
-\r
-class TokRelative : public Token\r
-{\r
-public:\r
-    TokRelative()\r
-        {\r
-        type = TOK_RELATIVE;\r
-        }\r
-    virtual bool execute(TokenExecutor &exec)\r
-        {\r
-        ///exec.axis.currentNode = stack.rootNode;\r
-        return true;\r
-        }\r
-};\r
-\r
-class TokStep : public Token\r
-{\r
-public:\r
-    TokStep()\r
-        {\r
-        type = TOK_STEP;\r
-        }\r
-    virtual bool execute(TokenExecutor &exec)\r
-        {\r
-        return true;\r
-        }\r
-};\r
-\r
-class TokNameTest : public Token\r
-{\r
-public:\r
-    TokNameTest(const DOMString &name)\r
-        {\r
-        type  = TOK_NAME_TEST;\r
-        sval  = name;\r
-        }\r
-    virtual bool execute(TokenExecutor &exec)\r
-        {\r
-        return true;\r
-        }\r
-};\r
-\r
-class TokExpr : public Token\r
-{\r
-public:\r
-    TokExpr()\r
-        {\r
-        type = TOK_EXPR;\r
-        }\r
-    virtual bool execute(TokenExecutor &exec)\r
-        {\r
-        return true;\r
-        }\r
-};\r
-\r
-class TokUnion : public Token\r
-{\r
-public:\r
-    TokUnion()\r
-        {\r
-        type = TOK_UNION;\r
-        }\r
-    virtual bool execute(TokenExecutor &exec)\r
-        {\r
-        return true;\r
-        }\r
-};\r
-\r
-\r
-\r
-\r
-//###########################\r
-//# A X I S\r
-//###########################\r
-\r
-\r
-class TokAxisAncestorOrSelf : public Token\r
-{\r
-public:\r
-    TokAxisAncestorOrSelf()\r
-        {\r
-        type = TOK_AXIS_ANCESTOR_OR_SELF;\r
-        }\r
-    virtual bool execute(TokenExecutor &exec)\r
-        {\r
-        return true;\r
-        }\r
-};\r
-\r
-class TokAxisAncestor : public Token\r
-{\r
-public:\r
-    TokAxisAncestor()\r
-        {\r
-        type = TOK_AXIS_ANCESTOR;\r
-        }\r
-    virtual bool execute(TokenExecutor &exec)\r
-        {\r
-        return true;\r
-        }\r
-};\r
-\r
-class TokAxisAttribute : public Token\r
-{\r
-public:\r
-    TokAxisAttribute()\r
-        {\r
-        type = TOK_AXIS_ATTRIBUTE;\r
-        }\r
-    virtual bool execute(TokenExecutor &exec)\r
-        {\r
-        return true;\r
-        }\r
-};\r
-\r
-class TokAxisChild : public Token\r
-{\r
-public:\r
-    TokAxisChild()\r
-        {\r
-        type = TOK_AXIS_CHILD;\r
-        }\r
-    virtual bool execute(TokenExecutor &exec)\r
-        {\r
-        return true;\r
-        }\r
-};\r
-\r
-class TokAxisDescendantOrSelf : public Token\r
-{\r
-public:\r
-    TokAxisDescendantOrSelf()\r
-        {\r
-        type = TOK_AXIS_DESCENDANT_OR_SELF;\r
-        }\r
-    virtual bool execute(TokenExecutor &exec)\r
-        {\r
-        return true;\r
-        }\r
-};\r
-\r
-class TokAxisDescendant : public Token\r
-{\r
-public:\r
-    TokAxisDescendant()\r
-        {\r
-        type = TOK_AXIS_DESCENDANT;\r
-        }\r
-    virtual bool execute(TokenExecutor &exec)\r
-        {\r
-        return true;\r
-        }\r
-};\r
-\r
-class TokAxisFollowingSibling : public Token\r
-{\r
-public:\r
-    TokAxisFollowingSibling()\r
-        {\r
-        type = TOK_AXIS_FOLLOWING_SIBLING;\r
-        }\r
-    virtual bool execute(TokenExecutor &exec)\r
-        {\r
-        return true;\r
-        }\r
-};\r
-\r
-class TokAxisFollowing : public Token\r
-{\r
-public:\r
-    TokAxisFollowing()\r
-        {\r
-        type = TOK_AXIS_FOLLOWING;\r
-        }\r
-    virtual bool execute(TokenExecutor &exec)\r
-        {\r
-        return true;\r
-        }\r
-};\r
-\r
-class TokAxisNamespace : public Token\r
-{\r
-public:\r
-    TokAxisNamespace()\r
-        {\r
-        type = TOK_AXIS_NAMESPACE;\r
-        }\r
-    virtual bool execute(TokenExecutor &exec)\r
-        {\r
-        return true;\r
-        }\r
-};\r
-\r
-class TokAxisParent : public Token\r
-{\r
-public:\r
-    TokAxisParent()\r
-        {\r
-        type = TOK_AXIS_PARENT;\r
-        }\r
-    virtual bool execute(TokenExecutor &exec)\r
-        {\r
-        return true;\r
-        }\r
-};\r
-\r
-class TokAxisPrecedingSibling : public Token\r
-{\r
-public:\r
-    TokAxisPrecedingSibling()\r
-        {\r
-        type = TOK_AXIS_PRECEDING_SIBLING;\r
-        }\r
-    virtual bool execute(TokenExecutor &exec)\r
-        {\r
-        return true;\r
-        }\r
-};\r
-\r
-class TokAxisPreceding : public Token\r
-{\r
-public:\r
-    TokAxisPreceding()\r
-        {\r
-        type = TOK_AXIS_PRECEDING;\r
-        }\r
-    virtual bool execute(TokenExecutor &exec)\r
-        {\r
-        return true;\r
-        }\r
-};\r
-\r
-class TokAxisSelf : public Token\r
-{\r
-public:\r
-    TokAxisSelf()\r
-        {\r
-        type = TOK_AXIS_SELF;\r
-        }\r
-    virtual bool execute(TokenExecutor &exec)\r
-        {\r
-        return true;\r
-        }\r
-};\r
-\r
-\r
-\r
-//###########################\r
-//# F U N C T I O N S\r
-//###########################\r
-\r
-class TokFuncLast : public Token\r
-{\r
-public:\r
-    TokFuncLast()\r
-        {\r
-        type = TOK_FUNC_LAST;\r
-        }\r
-    virtual bool execute(TokenExecutor &exec)\r
-        {\r
-        return true;\r
-        }\r
-};\r
-\r
-class TokFuncPosition : public Token\r
-{\r
-public:\r
-    TokFuncPosition()\r
-        {\r
-        type = TOK_FUNC_POSITION;\r
-        }\r
-    virtual bool execute(TokenExecutor &exec)\r
-        {\r
-        return true;\r
-        }\r
-};\r
-\r
-class TokFuncCount : public Token\r
-{\r
-public:\r
-    TokFuncCount()\r
-        {\r
-        type = TOK_FUNC_COUNT;\r
-        }\r
-    virtual bool execute(TokenExecutor &exec)\r
-        {\r
-        return true;\r
-        }\r
-};\r
-\r
-class TokFuncId : public Token\r
-{\r
-public:\r
-    TokFuncId()\r
-        {\r
-        type = TOK_FUNC_ID;\r
-        }\r
-    virtual bool execute(TokenExecutor &exec)\r
-        {\r
-        return true;\r
-        }\r
-};\r
-\r
-class TokFuncLocalName : public Token\r
-{\r
-public:\r
-    TokFuncLocalName()\r
-        {\r
-        type = TOK_FUNC_LOCAL_NAME;\r
-        }\r
-    virtual bool execute(TokenExecutor &exec)\r
-        {\r
-        return true;\r
-        }\r
-};\r
-\r
-class TokFuncNamespaceUri : public Token\r
-{\r
-public:\r
-    TokFuncNamespaceUri()\r
-        {\r
-        type = TOK_FUNC_NAMESPACE_URI;\r
-        }\r
-    virtual bool execute(TokenExecutor &exec)\r
-        {\r
-        return true;\r
-        }\r
-};\r
-\r
-class TokFuncName : public Token\r
-{\r
-public:\r
-    TokFuncName()\r
-        {\r
-        type = TOK_FUNC_NAME;\r
-        }\r
-    virtual bool execute(TokenExecutor &exec)\r
-        {\r
-        return true;\r
-        }\r
-};\r
-\r
-class TokFuncString : public Token\r
-{\r
-public:\r
-    TokFuncString()\r
-        {\r
-        type = TOK_FUNC_STRING;\r
-        }\r
-    virtual bool execute(TokenExecutor &exec)\r
-        {\r
-        return true;\r
-        }\r
-};\r
-\r
-class TokFuncConcat : public Token\r
-{\r
-public:\r
-    TokFuncConcat()\r
-        {\r
-        type = TOK_FUNC_CONCAT;\r
-        }\r
-    virtual bool execute(TokenExecutor &exec)\r
-        {\r
-        return true;\r
-        }\r
-};\r
-\r
-class TokFuncStartsWith : public Token\r
-{\r
-public:\r
-    TokFuncStartsWith()\r
-        {\r
-        type = TOK_FUNC_STARTS_WITH;\r
-        }\r
-    virtual bool execute(TokenExecutor &exec)\r
-        {\r
-        return true;\r
-        }\r
-};\r
-\r
-class TokFuncContains : public Token\r
-{\r
-public:\r
-    TokFuncContains()\r
-        {\r
-        type = TOK_FUNC_CONTAINS;\r
-        }\r
-    virtual bool execute(TokenExecutor &exec)\r
-        {\r
-        return true;\r
-        }\r
-};\r
-\r
-class TokFuncSubstringBefore : public Token\r
-{\r
-public:\r
-    TokFuncSubstringBefore()\r
-        {\r
-        type = TOK_FUNC_SUBSTRING_BEFORE;\r
-        }\r
-    virtual bool execute(TokenExecutor &exec)\r
-        {\r
-        return true;\r
-        }\r
-};\r
-\r
-class TokFuncSubstringAfter : public Token\r
-{\r
-public:\r
-    TokFuncSubstringAfter()\r
-        {\r
-        type = TOK_FUNC_SUBSTRING_AFTER;\r
-        }\r
-    virtual bool execute(TokenExecutor &exec)\r
-        {\r
-        return true;\r
-        }\r
-};\r
-\r
-class TokFuncSubstring : public Token\r
-{\r
-public:\r
-    TokFuncSubstring()\r
-        {\r
-        type = TOK_FUNC_SUBSTRING;\r
-        }\r
-    virtual bool execute(TokenExecutor &exec)\r
-        {\r
-        return true;\r
-        }\r
-};\r
-\r
-class TokFuncStringLength : public Token\r
-{\r
-public:\r
-    TokFuncStringLength()\r
-        {\r
-        type = TOK_FUNC_STRING_LENGTH;\r
-        }\r
-    virtual bool execute(TokenExecutor &exec)\r
-        {\r
-        return true;\r
-        }\r
-};\r
-\r
-class TokFuncNormalizeSpace : public Token\r
-{\r
-public:\r
-    TokFuncNormalizeSpace()\r
-        {\r
-        type = TOK_FUNC_NORMALIZE_SPACE;\r
-        }\r
-    virtual bool execute(TokenExecutor &exec)\r
-        {\r
-        return true;\r
-        }\r
-};\r
-\r
-class TokFuncTranslate : public Token\r
-{\r
-public:\r
-    TokFuncTranslate()\r
-        {\r
-        type = TOK_FUNC_TRANSLATE;\r
-        }\r
-    virtual bool execute(TokenExecutor &exec)\r
-        {\r
-        return true;\r
-        }\r
-};\r
-\r
-class TokFuncBoolean : public Token\r
-{\r
-public:\r
-    TokFuncBoolean()\r
-        {\r
-        type = TOK_FUNC_BOOLEAN;\r
-        }\r
-    virtual bool execute(TokenExecutor &exec)\r
-        {\r
-        return true;\r
-        }\r
-};\r
-\r
-class TokFuncNot : public Token\r
-{\r
-public:\r
-    TokFuncNot()\r
-        {\r
-        type = TOK_FUNC_NOT;\r
-        }\r
-    virtual bool execute(TokenExecutor &exec)\r
-        {\r
-        return true;\r
-        }\r
-};\r
-\r
-class TokFuncTrue : public Token\r
-{\r
-public:\r
-    TokFuncTrue()\r
-        {\r
-        type = TOK_FUNC_TRUE;\r
-        }\r
-    virtual bool execute(TokenExecutor &exec)\r
-        {\r
-        return true;\r
-        }\r
-};\r
-\r
-class TokFuncFalse : public Token\r
-{\r
-public:\r
-    TokFuncFalse()\r
-        {\r
-        type = TOK_FUNC_FALSE;\r
-        }\r
-    virtual bool execute(TokenExecutor &exec)\r
-        {\r
-        return true;\r
-        }\r
-};\r
-\r
-class TokFuncLang : public Token\r
-{\r
-public:\r
-    TokFuncLang()\r
-        {\r
-        type = TOK_FUNC_LANG;\r
-        }\r
-    virtual bool execute(TokenExecutor &exec)\r
-        {\r
-        return true;\r
-        }\r
-};\r
-\r
-class TokFuncNumber : public Token\r
-{\r
-public:\r
-    TokFuncNumber()\r
-        {\r
-        type = TOK_FUNC_NUMBER;\r
-        }\r
-    virtual bool execute(TokenExecutor &exec)\r
-        {\r
-        return true;\r
-        }\r
-};\r
-\r
-class TokFuncSum : public Token\r
-{\r
-public:\r
-    TokFuncSum()\r
-        {\r
-        type = TOK_FUNC_SUM;\r
-        }\r
-    virtual bool execute(TokenExecutor &exec)\r
-        {\r
-        return true;\r
-        }\r
-};\r
-\r
-class TokFuncFloor : public Token\r
-{\r
-public:\r
-    TokFuncFloor()\r
-        {\r
-        type = TOK_FUNC_FLOOR;\r
-        }\r
-    virtual bool execute(TokenExecutor &exec)\r
-        {\r
-        return true;\r
-        }\r
-};\r
-\r
-class TokFuncCeiling : public Token\r
-{\r
-public:\r
-    TokFuncCeiling()\r
-        {\r
-        type = TOK_FUNC_CEILING;\r
-        }\r
-    virtual bool execute(TokenExecutor &exec)\r
-        {\r
-        return true;\r
-        }\r
-};\r
-\r
-class TokFuncRound : public Token\r
-{\r
-public:\r
-    TokFuncRound()\r
-        {\r
-        type = TOK_FUNC_ROUND;\r
-        }\r
-    virtual bool execute(TokenExecutor &exec)\r
-        {\r
-        return true;\r
-        }\r
-};\r
-\r
-\r
-\r
-\r
-\r
-\r
-//########################################################################\r
-//# T O K E N    L I S T\r
-//########################################################################\r
-\r
-/**\r
- *\r
- */\r
-class TokenList\r
-{\r
-public:\r
-\r
-    /**\r
-     *\r
-     */\r
-    TokenList();\r
-\r
-    /**\r
-     *\r
-     */\r
-    TokenList(const TokenList &other);\r
-\r
-    /**\r
-     *\r
-     */\r
-    TokenList &operator=(const TokenList &other);\r
-\r
-    /**\r
-     *\r
-     */\r
-    void assign(const TokenList &other);\r
-\r
-    /**\r
-     *\r
-     */\r
-    virtual ~TokenList();\r
-\r
-    /**\r
-     *\r
-     */\r
-    virtual void clear();\r
-\r
-    /**\r
-     *\r
-     */\r
-    virtual void add(Token *tok);\r
-\r
-    /**\r
-     *\r
-     */\r
-    virtual unsigned int size() const;\r
-\r
-    /**\r
-     *\r
-     */\r
-    virtual void dump();\r
-\r
-private:\r
-\r
-\r
-    std::vector<Token *> tokens;\r
-\r
-\r
-};\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-} // namespace xpath\r
-} // namespace dom\r
-} // namespace w3c\r
-} // namespace org\r
-\r
-\r
-\r
-\r
-\r
-\r
-#endif  /* __XPATHTOKEN_H__ */\r
-//########################################################################\r
-//# E N D    O F    F I L E\r
-//########################################################################\r
-\r
+#ifndef __XPATHTOKEN_H__
+#define __XPATHTOKEN_H__
+
+/**
+ * Phoebe DOM Implementation.
+ *
+ * This is a C++ approximation of the W3C DOM model, which follows
+ * fairly closely the specifications in the various .idl files, copies of
+ * which are provided for reference.  Most important is this one:
+ *
+ * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/idl-definitions.html
+ *
+ * Authors:
+ *   Bob Jamison
+ *
+ * Copyright (C) 2006 Bob Jamison
+ *
+ *  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.1 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 St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+
+#include "dom.h"
+
+#include <math.h>
+
+#include <cstdio>
+#include <vector>
+
+namespace org
+{
+namespace w3c
+{
+namespace dom
+{
+namespace xpath
+{
+
+typedef org::w3c::dom::DOMString DOMString;
+
+
+class TokenExecutor;
+
+
+//########################################################################
+//# S T A C K    I T E M
+//########################################################################
+
+
+/**
+ * This represents a single value on the evaluation stack
+ */
+class StackItem
+{
+public:
+
+    /**
+     *  Constructor
+     */
+    StackItem()
+        { init(); }
+
+    /**
+     *  Copy constructor
+     */
+    StackItem(const StackItem &other)
+        { assign(other); }
+
+    /**
+     *  Destructor
+     */
+    virtual ~StackItem()
+        {}
+
+    /**
+     *
+     */
+    StackItem &operator=(const StackItem &other)
+        { assign(other); return *this; }
+
+    //treat the stack item like an union of string, integer, and double
+
+    /**
+     * String value
+     */
+    DOMString sval;
+
+    /**
+     * Integer value
+     */
+    long      ival;
+
+    /**
+     * Double value;
+     */
+    double    dval;
+
+
+private:
+
+    void init()
+        {
+        sval = "";
+        ival = 0;
+        dval = 0.0;
+        }
+
+    void assign(const StackItem &other)
+        {
+        sval = other.sval; 
+        ival = other.ival;
+        dval = other.dval;
+        }
+
+};
+
+
+
+//########################################################################
+//# X P A T H    T O K E N
+//########################################################################
+
+class Token;
+class Stack;
+
+typedef bool (*TokenFunc)(Token &tok, Stack &stack);
+
+
+/**
+ *  This is a pseudocode-type class that executes itself on a stack,
+ *  much like stack-oriented languages such as FORTH or Postscript.
+ *  Each token can pop zero or more tokens off the stack, and push
+ *  zero or one token back onto it.  When a list of tokens is completed,
+ *  a single stack value should be left on the stack.
+ */
+class Token
+{
+public:
+
+    /**
+     * Token types.  Look in xpathtoken.cpp's function table
+     * to see how these types map to their respective
+     * functionalities
+     */
+    typedef enum
+        {
+        //primitives
+        TOK_NOP = 0,
+        TOK_STR,
+        TOK_INT,
+        TOK_FLOAT,
+        //operators
+        TOK_AND,
+        TOK_OR,
+        TOK_MOD,
+        TOK_DIV,
+        TOK_MUL,
+        TOK_DOUBLE_SLASH,
+        TOK_SLASH,
+        TOK_PIPE,
+        TOK_PLUS,
+        TOK_MINUS,
+        TOK_NEG,
+        TOK_EQUALS,
+        TOK_NOT_EQUALS,
+        TOK_LESS_THAN_EQUALS,
+        TOK_LESS_THAN,
+        TOK_GREATER_THAN_EQUALS,
+        TOK_GREATER_THAN,
+        //path types
+        TOK_ABSOLUTE,
+        TOK_RELATIVE,
+        TOK_STEP,
+        TOK_NAME_TEST,
+        TOK_EXPR,
+        TOK_UNION,
+        //axis types
+        TOK_AXIS_ANCESTOR_OR_SELF,
+        TOK_AXIS_ANCESTOR,
+        TOK_AXIS_ATTRIBUTE,
+        TOK_AXIS_CHILD,
+        TOK_AXIS_DESCENDANT_OR_SELF,
+        TOK_AXIS_DESCENDANT,
+        TOK_AXIS_FOLLOWING_SIBLING,
+        TOK_AXIS_FOLLOWING,
+        TOK_AXIS_NAMESPACE,
+        TOK_AXIS_PARENT,
+        TOK_AXIS_PRECEDING_SIBLING,
+        TOK_AXIS_PRECEDING,
+        TOK_AXIS_SELF,
+        //function types
+        TOK_FUNC_LAST,
+        TOK_FUNC_POSITION,
+        TOK_FUNC_COUNT,
+        TOK_FUNC_ID,
+        TOK_FUNC_LOCAL_NAME,
+        TOK_FUNC_NAMESPACE_URI,
+        TOK_FUNC_NAME,
+        TOK_FUNC_STRING,
+        TOK_FUNC_CONCAT,
+        TOK_FUNC_STARTS_WITH,
+        TOK_FUNC_CONTAINS,
+        TOK_FUNC_SUBSTRING_BEFORE,
+        TOK_FUNC_SUBSTRING_AFTER,
+        TOK_FUNC_SUBSTRING,
+        TOK_FUNC_STRING_LENGTH,
+        TOK_FUNC_NORMALIZE_SPACE,
+        TOK_FUNC_TRANSLATE,
+        TOK_FUNC_BOOLEAN,
+        TOK_FUNC_NOT,
+        TOK_FUNC_TRUE,
+        TOK_FUNC_FALSE,
+        TOK_FUNC_LANG,
+        TOK_FUNC_NUMBER,
+        TOK_FUNC_SUM,
+        TOK_FUNC_FLOOR,
+        TOK_FUNC_CEILING,
+        TOK_FUNC_ROUND,
+        } TokenType;
+
+
+
+
+    /**
+     *  Constructor with a NOP default type
+     */
+    Token()
+        { init(); }
+
+    /**
+     *  Constructor with a NOP default type
+     */
+    Token(int typeArg)
+        { init(); type = typeArg; }
+
+    /**
+     *  Constructor with a NOP default type
+     */
+    Token(int typeArg, 
+          long ivalArg, double dvalArg, const DOMString &svalArg)
+        { 
+        init();
+        type = typeArg,
+        ival = ivalArg;
+        dval = dvalArg;
+        sval = svalArg;
+        }
+
+    /**
+     * Copy constructor
+     */
+    Token(const Token &other)
+        { assign(other); }
+
+    /**
+     * Assignment
+     */
+    Token &operator=(const Token &other)
+        { assign(other); return *this; }
+
+    /**
+     * Destructor
+     */
+    virtual ~Token()
+        {}
+
+    /**
+     *  Return the enumerated TokenType of this token
+     */
+    virtual int getType()
+        { return type; }
+
+    /**
+     *  Return true if the type is one of the Axis types
+     *  above;
+     */
+    virtual bool isAxis()
+        {
+        return type>=TOK_AXIS_ANCESTOR_OR_SELF &&
+                 type <= TOK_AXIS_SELF;
+        }
+    /**
+     *  Return the string TokenType of this token
+     */
+    virtual DOMString getTypeString();
+
+    /**
+     *  Let this token execute itself on the given stack,
+     *  possibly adding Nodes to the node list.
+     */
+    virtual bool execute(Stack &stack)
+        {
+        if (tokenFunc)
+            return tokenFunc(*this, stack);
+        return false;
+        }
+
+    /**
+     *  Print the contents of this token
+     */
+    virtual void dump()
+        {
+        printf("%s %s %f %ld\n",
+            getTypeString().c_str(), sval.c_str(), dval, ival);
+        }
+
+    //treat the token like an union of string, integer, and double
+
+    /**
+     * String value
+     */
+    DOMString sval;
+
+    /**
+     * Integer value
+     */
+    long ival;
+
+    /**
+     * Double value;
+     */
+    double dval;
+
+    /**
+     *
+     */
+    static Token create(int type, long ival,
+              double dval, const DOMString &sval);
+
+    /**
+     *
+     */
+    static Token create(int type)
+        { return create(type, 0, 0.0, ""); }
+
+    /**
+     *
+     */
+    static Token create(int type, long val)
+        { return create(type, val, 0.0, ""); }
+
+    /**
+     *
+     */
+    static Token create(int type, double val)
+        { return create(type, 0, val, ""); }
+
+    /**
+     *
+     */
+    static Token create(int type, const DOMString &val)
+        { return create(type, 0, 0.0, val); }
+
+
+
+protected:
+
+    /**
+     * The enmerated token type
+     */
+    int type;
+
+    /**
+     * The function that defines the behaviour of this token
+     */
+    TokenFunc tokenFunc;
+
+
+private:
+
+    void init()
+        {
+        tokenFunc = NULL;
+        type      = TOK_NOP;
+        ival      = 0L;
+        dval      = 0.0;
+        //sval      = ""; //not necessary
+        }
+
+    void assign(const Token &other)
+        {
+        tokenFunc = other.tokenFunc;
+        type      = other.type;
+        sval      = other.sval;
+        ival      = other.ival;
+        dval      = other.dval;
+        }
+
+
+};
+
+
+//########################################################################
+//# S T A C K
+//########################################################################
+
+/**
+ *
+ */
+class Stack
+{
+public:
+
+    //# From 2.3, principal type of child axes
+    typedef enum
+        {
+        AXIS_ATTRIBUTE,
+        AXIS_NAMESPACE,
+        AXIS_ELEMENT
+        } PrincipalNodeType;
+
+    /**
+     *  Constructor
+     */
+    Stack(TokenExecutor &par) : parent(par)
+        { clear(); }
+
+    /**
+     *  Copy constructor
+     */
+    Stack(const Stack &other) : parent(other.parent)
+        { assign(other); }
+
+    /**
+     *  Destructor
+     */
+    virtual ~Stack()
+        {}
+
+    /**
+     *
+     */
+    Stack &operator=(const Stack &other)
+        { assign(other); return *this; }
+
+    /**
+     *
+     */
+    void push(StackItem &item)
+        { return stackItems.push_back(item); }
+
+    /**
+     *
+     */
+    StackItem pop()
+        {
+        if (stackItems.size() < 1)
+            {
+            //TODO: error here
+            StackItem item;
+            return item;
+            }
+        std::vector<StackItem>::iterator iter =
+                   stackItems.end() - 1;
+        StackItem item = *iter;
+        stackItems.erase(iter);
+        return item;
+        }
+
+    /**
+     *
+     */
+    virtual void clear()
+        {
+        stackItems.clear();
+        principalNodeType = AXIS_ELEMENT;
+        }
+
+private:
+
+    void assign(const Stack &other)
+        {
+        principalNodeType = other.principalNodeType;
+        stackItems        = other.stackItems;
+        }
+
+    int principalNodeType;
+
+    std::vector<StackItem> stackItems;
+
+    TokenExecutor &parent;
+
+};
+
+
+
+
+//########################################################################
+//# T O K E N    L I S T
+//########################################################################
+
+/**
+ *
+ */
+class TokenList
+{
+public:
+
+    /**
+     *
+     */
+    TokenList()
+        { init(); }
+
+    /**
+     *
+     */
+    TokenList(const TokenList &other)
+        { assign(other); }
+
+    /**
+     *
+     */
+    TokenList &operator=(const TokenList &other)
+        { assign(other); return *this; }
+
+    /**
+     *
+     */
+    virtual ~TokenList()
+        { }
+
+
+    /**
+     *
+     */
+    virtual void add(const Token &token)
+        { tokens.push_back(token); }
+
+    /**
+     *
+     */
+    virtual std::vector<Token> &getTokens()
+        { return tokens; }
+
+    /**
+     *
+     */
+    virtual void dump()
+        {
+        for (unsigned int i=0 ; i<tokens.size() ; i++)
+            {
+            Token token = tokens[i];
+            token.dump();
+            }
+        }
+
+    /**
+     *
+     */
+    virtual void clear()
+       {
+       tokens.clear();
+       }
+
+private:
+
+
+    void init()
+        {
+        clear();
+        }
+
+    void assign(const TokenList &other)
+        {
+        tokens = other.tokens;
+        }
+
+    std::vector<Token> tokens;
+
+
+};
+
+
+
+
+//########################################################################
+//# T O K E N    E X E C U T O R
+//########################################################################
+
+
+/**
+ * A token evaluator, with stack and axis context
+ */
+class TokenExecutor
+{
+public:
+
+    /**
+     * Constructor
+     */
+    TokenExecutor();
+
+    /**
+     * Copy constructor
+     */
+    TokenExecutor(const TokenExecutor &other);
+
+    /**
+     * Destructor
+     */
+    virtual ~TokenExecutor();
+
+    /**
+     *  Assign our values to those of the other
+     */
+    virtual void assign(const TokenExecutor &other);
+
+    /**
+     * Reset the stack to its original settings
+     */
+    virtual void reset();
+
+    /**
+     * Execute a list upon a given node.  For each Axis encountered,
+     * get the nodes encountered so far, and execute the rest of the
+     * list of tokens upon each of the nodes.
+     */
+    int execute(std::vector<Token> &tokens,
+                int position,
+                const NodePtr node,
+                NodeList &nodeList);
+
+    /**
+     * Execute a token list on the stack
+     */
+    bool execute(TokenList &list,
+                 const NodePtr node,
+                 NodeList &result);
+
+private:
+
+    /**
+     *
+     */
+    TokenList tokenList;
+
+    /**
+     *
+     */
+    NodeList nodeList;
+
+
+};
+
+
+
+
+} // namespace xpath
+} // namespace dom
+} // namespace w3c
+} // namespace org
+
+
+
+
+
+
+#endif  /* __XPATHTOKEN_H__ */
+//########################################################################
+//# E N D    O F    F I L E
+//########################################################################
+