File:  [Public] / Amaya / amaya / XPointer.h
Revision 1.1: download - view: text, annotated - select for diffs
Tue Sep 12 12:54:19 2000 UTC (23 years, 9 months ago) by kahan
Branches: MAIN
CVS tags: HEAD
JK: Adding missing file (sorry!)

#ifndef AMAYA_XPOINTER_H

/***************************************************
  General definitions
**************************************************/

/* the different types of nodes */
typedef enum _nodeType {
  SINGLE_NODE,     /* XPointer is a single node */
  RANGE_TO,        /* XPointer is a node set (two nodes */
  STRING_RANGE     /* XPointer node points to a string */
} nodeType;

/***************************************************
  Symbol table  (move this back to XPointerparse.c)
***************************************************/

#define STRMAX 999 /* size of lexemes array */
#define SYMMAX 100 /* size of symtable */

/* forms of symbol table entry */
struct entry { 
  char *lexptr;
  int token;
};

/* tokens */
typedef enum {
  /* type identifiers */
  NUM=256,
  ID,
  /* the xpointer functions */
  FID,            
  FRANGE_TO,
  FSTRING_RANGE,
  FSTARTP,
  FENDP,
  /* non-operators */
  DONE,
  NONE
} tokEnum;

/* the symbol table */
typedef struct _symTableCtx {
  char lexemes[STRMAX];  /* lexemes table */
  int lastchar;          /* last used position in lexemes */
  struct entry symtable[SYMMAX]; 
  int lastentry;        /* last entry in the symtable */
} symTableCtx;

typedef symTableCtx *symTableCtxPtr;

/***************************************************
  The parser context
**************************************************/

/* the node info that the parsing will return */
typedef struct _nodeInfo {
  Element  el;
  char node[10];
  nodeType type;
  int  startC;
  int  endC;
  int  index;
  int  processed;
} nodeInfo;

typedef struct _parserContext {
  Document doc; /* document where we are resolving the XPointer */
  Element root; /* root element of the document */

  char *cur;    /* the current char being parsed */
  char *buffer; /* the input string */

  char *error;    /* error code */

  int   lookahead;  /* the lookahead token */
  tokEnum tok;      /* token */
  int tokval;       /* token value */

  symTableCtxPtr symtable; /* the symbol table */
  
  nodeType   type;        /* 0, single node, 1 range-to */
  nodeInfo  *curNode;
  nodeInfo   nodeA;
  nodeInfo   nodeB;
} parserContext;

typedef parserContext *parserContextPtr;

#endif /* AMAYA_XPOINTER_H */





Webmaster