75
|
1 |
"{ Package: 'stx:goodies/petitparser/devtools' }"
|
|
2 |
|
|
3 |
Object subclass:#PPDebugger
|
|
4 |
instanceVariableNames:'indent'
|
|
5 |
classVariableNames:''
|
|
6 |
poolDictionaries:''
|
|
7 |
category:'PetitParser-Debugging'
|
|
8 |
!
|
|
9 |
|
|
10 |
|
|
11 |
!PPDebugger class methodsFor:'instance creation'!
|
|
12 |
|
|
13 |
new
|
|
14 |
"return an initialized instance"
|
|
15 |
|
|
16 |
^ self basicNew initialize.
|
|
17 |
! !
|
|
18 |
|
|
19 |
!PPDebugger methodsFor:'events'!
|
|
20 |
|
|
21 |
enterParser: aPPParser stream: aStream
|
|
22 |
|
|
23 |
indent timesRepeat:[Transcript nextPutAll:' '].
|
|
24 |
Transcript nextPutAll:'{ '.
|
|
25 |
Transcript nextPutAll: aPPParser name ? aPPParser printString.
|
|
26 |
Transcript nextPutAll: ' pos = '; nextPutAll: aStream position.
|
|
27 |
Transcript cr.
|
|
28 |
indent := indent + 1.
|
|
29 |
|
|
30 |
"Created: / 12-03-2012 / 16:41:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
31 |
!
|
|
32 |
|
|
33 |
leaveParser: aPPParser stream: aStream result: result
|
|
34 |
|
|
35 |
indent := indent - 1.
|
|
36 |
indent timesRepeat:[Transcript nextPutAll:' '].
|
|
37 |
Transcript nextPutAll:'} '.
|
|
38 |
Transcript nextPutAll: aPPParser name ? aPPParser printString.
|
|
39 |
Transcript nextPutAll: ' pos = '; nextPutAll: aStream position.
|
|
40 |
Transcript nextPutAll: ' result = '.
|
|
41 |
result isPetitFailure ifTrue:[
|
|
42 |
Transcript nextPutAll: 'FAILURE '.
|
|
43 |
].
|
|
44 |
Transcript nextPutAll: result printString.
|
|
45 |
Transcript cr.
|
|
46 |
|
|
47 |
"Created: / 12-03-2012 / 16:41:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
48 |
! !
|
|
49 |
|
|
50 |
!PPDebugger methodsFor:'initialization'!
|
|
51 |
|
|
52 |
initialize
|
|
53 |
"Invoked when a new instance is created."
|
|
54 |
|
|
55 |
"/ please change as required (and remove this comment)
|
|
56 |
indent := 0.
|
|
57 |
|
|
58 |
"/ super initialize. -- commented since inherited method does nothing
|
|
59 |
|
|
60 |
"Modified: / 12-03-2012 / 16:41:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
61 |
! !
|
|
62 |
|
|
63 |
!PPDebugger class methodsFor:'documentation'!
|
|
64 |
|
|
65 |
version
|
|
66 |
^ '$Header: /cvs/stx/stx/goodies/petitparser/devtools/PPDebugger.st,v 1.1 2012-05-05 14:48:51 vrany Exp $'
|
|
67 |
!
|
|
68 |
|
|
69 |
version_CVS
|
|
70 |
^ '$Header: /cvs/stx/stx/goodies/petitparser/devtools/PPDebugger.st,v 1.1 2012-05-05 14:48:51 vrany Exp $'
|
|
71 |
!
|
|
72 |
|
|
73 |
version_SVN
|
|
74 |
^ '§Id: PPDebugger.st 10 2012-05-04 18:54:13Z vranyj1 §'
|
|
75 |
! !
|