<< Aspect Deployment | Contents | >>
Language Grammar
The Caesar grammar definition is generated by
ANTLR
Caesar Specific Grammar
jTypeDefinition
: jModifiers
( jClassDefinition
| jInterfaceDefinition
| jCClassDefinition
)
| SEMI
jCClassDefinition
: "cclass" IDENT
( jCSuperClassClause
|
)
( jImplementsClause
|
)
( jWrapsClause
|
)
jCClassBlock
jModifier
: ...
| "deployed"
jCSuperClassClause
: ( "extends" jTypeName ) ( BAND jTypeName )*
jWrapsClause
: ( "wraps" jTypeName )
jCClassBlock
: LCURLY
( jCMember
| SEMI
)*
RCURLY
jCMember
: ( jModifiers
( jCClassDefinition
| jConstructorDefinition
| "pointcut" jPointcutDefinition
| "declare" TYPE_PATTERN
| "before" LPAREN jParameterDeclarationList RPAREN jCjAdviceDeclaration
| "after" LPAREN jParameterDeclarationList RPAREN
( "returning"
( LPAREN jParameterDeclaration RPAREN
|
)
| "throwing"
( LPAREN jParameterDeclaration RPAREN
|
)
|
)
jCjAdviceDeclaration
| jTypeSpec
( "around" LPAREN jParameterDeclarationList RPAREN
( jThrowsClause
|
)
jCjAdviceDeclaration
| jMethodDefinition
| jVariableDefinitions SEMI
)
) )
| "static" jCompoundStatement
| jCompoundStatement
jPointcutDefinition
: IDENT LPAREN jParameterDeclarationList RPAREN jPointcut SEMI
jCjAdviceDeclaration
: TYPE_PATTERN jCompoundStatement
jPrimaryExpression
: ...
| "wrappee"
jStatement
: ...
| jDeployStatement
jDeployStatement
: "deploy" LPAREN jExpression RPAREN jStatement
jPointcut
: ( TYPE_PATTERN
|
)
Full Grammar
jCompilationUnit
: jPackageDeclaration jImportDeclarations ( jTypeDefinition )* EOF
jPackageDeclaration
: ( "package" jIdentifier SEMI
|
)
jImportDeclarations
: jAutomaticImports ( jImportDeclaration )*
jTypeDefinition
: jModifiers
( jClassDefinition
| jInterfaceDefinition
| jCClassDefinition
)
| SEMI
jIdentifier
: IDENT ( DOT IDENT )*
jAutomaticImports
:
jImportDeclaration
: "import" IDENT ( DOT IDENT )*
( DOT STAR
|
)
SEMI
jModifiers
: ( jModifier )*
jClassDefinition
: "class" IDENT
( jSuperClassClause
|
)
( jImplementsClause
|
)
jClassBlock
jInterfaceDefinition
: "interface" IDENT jInterfaceExtends jClassBlock
jCClassDefinition
: "cclass" IDENT
( jCSuperClassClause
|
)
( jImplementsClause
|
)
( jWrapsClause
|
)
jCClassBlock
jLocalVariableDeclaration
: jTypeSpec jVariableDefinitions
jTypeSpec
: jClassTypeSpec
| jBuiltInTypeSpec
jVariableDefinitions
: jVariableDeclarator ( COMMA jVariableDeclarator )*
jModifier
: "public"
| "protected"
| "private"
| "static"
| "abstract"
| "final"
| "native"
| "strictfp"
| "synchronized"
| "transient"
| "volatile"
| "privileged"
| "deployed"
jClassTypeSpec
: jTypeName ( LBRACK RBRACK )*
jBuiltInTypeSpec
: jBuiltInType ( LBRACK RBRACK )*
jTypeName
: IDENT ( DOT IDENT )*
jBuiltInType
: "void"
| "boolean"
| "byte"
| "char"
| "short"
| "int"
| "long"
| "float"
| "double"
jType
: jBuiltInType
| jTypeName
jSuperClassClause
: ( "extends" jTypeName )
jImplementsClause
: ( "implements" jNameList )
jClassBlock
: LCURLY
( jMember
| SEMI
)*
RCURLY
jCSuperClassClause
: ( "extends" jTypeName ) ( BAND jTypeName )*
jWrapsClause
: ( "wraps" jTypeName )
jCClassBlock
: LCURLY
( jCMember
| SEMI
)*
RCURLY
jInterfaceExtends
: ( "extends" jNameList
|
)
jMember
: ( jModifiers
( jClassDefinition
| jInterfaceDefinition
| jConstructorDefinition
| jTypeSpec
( jMethodDefinition
| jVariableDefinitions SEMI
)
) )
| "static" jCompoundStatement
| jCompoundStatement
jCMember
: ( jModifiers
( jCClassDefinition
| jConstructorDefinition
| "pointcut" jPointcutDefinition
| "declare" TYPE_PATTERN
| "before" LPAREN jParameterDeclarationList RPAREN jCjAdviceDeclaration
| "after" LPAREN jParameterDeclarationList RPAREN
( "returning"
( LPAREN jParameterDeclaration RPAREN
|
)
| "throwing"
( LPAREN jParameterDeclaration RPAREN
|
)
|
)
jCjAdviceDeclaration
| jTypeSpec
( "around" LPAREN jParameterDeclarationList RPAREN
( jThrowsClause
|
)
jCjAdviceDeclaration
| jMethodDefinition
| jVariableDefinitions SEMI
)
) )
| "static" jCompoundStatement
| jCompoundStatement
jNameList
: jTypeName ( COMMA jTypeName )*
jConstructorDefinition
: IDENT LPAREN jParameterDeclarationList RPAREN
( jThrowsClause
|
)
LCURLY
( jExplicitConstructorInvocation
| jExplicitConstructorInvocation
|
)
( jBlockStatement )* RCURLY
private jMethodDefinition
: IDENT LPAREN jParameterDeclarationList RPAREN ( LBRACK RBRACK )*
( jThrowsClause
|
)
( ( jCompoundStatement
| SEMI
) )
jCompoundStatement
: LCURLY ( jBlockStatement )* RCURLY
jPointcutDefinition
: IDENT LPAREN jParameterDeclarationList RPAREN jPointcut SEMI
jParameterDeclarationList
: ( jParameterDeclaration ( COMMA jParameterDeclaration )*
|
)
jCjAdviceDeclaration
: TYPE_PATTERN jCompoundStatement
jParameterDeclaration
: ( "final"
|
)
jTypeSpec IDENT ( LBRACK RBRACK )*
jThrowsClause
: "throws" jNameList
jExplicitConstructorInvocation
: ( "this"
| "super"
| ( jPrimaryExpression
|
)
DOT "super"
)
LPAREN jArgList RPAREN SEMI
jPrimaryExpression
: IDENT
| jUnqualifiedNewExpression
| jLiteral
| "super"
| "true"
| "false"
| "this"
| "wrappee"
| "null"
| LPAREN jAssignmentExpression RPAREN
| jBuiltInType ( LBRACK RBRACK )* DOT "class"
jBlockStatement
: jModifiers jClassDefinition
| jModifiers jLocalVariableDeclaration SEMI
| jStatement
jArgList
: ( jExpressionList
|
)
jsMethodDefinition
: jModifiers jTypeSpec jMethodDefinition
jVariableDeclarator
: IDENT ( LBRACK RBRACK )*
( ASSIGN jVariableInitializer
|
)
jVariableInitializer
: jExpression
| jArrayInitializer
jExpression
: jAssignmentExpression
jArrayInitializer
: LCURLY
( jVariableInitializer ( COMMA jVariableInitializer )*
|
)
( COMMA
|
)
RCURLY
jStatement
: jCompoundStatement
| jExpression SEMI
| jLabeledStatement
| jIfStatement
| jForStatement
| jWhileStatement
| jDoStatement
| jBreakStatement
| jContinueStatement
| jReturnStatement
| jSwitchStatement
| jTryBlock
| jThrowStatement
| jSynchronizedStatement
| jDeployStatement
| SEMI
jLabeledStatement
: IDENT COLON jStatement
jIfStatement
: "if" LPAREN jExpression RPAREN jStatement
( "else" jStatement
|
)
jForStatement
: "for" LPAREN jForInit SEMI jForCond SEMI jForIter RPAREN jStatement
jWhileStatement
: "while" LPAREN jExpression RPAREN jStatement
jDoStatement
: "do" jStatement "while" LPAREN jExpression RPAREN SEMI
jBreakStatement
: "break"
( IDENT
|
)
SEMI
jContinueStatement
: "continue"
( IDENT
|
)
SEMI
jReturnStatement
: "return"
( jExpression
|
)
SEMI
jSwitchStatement
: "switch" LPAREN jExpression RPAREN LCURLY ( jCasesGroup )* RCURLY
jTryBlock
: "try" jCompoundStatement ( jHandler )*
( "finally" jCompoundStatement
|
)
jThrowStatement
: "throw" jExpression SEMI
jSynchronizedStatement
: "synchronized" LPAREN jExpression RPAREN jCompoundStatement
jDeployStatement
: "deploy" LPAREN jExpression RPAREN jStatement
jCasesGroup
: ( jACase )+ ( jBlockStatement )*
jACase
: ( "case" jExpression
| "default"
)
COLON
jForInit
: ( jModifiers jLocalVariableDeclaration
| jExpressionList
|
)
jForCond
: ( jExpression
|
)
jForIter
: ( jExpressionList
|
)
jExpressionList
: jExpression ( COMMA jExpression )*
jHandler
: "catch" LPAREN jParameterDeclaration RPAREN jCompoundStatement
jAssignmentExpression
: jConditionalExpression
( ASSIGN jAssignmentExpression
| jCompoundAssignmentOperator jAssignmentExpression
|
)
jConditionalExpression
: jLogicalOrExpression
( QUESTION jAssignmentExpression COLON jConditionalExpression
|
)
jCompoundAssignmentOperator
: PLUS_ASSIGN
| MINUS_ASSIGN
| STAR_ASSIGN
| SLASH_ASSIGN
| PERCENT_ASSIGN
| SR_ASSIGN
| BSR_ASSIGN
| SL_ASSIGN
| BAND_ASSIGN
| BXOR_ASSIGN
| BOR_ASSIGN
jLogicalOrExpression
: jLogicalAndExpression ( LOR jLogicalAndExpression )*
jLogicalAndExpression
: jInclusiveOrExpression ( LAND jInclusiveOrExpression )*
jInclusiveOrExpression
: jExclusiveOrExpression ( BOR jExclusiveOrExpression )*
jExclusiveOrExpression
: jAndExpression ( BXOR jAndExpression )*
jAndExpression
: jEqualityExpression ( BAND jEqualityExpression )*
jEqualityExpression
: jRelationalExpression
( NOT_EQUAL jRelationalExpression
| EQUAL jRelationalExpression
)*
jRelationalExpression
: jShiftExpression
( ( ( LT
| GT
| LE
| GE
)
jShiftExpression )*
| "instanceof" jTypeSpec
)
jShiftExpression
: jAdditiveExpression ( ( SL
| SR
| BSR
)
jAdditiveExpression )*
jAdditiveExpression
: jMultiplicativeExpression
( PLUS jMultiplicativeExpression
| MINUS jMultiplicativeExpression
)*
jMultiplicativeExpression
: jUnaryExpression
( STAR jUnaryExpression
| SLASH jUnaryExpression
| PERCENT jUnaryExpression
)*
jUnaryExpression
: INC jUnaryExpression
| DEC jUnaryExpression
| MINUS jUnaryExpression
| PLUS jUnaryExpression
| jUnaryExpressionNotPlusMinus
jUnaryExpressionNotPlusMinus
: BNOT jUnaryExpression
| LNOT jUnaryExpression
| ( LPAREN jBuiltInTypeSpec
( RPAREN jUnaryExpression
| DOT "class" RPAREN
)
| LPAREN jClassTypeSpec RPAREN jUnaryExpressionNotPlusMinus
| jPostfixExpression
)
jPostfixExpression
: jPrimaryExpression
( DOT
( IDENT
| "this"
| "super"
| "class"
| jQualifiedNewExpression
)
| ( LBRACK RBRACK )+ DOT "class"
| LBRACK jExpression RBRACK
| LPAREN jArgList RPAREN
)*
( INC
| DEC
|
)
jQualifiedNewExpression
: "new" IDENT LPAREN jArgList RPAREN
( jClassBlock
|
)
jUnqualifiedNewExpression
: "new"
( jBuiltInType jNewArrayDeclarator
( jArrayInitializer
|
)
| jTypeName
( jNewArrayDeclarator
( jArrayInitializer
|
)
| LPAREN jArgList RPAREN
( jClassBlock
|
)
)
)
jLiteral
: jIntegerLiteral
| jCharLiteral
| jStringLiteral
| jRealLiteral
jNewArrayDeclarator
: ( LBRACK
( jExpression
|
)
RBRACK )+
jIntegerLiteral
: INTEGER_LITERAL
jCharLiteral
: CHARACTER_LITERAL
jStringLiteral
: STRING_LITERAL
jRealLiteral
: REAL_LITERAL
jPointcut
: ( TYPE_PATTERN
|
)
<< Aspect Deployment | Contents | >>