compiler/PPCCompilationOptions.st
changeset 529 439c4057517f
parent 524 f6f68d32de73
child 533 666372dbe307
equal deleted inserted replaced
528:ebfddc82b8bb 529:439c4057517f
       
     1 "{ Package: 'stx:goodies/petitparser/compiler' }"
       
     2 
       
     3 "{ NameSpace: Smalltalk }"
       
     4 
       
     5 Object subclass:#PPCCompilationOptions
       
     6 	instanceVariableNames:'options'
       
     7 	classVariableNames:''
       
     8 	poolDictionaries:''
       
     9 	category:'PetitCompiler-Core'
       
    10 !
       
    11 
       
    12 !PPCCompilationOptions class methodsFor:'as yet unclassified'!
       
    13 
       
    14 default
       
    15     ^ self new
       
    16 !
       
    17 
       
    18 new
       
    19     ^ self basicNew 
       
    20         initialize;
       
    21         yourself
       
    22 ! !
       
    23 
       
    24 !PPCCompilationOptions methodsFor:'accessing'!
       
    25 
       
    26 cacheFirstFollow
       
    27     ^ self at: #cacheFirstFollow ifAbsent: true
       
    28 !
       
    29 
       
    30 cacheFirstFollow: value
       
    31     self set: #cacheFirstFollow to: value.
       
    32 !
       
    33 
       
    34 codeGenerator
       
    35     self error: 'deprecated?'.
       
    36     ^ self at: #codeGenerator ifAbsent: PPCCodeGenerator
       
    37 !
       
    38 
       
    39 codeGenerator: value
       
    40     self set: #codeGenerator to: value.
       
    41 !
       
    42 
       
    43 debug
       
    44     ^ self at: #debug ifAbsent: true
       
    45 !
       
    46 
       
    47 debug: value
       
    48     self set: #debug to: value.
       
    49 !
       
    50 
       
    51 detectTokens
       
    52     ^ self at: #detectTokens ifAbsent: true
       
    53 !
       
    54 
       
    55 detectTokens: value
       
    56     self set: #detectTokens to: value.
       
    57 !
       
    58 
       
    59 generate
       
    60     ^ self at: #generate ifAbsent: true
       
    61 !
       
    62 
       
    63 generate: value
       
    64     ^ self set: #generate to: value
       
    65 !
       
    66 
       
    67 guards
       
    68     ^ self at: #guards ifAbsent: true
       
    69 !
       
    70 
       
    71 guards: value
       
    72     self set: #guards to: value.
       
    73 !
       
    74 
       
    75 inline
       
    76     ^ self at: #inline ifAbsent: true
       
    77 !
       
    78 
       
    79 inline: value
       
    80     self set: #inline to: value.
       
    81 !
       
    82 
       
    83 merge
       
    84     ^ self at: #merge ifAbsent: true
       
    85 !
       
    86 
       
    87 merge: value
       
    88     self set: #merge to: value.
       
    89 !
       
    90 
       
    91 parserName
       
    92     ^ self at: #parserName ifAbsent: #PPGeneratedParser 
       
    93 !
       
    94 
       
    95 parserName: value
       
    96     self set: #parserName to: value.
       
    97 !
       
    98 
       
    99 parserSuperclass
       
   100     ^ self at: #parserSuperclass ifAbsent: PPTokenizingCompiledParser
       
   101 !
       
   102 
       
   103 parserSuperclass: value
       
   104     self set: #parserSuperclass to: value.
       
   105 !
       
   106 
       
   107 profile
       
   108     ^ self at: #profile ifAbsent: false
       
   109 !
       
   110 
       
   111 profile: value
       
   112     self set: #profile to: value.
       
   113 !
       
   114 
       
   115 recognizingComponents
       
   116     ^ self at: #recognizingComponents ifAbsent: true
       
   117 !
       
   118 
       
   119 recognizingComponents: value
       
   120     self set: #recognizingComponents to: value.
       
   121 !
       
   122 
       
   123 scannerName
       
   124     ^ self at: #scannerName ifAbsent: #PPGeneratedScanner
       
   125 !
       
   126 
       
   127 scannerName: value
       
   128     self set: #scannerName to: value.
       
   129 !
       
   130 
       
   131 scannerSuperclass
       
   132     ^ self at: #scannerSuperclass ifAbsent: PPCDistinctScanner
       
   133 !
       
   134 
       
   135 scannerSuperclass: value
       
   136     self set: #scannerSuperclass to: value.
       
   137 !
       
   138 
       
   139 specialize
       
   140     ^ self at: #specialize ifAbsent: true
       
   141 !
       
   142 
       
   143 specialize: value
       
   144     self set: #specialize to: value.
       
   145 !
       
   146 
       
   147 tokenize
       
   148     ^ self at: #tokenize ifAbsent: true
       
   149 !
       
   150 
       
   151 tokenize: value
       
   152     self set: #tokenize to: value.
       
   153 ! !
       
   154 
       
   155 !PPCCompilationOptions methodsFor:'initialization'!
       
   156 
       
   157 initialize
       
   158     super initialize.
       
   159     options := IdentityDictionary new
       
   160 ! !
       
   161 
       
   162 !PPCCompilationOptions methodsFor:'private'!
       
   163 
       
   164 at: symbol ifAbsent: defaultValue
       
   165     ^ options at: symbol ifAbsent: [ ^ defaultValue  ]
       
   166 !
       
   167 
       
   168 set: symbol to: defaultValue
       
   169     ^ options at: symbol put: defaultValue 
       
   170 ! !
       
   171