#ifndef __PARSER_H__
#define __PARSER_H__ 1

#include "flex.h"

#include <wchar.h>

typedef int StrpoolIDX; // An index into the string pool which can be used in place of a wchar * where appropriate.

extern SPEC(CST,int);
#define _CST(x) WRITE(x,CST,int)
#define  CST(x) READ(x,CST,int)

typedef struct reconstructed {
  wint_t ch;
  int start, end; // offset into original text
  StrpoolIDX skipped, canon; // stored in Stringpool.
  // Very similar to source_descriptor.  I may merge the two later.
} reconstructed;

extern SPEC(source,reconstructed);
#define _source(x) WRITE(x,source,reconstructed)
#define  source(x) READ(x,source,reconstructed)

extern wchar_t *PHRASE(int PhraseStart);
extern wchar_t *TERM_NAME(int P);

extern int phrasenum(int PhraseStart);
extern int BIPnum(int BIPStart);

extern int TP;

#endif //  __PARSER_H__
