analyzer/PPProcessor.st
changeset 200 4c2367c19e67
child 285 e475ffd31c4b
equal deleted inserted replaced
199:7ee9dd62dcb2 200:4c2367c19e67
       
     1 "{ Package: 'stx:goodies/petitparser/analyzer' }"
       
     2 
       
     3 Object subclass:#PPProcessor
       
     4 	instanceVariableNames:'searches context'
       
     5 	classVariableNames:''
       
     6 	poolDictionaries:''
       
     7 	category:'PetitAnalyzer-Core'
       
     8 !
       
     9 
       
    10 
       
    11 !PPProcessor class methodsFor:'instance creation'!
       
    12 
       
    13 new
       
    14 	^ self basicNew initialize
       
    15 ! !
       
    16 
       
    17 !PPProcessor methodsFor:'initialization'!
       
    18 
       
    19 initialize
       
    20 	super initialize.
       
    21 	searches := OrderedCollection new.
       
    22 	context := Dictionary new
       
    23 ! !
       
    24 
       
    25 !PPProcessor methodsFor:'private'!
       
    26 
       
    27 context
       
    28 	^ context
       
    29 !
       
    30 
       
    31 performRule: aRule on: aParser
       
    32 	context := Dictionary new.
       
    33 	^ aRule performOn: aParser
       
    34 !
       
    35 
       
    36 performRulesOn: aParser
       
    37 	| result |
       
    38 	searches do: [ :rule |
       
    39 		result := self performRule: rule on: aParser.
       
    40 		result notNil ifTrue: [ ^ result ] ].
       
    41 	^ nil
       
    42 ! !
       
    43 
       
    44 !PPProcessor methodsFor:'rules'!
       
    45 
       
    46 addRule: aGrammarRule
       
    47 	searches add: (aGrammarRule setOwner: self)
       
    48 ! !
       
    49 
       
    50 !PPProcessor class methodsFor:'documentation'!
       
    51 
       
    52 version
       
    53     ^ '$Header: /cvs/stx/stx/goodies/petitparser/analyzer/PPProcessor.st,v 1.1 2014-03-04 15:41:40 cg Exp $'
       
    54 !
       
    55 
       
    56 version_CVS
       
    57     ^ '$Header: /cvs/stx/stx/goodies/petitparser/analyzer/PPProcessor.st,v 1.1 2014-03-04 15:41:40 cg Exp $'
       
    58 ! !
       
    59