gui/PPParserDebuggerResult.st
changeset 365 5fb1869bd3c7
parent 331 33ef8249a32b
equal deleted inserted replaced
364:96239b58228c 365:5fb1869bd3c7
     8 !
     8 !
     9 
     9 
    10 
    10 
    11 !PPParserDebuggerResult class methodsFor:'instance creation'!
    11 !PPParserDebuggerResult class methodsFor:'instance creation'!
    12 
    12 
       
    13 new
       
    14     ^ self basicNew initialize
       
    15 !
       
    16 
    13 parse: aStream with: parser 
    17 parse: aStream with: parser 
    14 	| root newParser |
    18         | root newParser |
    15 	root := self new.
    19         root := self new.
    16 	newParser := parser transform: [:each |
    20         newParser := parser transform: [:each |
    17 		each name isNil 
    21                 each name isNil 
    18 			ifTrue: [ each ]
    22                         ifTrue: [ each ]
    19 			ifFalse: [
    23                         ifFalse: [
    20 				each >=> [:stream :continuation | 
    24                                 each >=> [:stream :continuation | 
    21 					| result child |
    25                                         | result child |
    22 					child := PPParserDebuggerResult new 
    26                                         child := PPParserDebuggerResult new 
    23 							parser: each;
    27                                                         parser: each;
    24 							parent: root.
    28                                                         parent: root.
    25 					root := root children add: child.
    29                                         root := root children add: child.
    26 					child start: stream position + 1.
    30                                         child start: stream position + 1.
    27 					result := continuation value.
    31                                         result := continuation value.
    28 					child end: stream position.
    32                                         child end: stream position.
    29 					root result: result.
    33                                         root result: result.
    30 					root := root parent.
    34                                         root := root parent.
    31 					result ]]].
    35                                         result ]]].
    32 	newParser parse: aStream.
    36         newParser parse: aStream.
    33 	^ root children first
    37         ^ root children first
    34 ! !
    38 ! !
    35 
    39 
    36 !PPParserDebuggerResult methodsFor:'accessing'!
    40 !PPParserDebuggerResult methodsFor:'accessing'!
    37 
    41 
    38 children
    42 children
   105 ! !
   109 ! !
   106 
   110 
   107 !PPParserDebuggerResult class methodsFor:'documentation'!
   111 !PPParserDebuggerResult class methodsFor:'documentation'!
   108 
   112 
   109 version
   113 version
   110     ^ '$Header: /cvs/stx/stx/goodies/petitparser/gui/PPParserDebuggerResult.st,v 1.1 2014-03-04 21:14:37 cg Exp $'
   114     ^ '$Header: /cvs/stx/stx/goodies/petitparser/gui/PPParserDebuggerResult.st,v 1.2 2014-03-04 23:58:31 cg Exp $'
   111 !
   115 !
   112 
   116 
   113 version_CVS
   117 version_CVS
   114     ^ '$Header: /cvs/stx/stx/goodies/petitparser/gui/PPParserDebuggerResult.st,v 1.1 2014-03-04 21:14:37 cg Exp $'
   118     ^ '$Header: /cvs/stx/stx/goodies/petitparser/gui/PPParserDebuggerResult.st,v 1.2 2014-03-04 23:58:31 cg Exp $'
   115 ! !
   119 ! !
   116 
   120