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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
|
/*
Copyright Dave Bone 1998 - 2014
All Rights Reserved.
No part of this document may be reproduced without written consent from the author.
FILE: rtn_component.lex
Dates: 16 Dec, 2005
Purpose: a T returned from a thread
Output: T_in_stbl
"|||"
assorted errors
*/
/@
@i "/usr/local/yacco2/copyright.w"
@** |rtn_component| Thread.\fbreak
A T returned from a thread.
@/
fsm
(fsm-id "rtn_component.lex"
,fsm-filename rtn_component
,fsm-namespace NS_rtn_component
,fsm-class Crtn_component{
user-prefix-declaration
#include "identifier.h"
#include "c_string.h"
#include "unq_str.h"
#include "yacco2_stbl.h"
***
user-declaration
public:
void fnd_T_of_chr_str(const char* Str,yacco2::CAbs_lr1_sym* Tok);
***
user-implementation
void Crtn_component::fnd_T_of_chr_str(const char* Str,yacco2::CAbs_lr1_sym* Tok){
T_sym_tbl_report_card report_card;
using namespace yacco2_stbl;
find_sym_in_stbl(report_card,*Str);
if(report_card.action_ == T_sym_tbl_report_card::not_fnd){
CAbs_lr1_sym* sym = new Err_subrule_use_undefined_T;
sym->set_rc(*parser__->start_token__,__FILE__,__LINE__);
RSVP_FSM(sym);
parser__->set_stop_parse(true);
return;
}
if(report_card.tbl_entry_->type_ != table_entry::terminal){
CAbs_lr1_sym* sym = new Err_not_T_for_rtned_token_from_th;
sym->set_rc(*parser__->start_token__,__FILE__,__LINE__);
RSVP_FSM(sym);
parser__->set_stop_parse(true);
return;
}
report_card.tbl_entry_->used_ = true;
CAbs_lr1_sym* sym = report_card.tbl_entry_->symbol_;
T_in_stbl* T = (T_in_stbl*)sym;
refered_T* rT = new refered_T(*T);
rT->set_rc(*Tok,__FILE__,__LINE__);
T->add_T_into_xref(*rT);
RSVP_FSM(T);
parser__->set_stop_parse(true);
}
***
}
,fsm-version "1.0",fsm-date "16 dec. 2005",fsm-debug "false"
,fsm-comments "Recognizer of returned T from a thread call expression.")
parallel-parser
(
parallel-thread-function
TH_rtn_component
***
parallel-la-boundary
eolr
***
)
@"/usr/local/yacco2/compiler/grammars/yacco2_T_includes.T"
rules{
Rrtn_component (
lhs
,parallel-control-monitor{
/@
unquoted-string supersets identifier
and also includes other T like $-$$>$ and cweb comments ie cweb-marker.
Code only gets tried when \# parms in accept queue $>$ 1.
Single entry is one of identifier or cweb.
@/
arbitrator-code
using namespace NS_yacco2_T_enum;
for(i=1;i<=ie;++i){
if(Caller_pp->pp_accept_queue__[i].accept_token__->enumerated_id__
!= NS_yacco2_T_enum::T_Enum::T_T_unquoted_string_){// bypass unq str
goto arbitrated_parameter;
}
}
***
}
){
-> ||| identifier NS_identifier::TH_identifier {
op // used rule and not defined, so create it
CAbs_lr1_sym* sym = new Err_not_T_for_rtned_token_from_th;
sym->set_rc(*rule_info__.parser__->start_token__,__FILE__,__LINE__);
RSVP(sym);
rule_info__.parser__->set_stop_parse(true);
***
}
-> ||| "c-string" NS_c_string::TH_c_string { // T type
op
Crtn_component* fsm = (Crtn_component*)rule_info__.parser__->fsm_tbl__;
fsm->fnd_T_of_chr_str(sf->p2__->c_string()->c_str(),sf->p2__);// stop parsing in call
sf->p2__->set_auto_delete(true);
rule_info__.parser__->set_stop_parse(true);
***
}
-> ||| "unquoted-string" NS_unq_str::TH_unq_str {// T type
op // only accept when no identifier
Crtn_component* fsm = (Crtn_component*)rule_info__.parser__->fsm_tbl__;
fsm->fnd_T_of_chr_str(sf->p2__->unquoted_string()->c_str(),sf->p2__);// stop parsing in call
sf->p2__->set_auto_delete(true);
rule_info__.parser__->set_stop_parse(true);
***
}
-> ||| |+| NULL { // forward errors
/@
Forward the error.
@/
op
RSVP(sf->p2__);
rule_info__.parser__->set_stop_parse(true);
***
}
-> ||| "T-in-stbl" NULL {
op
using namespace yacco2_stbl;
T_sym_tbl_report_card report_card;
find_sym_in_stbl(report_card,*sf->p2__->t_def()->t_name()->c_str());
if(report_card.action_ == T_sym_tbl_report_card::not_fnd){
CAbs_lr1_sym* sym = new Err_T_not_in_stbl;
sym->set_rc(*rule_info__.parser__->start_token__,__FILE__,__LINE__);
RSVP(sym);
rule_info__.parser__->set_stop_parse(true);
return;
}
report_card.tbl_entry_->used_ = true;
refered_T* rt = new refered_T(*sf->p2__);
rt->set_rc(*sf->p2__,__FILE__,__LINE__);
sf->p2__->add_T_into_xref(*rt);
RSVP(sf->p2__);
rule_info__.parser__->set_stop_parse(true);
***
}
-> ||| "rule-in-stbl" NULL {
op
CAbs_lr1_sym* sym = new Err_not_T_for_rtned_token_from_th;
sym->set_rc(*rule_info__.parser__->start_token__,__FILE__,__LINE__);
RSVP(sym);
rule_info__.parser__->set_stop_parse(true);
***
}
-> ||| "kw-in-stbl" NULL {
op
CAbs_lr1_sym* sym = new Err_not_T_for_rtned_token_from_th;
sym->set_rc(*rule_info__.parser__->start_token__,__FILE__,__LINE__);
RSVP(sym);
rule_info__.parser__->set_stop_parse(true);
return;
***
}
}
}// end of rules
|