ClassTraverse.str 2.36 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/*
 * Copyright (C) 2003  EPITA Research and Development Laboratory
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 */
david_v's avatar
david_v committed
19
20
21
22
23
24
25
26
27
module ClassTraverse

imports

  lib

imports

  AsFix2-Syntax
28
29
  asfix
  Cxx
david_v's avatar
david_v committed
30
31
32
33
34
35
36
37
38
39
40
41
42
43
  ClassDefinitionCandidate
  Identifier
  Keys
  Kinds
  Resolve

rules

  //
  // Traverse definition of class C in namespace N.
  // This rule is very similar to ClassDefinition in module
  // ClassDefinition.
  //

44
45
46
  ClassTraverse : a@|ClassSpecifier[ ClassKey la1 ID la2 BaseClause-opt la3 { la4 MemberSpecification-opt la5 } ]| ->
                    |ClassSpecifier[ ClassKey la1 ID la2 BaseClause-opt' la3 { la4 MemberSpecification-opt' la5 } ]|
                  where < identifier > ID => c
david_v's avatar
david_v committed
47
48
49
50
51
52
53
                      ; < rewrite (!"$namespace") > "$value" => d
                      ; < ?list-key (as); !as > d => d'
                      ; < conc; ?x; !list-key (x) > (d', [string-key (c)]) => e
                      ; < print-key > e => e'
                      ; < concat-strings; debug > ["+ Entering class", " ", e']
                      ; < begin-scope (!"$namespace") > a
                      ; < assert (!"$namespace") > ("$value", e)
54
55
                      ; < resolve > BaseClause-opt => BaseClause-opt'
                      ; < resolve > MemberSpecification-opt => MemberSpecification-opt'
david_v's avatar
david_v committed
56
57
58
                      ; < end-scope (!"$namespace") > a
                      ; < concat-strings; debug > ["- Entering class", " ", e']

59
60
  ClassTraverse : a@|ElaboratedTypeSpecifier[ ClassKey Dummy0-opt NestedNameSpecifier-opt ID ]| -> a

david_v's avatar
david_v committed
61
62
63
64
strategies

  class-traverse-candidate = class-definition-candidate

65
  class-traverse-stop(s) = class-traverse-candidate
david_v's avatar
david_v committed
66
67
68

  class-traverse = (class-traverse-candidate;
                    ClassTraverse)