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