diff -r 000000000000 -r 739fe9b7253e PPLiteralParser.st --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/PPLiteralParser.st Thu Aug 18 20:56:17 2011 +0200 @@ -0,0 +1,68 @@ +"{ Package: 'squeak:petitparser' }" + +PPParser subclass:#PPLiteralParser + instanceVariableNames:'literal message' + classVariableNames:'' + poolDictionaries:'' + category:'PetitParser-Parsers' +! + +PPLiteralParser comment:'Abstract literal parser that parses some kind of literal type (to be specified by subclasses). +Instance Variables: + literal The literal object to be parsed. + message The error message to be generated. +' +! + + +!PPLiteralParser class methodsFor:'instance creation'! + +on: anObject + ^ self on: anObject message: anObject printString , ' expected' +! + +on: anObject message: aString + ^ self new initializeOn: anObject message: aString +! ! + +!PPLiteralParser methodsFor:'accessing'! + +literal + "Answer the parsed literal." + + ^ literal +! + +message + "Answer the failure message." + + ^ message +! ! + +!PPLiteralParser methodsFor:'initialization'! + +initializeOn: anObject message: aString + literal := anObject. + message := aString +! ! + +!PPLiteralParser methodsFor:'operators'! + +caseInsensitive + "Answer a parser that can parse the receiver case-insensitive." + + self subclassResponsibility +! ! + +!PPLiteralParser methodsFor:'printing'! + +printNameOn: aStream + super printNameOn: aStream. + aStream nextPutAll: ', '; print: literal +! ! + +!PPLiteralParser class methodsFor:'documentation'! + +version_SVN + ^ '$Id: PPLiteralParser.st,v 1.1 2011-08-18 18:56:17 cg Exp $' +! !