You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

grammar.adoc 5.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. [[grammar]]
  2. = A Grammar for the AspectJ 5 Language
  3. [source, text]
  4. ....
  5. == type patterns ===
  6. TypePattern :=
  7. SimpleTypePattern |
  8. '!' TypePattern |
  9. '(' AnnotationPattern? TypePattern ')'
  10. TypePattern '&&' TypePattern |
  11. TypePattern '||' TypePattern
  12. SimpleTypePattern := DottedNamePattern '+'? '[]'*
  13. DottedNamePattern :=
  14. FullyQualifiedName RestOfNamePattern? |
  15. '*' NotStarNamePattern?
  16. RestOfNamePattern := '..' DottedNamePattern | '*' NotStarNamePattern?
  17. NotStarNamePattern :=
  18. FullyQualifiedName RestOfNamePattern? |
  19. '..' DottedNamePattern
  20. FullyQualifiedName := JavaIdentifierCharacter+ ('.' JavaIdentifierCharacter+)*
  21. == annotation patterns ===
  22. AnnotationPattern := '!'? '@' AnnotationTypePattern AnnotationPattern*
  23. AnnotationTypePattern := FullyQualifiedName | '(' TypePattern ')'
  24. == signature patterns ===
  25. -- field --
  26. FieldPattern :=
  27. AnnotationPattern? FieldModifiersPattern?
  28. TypePattern (TypePattern DotOrDotDot)? SimpleNamePattern
  29. FieldModifiersPattern := '!'? FieldModifier FieldModifiersPattern*
  30. FieldModifier :=
  31. 'public' | 'private' | 'protected' | 'static' |
  32. 'transient' | 'final'
  33. DotOrDotDot := '.' | '..'
  34. SimpleNamePattern := JavaIdentifierChar+ ('*' SimpleNamePattern)?
  35. -- method --
  36. MethodPattern :=
  37. AnnotationPattern? MethodModifiersPattern? TypePattern
  38. (TypePattern DotOrDotDot)? SimpleNamePattern
  39. '(' FormalsPattern ')' ThrowsPattern?
  40. MethodModifiersPattern := '!'? MethodModifier MethodModifiersPattern*
  41. MethodModifier :=
  42. 'public' | 'private' | 'protected' | 'static' |
  43. 'synchronized' | 'final'
  44. FormalsPattern :=
  45. '..' (',' FormalsPatternAfterDotDot)? |
  46. OptionalParensTypePattern (',' FormalsPattern)* |
  47. TypePattern '...'
  48. FormalsPatternAfterDotDot :=
  49. OptionalParensTypePattern (',' FormalsPatternAfterDotDot)* |
  50. TypePattern '...'
  51. ThrowsPattern := 'throws' TypePatternList
  52. TypePatternList := TypePattern (',' TypePattern)*
  53. -- constructor --
  54. ConstructorPattern :=
  55. AnnotationPattern? ConstructorModifiersPattern?
  56. (TypePattern DotOrDotDot)? 'new' '(' FormalsPattern ')'
  57. ThrowsPattern?
  58. ConstructorModifiersPattern :=
  59. '!'? ConstructorModifier ConstructorModifiersPattern*
  60. ConstructorModifier := 'public' | 'private' | 'protected'
  61. == Pointcuts ===
  62. PointcutPrimitive :=
  63. Call | Execution | Get | Set | Handler |
  64. Initialization | PreInitialization |
  65. StaticInitialization | AdviceExecution |
  66. This | Target | Args | CFlow | CFlowBelow |
  67. Within | WithinCode | If |
  68. AnnotationPointcut
  69. AnnotationPointcut :=
  70. AtAnnotation | AtThis | AtTarget |
  71. AtWithin | AtWithinCode | AtArgs
  72. Call := 'call' '(' MethodOrConstructorPattern ')'
  73. MethodOrConstructorPattern := MethodPattern | ConstructorPattern
  74. Execution := 'execution' '(' MethodOrConstructorPattern ')'
  75. Get := 'get' '(' FieldPattern ')'
  76. Set := 'set' '(' FieldPattern ')'
  77. Handler := 'handler' '(' OptionalParensTypePattern ')'
  78. Initialization := 'initialization' '(' ConstructorPattern ')'
  79. PreInitialization := 'preinitialization' '(' ConstructorPattern ')'
  80. StaticInitialization := 'staticinitialization' '(' OptionalParensTypePattern ')'
  81. AdviceExecution := 'adviceexecution' '(' ')'
  82. This := 'this' '(' TypeOrIdentifier ')'
  83. Target := 'target' '(' TypeOrIdentifier ')'
  84. Args := 'args' '(' FormalsOrIdentifiersPattern ')'
  85. CFlow := 'cflow' '(' Pointcut ')'
  86. CFlowBelow := 'cflowbelow' '(' Pointcut ')'
  87. Within := 'within' '(' OptionalParensTypePattern ')'
  88. WithinCode := 'withincode' '(' OptionalParensTypePattern ')'
  89. If := 'if' '(' BooleanJavaExpression ')'
  90. TypeOrIdentifier := FullyQualifiedName ('[' ']')* | Identifier
  91. Identifier := JavaIdentifierChar+
  92. FormalsOrIdentifiersPattern :=
  93. '..' (',' FormalsOrIdentifiersPatternAfterDotDot)? |
  94. TypeOrIdentifier (',' FormalsOrIdentifiersPattern)* |
  95. '*' (',' FormalsOrIdentifiersPattern)*
  96. FormalsOrIdentifiersPatternAfterDotDot :=
  97. TypeOrIdentifier (',' FormalsOrIdentifiersPatternAfterDotDot)* |
  98. '*' (',' FormalsOrIdentifiersPatternAfterDotDot)*
  99. AtAnnotation := '@annotation' '(' AnnotationOrIdentifier ')'
  100. AtThis := '@this' '(' AnnotationOrIdentifer ')'
  101. AtTarget := '@target' '(' AnnotationOrIdentifier ')'
  102. AtWithin := '@within' '(' AnnotationOrIdentifier ')'
  103. AtWithinCode := '@withincode' '(' AnnotationOrIdentifier ')'
  104. AnnotationOrIdentifier := FullyQualifiedName | Identifier
  105. AtArgs := '@args' '(' AnnotationsOrIdentifiersPattern ')'
  106. AnnotationsOrIdentifiersPattern :=
  107. '..' (',' AnnotationsOrIdentifiersPatternAfterDotDot)? |
  108. AnnotationOrIdentifier (',' AnnotationsOrIdentifiersPattern)* |
  109. '*' (',' AnnotationsOrIdentifiersPattern)*
  110. AnnotationsOrIdentifiersPatternAfterDotDot :=
  111. AnnotationOrIdentifier (',' AnnotationsOrIdentifiersPatternAfterDotDot)* |
  112. '*' (',' AnnotationsOrIdentifiersPatternAfterDotDot)*
  113. PointcutDeclaration :=
  114. PointcutModifiers? 'pointcut' Identifier Formals ':' PointcutExpression
  115. PointcutModifiers := PointcutModifier*
  116. PointcutModifier := 'public' | 'private' | 'protected' | 'abstract'
  117. Formals := '(' ParamList? ')'
  118. ParamList := FullyQualifiedName Identifier (',' ParamList)*
  119. ReferencePointcut := (FullyQualifiedName '.')? Identifier Formals
  120. PointcutExpression :=
  121. (PointcutPrimitive | ReferencePointcut) |
  122. '!' PointcutExpression |
  123. '(' PointcutExpression ')' |
  124. PointcutExpression '&&' PointcutExpression |
  125. PointcutExpression '||' PointcutExpression
  126. == Advice ===
  127. to be written...
  128. == Inter-type Declarations ===
  129. to be written...
  130. == Declare Statements ===
  131. to be written...
  132. == Aspects ===
  133. to be written...
  134. ....