summaryrefslogtreecommitdiff
path: root/web/yacco2/qa/rule7.dat
blob: 34456ee047e437523b8bf5713556d128148987cd (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
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
/*
$echo file: rule7.dat
$echo test: undefined terminal ###
$echo Error
*/
/*	
FILE:		  rule_def_phrase.lex
Dates:		  3 Jun 2004
Purpose:	  parse a rule definition construct
              Verifies if the symbol being defined is duplicate
              within yacco2's symbol table.
              Adds symbol to global symbol table.
Output:       T_rule_def
              assorted errors
*/
fsm	
(fsm-id "rule_def_phrase.lex"
,fsm-filename rule_def_phrase
,fsm-namespace NS_rule_def_phrase
,fsm-class Crule_def_phrase{
  user-prefix-declaration
    using namespace NS_yacco2_terminals;
    #include "c:/yacco2/compiler/grammars/ws.h"
    #include "c:/yacco2/compiler/grammars/c_comments.h"
    #include "c:/yacco2/compiler/grammars/identifier.h"
    #include "c:/yacco2/compiler/grammars/c_string.h"
    #include "c:/yacco2/compiler/grammars/terminal_def_directives.h"
    #include "c:/yacco2/compiler/grammars/terminal_def_delabort_tags.h"
    #include "c:/yacco2/compiler/grammars/subrules_phrase.h"
    #include "c:/yacco2/compiler/grammars/rule_lhs_phrase.h"
    #include "c:/yacco2/compiler/cweb/symbol table/yacco2_ste.h"
    #include "c:/yacco2/compiler/grammars/parallel_monitor_phrase.h"
  ***
  user-declaration
    public:
    T_rule_def* rule_def_;
  ***
  constructor
    rule_def_ = 0;
  ***
  destructor
    delete rule_def_; // stop_parse: clean up software dodos
  ***
  op
    if(rule_def_ != 0){
      delete rule_def_;
      rule_def_ = 0;
    }
    rule_def_ = new T_rule_def;
  ***
}
,fsm-version "1.0",fsm-date "24 mar 2004",fsm-debug "true"
,fsm-comments "into the valley of ...")
parallel-parser	
(	
  parallel-thread-function
    TH_rule_def_phrase
  ***
  parallel-la-boundary
    eolr
  ***
)
@"/yacco2/compiler/grammars/yacco2_T_includes.T"

rules{
Rrule_def_phrase AD AB(){
  -> Rid 
  -> ### 
}

Rid AD AB(
lhs
,parallel-control-monitor{
  arbitrator-code
  ***
  }
){
  ->  ||| identifier NS_identifier::TH_identifier {
      op 
        Crule_def_phrase* fsm = (Crule_def_phrase*)abs_parser()->fsm_tbl();
        const char* skey = Sub_rule_1.p2__->identifier()->c_str();
        fsm->rule_def_->rule_name(skey);
        Sub_rule_1.p2__->auto_delete(true);
      ***
      } 
  ->  |.| {
      op
        CAbs_lr1_sym* sym = new LR1_err_no_rule_name_present;
        sym->rc(abs_parser()->current_token(),abs_parser());
        RSVP(sym)
        abs_parser()->stop_parse(true);
      ***
      }
}
}// end of rules