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