# HG changeset patch # User Jan Vrany # Date 1336229331 -7200 # Node ID 11f265240739004bcd4be63c2cc2b0785c281598 # Parent 21381bc66c96e63850f86daf23b7e3509b67dacc initial checkin diff -r 21381bc66c96 -r 11f265240739 devtools/PPDebugger.st --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devtools/PPDebugger.st Sat May 05 16:48:51 2012 +0200 @@ -0,0 +1,75 @@ +"{ Package: 'stx:goodies/petitparser/devtools' }" + +Object subclass:#PPDebugger + instanceVariableNames:'indent' + classVariableNames:'' + poolDictionaries:'' + category:'PetitParser-Debugging' +! + + +!PPDebugger class methodsFor:'instance creation'! + +new + "return an initialized instance" + + ^ self basicNew initialize. +! ! + +!PPDebugger methodsFor:'events'! + +enterParser: aPPParser stream: aStream + + indent timesRepeat:[Transcript nextPutAll:' ']. + Transcript nextPutAll:'{ '. + Transcript nextPutAll: aPPParser name ? aPPParser printString. + Transcript nextPutAll: ' pos = '; nextPutAll: aStream position. + Transcript cr. + indent := indent + 1. + + "Created: / 12-03-2012 / 16:41:35 / Jan Vrany " +! + +leaveParser: aPPParser stream: aStream result: result + + indent := indent - 1. + indent timesRepeat:[Transcript nextPutAll:' ']. + Transcript nextPutAll:'} '. + Transcript nextPutAll: aPPParser name ? aPPParser printString. + Transcript nextPutAll: ' pos = '; nextPutAll: aStream position. + Transcript nextPutAll: ' result = '. + result isPetitFailure ifTrue:[ + Transcript nextPutAll: 'FAILURE '. + ]. + Transcript nextPutAll: result printString. + Transcript cr. + + "Created: / 12-03-2012 / 16:41:38 / Jan Vrany " +! ! + +!PPDebugger methodsFor:'initialization'! + +initialize + "Invoked when a new instance is created." + + "/ please change as required (and remove this comment) + indent := 0. + + "/ super initialize. -- commented since inherited method does nothing + + "Modified: / 12-03-2012 / 16:41:04 / Jan Vrany " +! ! + +!PPDebugger class methodsFor:'documentation'! + +version + ^ '$Header: /cvs/stx/stx/goodies/petitparser/devtools/PPDebugger.st,v 1.1 2012-05-05 14:48:51 vrany Exp $' +! + +version_CVS + ^ '$Header: /cvs/stx/stx/goodies/petitparser/devtools/PPDebugger.st,v 1.1 2012-05-05 14:48:51 vrany Exp $' +! + +version_SVN + ^ '§Id: PPDebugger.st 10 2012-05-04 18:54:13Z vranyj1 §' +! !