compiler/tests/PPCCodeGeneratorTest.st
changeset 524 f6f68d32de73
parent 515 b5316ef15274
child 525 751532c8f3db
equal deleted inserted replaced
515:b5316ef15274 524:f6f68d32de73
    21         profile: true;
    21         profile: true;
    22         codeGenerator: PPCCodeGenerator.
    22         codeGenerator: PPCCodeGenerator.
    23         
    23         
    24     configuration := PPCPluggableConfiguration on: [ :_self | 
    24     configuration := PPCPluggableConfiguration on: [ :_self | 
    25         _self cacheFirstFollow.
    25         _self cacheFirstFollow.
       
    26         _self check.
    26         _self generate.
    27         _self generate.
    27     ].
    28     ].
    28     configuration arguments: arguments.
    29     configuration arguments: arguments.
    29     
       
    30             
       
    31     compiler := PPCCodeGen new.
       
    32     compiler arguments: arguments.
       
    33 
       
    34     visitor := PPCCodeGenerator new.
       
    35     visitor compiler: compiler.
       
    36     visitor arguments: arguments.
       
    37 !
    30 !
    38 
    31 
    39 tearDown
    32 tearDown
    40     | class |
    33     | class |
    41 
    34 
   984     
   977     
   985     self compileTree: node.
   978     self compileTree: node.
   986     
   979     
   987     self assert: parser parse: 'aaa' to: #($a $a $a) end: 3.
   980     self assert: parser parse: 'aaa' to: #($a $a $a) end: 3.
   988     self assert: parser parse: 'ab' to: #( $a ) end: 1.
   981     self assert: parser parse: 'ab' to: #( $a ) end: 1.
   989     self assert: parser parse: 'b' to: #( ) end: 0.
   982     self assert: parser parse: 'b' to: #() end: 0.
       
   983     
       
   984     self assert: parser parse: ''.
       
   985     self assert: result isArray.
       
   986 !
       
   987 
       
   988 testStarNode2
       
   989     node := PPCStarNode new
       
   990         child: ('aa' asParser asCompilerNode);
       
   991         yourself.
       
   992     
       
   993     self compileTree: node.
       
   994     
       
   995     self assert: parser parse: 'aaaa' to: #('aa' 'aa') end: 4.
       
   996     self assert: parser parse: 'aab' to: #( 'aa' ) end: 2.
       
   997     self assert: parser parse: 'a' to: #() end: 0.
   990 !
   998 !
   991 
   999 
   992 testSymbolActionNode
  1000 testSymbolActionNode
   993     node := PPCSymbolActionNode new
  1001     node := PPCSymbolActionNode new
   994         block: #second;
  1002         block: #second;