PPLiteralParser.st
changeset 377 6112a403a52d
parent 171 eebf3d210c09
equal deleted inserted replaced
376:a2656b27cace 377:6112a403a52d
     9 
     9 
    10 
    10 
    11 !PPLiteralParser class methodsFor:'instance creation'!
    11 !PPLiteralParser class methodsFor:'instance creation'!
    12 
    12 
    13 on: anObject
    13 on: anObject
    14     |msg|
    14 	^ self on: anObject message: anObject printString , ' expected'
    15 
       
    16     "portable - does not depend on character to print with a $"
       
    17     msg := anObject isCharacter 
       
    18             ifTrue:[ '$',anObject asString]
       
    19             ifFalse:[ anObject printString ].
       
    20     ^ self on: anObject message: msg , ' expected'
       
    21 !
    15 !
    22 
    16 
    23 on: anObject message: aString
    17 on: anObject message: aString
    24 	^ self new initializeOn: anObject message: aString
    18 	^ self new initializeOn: anObject message: aString
    25 ! !
    19 ! !
    26 
    20 
    27 !PPLiteralParser methodsFor:'*petitanalyzer-matching'!
       
    28 
       
    29 match: aParser inContext: aDictionary seen: anIdentitySet
       
    30 	^ (super match: aParser inContext: aDictionary seen: anIdentitySet) and: [ self literal = aParser literal and: [ self message = aParser message ] ]
       
    31 ! !
       
    32 
    21 
    33 !PPLiteralParser methodsFor:'accessing'!
    22 !PPLiteralParser methodsFor:'accessing'!
    34 
    23 
    35 literal
    24 literal
    36 	"Answer the parsed literal."
    25 	"Answer the parsed literal."
    60 ! !
    49 ! !
    61 
    50 
    62 !PPLiteralParser methodsFor:'printing'!
    51 !PPLiteralParser methodsFor:'printing'!
    63 
    52 
    64 printNameOn: aStream
    53 printNameOn: aStream
    65         super printNameOn: aStream.
    54 	super printNameOn: aStream.
    66         literal isCharacter ifTrue:[
    55 	aStream nextPutAll: ', '; print: literal
    67             "/ portable - does not depend on character-print to print with $
       
    68             aStream nextPutAll: ', $'; print: literal asString
       
    69         ] ifFalse:[
       
    70             aStream nextPutAll: ', '; print: literal
       
    71         ].
       
    72 ! !
    56 ! !
    73 
    57 
    74 !PPLiteralParser class methodsFor:'documentation'!
    58 !PPLiteralParser class methodsFor:'documentation'!
    75 
    59 
    76 version
    60 version