compiler/tests/PPCTokenizingTest.st
changeset 518 a6d8b93441b0
parent 516 3b81c9e53352
child 525 751532c8f3db
equal deleted inserted replaced
517:9a7fa841f12e 518:a6d8b93441b0
   371 !
   371 !
   372 
   372 
   373 testCompileTokenComplex4
   373 testCompileTokenComplex4
   374     |  symbol symbolLiteralArray symbolLiteral arrayItem  arrayLiteral |
   374     |  symbol symbolLiteralArray symbolLiteral arrayItem  arrayLiteral |
   375     "based on symbolLiteral symbolLiteralArray in SmalltalkGrammar"
   375     "based on symbolLiteral symbolLiteralArray in SmalltalkGrammar"
   376     
   376 
   377     symbol := PPDelegateParser new.
   377     symbol := PPDelegateParser new.
   378     symbol setParser: 'foo' asParser.
   378     symbol setParser: 'foo' asParser.
   379     symbol name: 'symbol'.
   379     symbol name: 'symbol'.
   380     
   380     
   381     symbolLiteralArray := PPDelegateParser new.
   381     symbolLiteralArray := PPDelegateParser new.
   382     symbolLiteralArray setParser: symbol token.
   382     symbolLiteralArray setParser: symbol token.
   383     symbolLiteralArray name: 'symbolLiteralArray'.
   383     symbolLiteralArray name: 'symbolLiteralArray'.
   384     
   384     
   385     symbolLiteral := PPDelegateParser new.
   385     symbolLiteral := PPDelegateParser new.
   386     symbolLiteral setParser: $# asParser token, symbol token ==> [:e | e].
   386     symbolLiteral setParser: $# asParser token, symbol token ==> [:e | e isNil. e ].
       
   387     "                                                                  ^^^^^^^ "    
       
   388     " This is here to trick Smalltalk/X JIT optimizer which would create
       
   389       a __shared__ arg0-returning block. Because it is __shared__ it won't
       
   390       have a sourceposition filled and hence the inlining would fail.
       
   391       Sigh, there must be a better solution..."
   387     symbolLiteral name: 'symbolLiteral'.
   392     symbolLiteral name: 'symbolLiteral'.
   388     
   393     
   389     arrayLiteral := PPDelegateParser new.
   394     arrayLiteral := PPDelegateParser new.
   390     arrayLiteral setParser: '#(' asParser token, symbolLiteralArray, ')' asParser token.
   395     arrayLiteral setParser: '#(' asParser token, symbolLiteralArray, ')' asParser token.
   391     arrayLiteral name: 'arrayLiteral'.
   396     arrayLiteral name: 'arrayLiteral'.
   394 
   399 
   395     parser := arrayItem compileWithConfiguration: configuration.
   400     parser := arrayItem compileWithConfiguration: configuration.
   396 
   401 
   397     self assert: parser parse: '#(foo)'.
   402     self assert: parser parse: '#(foo)'.
   398     self assert: parser parse: '#foo'.
   403     self assert: parser parse: '#foo'.
       
   404 
       
   405     "Modified (comment): / 17-08-2015 / 23:07:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   399 !
   406 !
   400 
   407 
   401 testCompileTrim
   408 testCompileTrim
   402     parser := 'foo' asParser token trim end compileWithConfiguration: configuration.
   409     parser := 'foo' asParser token trim end compileWithConfiguration: configuration.
   403     
   410