// semcheck.cd // // This file defines the class dictionary for the // XAspects language. import edu.neu.ccs.demeter.dj.*; import edu.neu.ccs.demeter.aplib.*; import java.util.*; AspectFile = ClassDictionaryAspect TraversalAspect. ClassDictionaryAspect = "aspect" "(ClassDictionary)" AspectName TextCD. TraversalAspect = "aspect" "(Traversal)" AspectName "{" List(Declaration) "}". // traversal aspect declarations Declaration = "declare" GeneralDeclaration. GeneralDeclaration : StrategyDecl | NodesetDecl. StrategyDecl = "strategy" ":" StrategyDeclName ":" StrategyExpression ";". NodesetDecl = "node" "set" ":" NodesetDeclName ":" NodesetDef ";". // definition of strategy StrategyExpression = Strategy. public Strategy : SimpleStrategy | StrategyCombination | StrategyReference. public SimpleStrategy : StrategyGraph | PathDirective common [ "with" *s NameMap ]. public StrategyGraph = "{" *l + SList(SGEdge) - *l "}". SGEdge = [ SourceMarker *s ] GlobSpec *s "->" *s [ TargetMarker *s ] GlobSpec [ *s NegativeConstraint ]. 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) ")". 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 }. // Parameterized class definitions. List(S) ~ {*s S}. SList(S) ~ S { *l S } . Commalist(S) ~ S {"," *s S}. // definition of nodeset NodesetDef : NodesDef | ClassListDef | RegularExpression. NodesDef = "nodes" StrategyName. ClassListDef = CList(ClassListName). // definition of regular expression RegularExpression = ComplexExp. RegExp : SimpleExp | ComplexExp. SimpleExp = NodesetIdent. ComplexExp : AndExp | OrExp. AndExp = "and" ExpArguments. OrExp = "or" ExpArguments. ExpArguments = "(" RegExp "," RegExp ")". NodesetIdent = [Complement] Ident. Complement = "!". // terminal buffer classes AspectName = Ident. TextCD = Text. StrategyDeclName = Ident. NodesetDeclName = Ident. StrategyName = Ident. ClassListName = Ident. List (S) ~ {S}. CList(S) ~ S {"," S}. Main = . SemanticChecker = .