/* * BaseTraverse.str: * this file is a part of CxxGrammar from the Transformers project. * Copyright (C) 2003, 2004 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 * */ module BaseTraverse imports lib imports AsFix Cxx BaseTraverseCandidate Identifier LocalOrGlobal Lookup NestedNameSpecifier Options rules BaseTraverse-1 : |BaseSpecifier[ Dummy0-opt la1 NestedNameSpecifier la2 ClassName ]| -> |BaseSpecifier[ Dummy0-opt' la1 NestedNameSpecifier' la2 ClassName' ]| where < BaseTraverse-core > [Dummy0-opt, Some (NestedNameSpecifier), ClassName] => [Dummy0-opt', Some (NestedNameSpecifier'), ClassName'] BaseTraverse-1' : |BaseSpecifier[ Dummy0-opt la ClassName ]| -> |BaseSpecifier[ Dummy0-opt' la ClassName' ]| where < BaseTraverse-core > [Dummy0-opt, None, ClassName] => [Dummy0-opt', None, ClassName'] BaseTraverse-2 : |BaseSpecifier[ virtual la1 AccessSpecifier-opt la2 Dummy0-opt la3 NestedNameSpecifier la4 ClassName ]| -> |BaseSpecifier[ virtual la1 AccessSpecifier-opt la2 Dummy0-opt' la3 NestedNameSpecifier' la4 ClassName' ]| where < BaseTraverse-core > [Dummy0-opt, Some (NestedNameSpecifier), ClassName] => [Dummy0-opt', Some (NestedNameSpecifier'), ClassName'] BaseTraverse-2 : |BaseSpecifier[ AccessSpecifier la1 Dummy7-opt la2 Dummy0-opt la3 NestedNameSpecifier la4 ClassName ]| -> |BaseSpecifier[ AccessSpecifier la1 Dummy7-opt la2 Dummy0-opt' la3 NestedNameSpecifier' la4 ClassName' ]| where < BaseTraverse-core > [Dummy0-opt, Some (NestedNameSpecifier), ClassName] => [Dummy0-opt', Some (NestedNameSpecifier'), ClassName'] BaseTraverse-2' : |BaseSpecifier[ virtual la1 AccessSpecifier-opt la2 Dummy0-opt la3 ClassName ]| -> |BaseSpecifier[ virtual la1 AccessSpecifier-opt la2 Dummy0-opt' la3 ClassName' ]| where < BaseTraverse-core > [Dummy0-opt, None, ClassName] => [Dummy0-opt', None, ClassName'] BaseTraverse-2' : |BaseSpecifier[ AccessSpecifier la1 Dummy7-opt la2 Dummy0-opt la3 ClassName ]| -> |BaseSpecifier[ AccessSpecifier la1 Dummy7-opt la2 Dummy0-opt' la3 ClassName' ]| where < BaseTraverse-core > [Dummy0-opt, None, ClassName] => [Dummy0-opt', None, ClassName'] BaseTraverse-core : [global, nested, name@|ClassName[ ID ]|] -> [global', nested', name] where < identifier > ID => ID' ; < rewrite (!"$namespace") > "$value" => local ; < local-or-global > global => global' ; < opt-apply (nested-name-specifier) > nested => nested' ; < lookup' > ID' ; < rewrite (!"$namespace") > "$value" => base ; < ?list-key (xs); !xs > base => base' ; < conc; ?x; !list-key (x) > (base', [string-key (ID')]) => inherit ; < rewrite (!local) <+ (!Nil) > "$inherit" => inherits ; < conc > (inherits, [inherit]) => inherits' ; < my-assert (!local) > ("$inherit", inherits') strategies base-traverse-stop(s) = base-traverse-candidate base-traverse = scope (!"$namespace", (base-traverse-candidate; (BaseTraverse-1 <+ BaseTraverse-1' <+ BaseTraverse-2 <+ BaseTraverse-2')))