diff -r 439c4057517f -r e36906742693 compiler/PPCCompilationContext.st --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/compiler/PPCCompilationContext.st Tue Aug 25 01:30:32 2015 +0100 @@ -0,0 +1,47 @@ +"{ Package: 'stx:goodies/petitparser/compiler' }" + +"{ NameSpace: Smalltalk }" + +Object subclass:#PPCCompilationContext + instanceVariableNames:'parserClass scannerClass' + classVariableNames:'' + poolDictionaries:'' + category:'PetitCompiler-Core' +! + +!PPCCompilationContext class methodsFor:'instance creation'! + +new + "return an initialized instance" + + ^ self basicNew initialize. +! ! + +!PPCCompilationContext methodsFor:'accessing'! + +parserClass + "Return parser class as PPCClass" + + parserClass isNil ifTrue:[ + parserClass := PPCClass new. + ]. + ^ parserClass + + "Created: / 24-08-2015 / 23:58:53 / Jan Vrany " +! + +scannerClass + "Return scanner class as PPCClass" + + scannerClass isNil ifTrue:[ + scannerClass := PPCClass new. + "Both parser class and scanner class must share the + same ID generator in order to to use same names + for tokens." + scannerClass idGen: self parserClass idGen + ]. + ^ scannerClass + + "Created: / 24-08-2015 / 23:59:23 / Jan Vrany " +! ! +