extensions.st
changeset 58 4af6ce1837b2
parent 4 90de244a7fa2
child 150 24e8d10ff041
equal deleted inserted replaced
57:caf553957d9c 58:4af6ce1837b2
    16 
    16 
    17 - aMagnitude
    17 - aMagnitude
    18     "Return the Character that is <aMagnitude> lower than the receiver.
    18     "Return the Character that is <aMagnitude> lower than the receiver.
    19      Wrap if the resulting value is not a legal Character value. (JS)
    19      Wrap if the resulting value is not a legal Character value. (JS)
    20      claus:
    20      claus:
    21 	modified to return the difference as integer, if the argument
    21         modified to return the difference as integer, if the argument
    22 	is another character. If the argument is a number, a character is
    22         is another character. If the argument is a number, a character is
    23 	returned."
    23         returned."
    24 
    24 
    25     aMagnitude isCharacter ifTrue:[
    25     aMagnitude isCharacter ifTrue:[
    26 	^ asciivalue - aMagnitude asInteger
    26         ^ asciivalue - aMagnitude asInteger
    27     ].
    27     ].
    28     ^ Character codePoint:((asciivalue - aMagnitude asInteger) \\ 16r3FFFFFFF)
    28     ^ Character codePoint:((asciivalue - aMagnitude asInteger) \\ 16r3FFFFFFF)
    29 
    29 
    30     "
    30     "
    31      $z - $a
    31      $z - $a
    44 
    44 
    45 !Character methodsFor:'arithmetic'!
    45 !Character methodsFor:'arithmetic'!
    46 
    46 
    47 ppMinus: aCharacter
    47 ppMinus: aCharacter
    48     "Create a range of characters between the receiver and the argument."
    48     "Create a range of characters between the receiver and the argument."
    49 
    49     
    50     ^ PPPredicateObjectParser between: self and: aCharacter
    50     ^ PPPredicateObjectParser between: self and: aCharacter
    51 
    51 
    52     "Created: / 19-12-2010 / 18:13:19 / Jan Kurs <kurs.jan@post.cz>"
    52     "Created: / 19-12-2010 / 18:13:19 / Jan Kurs <kurs.jan@post.cz>"
    53 ! !
    53 ! !
    54 
    54 
    71 ! !
    71 ! !
    72 
    72 
    73 !PositionableStream methodsFor:'*petitparser-core-converting'!
    73 !PositionableStream methodsFor:'*petitparser-core-converting'!
    74 
    74 
    75 asPetitStream
    75 asPetitStream
    76 	"Some of my subclasses do not use the instance-variables collection, position and readLimit but instead have a completely different internal representation. In these cases just use the super implementation that is inefficient but should work in all cases."
    76         "Some of my subclasses do not use the instance-variables collection, position and readLimit but instead have a completely different internal representation. In these cases just use the super implementation that is inefficient but should work in all cases."
    77 
    77 
    78 	"DUNNO WHY, but on: collection from: position to: last set the start to position -1"
    78         "DUNNO WHY, but on: collection from: position to: last set the start to position -1"
    79 	self breakPoint: #petitparser.
    79         self breakPoint: #petitparser.
    80 
    80 
    81 	^ (collection isNil or: [ position  isNil or: [ readLimit isNil ] ])
    81         ^ (collection isNil or: [ position  isNil or: [ readLimit isNil ] ])
    82 		ifFalse: [ PPStream on: collection from: (position +1) to: readLimit ]
    82                 ifFalse: [ PPStream on: collection from: (position +1) to: readLimit ]
    83 		ifTrue: [ super asPetitStream ]
    83                 ifTrue: [ super asPetitStream ]
    84 
    84 
    85 
    85 
    86 "/        ^ (collection isNil or: [ position isNil or: [ readLimit isNil ] ])
    86 "/        ^ (collection isNil or: [ position isNil or: [ readLimit isNil ] ])
    87 "/                ifFalse: [ PPStream on: collection from: position to: readLimit ]
    87 "/                ifFalse: [ PPStream on: collection from: position to: readLimit ]
    88 "/                ifTrue: [ super asPetitStream ]
    88 "/                ifTrue: [ super asPetitStream ]
   147 ! !
   147 ! !
   148 
   148 
   149 !stx_goodies_petitparser class methodsFor:'documentation'!
   149 !stx_goodies_petitparser class methodsFor:'documentation'!
   150 
   150 
   151 extensionsVersion_CVS
   151 extensionsVersion_CVS
   152     ^ '$Header: /cvs/stx/stx/goodies/petitparser/extensions.st,v 1.3 2012-01-13 11:22:50 cg Exp $'
   152     ^ '$Header: /cvs/stx/stx/goodies/petitparser/extensions.st,v 1.4 2012-05-04 22:14:41 vrany Exp $'
   153 ! !
   153 ! !