compiler/tests/PPCOverlappingTokensTest.st
changeset 529 439c4057517f
parent 525 751532c8f3db
child 534 a949c4fe44df
equal deleted inserted replaced
528:ebfddc82b8bb 529:439c4057517f
     1 "{ Package: 'stx:goodies/petitparser/compiler/tests' }"
     1 "{ Package: 'stx:goodies/petitparser/compiler/tests' }"
     2 
     2 
     3 "{ NameSpace: Smalltalk }"
     3 "{ NameSpace: Smalltalk }"
     4 
     4 
     5 PPAbstractParserTest subclass:#PPCOverlappingTokensTest
     5 PPAbstractParserTest subclass:#PPCOverlappingTokensTest
     6 	instanceVariableNames:'parser result context node arguments configuration fooToken
     6 	instanceVariableNames:'parser result context node options configuration fooToken idToken
     7 		idToken keywordToken p unaryToken assignmentToken'
     7 		keywordToken p unaryToken assignmentToken'
     8 	classVariableNames:''
     8 	classVariableNames:''
     9 	poolDictionaries:''
     9 	poolDictionaries:''
    10 	category:'PetitCompiler-Tests-Core-Tokenizing'
    10 	category:'PetitCompiler-Tests-Core-Tokenizing'
    11 !
    11 !
    12 
    12 
    20     ^ result := super assert: p parse: whatever end: end
    20     ^ result := super assert: p parse: whatever end: end
    21 !
    21 !
    22 
    22 
    23 cleanClass
    23 cleanClass
    24     | parserClass scannerClass |
    24     | parserClass scannerClass |
    25     parserClass := (Smalltalk at: arguments parserName ifAbsent: [nil]).
    25     parserClass := (Smalltalk at: options parserName ifAbsent: [nil]).
    26     parserClass notNil ifTrue:[ 
    26     parserClass notNil ifTrue:[ 
    27         parserClass removeFromSystem
    27         parserClass removeFromSystem
    28     ].
    28     ].
    29 
    29 
    30     scannerClass := (Smalltalk at: arguments scannerName ifAbsent: [nil]).
    30     scannerClass := (Smalltalk at: options scannerName ifAbsent: [nil]).
    31     scannerClass notNil ifTrue:[ 
    31     scannerClass notNil ifTrue:[ 
    32         scannerClass removeFromSystem
    32         scannerClass removeFromSystem
    33     ].
    33     ].
    34 !
    34 !
    35 
    35 
    40 context	
    40 context	
    41     ^ context := PPCProfilingContext new
    41     ^ context := PPCProfilingContext new
    42 !
    42 !
    43 
    43 
    44 setUp
    44 setUp
    45     arguments := PPCArguments default
    45     options := PPCCompilationOptions default
    46         profile: true;
    46         profile: true;
    47         yourself.
    47         yourself.
    48         
    48         
    49     configuration := PPCTokenizingConfiguration new
    49     configuration := PPCTokenizingConfiguration new
    50         arguments: arguments;
    50         options: options;
    51         yourself.
    51         yourself.
    52         
    52         
    53     self cleanClass.
    53     self cleanClass.
    54     
    54     
    55     fooToken := 'foo' asParser token trim name: 'foo'; yourself.
    55     fooToken := 'foo' asParser token trim name: 'foo'; yourself.
    56     idToken := (#word asParser plus) token trim name: 'id'; yourself.
    56     idToken := (#word asParser plus) token trim name: 'id'; yourself.
    57     unaryToken := (#word asParser plus, $: asParser not) token trim name: 'unary'; yourself.
    57     unaryToken := (#word asParser plus, $: asParser not) token trim name: 'unary'; yourself.
    58     keywordToken := (#word asParser plus, $: asParser) token trim name: 'kw'; yourself.
    58     keywordToken := (#word asParser plus, $: asParser) token trim name: 'kw'; yourself.
    59     assignmentToken := (':=' asParser) token trim name: 'assignment'; yourself.	
    59     assignmentToken := (':=' asParser) token trim name: 'assignment'; yourself.
       
    60 
       
    61     "Modified: / 24-08-2015 / 23:40:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    60 !
    62 !
    61 
    63 
    62 tearDown
    64 tearDown
    63     "self cleanClass"
    65     "self cleanClass"
    64 !
    66 !