compiler/PPCCompilationContext.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Wed, 26 Aug 2015 23:34:48 +0100
changeset 533 666372dbe307
parent 531 dc3d13c2837d
child 534 a949c4fe44df
permissions -rw-r--r--
PPCConfiguration refactoring: [5/10]: Commented options in PPCCompilationOptions. So it's more clear for what the option is and how to use it. This is a base for user-documentation as options are meant to be set by the end user.

"{ Package: 'stx:goodies/petitparser/compiler' }"

"{ NameSpace: Smalltalk }"

Object subclass:#PPCCompilationContext
	instanceVariableNames:'options configuration parserClass scannerClass'
	classVariableNames:''
	poolDictionaries:''
	category:'PetitCompiler-Core'
!

!PPCCompilationContext class methodsFor:'instance creation'!

new
    "return an initialized instance"

    ^ self basicNew initialize.
! !

!PPCCompilationContext methodsFor:'accessing'!

options
    ^ options
!

options:aPPCCompilationOptions
    options := aPPCCompilationOptions.
!

parserClass
    "Return parser class as PPCClass"

    parserClass isNil ifTrue:[
        parserClass := PPCClass new.
    ].
    ^ parserClass

    "Created: / 24-08-2015 / 23:58:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

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 <jan.vrany@fit.cvut.cz>"
! !

!PPCCompilationContext methodsFor:'initialization'!

initialize
    "Invoked when a new instance is created."

    options := PPCCompilationOptions default.

    "Modified: / 26-08-2015 / 19:49:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !