author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Tue, 25 Aug 2015 01:30:32 +0100 | |
changeset 530 | e36906742693 |
child 531 | dc3d13c2837d |
permissions | -rw-r--r-- |
530
e36906742693
PPCConfiguration refactoring: [2/10]: introduced PPCCompilationContext
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
1 |
"{ Package: 'stx:goodies/petitparser/compiler' }" |
e36906742693
PPCConfiguration refactoring: [2/10]: introduced PPCCompilationContext
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
2 |
|
e36906742693
PPCConfiguration refactoring: [2/10]: introduced PPCCompilationContext
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
3 |
"{ NameSpace: Smalltalk }" |
e36906742693
PPCConfiguration refactoring: [2/10]: introduced PPCCompilationContext
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
4 |
|
e36906742693
PPCConfiguration refactoring: [2/10]: introduced PPCCompilationContext
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
5 |
Object subclass:#PPCCompilationContext |
e36906742693
PPCConfiguration refactoring: [2/10]: introduced PPCCompilationContext
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
6 |
instanceVariableNames:'parserClass scannerClass' |
e36906742693
PPCConfiguration refactoring: [2/10]: introduced PPCCompilationContext
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
7 |
classVariableNames:'' |
e36906742693
PPCConfiguration refactoring: [2/10]: introduced PPCCompilationContext
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
8 |
poolDictionaries:'' |
e36906742693
PPCConfiguration refactoring: [2/10]: introduced PPCCompilationContext
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
9 |
category:'PetitCompiler-Core' |
e36906742693
PPCConfiguration refactoring: [2/10]: introduced PPCCompilationContext
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
10 |
! |
e36906742693
PPCConfiguration refactoring: [2/10]: introduced PPCCompilationContext
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
11 |
|
e36906742693
PPCConfiguration refactoring: [2/10]: introduced PPCCompilationContext
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
12 |
!PPCCompilationContext class methodsFor:'instance creation'! |
e36906742693
PPCConfiguration refactoring: [2/10]: introduced PPCCompilationContext
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
13 |
|
e36906742693
PPCConfiguration refactoring: [2/10]: introduced PPCCompilationContext
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
14 |
new |
e36906742693
PPCConfiguration refactoring: [2/10]: introduced PPCCompilationContext
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
15 |
"return an initialized instance" |
e36906742693
PPCConfiguration refactoring: [2/10]: introduced PPCCompilationContext
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
16 |
|
e36906742693
PPCConfiguration refactoring: [2/10]: introduced PPCCompilationContext
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
17 |
^ self basicNew initialize. |
e36906742693
PPCConfiguration refactoring: [2/10]: introduced PPCCompilationContext
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
18 |
! ! |
e36906742693
PPCConfiguration refactoring: [2/10]: introduced PPCCompilationContext
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
19 |
|
e36906742693
PPCConfiguration refactoring: [2/10]: introduced PPCCompilationContext
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
20 |
!PPCCompilationContext methodsFor:'accessing'! |
e36906742693
PPCConfiguration refactoring: [2/10]: introduced PPCCompilationContext
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
21 |
|
e36906742693
PPCConfiguration refactoring: [2/10]: introduced PPCCompilationContext
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
22 |
parserClass |
e36906742693
PPCConfiguration refactoring: [2/10]: introduced PPCCompilationContext
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
23 |
"Return parser class as PPCClass" |
e36906742693
PPCConfiguration refactoring: [2/10]: introduced PPCCompilationContext
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
24 |
|
e36906742693
PPCConfiguration refactoring: [2/10]: introduced PPCCompilationContext
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
25 |
parserClass isNil ifTrue:[ |
e36906742693
PPCConfiguration refactoring: [2/10]: introduced PPCCompilationContext
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
26 |
parserClass := PPCClass new. |
e36906742693
PPCConfiguration refactoring: [2/10]: introduced PPCCompilationContext
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
27 |
]. |
e36906742693
PPCConfiguration refactoring: [2/10]: introduced PPCCompilationContext
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
28 |
^ parserClass |
e36906742693
PPCConfiguration refactoring: [2/10]: introduced PPCCompilationContext
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
29 |
|
e36906742693
PPCConfiguration refactoring: [2/10]: introduced PPCCompilationContext
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
30 |
"Created: / 24-08-2015 / 23:58:53 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
e36906742693
PPCConfiguration refactoring: [2/10]: introduced PPCCompilationContext
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
31 |
! |
e36906742693
PPCConfiguration refactoring: [2/10]: introduced PPCCompilationContext
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
32 |
|
e36906742693
PPCConfiguration refactoring: [2/10]: introduced PPCCompilationContext
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
33 |
scannerClass |
e36906742693
PPCConfiguration refactoring: [2/10]: introduced PPCCompilationContext
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
34 |
"Return scanner class as PPCClass" |
e36906742693
PPCConfiguration refactoring: [2/10]: introduced PPCCompilationContext
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
35 |
|
e36906742693
PPCConfiguration refactoring: [2/10]: introduced PPCCompilationContext
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
36 |
scannerClass isNil ifTrue:[ |
e36906742693
PPCConfiguration refactoring: [2/10]: introduced PPCCompilationContext
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
37 |
scannerClass := PPCClass new. |
e36906742693
PPCConfiguration refactoring: [2/10]: introduced PPCCompilationContext
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
38 |
"Both parser class and scanner class must share the |
e36906742693
PPCConfiguration refactoring: [2/10]: introduced PPCCompilationContext
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
39 |
same ID generator in order to to use same names |
e36906742693
PPCConfiguration refactoring: [2/10]: introduced PPCCompilationContext
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
40 |
for tokens." |
e36906742693
PPCConfiguration refactoring: [2/10]: introduced PPCCompilationContext
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
41 |
scannerClass idGen: self parserClass idGen |
e36906742693
PPCConfiguration refactoring: [2/10]: introduced PPCCompilationContext
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
42 |
]. |
e36906742693
PPCConfiguration refactoring: [2/10]: introduced PPCCompilationContext
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
43 |
^ scannerClass |
e36906742693
PPCConfiguration refactoring: [2/10]: introduced PPCCompilationContext
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
44 |
|
e36906742693
PPCConfiguration refactoring: [2/10]: introduced PPCCompilationContext
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
45 |
"Created: / 24-08-2015 / 23:59:23 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
e36906742693
PPCConfiguration refactoring: [2/10]: introduced PPCCompilationContext
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
46 |
! ! |
e36906742693
PPCConfiguration refactoring: [2/10]: introduced PPCCompilationContext
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
47 |