/* dlgauto.h automaton
*
* SOFTWARE RIGHTS
*
* We reserve no LEGAL rights to the Purdue Compiler Construction Tool
* Set (PCCTS) -- PCCTS is in the public domain. An individual or
* company may do whatever they wish with source code distributed with
* PCCTS or the code generated by PCCTS, including the incorporation of
* PCCTS, or its output, into commerical software.
*
* We encourage users to develop software with PCCTS. However, we do ask
* that credit is given to us for developing PCCTS. By "credit",
* we mean that if you incorporate our source code into one of your
* programs (commercial product, research project, or otherwise) that you
* acknowledge this fact somewhere in the documentation, research report,
* etc... If you like PCCTS and have developed a nice tool with the
* output, please mention that you developed it using PCCTS. In
* addition, we ask that this header remain intact in our source code.
* As long as these guidelines are kept, we expect to continue enhancing
* this system and expect to make other tools available as they are
* completed.
*
* ANTLR 1.33
* Will Cohen and Terence Parr
* Parr Research Corporation
* with Purdue University and AHPCRC, University of Minnesota
* 1989-2000
*/
#ifndef ZZDEFAUTO_H
#define ZZDEFAUTO_H
/* 10-Apr-97 133MR1 Uses __USE_PROTOS show should #include pcctscfg.h */
#include "pcctscfg.h"
int zzcharfull = 0;
static int zzclass;
#ifdef __USE_PROTOS
void zzerrstd(const char *);
extern int zzerr_in(void);
#else
void zzerrstd();
extern int zzerr_in();
#endif
#ifdef USER_ZZMODE_STACK
int zzauto = 0;
#else
static int zzauto = 0;
#endif
static int zzadd_erase;
#ifdef ZZCOL
#else
#define ZZINC
#endif
#define ZZGETC_STR { \
if (*zzstr_in){ \
++zzstr_in; \
}else{ \
} \
}
#ifndef ZZCOPY
#define ZZCOPY \
/* Truncate matching buffer to size (not an error) */ \
}else{ \
zzbufovf = 1; \
}
#endif
void
#ifdef __USE_PROTOS
#else
zzrdstream( f )
FILE *f;
#endif
{
/* make sure that it is really set to something, otherwise just
leave it be.
*/
if (f){
/* make sure that there is always someplace to get input
before closing zzstream_in
*/
#if 0
#endif
zzline = 1;
zzstream_in = f;
zzstr_in = 0;
zzcharfull = 0;
}
}
void
#ifdef __USE_PROTOS
zzrdfunc( int (*f)(void) )
#else
zzrdfunc( f )
int (*f)();
#endif
{
/* make sure that it is really set to something, otherwise just
leave it be.
*/
if (f){
/* make sure that there is always someplace to get input
before closing zzstream_in
*/
#if 0
#endif
zzline = 1;
zzstream_in = NULL;
zzfunc_in = f;
zzstr_in = 0;
zzcharfull = 0;
}
}
void
#ifdef __USE_PROTOS
#else
zzrdstr( s )
zzchar_t *s;
#endif
{
/* make sure that it is really set to something, otherwise just
leave it be.
*/
if (s){
/* make sure that there is always someplace to get input
before closing zzstream_in
*/
#if 0
#endif
zzline = 1;
zzstream_in = NULL;
zzfunc_in = 0;
zzstr_in = s;
zzcharfull = 0;
}
}
#ifdef __USE_PROTOS
void zzclose_stream(void)
#else
void zzclose_stream()
#endif
{
#if 0
fclose( zzstream_in );
zzstream_in = NULL;
#endif
}
/* saves dlg state, but not what feeds dlg (such as file position) */
void
#ifdef __USE_PROTOS
#else
struct zzdlg_state *state;
#endif
{
}
void
#ifdef __USE_PROTOS
#else
struct zzdlg_state *state;
#endif
{
}
void
#ifdef __USE_PROTOS
zzmode( int m )
#else
zzmode( m )
int m;
#endif
{
/* points to base of dfa table */
if (m<MAX_MODE){
zzauto = m;
/* have to redo class since using different compression */
}else{
}
}
/* erase what is currently in the buffer, and get a new reg. expr */
#ifdef __USE_PROTOS
void zzskip(void)
#else
void zzskip()
#endif
{
zzadd_erase = 1;
}
/* don't erase what is in the zzlextext buffer, add on to it */
#ifdef __USE_PROTOS
void zzmore()
#else
void zzmore()
#endif
{
zzadd_erase = 2;
}
/* substitute c for the reg. expr last matched and is in the buffer */
#ifdef __USE_PROTOS
void
#else
void
zzreplchar(c)
zzchar_t c;
#endif
{
/* can't allow overwriting null at end of string */
*zzbegexpr = c;
}
if (c != '\0') {
}
else {
}
}
/* replace the string s for the reg. expr last matched and in the buffer */
void
#ifdef __USE_PROTOS
#else
zzreplstr(s)
register zzchar_t *s;
#endif
{
if (s){
/* empty */
}
/* correct for NULL at end of string */
zznextpos--;
}
if ((zznextpos <= l) && (*(--s) == 0)){
zzbufovf = 0;
}else{
zzbufovf = 1;
}
*(zznextpos) = '\0';
}
#ifdef __USE_PROTOS
void zzgettok(void)
#else
void zzgettok()
#endif
{
/* last space reserved for the null char */
skip:
zzbufovf = 0;
more:
#ifdef ZZINTERACTIVE
/* interactive version of automaton */
/* if there is something in zzchar, process it */
if (zzcharfull){
}
if (zzstr_in)
while (zzalternatives[newstate]){
}
else if (zzstream_in)
while (zzalternatives[newstate]){
}
else if (zzfunc_in)
while (zzalternatives[newstate]){
}
/* figure out if last character really part of token */
zzcharfull = 1;
--zznextpos;
}else{
zzcharfull = 0;
}
*(zznextpos) = '\0';
/* Able to transition out of start state to some non err state?*/
/* make sure doesn't get stuck */
zzadvance();
}
#else
/* non-interactive version of automaton */
if (!zzcharfull)
zzadvance();
else
if (zzstr_in)
while (ZZNEWSTATE != DfaStates){
}
else if (zzstream_in)
while (ZZNEWSTATE != DfaStates){
}
else if (zzfunc_in)
while (ZZNEWSTATE != DfaStates){
}
zzcharfull = 1;
}else{
zzbufovf = 1;
}
*zznextpos = '\0';
/* make sure doesn't get stuck */
zzadvance();
}else{
*zznextpos = '\0';
}
#endif
#ifdef ZZCOL
zzendcol -= zzcharfull;
#endif
zzadd_erase = 0;
switch (zzadd_erase) {
case 1: goto skip;
case 2: goto more;
}
}
#ifdef __USE_PROTOS
void zzadvance(void)
#else
void zzadvance()
#endif
{
zzerr_in();
}
}
void
#ifdef __USE_PROTOS
zzerrstd(const char *s)
#else
zzerrstd(s)
char *s;
#endif
{
zzLexErrCount++; /* MR11 */
"%s near line %d (text was '%s')\n",
((s == NULL) ? "Lexical error" : s),
}
#ifdef __USE_PROTOS
int zzerr_in(void)
#else
int zzerr_in()
#endif
{
/* return eof to get out gracefully */
return EOF;
}
#endif