compiler/tests/PPCDistinctScannerTest.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Mon, 24 Aug 2015 23:42:53 +0100
changeset 529 439c4057517f
parent 524 f6f68d32de73
child 534 a949c4fe44df
permissions -rw-r--r--
PPCConfiguration refactoring [1/10]: renamed PPCArguments to PPCCompilationOptions Renamed PPCConfiguration>>#arguments/#arguments: to #options/#options:
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
524
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     1
"{ Package: 'stx:goodies/petitparser/compiler/tests' }"
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     2
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     3
"{ NameSpace: Smalltalk }"
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     4
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     5
TestCase subclass:#PPCDistinctScannerTest
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     6
	instanceVariableNames:'configuration scanner'
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     7
	classVariableNames:''
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     8
	poolDictionaries:''
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     9
	category:'PetitCompiler-Tests-Core-Tokenizing'
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    10
!
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    11
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    12
!PPCDistinctScannerTest methodsFor:'as yet unclassified'!
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    13
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    14
aToken
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    15
    ^ 'a' asParser token 
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    16
        name: #token;
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    17
        yourself.
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    18
!
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    19
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    20
barToken
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    21
    ^ 'bar' asParser token 
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    22
        name: #bar;
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    23
        yourself.
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    24
!
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    25
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    26
fooToken
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    27
    ^ 'foo' asParser token 
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    28
        name: #foo;
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    29
        yourself.
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    30
!
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    31
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    32
fooTrimmingToken
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    33
    ^ 'foo' asParser trimmingToken 
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    34
        name: #foo;
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    35
        yourself.
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    36
!
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    37
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    38
idToken
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    39
    ^ #letter asParser plus token 
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    40
        name: #id;
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    41
        yourself.
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    42
!
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    43
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    44
idTrimmingToken
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    45
    ^ #letter asParser plus trimmingToken 
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    46
        name: #id;
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    47
        yourself.
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    48
!
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    49
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    50
overlappingToken
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    51
    ^ 'a' asParser token / 'a' asParser token
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    52
!
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    53
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    54
setUp
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    55
    configuration := PPCConfiguration tokenizing.
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    56
!
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    57
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    58
testConsumeToken
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    59
    | parser |
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    60
    parser := self fooToken, self overlappingToken.
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    61
    parser compileWithConfiguration: configuration.
529
439c4057517f PPCConfiguration refactoring [1/10]: renamed PPCArguments to PPCCompilationOptions
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 524
diff changeset
    62
    scanner := (Smalltalk at: configuration options scannerName) new.
524
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    63
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    64
    scanner stream: 'foobaz' asPetitStream.
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    65
    scanner perform: #'consume_foo'.
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    66
    
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    67
    self assert: scanner position = 3.
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    68
    self assert: scanner resultPosition = 3.
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    69
    self assert: scanner result isNil.
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    70
!
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    71
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    72
testConsumeToken2
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    73
    | parser |
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    74
    parser := self fooToken, self barToken.
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    75
    parser compileWithConfiguration: configuration.
529
439c4057517f PPCConfiguration refactoring [1/10]: renamed PPCArguments to PPCCompilationOptions
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 524
diff changeset
    76
    scanner := (Smalltalk at: configuration options scannerName) new.
524
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    77
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    78
    scanner stream: 'foobar' asPetitStream.
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    79
    scanner perform: #'consume_foo'.
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    80
    
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    81
    self assert: scanner position = 3.
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    82
    self assert: scanner resultPosition = 6.
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    83
    self assert: scanner result = #bar.
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    84
!
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    85
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    86
testScan
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    87
    | parser |
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    88
    parser := self aToken.
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    89
    parser compileWithConfiguration: configuration.
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    90
    
529
439c4057517f PPCConfiguration refactoring [1/10]: renamed PPCArguments to PPCCompilationOptions
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 524
diff changeset
    91
    scanner := (Smalltalk at: configuration options scannerName) new.
524
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    92
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    93
    scanner stream: 'a' asPetitStream.
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    94
    scanner perform: #'scan_token'.
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    95
    
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    96
    self assert: scanner position = 0.
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    97
    self assert: scanner resultPosition = 1.
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    98
    self assert: scanner result = #token.
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    99
!
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   100
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   101
testScan2
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   102
    | parser |
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   103
    parser := self fooToken.
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   104
    parser compileWithConfiguration: configuration.
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   105
    
529
439c4057517f PPCConfiguration refactoring [1/10]: renamed PPCArguments to PPCCompilationOptions
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 524
diff changeset
   106
    scanner := (Smalltalk at: configuration options scannerName) new.
524
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   107
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   108
    scanner stream: 'foo' asPetitStream.
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   109
    scanner perform: #'scan_foo'.
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   110
    
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   111
    self assert: scanner position = 0.
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   112
    self assert: scanner resultPosition = 3.
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   113
    self assert: scanner result = #foo.
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   114
!
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   115
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   116
testScan3
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   117
    | parser |
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   118
    parser := self fooToken.
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   119
    parser compileWithConfiguration: configuration.
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   120
    
529
439c4057517f PPCConfiguration refactoring [1/10]: renamed PPCArguments to PPCCompilationOptions
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 524
diff changeset
   121
    scanner := (Smalltalk at: configuration options scannerName) new.
