compiler/tests/extras/PPCSmalltalkParserTests.st
changeset 537 fb212e14d1f4
parent 529 439c4057517f
child 538 16e8536f5cfb
equal deleted inserted replaced
536:548996aca274 537:fb212e14d1f4
    38 compiledParserClassName
    38 compiledParserClassName
    39     "Return the name of the compiled parser"
    39     "Return the name of the compiled parser"
    40 
    40 
    41     ^ (self petitParserClass name , 'C_' , 
    41     ^ (self petitParserClass name , 'C_' , 
    42             "This is bit hacky!!"
    42             "This is bit hacky!!"
    43             ((self compilerConfiguration isKindOf: PPCTokenizingConfiguration) ifTrue:[ 'Tokenizing' ] ifFalse:[ 'Universal' ])) asSymbol
    43             (("This is bit hacky!!" self compiler isKindOf: PPCTokenizingConfiguration) ifTrue:[ 'Tokenizing' ] ifFalse:[ 'Universal' ])) asSymbol
    44 
    44 
    45     "Created: / 29-07-2015 / 16:54:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    45     "Created: / 29-07-2015 / 16:54:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    46 !
    46 !
    47 
    47 
    48 compiledScannerClassName
    48 compiledScannerClassName
    49     "Return the name of the compiled scanner"
    49     "Return the name of the compiled scanner"
    50 
    50 
    51     ^ (self petitParserClass name , 'C_Scanner') asSymbol
    51     ^ (self petitParserClass name , 'C_Scanner') asSymbol
    52 !
    52 !
    53 
    53 
    54 compilerConfiguration
    54 compiler
    55     "Return configuration to use when compiling parser (as instance of PPCConfiguration)"
    55     "Return compiler to use when compiling parser (as instance of PPCConfiguration)"
    56 
    56     
    57     ^ self subclassResponsibility
    57     ^ self subclassResponsibility
    58 
    58 
    59     "Created: / 29-07-2015 / 16:53:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    59     "Created: / 29-07-2015 / 16:53:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    60 !
    60 !
    61 
    61 
    90 
    90 
    91 !PPCSmalltalkParserTests methodsFor:'setup & teardown'!
    91 !PPCSmalltalkParserTests methodsFor:'setup & teardown'!
    92 
    92 
    93 setUpBefore
    93 setUpBefore
    94     "Called before any of my tests is run (when resources are set up)"
    94     "Called before any of my tests is run (when resources are set up)"
    95     | time configuration |
    95     | time compiler |
    96 
    96 
    97     configuration := self compilerConfiguration.
    97     compiler := self compiler.
    98     configuration options parserName: self compiledParserClassName.
    98     compiler options parserName: self compiledParserClassName.
    99     configuration options scannerName: self compiledScannerClassName.	
    99     compiler options scannerName: self compiledScannerClassName.	
   100     
   100     
   101     time := Time millisecondsToRun: [
   101     time := Time millisecondsToRun: [
   102         self petitParser compileWithConfiguration: configuration.
   102         self petitParser compileUsingCompiler:compiler.
   103     ].
   103     ].
   104     Transcript show: self petitParserClass name ; show:' compiled in: '; show: time asString; show: 'ms'; cr.
   104     Transcript show: self petitParserClass name ; show:' compiled in: '; show: time asString; show: 'ms'; cr.
   105 
   105 
   106     "Created: / 29-07-2015 / 16:29:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   106     "Created: / 29-07-2015 / 16:29:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   107     "Modified: / 29-07-2015 / 18:40:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   107     "Modified: / 29-07-2015 / 18:40:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"