RPA Toolkit
work on AST
authorMartin Stoilov <martin@rpasearch.com>
Mon, 7 Feb 2011 06:09:02 +0000 (22:09 -0800)
committerMartin Stoilov <martin@rpasearch.com>
Mon, 7 Feb 2011 06:09:02 +0000 (22:09 -0800)
rast/rastnode.h
rlib/rharray.c
tests/astecma262.rpa [new file with mode: 0644]
tests/build/linux/robject-tests.mk
tests/rast-test.c

index 0285452..7629dca 100644 (file)
@@ -40,8 +40,8 @@ typedef struct rastval_s {
        ruint type;
 } rastval_t;
 
        ruint type;
 } rastval_t;
 
-#define R_ASTVAL_SET_ARRAY(__p__, __a__) do { (__p__)->v.arr = __a__; (__p__)->type =  R_ASTVAL_ARRAY; } while (0)
-
+#define R_ASTVAL_SET_ARRAY(__p__, __v__) do { (__p__)->v.arr = __v__; (__p__)->type =  R_ASTVAL_ARRAY; } while (0)
+#define R_ASTVAL_SET_STRING(__p__, __v__) do { (__p__)->v.str = __v__; (__p__)->type =  R_ASTVAL_STRING; } while (0)
 
 struct rastnode_s {
        robject_t obj;
 
 struct rastnode_s {
        robject_t obj;
index a5d9672..fb0aeec 100644 (file)
@@ -223,7 +223,7 @@ rint r_harray_set(rharray_t *harray, rlong index, rconstpointer pval)
 
 rpointer r_harray_get(rharray_t *harray, rulong index)
 {
 
 rpointer r_harray_get(rharray_t *harray, rulong index)
 {
-       if (index >= r_carray_length(harray->members))
+       if (index >= r_carray_length(harray->members) || index < 0)
                return NULL;
        return r_carray_slot(harray->members, index);
 }
                return NULL;
        return r_carray_slot(harray->members, index);
 }
diff --git a/tests/astecma262.rpa b/tests/astecma262.rpa
new file mode 100644 (file)
index 0000000..d30c9c8
--- /dev/null
@@ -0,0 +1,445 @@
+# 6 Source Text
+SourceCharacter                ::= .
+
+# 7.2 White space
+WhiteSpace             ::= [#0x0009] | [#0x000B] | [#0x000C] | [#0x0020] | [#0x00A0] | [#0xFEFF]
+
+# 7.3 Line Terminators
+LineTerminator         ::= [#0x000D] [#0x000A] | [#0x000A] | [#0x000D] | [#0x2028] | [#0x2029]
+LineTerminatorSequence ::= [#0x000D] [#0x000A] |
+                           [#0x000A] | 
+                           [#0x000D] | 
+                           [#0x2028] | 
+                           [#0x2029]
+
+S                      ::= ( <WhiteSpace> | <LineTerminator> )+
+
+# 7.4 Comments
+Comment                        ::= <:MultiLineComment:> | <:SingleLineComment:>
+MultiLineComment       ::= '/*' <:MultiLineCommentChar:>* '*/'
+MultiLineCommentChar   ::= . - '*/'
+SingleLineComment      ::= '//' <:SingleLineCommentChar:>*
+SingleLineCommentChar  ::= <:SourceCharacter:> - <:LineTerminator:>
+
+
+# 7.5 Tokens
+Token                  ::= <:IdentifierName:> |
+                           <:Punctuator:> |
+                           <:NumericLiteral:> |
+                           <:StringLiteral:>
+
+# 7.6 Identifier Names and Identifiers
+
+Identifier             ::= <IdentifierName> - <ReservedWord> - <ReservedWord> <IdentifierPart>
+IdentifierName         ::= <IdentifierStart> <IdentifierPart>*
+IdentifierStart                ::= <UnicodeLetter> | '$' | '_' | '\' <:UnicodeEscapeSequence:>
+UnicodeLetter          ::= <Lu> |
+                       <Ll> |
+                       <Lt> |
+                       <Lm> |
+                       <Lo> |
+                       <Nl>
+
+Lu                     ::= [#0x0041-#0x005A] | [#0x00C0-#0x00DE] | [#0x0100-#0x0232]   # TBD
+Ll                     ::= [#0x0061-#0x007A] | [#0x00C0-#0x00DE]                       # TBD
+IdentifierPart         ::= <IdentifierStart> | 
+                       <:UnicodeCombiningMark:> |
+                       <:UnicodeDigit:> | 
+                       <:UnicodeConnectorPunctuation:>                                 # TBD
+
+UnicodeDigit           ::= [0-9] | [#0x0660-#0x0669]                                   # TBD
+ReservedWord           ::= <:Keyword:>
+                       <:Keyword:> | 
+                       <:FutureReservedWord:> |
+                       <:NullLiteral:> |
+                       <:BooleanLiteral:>
+
+Keyword                        ::= 'instanceof' | 'typeof'     | 'break' | 
+                           'do' | 'new' | 'var' |
+                           'case' | 'else' | 'return' | 'void' | 
+                           'catch' | 'finally' | 'continue' | 'for' | 
+                           'switch' | 'while' | 'this' | 'with' | 
+                           'debugger' | 'function' | 'throw' | 'default' |  
+                           'if' | 'try' | 'delete' | 'in'
+
+FutureReservedWord     ::= 'class' | 'enum' | 'extends' | 'import' | 'const' | 'export' |
+                           'implements' | 'let' | 'private' | 'public' |
+                            'static' | 'interface' | 'package' | 'protected'
+
+NullLiteral            ::= 'null'
+BooleanLiteral                 ::= 'true' | 'false'
+Literal                ::= <:NullLiteral:> |
+                           <:BooleanLiteral:> |
+                           <:NumericLiteral:> |
+                           <:StringLiteral:> |
+                           <:RegularExpressionLiteral:>
+
+
+
+# 7.7 Punctuators
+Punctuator             ::= '{' | '}' | '(' | ')' | '[' | ']' |
+                            '===' | '!==' | '>=' | '<=' | '==' | '!=' |
+                           '<<' | '>>>' | '>>' | '&' | '^=' | '^' |
+                           '!' | '~' | '&&' | '||' | '?' | ':' |
+                           '>>=' | '>>>=' | '&=' | '|=' |
+                           '=' | '+='| '-=' | '*=' | '%=' | '<<=' |
+                           '.' | ';' | ',' | '<' | '>' | '|' |
+                           '+' | '-' | '*' | '%' | '++' | '--'
+DivPunctuator          ::= '/' | '/='
+
+
+
+# 7.8.3 Numeric Literals
+NumericLiteral         ::= <:HexIntegerLiteral:> | <:DecimalLiteral:>
+DecimalLiteral         ::= <:DecimalIntegerLiteral:> '.' <:DecimalDigits:>? <:ExponentPart:>? |
+                           '.' <:DecimalDigits:> <:ExponentPart:>? |
+                           <:DecimalIntegerLiteral:> <:ExponentPart:>?
+
+DecimalIntegerLiteral  ::= '0' |
+                           <:NonZeroDigit:> <:DecimalDigits:>?
+
+DecimalDigits          ::= <:DecimalDigit:>+
+DecimalDigit           ::= [0-9]
+NonZeroDigit           ::= [1-9]
+ExponentPart           ::= <:ExponentIndicator:> <:SignedInteger:>
+ExponentIndicator      ::= [eE]
+SignedInteger          ::= <:DecimalDigits:> |
+                           '+' <:DecimalDigits:> |
+                           '-' <:DecimalDigits:>
+HexIntegerLiteral      ::= '0' [xX] <:HexDigit:>+
+HexDigit               ::= [0-9a-fA-F]
+
+
+# 7.8.4 String Literals
+
+StringLiteral          ::= '"' <:DoubleStringCharacters:>? '"' |
+                           "'" <:SingleStringCharacters:>? "'"
+
+DoubleStringCharacters ::= <:DoubleStringCharacter:>+
+SingleStringCharacters ::= <:SingleStringCharacter:>+
+
+
+DoubleStringCharacter  ::= '\' <:EscapeSequence:> |
+                           <:LineContinuation:> |
+                           <:SourceCharacter:> - ('"' | '\' | <:LineTerminator:>)
+
+SingleStringCharacter  ::= '\' <:EscapeSequence:> |
+                           <:LineContinuation:> |
+                           <:SourceCharacter:> - ("'" | '\' | <:LineTerminator:>)
+
+LineContinuation       ::= '\' <:LineTerminatorSequence:>
+
+
+EscapeSequence                 ::= <:CharacterEscapeSequence:> |
+                                   '0' ^<:DecimalDigit:> |
+                           <:HexEscapeSequence:> |
+                           <:UnicodeEscapeSequence:>
+
+CharacterEscapeSequence ::= <:SingleEscapeCharacter:> |
+                           <:NonEscapeCharacter:>
+
+SingleEscapeCharacter  ::= "'" | '"' | '\' | [bfnrtv]
+NonEscapeCharacter     ::= <:SourceCharacter:> - (<:EscapeCharacter:> | <:LineTerminator:>)
+EscapeCharacter        ::= <:SingleEscapeCharacter:> |
+                           <:DecimalDigit:> |
+                           'x' |
+                           'u'
+
+HexEscapeSequence      ::= 'x' <:HexDigit:> <:HexDigit:>
+UnicodeEscapeSequence  ::= 'u' <:HexDigit:> <:HexDigit:> <:HexDigit:> <:HexDigit:>
+
+
+# 7.8.5 Regular Expression Literals
+RegularExpressionLiteral::= '/' <:RegularExpressionBody:> '/' <:RegularExpressionFlags:>
+RegularExpressionBody  ::= <:RegularExpressionFirstChar:> <:RegularExpressionChars:>?
+RegularExpressionChars ::= <:RegularExpressionChar:>+
+RegularExpressionFirstChar ::= <:RegularExpressionNonTerminator:> - ( '*' | '\' | '/' | '[' ) |
+                              <:RegularExpressionBackslashSequence:> |
+                              <:RegularExpressionClass:>
+
+RegularExpressionChar  ::= <:RegularExpressionNonTerminator:> - ( '\' | '/' | '[') |
+                           <:RegularExpressionBackslashSequence:> |
+                           <:RegularExpressionClass:>
+
+
+RegularExpressionBackslashSequence ::= '\' <:RegularExpressionNonTerminator:>
+RegularExpressionNonTerminator    ::= <:SourceCharacter:> - <:LineTerminator:>
+RegularExpressionClass                    ::= '[' <:RegularExpressionClassChars:> ']'
+RegularExpressionClassChars       ::= <:RegularExpressionClassChar:>+
+RegularExpressionClassChar        ::= <:RegularExpressionNonTerminator:> - ( ']' | '\' ) |
+                                      <:RegularExpressionBackslashSequence:>
+
+RegularExpressionFlags            ::= <:IdentifierPart:> <:RegularExpressionFlags:> | <:IdentifierPart:>
+
+# 11.1 Primary Expressions
+
+PrimaryExpression      ::= <:Identifier:> |
+                           <:Literal:> |
+                           <:ArrayLiteral:> |
+                           <:ObjectLiteral:> |
+                           '(' <S>? <:Expression:> <S>? ')' |
+                           'this'
+
+ArrayLiteral           ::= '[' <S>? <:Elision:>? <S>? ']' |
+                           '[' <S>? <:ElementList:> <S>? ']' |
+                           '[' <S>? <:ElementList:> <S>? ',' <S>? <:Elision:> <S>? ']'
+
+
+ElementList            ::= <:Elision:>? <S>? <:AssignmentExpression:> (<S>? ',' <S>? <:Elision:>? <S>? <:AssignmentExpression:> )*
+Elision                        ::= ',' <S>? <:Elision:> | <S>? ','
+ObjectLiteral          ::= '{' <S>? '}' |
+                           '{' <S>? <:PropertyNameAndValueList:>  <S>? '}' |
+                           '{' <S>? <:PropertyNameAndValueList:>  <S>? ','  <S>? '}'
+
+PropertyNameAndValueList::= <:PropertyAssignment:> ( <S>? ','  <S>? <:PropertyAssignment:>)*
+
+PropertyAssignment     ::= <:PropertyName:>  <S>? ':'  <S>? <:AssignmentExpression:> |
+                           'get'  <S>? <:PropertyName:>  <S>? '(' <S>? ')'  <S>? '{' <S>? <:FunctionBody:>?  <S>? '}' |
+                           'set'  <S>? <:PropertyName:>  <S>? '(' <S>? <:PropertySetParameterList:>  <S>? ')' <S>? '{' <S>? <:FunctionBody:>?  <S>? '}'
+
+
+PropertyName           ::= <:IdentifierName:> |
+                                               <:StringLiteral:> |
+                                               <:NumericLiteral:>
+
+PropertySetParameterList::= <:Identifier:>
+
+
+# 11.2 Left-Hand-Side Expressions
+MemberExpression                               ::= <:MemberExpression:> <S>? '[' <S>? <:Expression:> <S>? ']' |
+                                                                       <:MemberExpression:> '.' <:IdentifierName:> |
+                                                                       'new' <S> <:MemberExpression:> <S>? <:Arguments:> |
+                                                                       <:FunctionExpression:> |
+                                                                       <:PrimaryExpression:>
+
+NewExpression                                  ::= <:NewKeyword:> <S>? <:NewExpression:> |
+                                                                       <:MemberExpression:>
+
+
+CallExpression                                 ::= <:CallExpression:> <:Arguments:> |
+                                                                       <:CallExpression:> <S>? '[' <S>? Expression <S>? ']' |
+                                                                       <:CallExpression:> '.' <:IdentifierName:> |
+                                                                       <:MemberExpression:> <S>? <:Arguments:>
+
+Arguments                                              ::= '(' <S>? ')' |
+                                                               '(' <S>? <:ArgumentList:> <S>? ')'
+ArgumentList                                   ::= <:ArgumentList:> <S>? ',' <S>? <:AssignmentExpression:> |
+                                                                       <:AssignmentExpression:>
+LeftHandSideExpression                 ::= <:CallExpression:> | <:NewExpression:>
+       
+# 11.3 Postfix Expressions
+PostfixOperator        ::= '++' | '--'
+PostfixExpression      ::= <:LeftHandSideExpression:> <:PostfixOperator:>?
+
+# 11.4 Unary Operators
+UnaryOperator              ::= 'delete' | 'void' | 'typeof' | '++' | '--' | '+' | '-' | '~' | '!'
+UnaryExpression                    ::= <S>? <:UnaryOperator:> <S>? <:UnaryExpression:> | <:PostfixExpression:>
+
+
+# 11.5 Multiplicative Operators
+MultiplicativeOperator         ::= '*' | '/' | '%'
+MultiplicativeExpressionOp             ::= <:MultiplicativeExpression:> <S>? <:MultiplicativeOperator:> <S>? <:UnaryExpression:>
+MultiplicativeExpression               ::= <:MultiplicativeExpressionOp:> |
+                                                               <:UnaryExpression:>
+
+
+# 11.6 Additive Operators
+AdditiveOperator                               ::= '+' | '-'
+AdditiveExpressionOp                   ::= <:AdditiveExpression:> <S>? <:AdditiveOperator:> <S>? <:MultiplicativeExpression:>
+AdditiveExpression                             ::= <:AdditiveExpressionOp:> |
+                                                               <:MultiplicativeExpression:>
+
+11.7 Bitwise Shift Operators
+ShiftOperator                                  ::= '>>>' | '<<' | '>>'
+ShiftExpression                                        ::= <:ShiftExpression:> <S>? <:ShiftOperator:> <S>? <:AdditiveExpression:> |
+                                                               <:AdditiveExpression:>
+
+# 11.8 Relational Operators
+RelationalOperatorNoIn         ::= '<=' | '>=' | '<' | '>' | 'instanceof'
+RelationalOperator     ::= <:RelationalOperatorNoIn:> | 'in'
+RelationalExpression   ::= <:RelationalExpression:> <S>? <:RelationalOperator:> <S>? <:ShiftExpression:> |
+                           <:ShiftExpression:>
+RelationalExpressionNoIn::= <:RelationalExpressionNoIn:> <S>? <:RelationalOperatorNoIn:> <S>? <:ShiftExpression:> |
+                           <:ShiftExpression:>
+
+
+# 11.9 Equality Operators
+EqualityOperator       ::= '===' | '==' | '!==' | '!='
+EqualityExpression     ::= <:EqualityExpression:> <S>? <:EqualityOperator:> <S>? <:RelationalExpression:> |
+                           <:RelationalExpression:>
+EqualityExpressionNoIn         ::= <:EqualityExpression:> <S>? <:EqualityOperator:> <S>? <:RelationalExpressionNoIn:> |
+                           <:RelationalExpressionNoIn:>
+
+# 11.10 Binary Bitwise Operators
+BitwiseANDExpression   ::= <:BitwiseANDExpression:> <S>? <:BitwiseANDOperator:> <S>? <:EqualityExpression:> |
+                           <:EqualityExpression:>
+BitwiseANDExpressionNoIn::= <:BitwiseANDExpressionNoIn:> <S>? <:BitwiseANDOperator:> <S>? <:EqualityExpressionNoIn:> |
+                           <:EqualityExpressionNoIn:>
+BitwiseANDOperator     ::= '&'
+
+
+BitwiseXORExpression   ::= <:BitwiseXORExpression:> <S>? <:BitwiseXOROperator:> <S>? <:BitwiseANDExpression:> |
+                           <:BitwiseANDExpression:>
+BitwiseXORExpressionNoIn::= <:BitwiseXORExpressionNoIn:> <S>? <:BitwiseXOROperator:> <S>? <:BitwiseANDExpressionNoIn:> |
+                           <:BitwiseANDExpressionNoIn:>
+BitwiseXOROperator     ::= '^'
+
+BitwiseORExpression    ::= <:BitwiseORExpression:> <S>? <:BitwiseOROperator:> <S>? <:BitwiseXORExpression:> |
+                           <:BitwiseXORExpression:>
+BitwiseORExpressionNoIn::= <:BitwiseORExpressionNoIn:> <S>? <:BitwiseOROperator:> <S>? <:BitwiseXORExpressionNoIn:> |
+                          <:BitwiseXORExpressionNoIn:>
+BitwiseOROperator      ::= '|'
+
+
+
+# 11.11 Binary Logical Operators
+LogicalANDExpression   ::= <:LogicalANDExpression:> <S>? <:LogicalANDOperator:>  <S>? <:BitwiseORExpression:> |
+                           <:BitwiseORExpression:>
+LogicalANDExpressionNoIn::= <:LogicalANDExpressionNoIn:> <S>? <:LogicalANDOperator:>  <S>? <:BitwiseORExpressionNoIn:> |
+                           <:BitwiseORExpressionNoIn:>
+LogicalANDOperator     ::= '&&'
+
+LogicalORExpression    ::= <:LogicalORExpression:> <S>? <:LogicalOROperator:> <S>? <:LogicalANDExpression:> |
+                           <:LogicalANDExpression:>
+LogicalORExpressionNoIn ::= <:LogicalORExpressionNoIn:> <S>? <:LogicalOROperator:> <S>? <:LogicalANDExpressionNoIn:> |
+                           <:LogicalANDExpressionNoIn:> 
+LogicalOROperator      ::= '||'
+
+# 11.12 Conditional Operator ( ? : )
+ConditionalExpression  ::= <:LogicalORExpression:> ( <S>? '?' <S>? <:AssignmentExpression:> <S>? ':' <S>? <:AssignmentExpression:> )?
+ConditionalExpressionNoIn::=<:LogicalORExpressionNoIn:> ( <S>? '?' <S>? <:AssignmentExpression:> <S>? ':' <S>? <:AssignmentExpressionNoIn:> )?
+
+# 11.13 Assignment Operators
+AssignmentExpression   ::= <:LeftHandSideExpression:> <S>? <:AssignmentOperator:> <S>? <:AssignmentExpression:> | <:ConditionalExpression:>
+AssignmentExpressionNoIn::= <:LeftHandSideExpression:> <S>? <:AssignmentOperator:> <S>? <:AssignmentExpressionNoIn:> | <:ConditionalExpressionNoIn:>
+AssignmentOperator     ::= '=' | '*=' | '/=' | '%=' | '+=' | '-=' | '<<=' | '>>=' | '>>>=' | '&=' | '^=' | '|='
+
+
+# 11.14 Comma Operator         ( , )
+Expression             ::= <:AssignmentExpression:> ( <S>? ',' <S>? <:AssignmentExpression:> )*
+ExpressionNoIn         ::= <:AssignmentExpressionNoIn:> ( <S>? ',' <S>? <:AssignmentExpressionNoIn:> )*
+
+
+# 12 Statements
+
+Statement              ::= <:Block:> |
+                           <:Comment:> |
+                           <:VariableStatement:> |
+                           <:EmptyStatement:> |
+                           <:ExpressionStatement:> |
+                           <:IfStatement:> |
+                           <:IterationStatement:> |
+                           <:ContinueStatement:> |
+                           <:BreakStatement:> |
+                           <:ReturnStatement:> |
+                           <:ImportStatement:> |
+                           <:WithStatement:> |
+                           <:LabelledStatement:> |
+                           <:SwitchStatement:> |
+                           <:ThrowStatement:> |
+                           <:TryStatement:> |
+                           <:DebuggerStatement:>
+
+# 12.1 Block
+Block                  ::= '{' <S>? <:StatementList:>? <S>? '}'
+StatementList          ::= (<S>? <:Statement:>)+
+
+# 12.2 Variable Statement
+VariableStatement      ::= 'var' <S>? <:VariableDeclarationList:> (<S>? ';')
+VariableDeclarationList ::= <:VariableDeclaration:> (<S>? ',' <S>? <:VariableDeclaration:> )*
+VariableDeclarationListNoIn::= <:VariableDeclarationNoIn:> (<S>? ',' <S>? <:VariableDeclarationNoIn:> )*
+VariableDeclaration    ::= <:Identifier:> <:Initialiser:>?
+VariableDeclarationNoIn ::= <:Identifier:> <:InitialiserNoIn:>?
+Initialiser            ::= <S>? '=' <S>? <:AssignmentExpression:>
+InitialiserNoIn        ::= <S>? '=' <S>? <:AssignmentExpressionNoIn:>
+
+# 12.3 Empty Statement
+EmptyStatement         ::= <S>? ';'
+
+
+# 12.4 Expression Statement
+ExpressionStatement    ::= (<:Expression:> - ('function' | '{')) (<S>? ';')
+
+12.5 The if Statement
+IfStatement            ::= 'if' <S>? '(' <S>? <:Expression:> <S>? ')'<S>? <:Statement:> <S>? 'else' <S>? <:Statement:> |
+                           'if' <S>? '(' <S>? <:Expression:> <S>? ')'<S>? <:Statement:> 
+
+
+
+
+# 12.6 Iteration Statements
+IterationStatement     ::= 'do' <S>? <:Statement:> <S>? 'while' <S>? '(' <S>? <:Expression:> <S>? ')' (<S>? ';') |
+           'while' <S>? '(' <S>? <:Expression:> <S>? ')' <S>? <:Statement:> |
+           'for' <S>? '(' <S>?'var' <S>? <:VariableDeclarationListNoIn:> <S>? ';' <S>? <:Expression:>? <S>? ';'<S>? <:Expression:>? <S>? ')' <S>? <:Statement:> |
+           'for' <S>? '(' <S>?'var' <S>? <:VariableDeclarationNoIn:> <S>? 'in' <S>? <:Expression:> <S>? ')' <S>?  <:Statement:> |
+           'for' <S>? '(' <S>? <:LeftHandSideExpression:> <S>? 'in' <S>? <:Expression:> <S>? ')' <S>?  <:Statement:> |
+           'for' <S>? '(' <S>? <:ExpressionNoIn:>? <S>? ';' <S>? <:Expression:>? <S>? ';' <S>? <:Expression:>? <S>? ')' <S>? <:Statement:>
+
+
+# 12.7 The continue Statement
+ContinueStatement      ::= ('continue' - 'continue' <:IdentifierPart:>) <WhiteSpace>* <:Identifier:>? (<S>? ';')
+
+
+# 12.8 The break Statement
+BreakStatement         ::= ('break' - 'break' <:IdentifierPart:>)<WhiteSpace>* <:Identifier:>? (<S>? ';')
+
+
+# 12.9 The return Statement
+ReturnStatement                ::= ('return' - 'return' <:IdentifierPart:>) <WhiteSpace>* <:Expression:>? (<S>? ';')
+
+
+# 12.10 The with Statement
+WithStatement          ::= 'with' <S>? '(' <S>? <:Expression:> <S>? ')' <S>? <:Statement:>
+
+
+# 12.11 The switch Statement
+SwitchStatement                ::= 'switch' <S>? '(' <S>? <:Expression:> <S>? ')' <S>? <:CaseBlock:>
+
+CaseBlock              ::= '{' <S>? <:CaseClauses:>? <S>? <:DefaultClause:> <S>? <:CaseClauses:>? <S>? '}' |
+                           '{' <S>? <:CaseClauses:>? <S>? '}'
+
+
+
+CaseClauses            ::= (<S>? <:CaseClause:>)+
+
+CaseClause             ::= 'case' <S>? <:Expression:> <S>? ':' <S>? <:StatementList:>?
+DefaultClause          ::= 'default' <S>? ':' <S>? <:StatementList:>
+
+# 12.12 Labelled Statements
+LabelledStatement      ::= <:Identifier:> <S>? ':' <S>? <:Statement:>
+
+# 12.13 The throw Statement
+ThrowStatement         ::= ('throw' - 'throw' <:IdentifierPart:>) <WhiteSpace>* <:Expression:> (<S>? ';')
+
+12.14 The try Statement
+TryStatement           ::= 'try' <S>? <:Block:> <S>? <:Catch:> <S>? <:Finally:> |
+                           'try' <S>? <:Block:> <S>? <:Catch:> |
+                           'try' <S>? <:Block:> <S>? <:Finally:>
+
+
+Catch                  ::= 'catch' <S>? '(' <:Identifier:> ')' <S>? <:Block:>
+Finally                ::= 'finally' <S>? <:Block:>
+
+# 12.15 The debugger statement
+DebuggerStatement      ::= 'debugger' <S>? ';'
+
+
+# 13 Function Definition
+FunctionDeclaration    ::= ('function'-'function'<:IdentifierPart:>)<S>?<:Identifier:><S>?'('<S>?<:FormalParameterList:>?<S>?')'<S>?'{'<S>?<:FunctionBody:>?<S>?'}'
+FunctionExpression     ::= ('function'-'function'<:IdentifierPart:>)<S>?<:Identifier:>?<S>?'('<S>?<:FormalParameterList:>?<S>?')'<S>?'{'<S>?<:FunctionBody:>?<S>?'}'
+FormalParameterList    ::= <:Identifier:> ( <S>? ',' <S>? <:Identifier:> )*
+FunctionBody           ::= <:SourceElements:>
+
+
+# Other
+ImportStatement        ::= 'import' <:Name:> ( '.' '*' )? (<S>? ';')
+Name                   ::= <:IdentifierName:> ( '.' <:IdentifierName:> )*
+
+
+# 14 Program
+SourceElements                 ::= (<S>? <:SourceElement:>)+
+SourceElement          ::= <:FunctionDeclaration:> |
+                           <:Statement:>
+Program                        ::= <:SourceElements:>?
+
+<:Program:>
index 1a33d4c..45cae73 100644 (file)
@@ -59,9 +59,10 @@ $(OUTDIR)/%.o: $(TESTS_SRCDIR)/%.c
 $(OUTDIR)/rpagen-test : $(OUTDIR)/ecma262.o $(OUTDIR)/rpagen-test.o
        $(CC) $(CFLAGS)  -o $@ $^ $(LIBS)
 
 $(OUTDIR)/rpagen-test : $(OUTDIR)/ecma262.o $(OUTDIR)/rpagen-test.o
        $(CC) $(CFLAGS)  -o $@ $^ $(LIBS)
 
-$(OUTDIR)/rast-test : $(OUTDIR)/ecma262.o $(OUTDIR)/rast-test.o
+$(OUTDIR)/rast-test : $(OUTDIR)/astecma262.o $(OUTDIR)/rast-test.o
        $(CC) $(CFLAGS)  -o $@ $^ $(LIBS)
 
        $(CC) $(CFLAGS)  -o $@ $^ $(LIBS)
 
+
 $(OUTDIR)/%: $(TESTS_SRCDIR)/%.c
        + $(CC) $(CFLAGS) -o $(OUTDIR)/$* $(TESTS_SRCDIR)/$*.c $(LIBS) $(INCLUDE)
 
 $(OUTDIR)/%: $(TESTS_SRCDIR)/%.c
        + $(CC) $(CFLAGS) -o $(OUTDIR)/$* $(TESTS_SRCDIR)/$*.c $(LIBS) $(INCLUDE)
 
index e1a9fa6..518493d 100644 (file)
@@ -35,32 +35,6 @@ static int verboseinfo = 0;
 static int compileonly = 0;
 
 
 static int compileonly = 0;
 
 
-rastcompiler_t *r_astcompiler_create()
-{
-       rastcompiler_t *aco;
-
-       aco = r_malloc(sizeof(*aco));
-       r_memset(aco, 0, sizeof(*aco));
-       aco->gc = r_gc_create();
-       return aco;
-}
-
-
-void r_astcompiler_destroy(rastcompiler_t *aco)
-{
-       if (aco) {
-               r_object_destroy((robject_t*)aco->gc);
-       }
-       r_free(aco);
-}
-
-
-void r_astcompiler_dumptree(rastcompiler_t *aco)
-{
-
-}
-
-
 void codegen_unmap_file(rstr_t *buf)
 {
        if (buf) {
 void codegen_unmap_file(rstr_t *buf)
 {
        if (buf) {
@@ -106,17 +80,90 @@ error:
 }
 
 
 }
 
 
-inline int r_astcompiler_dumpnotification(rpa_stat_handle stat, const char *name, void *userdata, const char *input, unsigned int size, unsigned int reason)
+rastcompiler_t *r_astcompiler_create()
+{
+       rastcompiler_t *aco;
+
+       aco = r_malloc(sizeof(*aco));
+       r_memset(aco, 0, sizeof(*aco));
+       aco->gc = r_gc_create();
+       aco->root = r_astnode_create();
+       r_gc_add(aco->gc, (robject_t*)aco->root);
+       return aco;
+}
+
+
+void r_astcompiler_destroy(rastcompiler_t *aco)
+{
+       if (aco) {
+               r_object_destroy((robject_t*)aco->gc);
+       }
+       r_free(aco);
+}
+
+
+void r_astnode_dump(rastnode_t *node, ruint level)
+{
+       ruint i;
+       rastval_t *nodename;
+
+       for (i = 0; i < level; i++)
+               fprintf(stdout, "  ");
+       nodename = (rastval_t*)r_harray_get(node->props, r_harray_lookup_s(node->props, "name"));
+
+       if (node->val.type == R_ASTVAL_ARRAY) {
+               if (nodename) {
+                       fprintf(stdout, "%s: ", nodename->v.str->s.str);
+                       fwrite(node->src.ptr, sizeof(char), node->src.size, stdout);
+                       fprintf(stdout, "\n");
+               }
+
+               for (i = 0; i < r_carray_length(node->val.v.arr); i++) {
+                       rastval_t *val = (rastval_t *)r_carray_slot(node->val.v.arr, i);
+                       r_astnode_dump(val->v.node, level + 1);
+               }
+
+       } else {
+               if (nodename) {
+                       fprintf(stdout, "%s: ", nodename->v.str->s.str);
+               }
+               fwrite(node->src.ptr, sizeof(char), node->src.size, stdout);
+               fprintf(stdout, "\n");
+       }
+
+}
+
+
+void r_astnode_propery_set_string(rastnode_t *node, const char *key, rstring_t *str)
+{
+       rastval_t val;
+       R_ASTVAL_SET_STRING(&val, str);
+       r_harray_add_s(node->props, key, &val);
+}
+
+void r_astcompiler_dumptree(rastcompiler_t *aco)
+{
+       r_astnode_dump(aco->root, 0);
+}
+
+
+int r_astcompiler_dumpnotification(rpa_stat_handle stat, const char *name, void *userdata, const char *input, unsigned int size, unsigned int reason)
 {
        rastcompiler_t *aco = (rastcompiler_t *)userdata;
 
 {
        rastcompiler_t *aco = (rastcompiler_t *)userdata;
 
+       if (reason & RPA_REASON_START)
+               fprintf(stdout, "START ");
+       if (reason & RPA_REASON_MATCHED)
+               fprintf(stdout, "MATCHED ");
+       if (reason & RPA_REASON_END)
+               fprintf(stdout, "END ");
        fprintf(stdout, "%s: ", name);
        fprintf(stdout, "\n");
        return size;
 }
 
 
        fprintf(stdout, "%s: ", name);
        fprintf(stdout, "\n");
        return size;
 }
 
 
-inline int r_astcompiler_notify(rpa_stat_handle stat, const char *name, void *userdata, const char *input, unsigned int size, unsigned int reason)
+int r_astcompiler_notify(rpa_stat_handle stat, const char *name, void *userdata, const char *input, unsigned int size, unsigned int reason)
 {
        rastcompiler_t *aco = (rastcompiler_t *)userdata;
 
 {
        rastcompiler_t *aco = (rastcompiler_t *)userdata;
 
@@ -127,11 +174,18 @@ inline int r_astcompiler_notify(rpa_stat_handle stat, const char *name, void *us
                rastnode_t *node = r_astnode_create();
                r_gc_add(aco->gc, (robject_t*)node);
                node->parent = aco->root;
                rastnode_t *node = r_astnode_create();
                r_gc_add(aco->gc, (robject_t*)node);
                node->parent = aco->root;
+               aco->root = node;
        } else if (reason & RPA_REASON_MATCHED) {
        } else if (reason & RPA_REASON_MATCHED) {
-
-
+               rastnode_t *node = aco->root;
+               rstring_t *nodename = r_string_create_from_ansistr(name);
+               r_gc_add(aco->gc, (robject_t*)nodename);
+               r_astnode_propery_set_string(node, "name", nodename);
+               aco->root = node->parent;
+               r_astnode_addchild(aco->root, node);
+               node->src.ptr = (rpointer)input;
+               node->src.size = size;
        } else {
        } else {
-
+               aco->root = aco->root->parent;
        }
 
        return size;
        }
 
        return size;
@@ -215,19 +269,158 @@ end:
 
 
 
 
 
 
-extern char _binary_____________tests_ecma262_rpa_start[];
-extern char _binary_____________tests_ecma262_rpa_end[];
-extern unsigned long *_binary_____________tests_ecma262_rpa_size;
+extern char _binary_____________tests_astecma262_rpa_start[];
+extern char _binary_____________tests_astecma262_rpa_end[];
+extern unsigned long *_binary_____________tests_astecma262_rpa_size;
 
 void r_astcompiler_loadrules(rastcompiler_t *aco)
 {
        int ret, line;
 
 void r_astcompiler_loadrules(rastcompiler_t *aco)
 {
        int ret, line;
-       int inputsize = _binary_____________tests_ecma262_rpa_end - _binary_____________tests_ecma262_rpa_start;
-       const char *buffer = _binary_____________tests_ecma262_rpa_start;
+       int inputsize = _binary_____________tests_astecma262_rpa_end - _binary_____________tests_astecma262_rpa_start;
+       const char *buffer = _binary_____________tests_astecma262_rpa_start;
        const char *pattern = buffer;
 
        rpa_dbex_open(aco->dbex);
        const char *pattern = buffer;
 
        rpa_dbex_open(aco->dbex);
-       rpa_dbex_add_callback(aco->dbex, ".*", RPA_REASON_ALL, r_astcompiler_notify, aco);
+       rpa_dbex_add_callback_exact(aco->dbex, "Identifier", RPA_REASON_ALL, r_astcompiler_notify, aco);
+
+
+
+       rpa_dbex_add_callback_exact(aco->dbex, "BitwiseANDOp", RPA_REASON_ALL, r_astcompiler_notify, aco);
+       rpa_dbex_add_callback_exact(aco->dbex, "BitwiseXOROp", RPA_REASON_ALL, r_astcompiler_notify, aco);
+       rpa_dbex_add_callback_exact(aco->dbex, "BitwiseOROp", RPA_REASON_ALL, r_astcompiler_notify, aco);
+       rpa_dbex_add_callback_exact(aco->dbex, "AdditiveExpressionOp", RPA_REASON_ALL, r_astcompiler_notify, aco);
+       rpa_dbex_add_callback_exact(aco->dbex, "MultiplicativeExpressionOp", RPA_REASON_ALL, r_astcompiler_notify, aco);
+
+//     rpa_dbex_add_callback_exact(aco->dbex, "AdditiveExpression", RPA_REASON_ALL, r_astcompiler_notify, aco);
+//     rpa_dbex_add_callback_exact(aco->dbex, "MultiplicativeExpression", RPA_REASON_ALL, r_astcompiler_notify, aco);
+
+
+       rpa_dbex_add_callback_exact(aco->dbex, "ShiftExpressionOp", RPA_REASON_ALL, r_astcompiler_notify, aco);
+       rpa_dbex_add_callback_exact(aco->dbex, "EqualityExpressionOp", RPA_REASON_ALL, r_astcompiler_notify, aco);
+       rpa_dbex_add_callback_exact(aco->dbex, "RelationalExpressionOp", RPA_REASON_ALL, r_astcompiler_notify, aco);
+       rpa_dbex_add_callback_exact(aco->dbex, "LogicalOROp", RPA_REASON_ALL, r_astcompiler_notify, aco);
+       rpa_dbex_add_callback_exact(aco->dbex, "LogicalANDOp", RPA_REASON_ALL, r_astcompiler_notify, aco);
+
+       rpa_dbex_add_callback_exact(aco->dbex, "AssignmentOperator", RPA_REASON_ALL, r_astcompiler_notify, aco);
+       rpa_dbex_add_callback_exact(aco->dbex, "EqualityOperator", RPA_REASON_ALL, r_astcompiler_notify, aco);
+       rpa_dbex_add_callback_exact(aco->dbex, "RelationalOperator", RPA_REASON_ALL, r_astcompiler_notify, aco);
+       rpa_dbex_add_callback_exact(aco->dbex, "AdditiveOperator", RPA_REASON_ALL, r_astcompiler_notify, aco);
+       rpa_dbex_add_callback_exact(aco->dbex, "MultiplicativeOperator", RPA_REASON_ALL, r_astcompiler_notify, aco);
+       rpa_dbex_add_callback_exact(aco->dbex, "ShiftOperator", RPA_REASON_ALL, r_astcompiler_notify, aco);
+       rpa_dbex_add_callback_exact(aco->dbex, "BitwiseANDOperator", RPA_REASON_ALL, r_astcompiler_notify, aco);
+       rpa_dbex_add_callback_exact(aco->dbex, "BitwiseXOROperator", RPA_REASON_ALL, r_astcompiler_notify, aco);
+       rpa_dbex_add_callback_exact(aco->dbex, "BitwiseOROperator", RPA_REASON_ALL, r_astcompiler_notify, aco);
+       rpa_dbex_add_callback_exact(aco->dbex, "LogicalANDOperator", RPA_REASON_ALL, r_astcompiler_notify, aco);
+       rpa_dbex_add_callback_exact(aco->dbex, "LogicalOROperator", RPA_REASON_ALL, r_astcompiler_notify, aco);
+       rpa_dbex_add_callback_exact(aco->dbex, "LogicalNotOperator", RPA_REASON_ALL, r_astcompiler_notify, aco);
+       rpa_dbex_add_callback_exact(aco->dbex, "BitwiseNotOperator", RPA_REASON_ALL, r_astcompiler_notify, aco);
+       rpa_dbex_add_callback_exact(aco->dbex, "UnaryOperatorOpcode", RPA_REASON_ALL, r_astcompiler_notify, aco);
+       rpa_dbex_add_callback_exact(aco->dbex, "PrintOp", RPA_REASON_ALL, r_astcompiler_notify, aco);
+
+
+       rpa_dbex_add_callback_exact(aco->dbex, "PostfixOperator", RPA_REASON_ALL, r_astcompiler_notify, aco);
+       rpa_dbex_add_callback_exact(aco->dbex, "PostfixExpressionOp", RPA_REASON_ALL, r_astcompiler_notify, aco);
+       rpa_dbex_add_callback_exact(aco->dbex, "PrefixExpressionOp", RPA_REASON_ALL, r_astcompiler_notify, aco);
+
+
+       rpa_dbex_add_callback_exact(aco->dbex, "UnaryExpressionOp", RPA_REASON_ALL, r_astcompiler_notify, aco);
+       rpa_dbex_add_callback_exact(aco->dbex, "LogicalNotExpressionOp", RPA_REASON_ALL, r_astcompiler_notify, aco);
+       rpa_dbex_add_callback_exact(aco->dbex, "BitwiseNotExpressionOp", RPA_REASON_ALL, r_astcompiler_notify, aco);
+
+       rpa_dbex_add_callback_exact(aco->dbex, "DecimalIntegerLiteral", RPA_REASON_ALL, r_astcompiler_notify, aco);
+       rpa_dbex_add_callback_exact(aco->dbex, "DecimalNonIntegerLiteral", RPA_REASON_ALL, r_astcompiler_notify, aco);
+       rpa_dbex_add_callback_exact(aco->dbex, "BlockBegin", RPA_REASON_ALL, r_astcompiler_notify, aco);
+       rpa_dbex_add_callback_exact(aco->dbex, "BlockEnd", RPA_REASON_ALL, r_astcompiler_notify, aco);
+
+       rpa_dbex_add_callback_exact(aco->dbex, "DoKeyword", RPA_REASON_ALL, r_astcompiler_notify, aco);
+       rpa_dbex_add_callback_exact(aco->dbex, "IterationDo", RPA_REASON_ALL, r_astcompiler_notify, aco);
+
+       rpa_dbex_add_callback_exact(aco->dbex, "sqstring", RPA_REASON_ALL, r_astcompiler_notify, aco);
+       rpa_dbex_add_callback_exact(aco->dbex, "dqstring", RPA_REASON_ALL, r_astcompiler_notify, aco);
+       rpa_dbex_add_callback_exact(aco->dbex, "DoubleStringCharacters", RPA_REASON_ALL, r_astcompiler_notify, aco);
+       rpa_dbex_add_callback_exact(aco->dbex, "SingleStringCharacters", RPA_REASON_ALL, r_astcompiler_notify, aco);
+       rpa_dbex_add_callback_exact(aco->dbex, "Program", RPA_REASON_ALL, r_astcompiler_notify, aco);
+       rpa_dbex_add_callback_exact(aco->dbex, "Initialiser", RPA_REASON_ALL, r_astcompiler_notify, aco);
+       rpa_dbex_add_callback_exact(aco->dbex, "AssignmentExpressionOp", RPA_REASON_ALL, r_astcompiler_notify, aco);
+
+       rpa_dbex_add_callback_exact(aco->dbex, "VariableAllocate", RPA_REASON_ALL, r_astcompiler_notify, aco);
+       rpa_dbex_add_callback_exact(aco->dbex, "VariableAllocateAndInit", RPA_REASON_ALL, r_astcompiler_notify, aco);
+
+       rpa_dbex_add_callback_exact(aco->dbex, "ReturnOp", RPA_REASON_ALL, r_astcompiler_notify, aco);
+
+//     rpa_dbex_add_callback_exact(aco->dbex, "SwiId", RPA_REASON_ALL, r_astcompiler_notify, aco);
+//     rpa_dbex_add_callback_exact(aco->dbex, "SwiIdExist", RPA_REASON_ALL, r_astcompiler_notify, aco);
+
+       rpa_dbex_add_callback_exact(aco->dbex, "PostfixExpressionValOp", RPA_REASON_ALL, r_astcompiler_notify, aco);
+       rpa_dbex_add_callback_exact(aco->dbex, "LeftHandSideExpressionPush", RPA_REASON_ALL, r_astcompiler_notify, aco);
+
+       ////////////////
+
+       rpa_dbex_add_callback_exact(aco->dbex, "ThisOp", RPA_REASON_ALL, r_astcompiler_notify, aco);
+       rpa_dbex_add_callback_exact(aco->dbex, "IdentifierOp", RPA_REASON_ALL, r_astcompiler_notify, aco);
+       rpa_dbex_add_callback_exact(aco->dbex, "MemberIdentifierNameOp", RPA_REASON_ALL, r_astcompiler_notify, aco);
+       rpa_dbex_add_callback_exact(aco->dbex, "MemberExpressionBaseOp", RPA_REASON_ALL, r_astcompiler_notify, aco);
+       rpa_dbex_add_callback_exact(aco->dbex, "MemberExpressionIndexOp", RPA_REASON_ALL, r_astcompiler_notify, aco);
+       rpa_dbex_add_callback_exact(aco->dbex, "MemberExpressionNameOp", RPA_REASON_ALL, r_astcompiler_notify, aco);
+       rpa_dbex_add_callback_exact(aco->dbex, "CallExpressionNameOp", RPA_REASON_ALL, r_astcompiler_notify, aco);
+       rpa_dbex_add_callback_exact(aco->dbex, "CallExpressionBaseOp", RPA_REASON_ALL, r_astcompiler_notify, aco);
+       rpa_dbex_add_callback_exact(aco->dbex, "CallExpressionIndexOp", RPA_REASON_ALL, r_astcompiler_notify, aco);
+       rpa_dbex_add_callback_exact(aco->dbex, "AddressLeftHandSideExpression", RPA_REASON_ALL, r_astcompiler_notify, aco);
+
+       ////////////////
+
+
+       rpa_dbex_add_callback_exact(aco->dbex, "ConditionalExpression", RPA_REASON_ALL, r_astcompiler_notify, aco);
+       rpa_dbex_add_callback_exact(aco->dbex, "NewArrayExpressionOp", RPA_REASON_ALL, r_astcompiler_notify, aco);
+       rpa_dbex_add_callback_exact(aco->dbex, "compile_error", RPA_REASON_ALL, r_astcompiler_notify, aco);
+
+       rpa_dbex_add_callback_exact(aco->dbex, "ArgumentsOp", RPA_REASON_ALL, r_astcompiler_notify, aco);
+       rpa_dbex_add_callback_exact(aco->dbex, "BracketExpressionOp", RPA_REASON_ALL, r_astcompiler_notify, aco);
+       rpa_dbex_add_callback_exact(aco->dbex, "ValLeftHandSideExpression", RPA_REASON_ALL, r_astcompiler_notify, aco);
+
+       rpa_dbex_add_callback_exact(aco->dbex, "FunctionNameLookupAlloc", RPA_REASON_ALL, r_astcompiler_notify, aco);
+       rpa_dbex_add_callback_exact(aco->dbex, "FunctionName", RPA_REASON_ALL, r_astcompiler_notify, aco);
+       rpa_dbex_add_callback_exact(aco->dbex, "FunctionDeclaration", RPA_REASON_ALL, r_astcompiler_notify, aco);
+       rpa_dbex_add_callback_exact(aco->dbex, "FunctionParameter", RPA_REASON_ALL, r_astcompiler_notify, aco);
+       rpa_dbex_add_callback_exact(aco->dbex, "FunctionCallParameter", RPA_REASON_ALL, r_astcompiler_notify, aco);
+       rpa_dbex_add_callback_exact(aco->dbex, "FunctionCallName", RPA_REASON_ALL, r_astcompiler_notify, aco);
+       rpa_dbex_add_callback_exact(aco->dbex, "CallExpressionOp", RPA_REASON_ALL, r_astcompiler_notify, aco);
+       rpa_dbex_add_callback_exact(aco->dbex, "NewKeyword", RPA_REASON_ALL, r_astcompiler_notify, aco);
+
+       rpa_dbex_add_callback_exact(aco->dbex, "NewExpressionCallName", RPA_REASON_ALL, r_astcompiler_notify, aco);
+       rpa_dbex_add_callback_exact(aco->dbex, "NewExpressionCallOp", RPA_REASON_ALL, r_astcompiler_notify, aco);
+
+
+       rpa_dbex_add_callback_exact(aco->dbex, "IfConditionOp", RPA_REASON_ALL, r_astcompiler_notify, aco);
+       rpa_dbex_add_callback_exact(aco->dbex, "IfOp", RPA_REASON_ALL, r_astcompiler_notify, aco);
+       rpa_dbex_add_callback_exact(aco->dbex, "ElseOp", RPA_REASON_ALL, r_astcompiler_notify, aco);
+       rpa_dbex_add_callback_exact(aco->dbex, "IfElseOp", RPA_REASON_ALL, r_astcompiler_notify, aco);
+
+       rpa_dbex_add_callback_exact(aco->dbex, "WhileConditionOp", RPA_REASON_ALL, r_astcompiler_notify, aco);
+       rpa_dbex_add_callback_exact(aco->dbex, "IterationWhileOp", RPA_REASON_ALL, r_astcompiler_notify, aco);
+
+       rpa_dbex_add_callback_exact(aco->dbex, "QuestionMarkOp", RPA_REASON_ALL, r_astcompiler_notify, aco);
+       rpa_dbex_add_callback_exact(aco->dbex, "AssignmentExpressionIfTrueOp", RPA_REASON_ALL, r_astcompiler_notify, aco);
+       rpa_dbex_add_callback_exact(aco->dbex, "AssignmentExpressionIfFalseOp", RPA_REASON_ALL, r_astcompiler_notify, aco);
+
+       rpa_dbex_add_callback_exact(aco->dbex, "ForKeyword", RPA_REASON_ALL, r_astcompiler_notify, aco);
+       rpa_dbex_add_callback_exact(aco->dbex, "ForExpressionInitOp", RPA_REASON_END, r_astcompiler_notify, aco);
+       rpa_dbex_add_callback_exact(aco->dbex, "ForExpressionCompareOp", RPA_REASON_END, r_astcompiler_notify, aco);
+       rpa_dbex_add_callback_exact(aco->dbex, "ForExpressionIncrementOp", RPA_REASON_END, r_astcompiler_notify, aco);
+       rpa_dbex_add_callback_exact(aco->dbex, "IterationForOp", RPA_REASON_ALL, r_astcompiler_notify, aco);
+       rpa_dbex_add_callback_exact(aco->dbex, "BreakOp", RPA_REASON_ALL, r_astcompiler_notify, aco);
+       rpa_dbex_add_callback_exact(aco->dbex, "ContinueOp", RPA_REASON_ALL, r_astcompiler_notify, aco);
+
+       rpa_dbex_add_callback_exact(aco->dbex, "SwitchExpressionOp", RPA_REASON_ALL, r_astcompiler_notify, aco);
+       rpa_dbex_add_callback_exact(aco->dbex, "SwitchStatementOp", RPA_REASON_ALL, r_astcompiler_notify, aco);
+       rpa_dbex_add_callback_exact(aco->dbex, "CaseExpressionOp", RPA_REASON_ALL, r_astcompiler_notify, aco);
+       rpa_dbex_add_callback_exact(aco->dbex, "CaseClauseOp", RPA_REASON_ALL, r_astcompiler_notify, aco);
+       rpa_dbex_add_callback_exact(aco->dbex, "DefaultKeywordOp", RPA_REASON_ALL, r_astcompiler_notify, aco);
+       rpa_dbex_add_callback_exact(aco->dbex, "DefaultClauseOp", RPA_REASON_ALL, r_astcompiler_notify, aco);
+
+
+
+//     rpa_dbex_add_callback(aco->dbex, ".*", RPA_REASON_ALL, r_astcompiler_notify, aco);
 
        while ((ret = rpa_dbex_load(aco->dbex, pattern, inputsize)) > 0) {
                inputsize -= ret;
 
        while ((ret = rpa_dbex_load(aco->dbex, pattern, inputsize)) > 0) {
                inputsize -= ret;