]>
git.proxmox.com Git - mirror_edk2.git/blob - EdkCompatibilityPkg/Other/Maintained/Tools/Pccts/sorcerer/h/STreeParser.h
558f6a572bb59f51284ceef0ff22d6291d001ff8
9 * We reserve no LEGAL rights to SORCERER -- SORCERER is in the public
10 * domain. An individual or company may do whatever they wish with
11 * source code distributed with SORCERER or the code generated by
12 * SORCERER, including the incorporation of SORCERER, or its output, into
13 * commerical software.
15 * We encourage users to develop software with SORCERER. However, we do
16 * ask that credit is given to us for developing SORCERER. By "credit",
17 * we mean that if you incorporate our source code into one of your
18 * programs (commercial product, research project, or otherwise) that you
19 * acknowledge this fact somewhere in the documentation, research report,
20 * etc... If you like SORCERER and have developed a nice tool with the
21 * output, please mention that you developed it using SORCERER. In
22 * addition, we ask that this header remain intact in our source code.
23 * As long as these guidelines are kept, we expect to continue enhancing
24 * this system and expect to make other tools available as they are
28 * Parr Research Corporation
29 * with Purdue University and AHPCRC, University of Minnesota
33 /* The programmer should derive a class from SORASTBase; SORASTBase defines
34 * the minimum public interface that a tree node must follow for SORCERER to
35 * be able to walk the trees.
38 /* The @-vars are added by the subclass created by SORCERER; the constructor
39 * is used to init the @-vars.
47 #define _DOWN _t=(SORASTBase *)_t->down()
48 #define _RIGHT _t=(SORASTBase *)_t->right()
50 #define _SAVE SORASTBase *_save=_t
51 #define _RESTORE _t = _save
52 #define _GUESS_BLOCK STreeParser _st; int _gv; SORASTBase *_savet=NULL;
53 #define _GUESS {save_state(&_st); \
56 _gv = setjmp(startofguess.state);}
57 #define _GUESS_FAIL longjmp(startofguess.state, 1)
58 #define _GUESS_DONE {restore_state(&_st); _t = _savet;}
59 #define _MATCH(tok) MATCH(_t,tok)
60 #define _MATCHRANGE(t1,t2) MATCHRANGE(_t,t1,t2)
61 #define _WILDCARD WILDCARD(_t)
63 #define ast_return(t) *_result = (SORASTBase *)t;
65 #define STreeTry(r,p,t) \
66 (p)->try_result = NULL; \
67 (p)->sjrv = setjmp((p)->startofguess); \
69 rule(p,t,&try_result); \
78 /* Used only during TRANSFORM mode */
79 #define TREE_CONSTR_PTRS SORASTBase *_r=NULL,*_s=NULL,*_e=NULL
81 typedef struct _Sjmp_buf
{
87 int try_ok
, sjrv
; /* used by STreeTry macro */
88 SORASTBase
*try_result
; /* tree coming back from try */
90 Sjmp_buf startofguess
;
93 void _mkroot(SORASTBase
**, SORASTBase
**, SORASTBase
**, SORASTBase
*);
94 void _mkchild(SORASTBase
**, SORASTBase
**, SORASTBase
**, SORASTBase
*);
95 virtual void mismatched_range(int looking_for
, int upper_token
, SORASTBase
*found
);
96 virtual void missing_wildcard();
97 virtual void mismatched_token(int looking_for
, SORASTBase
*found
);
98 virtual void no_viable_alt(char *rulename
, SORASTBase
*root
);
99 virtual void MATCH(SORASTBase
*_t
, int tok
);
100 virtual void MATCHRANGE(SORASTBase
*_t
, int tok
, int tok2
);
101 virtual void WILDCARD(SORASTBase
*_t
);
104 STreeParser() { guessing
= 0; }
105 virtual void panic(char *err
);
106 void save_state(STreeParser
*);
107 void restore_state(STreeParser
*);