summaryrefslogtreecommitdiff
path: root/TAO/CIAO/CCF/CCF/CIDL/Parser.cpp
blob: ae99e2428b0500c7ae796ac9c90f0a086ba0a77f (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
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
// file      : CCF/CIDL/Parser.cpp
// author    : Boris Kolpackov <boris@dre.vanderbilt.edu>
// cvs-id    : $Id$

#include "CCF/CIDL/Parser.hpp"

//
// Note: DO NOT run emacs indenter (or any other indentation tool) over
//       this file because it will most likely break BNF indentation.
//

namespace CCF
{
  namespace CIDL
  {
    Parser::
    Parser (CompilerElements::Context& context,
            Diagnostic::Stream& dout,
            LexicalAnalyzer const& l,
            SemanticAction::Factory& f)
        : IDL2::Parser (context, dout, l, f),
          IDL3::Parser (context, dout, l, f),
          lexer_ (l),
          actions_ (f),

          COMPOSITION ("composition"),
          ENTITY      ("entity"     ),
          EXECUTOR    ("executor"   ),
          IMPLEMENTS  ("implements" ),
          PROCESS     ("process"    ),
          SERVICE     ("service"    ),
          SESSION     ("session"    ),

          // Composition
          //
          act_composition_begin (
            this, &Parser::act_composition_begin_core),

          act_composition_open_scope (
            f.composition (), &SemanticAction::Scope::open_scope),

          act_composition_close_scope (
            f.composition (), &SemanticAction::Scope::close_scope),

          act_composition_end (
            f.composition (), &SemanticAction::Composition::end),


          // Home Executor
          //
          act_home_executor_begin (
            f.home_executor (), &SemanticAction::HomeExecutor::begin),

          act_home_executor_implements (
            f.home_executor (), &SemanticAction::HomeExecutor::implements),

          act_home_executor_manages (
            f.home_executor (), &SemanticAction::HomeExecutor::manages),

          act_home_executor_end (
            f.home_executor (), &SemanticAction::HomeExecutor::end)

    {
      IDL3::Parser::extension =
           composition_decl
        |  extension
        ;

      //
      // Composition
      //
      composition_decl =
           composition_header
        >> LCBRACE[act_composition_open_scope]
        >> home_executor_decl
        >> RCBRACE[act_composition_close_scope]
        >> SEMI[act_composition_end]
        ;

      composition_header =
           COMPOSITION
        >> (composition_category >> simple_identifier)[act_composition_begin]
        ;

      composition_category =
          ENTITY
        | PROCESS
        | SERVICE
        | SESSION
        ;

      //
      // Home executor
      //
      home_executor_decl =
           home_executor_header
        >> LCBRACE
        >> home_executor_home_impl_decl
        >> home_executor_executor_decl
        >> RCBRACE
        >> SEMI[act_home_executor_end]
        ;

      home_executor_header =
           HOME
        >> EXECUTOR
        >> simple_identifier[act_home_executor_begin]
        ;

      home_executor_home_impl_decl =
           IMPLEMENTS
        >> identifier[act_home_executor_implements]
        >> SEMI
        ;

      home_executor_executor_decl =
           MANAGES
        >> simple_identifier[act_home_executor_manages]
        >> SEMI
        ;
    }
  }
}