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