524
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   122
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   123
    scanner stream: 'bar' asPetitStream.
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   124
    scanner perform: #'scan_foo'.
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   125
    
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   126
    self assert: scanner position = 0.
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   127
    self assert: scanner resultPosition = 0.
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   128
    self assert: scanner result isNil.
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   129
!
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   130
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   131
testScan4
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   132
    | parser |
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   133
    parser := self fooToken, self idToken.
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   134
    parser compileWithConfiguration: configuration.
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   135
    
529
439c4057517f PPCConfiguration refactoring [1/10]: renamed PPCArguments to PPCCompilationOptions
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 524
diff changeset
   136
    scanner := (Smalltalk at: configuration options scannerName) new.
524
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   137
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   138
    scanner stream: 'foothere' asPetitStream.
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   139
    scanner perform: #'scan_foo'.
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   140
    
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   141
    self assert: scanner position = 0.
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   142
    self assert: scanner resultPosition = 3.
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   143
    self assert: scanner result = #foo.
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   144
    
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   145
    scanner perform: #'consume_foo'.
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   146
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   147
    self assert: scanner position = 3.
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   148
    self assert: scanner resultPosition = 8.
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   149
    self assert: scanner result = #id.
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   150
!
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   151
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   152
testSequence
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   153
    | parser result |
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   154
    parser := self fooTrimmingToken, self idTrimmingToken.
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   155
    parser compileWithConfiguration: configuration.
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   156
    
529
439c4057517f PPCConfiguration refactoring [1/10]: renamed PPCArguments to PPCCompilationOptions
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 524
diff changeset
   157
    scanner := (Smalltalk at: configuration options scannerName) new.
524
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   158
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   159
    scanner stream: 'foo there ' asPetitStream.
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   160
    scanner perform: #'foo'.
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   161
    
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   162
    self assert: scanner position = 0.
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   163
    self assert: scanner resultPosition = 3.
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   164
    self assert: scanner stream position = 4.
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   165
    self assert: scanner result = #foo.	
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   166
    
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   167
    result := scanner perform: #'consume_foo'.
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   168
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   169
    self assert: scanner position = 4.
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   170
    self assert: scanner resultPosition = 9.
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   171
    self assert: scanner stream position = 10.
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   172
    self assert: scanner result = #id.
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   173
    
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   174
    self assert: (result isKindOf: PPToken).
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   175
    self assert: result start = 1.
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   176
    self assert: result stop = 3.
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   177
    self assert: result inputValue = 'foo'.
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   178
!
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   179
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   180
testToken
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   181
    | parser |
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   182
    parser := self fooToken, self idTrimmingToken.
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   183
    parser compileWithConfiguration: configuration.
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   184
    
529
439c4057517f PPCConfiguration refactoring [1/10]: renamed PPCArguments to PPCCompilationOptions
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 524
diff changeset
   185
    scanner := (Smalltalk at: configuration options scannerName) new.
524
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   186
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   187
    scanner stream: 'foo there' asPetitStream.
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   188
    scanner perform: #'foo'.
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   189
    
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   190
    self assert: scanner position = 0.
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   191
    self assert: scanner resultPosition = 3.
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   192
    self assert: scanner stream position = 3.
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   193
    self assert: scanner result = #foo.		
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   194
!
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   195
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   196
testTrimmingScan
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   197
    | parser |
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   198
    parser := self fooTrimmingToken, self idTrimmingToken.
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   199
    parser compileWithConfiguration: configuration.
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   200
    
529
439c4057517f PPCConfiguration refactoring [1/10]: renamed PPCArguments to PPCCompilationOptions
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 524
diff changeset
   201
    scanner := (Smalltalk at: configuration options scannerName) new.
524
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   202
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   203
    scanner stream: 'foo there' asPetitStream.
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   204
    scanner perform: #'scan_foo'.
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   205
    
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   206
    self assert: scanner position = 0.
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   207
    self assert: scanner resultPosition = 3.
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   208
    self assert: scanner result = #foo.	
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   209
!
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   210
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   211
testTrimmingToken
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   212
    | parser result |
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   213
    parser := self fooTrimmingToken, self idTrimmingToken.
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   214
    parser compileWithConfiguration: configuration.
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   215
    
529
439c4057517f PPCConfiguration refactoring [1/10]: renamed PPCArguments to PPCCompilationOptions
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 524
diff changeset
   216
    scanner := (Smalltalk at: configuration options scannerName) new.
524
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   217
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   218
    scanner stream: 'foo there' asPetitStream.
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   219
    result := scanner perform: #'foo'.
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   220
    
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   221
    self assert: scanner position = 0.
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   222
    self assert: scanner resultPosition = 3.
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   223
    self assert: scanner stream position = 4.
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   224
    self assert: scanner result = #foo.		
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   225
        
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   226
    self assert: result.
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   227
! !
f6f68d32de73 Merged in PetitCompiler-JanVrany.170, PetitCompiler-Tests-JanKurs.116, PetitCompiler-Extras-Tests-JanKurs.29, PetitCompiler-Benchmarks-JanKurs.19
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   228