author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Wed, 15 Apr 2015 11:28:09 +0100 | |
changeset 422 | 116d2b2af905 |
parent 414 | 0eaf09920532 |
child 438 | 20598d7ce9fa |
permissions | -rw-r--r-- |
391
553a5456963b
Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
1 |
"{ Package: 'stx:goodies/petitparser/compiler' }" |
553a5456963b
Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
2 |
|
422 | 3 |
"{ NameSpace: Smalltalk }" |
4 |
||
391
553a5456963b
Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
5 |
PPCAbstractPredicateNode subclass:#PPCNotCharSetPredicateNode |
553a5456963b
Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
6 |
instanceVariableNames:'' |
553a5456963b
Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
7 |
classVariableNames:'' |
553a5456963b
Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
8 |
poolDictionaries:'' |
553a5456963b
Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
9 |
category:'PetitCompiler-Nodes' |
553a5456963b
Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
10 |
! |
553a5456963b
Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
11 |
|
396
ec569977267a
Fixed PPCGuard>>compileCharacter:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
392
diff
changeset
|
12 |
|
391
553a5456963b
Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
13 |
!PPCNotCharSetPredicateNode methodsFor:'as yet unclassified'! |
553a5456963b
Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
14 |
|
553a5456963b
Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
15 |
asInlined |
553a5456963b
Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
16 |
^ PPCInlineNotCharSetPredicateNode new |
553a5456963b
Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
17 |
predicate: predicate; |
553a5456963b
Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
18 |
name: name; |
553a5456963b
Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
19 |
yourself |
553a5456963b
Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
20 |
! |
553a5456963b
Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
21 |
|
553a5456963b
Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
22 |
bodyOfPredicate: compiler |
553a5456963b
Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
23 |
| classificationId classification | |
553a5456963b
Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
24 |
classification := self extendClassification: predicate classification. |
553a5456963b
Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
25 |
classificationId := (compiler idFor: classification prefixed: #classification). |
553a5456963b
Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
26 |
compiler addConstant: classification as: classificationId. |
553a5456963b
Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
27 |
|
553a5456963b
Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
28 |
compiler addOnLine: '(', classificationId, ' at: context peek asInteger)'. |
553a5456963b
Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
29 |
compiler indent. |
553a5456963b
Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
30 |
compiler add: ' ifTrue: [ self error: '' predicate not expected'' ]'. |
553a5456963b
Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
31 |
compiler add: ' ifFalse: [ nil ].'. |
553a5456963b
Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
32 |
compiler dedent. |
553a5456963b
Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
33 |
! |
553a5456963b
Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
34 |
|
414
0eaf09920532
Merged JK's work on PetitCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
396
diff
changeset
|
35 |
firstCharSet |
0eaf09920532
Merged JK's work on PetitCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
396
diff
changeset
|
36 |
^ firstCharSet := PPCharSetPredicate on: [:e | (predicate value:e) not ] |
0eaf09920532
Merged JK's work on PetitCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
396
diff
changeset
|
37 |
|
391
553a5456963b
Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
38 |
! ! |
553a5456963b
Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
39 |
|
396
ec569977267a
Fixed PPCGuard>>compileCharacter:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
392
diff
changeset
|
40 |
!PPCNotCharSetPredicateNode class methodsFor:'documentation'! |
ec569977267a
Fixed PPCGuard>>compileCharacter:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
392
diff
changeset
|
41 |
|
ec569977267a
Fixed PPCGuard>>compileCharacter:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
392
diff
changeset
|
42 |
version_HG |
ec569977267a
Fixed PPCGuard>>compileCharacter:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
392
diff
changeset
|
43 |
|
ec569977267a
Fixed PPCGuard>>compileCharacter:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
392
diff
changeset
|
44 |
^ '$Changeset: <not expanded> $' |
ec569977267a
Fixed PPCGuard>>compileCharacter:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
392
diff
changeset
|
45 |
! ! |
ec569977267a
Fixed PPCGuard>>compileCharacter:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
392
diff
changeset
|
46 |