compiler/tests/PPCOverlappingTokensTest.st
changeset 537 fb212e14d1f4
parent 535 a8feb0f47574
child 538 16e8536f5cfb
equal deleted inserted replaced
536:548996aca274 537:fb212e14d1f4
     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 options configuration fooToken idToken
     6 	instanceVariableNames:'parser result context node options compiler fooToken idToken
     7 		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 !
    32         scannerClass removeFromSystem
    32         scannerClass removeFromSystem
    33     ].
    33     ].
    34 !
    34 !
    35 
    35 
    36 compile: aPPParser
    36 compile: aPPParser
    37     parser := aPPParser compileWithConfiguration: configuration
    37     parser := aPPParser compileUsingCompiler: compiler
       
    38 
       
    39     "Modified: / 07-09-2015 / 10:08:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    38 !
    40 !
    39 
    41 
    40 context	
    42 context	
    41     ^ context := PPCProfilingContext new
    43     ^ context := PPCProfilingContext new
    42 !
    44 !
    43 
    45 
    44 setUp
    46 setUp
    45     options := PPCCompilationOptions default
    47     options := (PPCCompilationOptions default)
    46         profile: true;
    48             profile:true;
    47         tokenize: true;
    49             tokenize:true;
    48         yourself.
    50             yourself.
    49         
    51     compiler := PPCCompiler new.
    50     configuration := PPCConfiguration new.
    52     compiler context options:options.
    51     configuration context options: options.
       
    52         
       
    53     self cleanClass.
    53     self cleanClass.
    54     
    54     fooToken := ('foo' asParser token trim)
    55     fooToken := 'foo' asParser token trim name: 'foo'; yourself.
    55             name:'foo';
    56     idToken := (#word asParser plus) token trim name: 'id'; yourself.
    56             yourself.
    57     unaryToken := (#word asParser plus, $: asParser not) token trim name: 'unary'; yourself.
    57     idToken := ((#word asParser plus) token trim)
    58     keywordToken := (#word asParser plus, $: asParser) token trim name: 'kw'; yourself.
    58             name:'id';
    59     assignmentToken := (':=' asParser) token trim name: 'assignment'; yourself.
    59             yourself.
       
    60     unaryToken := ((#word asParser plus , $: asParser not) token trim)
       
    61             name:'unary';
       
    62             yourself.
       
    63     keywordToken := ((#word asParser plus , $: asParser) token trim)
       
    64             name:'kw';
       
    65             yourself.
       
    66     assignmentToken := ((':=' asParser) token trim)
       
    67             name:'assignment';
       
    68             yourself.
    60 
    69 
    61     "Modified: / 04-09-2015 / 16:21:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    70     "Modified: / 04-09-2015 / 16:21:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    62 !
    71 !
    63 
    72 
    64 tearDown
    73 tearDown