PPCompositeParserTest.st
changeset 4 90de244a7fa2
parent 0 739fe9b7253e
equal deleted inserted replaced
3:e1b11f74e142 4:90de244a7fa2
     1 "{ Package: 'squeak:petitparser' }"
     1 "{ Package: 'stx:goodies/petitparser' }"
     2 
     2 
     3 PPAbstractParseTest subclass:#PPCompositeParserTest
     3 PPAbstractParseTest subclass:#PPCompositeParserTest
     4 	instanceVariableNames:'parser result'
     4 	instanceVariableNames:'parser result'
     5 	classVariableNames:''
     5 	classVariableNames:''
     6 	poolDictionaries:''
     6 	poolDictionaries:''
    30 	^ PPParserResource current parserAt: self parserClass
    30 	^ PPParserResource current parserAt: self parserClass
    31 ! !
    31 ! !
    32 
    32 
    33 !PPCompositeParserTest methodsFor:'parsing'!
    33 !PPCompositeParserTest methodsFor:'parsing'!
    34 
    34 
    35 fail: aString rule: aSymbol 
    35 fail: aString rule: aSymbol
    36 	| production |
    36 	| production |
    37 	production := self parserInstance
    37 	production := self parserInstance
    38 		productionAt: aSymbol.
    38 		productionAt: aSymbol.
    39 	result := production end 
    39 	result := production end
    40 		parse: aString.
    40 		parse: aString.
    41 	self
    41 	self
    42 		assert: result isPetitFailure
    42 		assert: result isPetitFailure
    43 		description: 'Able to parse ' , aString printString.
    43 		description: 'Able to parse ' , aString printString.
    44 	^ result
    44 	^ result
    45 !
    45 !
    46 
    46 
    47 parse: aString 
    47 parse: aString
    48 	^ self parse: aString rule: #start
    48 	^ self parse: aString rule: #start
    49 !
    49 !
    50 
    50 
    51 parse: aString rule: aSymbol
    51 parse: aString rule: aSymbol
    52 	| production |
    52 	| production |
    84 ! !
    84 ! !
    85 
    85 
    86 !PPCompositeParserTest class methodsFor:'documentation'!
    86 !PPCompositeParserTest class methodsFor:'documentation'!
    87 
    87 
    88 version_SVN
    88 version_SVN
    89     ^ '$Id: PPCompositeParserTest.st,v 1.1 2011-08-18 18:56:17 cg Exp $'
    89     ^ '$Id: PPCompositeParserTest.st,v 1.2 2012-01-13 11:22:50 cg Exp $'
    90 ! !
    90 ! !