PPLiteralParser.st
changeset 171 eebf3d210c09
parent 35 f34ac42e9496
child 377 6112a403a52d
equal deleted inserted replaced
170:38bf7423a5d4 171:eebf3d210c09
     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 	^ self on: anObject message: anObject printString , ' expected'
    14     |msg|
       
    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'
    15 !
    21 !
    16 
    22 
    17 on: anObject message: aString
    23 on: anObject message: aString
    18 	^ self new initializeOn: anObject message: aString
    24 	^ self new initializeOn: anObject message: aString
       
    25 ! !
       
    26 
       
    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 ] ]
    19 ! !
    31 ! !
    20 
    32 
    21 !PPLiteralParser methodsFor:'accessing'!
    33 !PPLiteralParser methodsFor:'accessing'!
    22 
    34 
    23 literal
    35 literal
    48 ! !
    60 ! !
    49 
    61 
    50 !PPLiteralParser methodsFor:'printing'!
    62 !PPLiteralParser methodsFor:'printing'!
    51 
    63 
    52 printNameOn: aStream
    64 printNameOn: aStream
    53 	super printNameOn: aStream.
    65         super printNameOn: aStream.
    54 	aStream nextPutAll: ', '; print: literal
    66         literal isCharacter ifTrue:[
       
    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         ].
    55 ! !
    72 ! !
    56 
    73 
    57 !PPLiteralParser class methodsFor:'documentation'!
    74 !PPLiteralParser class methodsFor:'documentation'!
    58 
    75 
    59 version
    76 version
    60     ^ '$Header: /cvs/stx/stx/goodies/petitparser/PPLiteralParser.st,v 1.3 2012-05-04 22:04:55 vrany Exp $'
    77     ^ '$Header: /cvs/stx/stx/goodies/petitparser/PPLiteralParser.st,v 1.4 2014-03-04 14:33:03 cg Exp $'
    61 !
    78 !
    62 
    79 
    63 version_CVS
    80 version_CVS
    64     ^ '$Header: /cvs/stx/stx/goodies/petitparser/PPLiteralParser.st,v 1.3 2012-05-04 22:04:55 vrany Exp $'
    81     ^ '$Header: /cvs/stx/stx/goodies/petitparser/PPLiteralParser.st,v 1.4 2014-03-04 14:33:03 cg Exp $'
    65 !
    82 !
    66 
    83 
    67 version_SVN
    84 version_SVN
    68     ^ '§Id: PPLiteralParser.st 2 2010-12-17 18:44:23Z vranyj1 §'
    85     ^ '$Id: PPLiteralParser.st,v 1.4 2014-03-04 14:33:03 cg Exp $'
    69 ! !
    86 ! !
       
    87