blob: a96efee8a707a269101fcefc9799fc31f1ebb57b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
/*
file: fsmclass.txt
Why: example of text to parse by fsm's class construct.
*/
fsm-class Crule_lhs_phrase{
user-prefix-declaration
using namespace NS_yacco2_terminals;
#include "lint_balls.h"
***
user-declaration
public:
void add_sdc_to_directive(yacco2::CAbs_lr1_sym* Dir,T_syntax_code* Sdc);
T_rule_lhs_phrase* rule_lhs_phrase_;
***
user-implementation
void Crule_lhs_phrase::
add_sdc_to_directive(yacco2::CAbs_lr1_sym* Dir,T_syntax_code* Sdc){
using namespace NS_yacco2_T_enum;
using namespace NS_yacco2_terminals;
yacco2::INT eid = Dir->enumerated_id();
switch (eid){
case T_Enum::T_T_user_implementation_: {
T_user_implementation* k = (T_user_implementation*)Dir;
k->syntax_code(Sdc);
break;
}
default: {
CAbs_lr1_sym* sym = new LR1_err_improper_directive;
sym->set_rc(*Dir,*parser());
RSVP_FSM(sym);
parser()->set_stop_parse(true);
}
}
}
***
op
rule_lhs_phrase_ = new T_rule_lhs_phrase;
rule_lhs_phrase_->set_rc(*parser()->start_token(),*parser());
AST* t = new AST(*rule_lhs_phrase_);
rule_lhs_phrase_->phrase_tree(t);
***
constructor
rule_lhs_phrase_ = 0;
***
}
|