// sg.cd -- class dictionary for strategy graphs // $Id: sg.cd,v 1.12 2003/01/30 02:26:05 dougo Exp $ // modified by Karl Lieberherr // added KJL package edu.neu.ccs.demeter.aplib.mysg; import java.util.*; import java.io.*; import edu.neu.ccs.demeter.aplib.*; // import edu.neu.ccs.demeter.dj.*; Main = . // testing stub visitor CollectVisitor = . // new visitor // added KJL XAspectLanguage2 = List(AspectLanguage) EOF. AspectLanguage : lookahead {{ 3 }} ClassDictionaryL | SelectorL. ClassDictionaryL = "aspect" "(" "ClassDictionary" ")" ClassDictionaryName ClassDict. ClassDictionaryName = Ident. TraversalName = Ident. SelectorL = "aspect" "(" "Traversal" ")" TraversalName "{" List(StrategyDef) List(NodeSubsetDef) [lookahead {{3}} "declare" "chosen" "selector:" SelectorName ";"] // to be highlighted [lookahead {{3}} "declare" "chosen" "class" "dictionary:" ClassDictionaryName ";"] // to be highlighted "}". StrategyDef = "declare" "strategy" ":" StrategyName ":" StrategyExpression ";". NodeSubsetDef = "declare" "node" "set" ":" NodeSubsetName ":" NodeSubsetExpression ";". SelectorName = Ident. ClassDict = Text. NodeSubsetExpression : Simple | BCompound | UCompound. Simple : NodeSubsetName | ClassNameSet | GraphNodes | GraphNodeRegExp. BCompound = BinaryOp PCList(NodeSubsetExpression) . UCompound = UnaryOp NodeSubsetExpression . Operator : BinaryOp | UnaryOp. BinaryOp : Union | Intersection. UnaryOp : Complement. Union = "or". Intersection = "and". Complement = "!". ClassNameSet = BCList(ClassName). GraphNodes = "nodes" StrategyName . GraphNodeRegExp = "regexp" ClassName WildCard . WildCard ="*". BCList(S) ~ "{" S {"," S} "}". PCList(S) ~ "(" S {"," S} ")". PList(S) ~ "(" {S} ")". NPList(S) ~ "(" S {S} ")". // end addition StrategyExpression = Strategy. public Strategy : SimpleStrategy | StrategyCombination | StrategyReference implements StrategyI. public SimpleStrategy : StrategyGraph | PathDirective common [ "with" *s NameMap ]. public StrategyGraph = "{" *l + SList(SGEdge) - *l "}" implements SimpleStrategyI, StrategyGraphI, ConstraintMapI. SGEdge = [ SourceMarker *s ] GlobSpec *s "->" *s [ TargetMarker *s ] GlobSpec [ *s NegativeConstraint ] implements Cloneable. SourceMarker = "source:". TargetMarker = "target:". public PathDirective = SourceDirective [ *s NegativeConstraint ] List(PathSegment) *s TargetDirective. SourceDirective : From common *s ClassGlobSpec. From = "from". PathSegment = PositiveConstraint [ *s NegativeConstraint ]. Constraint : PositiveConstraint | NegativeConstraint common *s GlobSpec. PositiveConstraint : Through | Via. // synonyms Through = "through". Via = "via". NegativeConstraint : Bypassing | OnlyThrough. // antonyms Bypassing = "bypassing". OnlyThrough = "only-through". TargetDirective : To | ToStop common *s ClassGlobSpec. To = "to". ToStop = "to-stop". public StrategyCombination : Join | Merge | Intersect common "(" Strategy "," *s Commalist(Strategy) ")" implements StrategyCombinationI, Cloneable. Join = "join". Merge = "merge". Intersect = "intersect". public StrategyReference = Ident. SymbolicNameMap : NameMap implements SymbolicNameMapI. NameMap = "{" *s [ Commalist(NameBinding) *s ] "}". NameBinding = Name "=" ClassGlobSpec. GlobSpec : OneGlob | GlobSet. OneGlob = Glob. GlobSet = "{" *s [ Commalist(Glob) *s ] "}". Glob : ClassGlob | EdgeGlob. EdgeGlob : PartGlob | SubclassGlob | SuperclassGlob. ClassGlob = ClassNameGlob. PartGlob = "->" *s SourceGlob "," PartNameGlob "," TargetGlob. SubclassGlob = "=>" *s SourceGlob "," TargetGlob. SuperclassGlob = ":>" *s SourceGlob "," TargetGlob. SourceGlob = ClassNameGlob. TargetGlob = ClassNameGlob. ClassNameGlob : ClassNameExact | AnyClass. ClassNameExact = ClassName. AnyClass = "*". PartNameGlob : PartNameExact | AnyPart. PartNameExact = PartName. AnyPart = "*". ClassGlobSpec : OneClassGlob | ClassGlobSet. OneClassGlob = ClassGlob. ClassGlobSet = "{" *s Commalist(ClassGlob) *s "}". ClassName = Name. PartName = Ident. Name ~ Ident { "." Ident }. // added KJL StrategyName = Ident. NodeSubsetName = Ident. // end addition // Parameterized class definitions. List(S) ~ { lookahead {{ 3 }} *s S}. SList(S) ~ S { *l S } . Commalist(S) ~ S {"," *s S}. noparse interface SymbolicNameMapI = extends NameMapI. visitors GlobVisitor : .