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