compiler/PPCBridge.st
changeset 391 553a5456963b
child 392 9b297f0d949c
equal deleted inserted replaced
390:17ba167b8ee1 391:553a5456963b
       
     1 "{ Package: 'stx:goodies/petitparser/compiler' }"
       
     2 
       
     3 PPParser subclass:#PPCBridge
       
     4 	instanceVariableNames:'selector'
       
     5 	classVariableNames:''
       
     6 	poolDictionaries:''
       
     7 	category:'PetitCompiler-Core'
       
     8 !
       
     9 
       
    10 PPCBridge comment:''
       
    11 !
       
    12 
       
    13 !PPCBridge class methodsFor:'as yet unclassified'!
       
    14 
       
    15 on: aSymbol
       
    16 	^ self new
       
    17 		selector: aSymbol;
       
    18 		yourself
       
    19 ! !
       
    20 
       
    21 !PPCBridge methodsFor:'as yet unclassified'!
       
    22 
       
    23 call
       
    24 	^ 'self callParser: ', self id, '.'.
       
    25 !
       
    26 
       
    27 selector: aSymbol
       
    28 	selector := aSymbol
       
    29 ! !
       
    30 
       
    31 !PPCBridge methodsFor:'parsing'!
       
    32 
       
    33 parseOn: aPPContext
       
    34 	| retval |
       
    35 	retval := (aPPContext compiledParser) perform: selector.
       
    36 	(aPPContext compiledParser isError) ifTrue: [ 
       
    37 		aPPContext compiledParser clearError.		
       
    38 		^ PPFailure message: 'error' context: aPPContext 
       
    39 	].
       
    40 	^ retval
       
    41 ! !
       
    42