14 #ifndef _CEPTR_SEMTREX_H
15 #define _CEPTR_SEMTREX_H
19 enum StateType {StateSymbol,StateAny,StateValue,StateSplit,StateMatch,StateGroupOpen,StateGroupClose,StateDescend,StateWalk,StateNot};
20 typedef int StateType;
30 enum {TransitionDown=1,TransitionNone=0x8000};
31 #define isTransitionPop(t) (t<0)
32 #define isTransitionNext(t) (t==0)
34 typedef int TransitionType;
53 #define LITERAL_NOT 0x01
54 #define LITERAL_SET 0x02
100 T *_stx_get_matched_node(
Symbol s,
T *match_results,
T *match_tree,
int *sibs);
101 void _stx_replace(
T *semtrex,
T *t,
T *replace);
103 T *__t_embody_from_match(
SemTable *sem,
T *match,
T *t);
110 T *__stxcv(
T *stxx,
char c);
111 T *__stxcvm(
T *stxx,
int not,
int count,...);
122 #define _sl(t,s) __sl(t,false,1,s)
125 #define _sln(t,s) __sl(t,true,1,s)
127 T *
__sl(
T *p,
bool not,
int count, ...);
130 #define DS(l,t) {char buf[1000];puts("\n" #l ":");_dump_semtrex(G_sem,t,buf);puts(buf);}
134 void __stx_dump(
SState *s,
char *buf);
135 char * _stx_dump(
SState *s,
char *buf);
137 char G_stx_dump_buf[100000];
int _did
used to hold a mark when freeing and printing out FSA to prevent looping.
union STypeData STypeData
SemanticID symbol
the symbol that describes the group semantically
T * asciiT_toc(T *asciiT, T *match, T *t, Symbol s)
T * asciiT_tos(T *asciiT, T *match, T *t, Symbol s)
SgroupOpen groupo
Group data for matching for StateGroup type states.
Svalue value
Value data to match on for StateValue type states.
semantic trees header file
T * __sl(T *p, bool not, int count,...)
T * asciiT_tof(T *asciiT, T *match, T *t, Symbol s)
T * makeASCIITree(char *c)
StateType type_
copy of state type needed for patch to grab (far too tricky)
TransitionType transition1
will be: TransitionNextChild=0,TransitionUp=-1,TransitionDown=1
SState * _stx_makeFA(T *s, int *statesP)
int _t_match(T *semtrex, T *t)
T * _t_get_match(T *result, Symbol group)
SgroupClose groupc
Group data for matching for StateGroup type states.
T * _t_embody_from_match(SemTable *sem, T *match, Symbol group, T *t)
int _t_matchr(T *semtrex, T *t, T **r)
void _stx_freeFA(SState *s)
struct SgroupOpen SgroupOpen
STypeData data
a union to hold the data for which ever type of SState this is
T * asciiT_toi(T *asciiT, T *match, T *t, Symbol s)
struct SState * out
which state to go to next
TransitionType transition
will be: TransitionNextChild=0,TransitionDown=1, or a negative number which means pop up that many le...
Sliteral symbol
Symbol to match on for StateSymbol type states.
T * parseSemtrex(SemTable *sem, char *stx)
T * asciiT_tol(T *asciiT, T *match, T *t, Symbol s)
struct SgroupClose SgroupClose
T * _stx_results2sem_map(SemTable *sem, T *match_results, T *match_tree)
char * _dump_semtrex(SemTable *sem, T *s, char *buf)
StateType type
what type of state this is
int uid
unique id for the group
struct SState * out1
which alternate state to go to next in the case this is a Split state