ppfsm.h revision 3f54fd611f536639ec30dd53c48e5ec1897cc7d9
/***********************************************************************
* *
* This software is part of the ast package *
* Copyright (c) 1986-2011 AT&T Intellectual Property *
* and is licensed under the *
* Eclipse Public License, Version 1.0 *
* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
* *
* Information and Software Systems Research *
* AT&T Research *
* Florham Park NJ *
* *
* Glenn Fowler <gsf@research.att.com> *
* *
***********************************************************************/
#pragma prototyped
/*
* Glenn Fowler
* AT&T Research
*
* preprocessor lexical analyzer definitions
*/
#ifndef _PPFSM_H
#define _PPFSM_H
#define MAX 255
#define EOB 0
/*
* FSM states
*
* NOTE: preserve the ranges
*/
/*
* proto non-terminal states
*/
#define PROTO 0
#if PROTOMAIN
#else
/*
* quick non-terminal states
*/
/*
* tokenize non-terminal states
*/
#endif
/*
* quick terminal states grouped together
*/
/*
* and the remaining terminal states
*/
#define S_RESERVED (S_HUH)
/*
* the last terminal state (for tracing)
*/
/*
* pseudo terminal states
*/
#define S_EOF (0)
/*
* common lex macros
*
* NOTE: common local variable names assumed
*/
do \
{ \
} while (0)
do \
{ \
{ \
} \
if ((pp.in->flags & IN_flush) && pp.level == 1 && !INMACRO(rp) && (!pp.comment || !INCOMMENT(rp)) && (c = op - pp.outbuf) > 0 && *(op - 1) == '\n') \
{ \
PPWRITE(c); \
} \
SYNCIN(); \
refill(p); \
CACHEIN(); \
} while (0)
#define POP() \
do \
{ \
debug((-7, "POP in=%s next=%s state=%s", ppinstr(cur), pptokchr(*prv->nextchr), pplexstr(INDEX(rp)))); \
} while (0)
/*
* fsm implementaion globals
*/
#define fsm _pp_fsmtab
#define refill _pp_refill
#define trigraph _pp_trigraph
/*
* first index is state, second is char, value is next state
* except for fsm[TERMINAL] where second is state+1 for EOF transition
*/
/*
* the index is char, value is trigraph value for <?><?><char>, 0 if invalid
*/
extern void refill(int);
#endif