SystemOrganization addCategory: #'PetitGui-Core'! !PPChoiceParser methodsFor: '*petitgui-accessing' stamp: 'lr 11/7/2009 15:09'! morphicShapeSeen: aSet depth: anInteger | morph | ^ (anInteger < 1 or: [ aSet includes: self ]) ifTrue: [ super morphicShapeSeen: aSet depth: anInteger ] ifFalse: [ aSet add: self. morph := RectangleMorph new. morph borderWidth: 0; color: Color transparent; layoutPolicy: TableLayout new; cellPositioning: #leftCenter; listDirection: #topToBottom; hResizing: #shrinkWrap; vResizing: #spaceFill; layoutInset: 5; cellInset: 5. self children do: [ :each | morph addMorphBack: (each morphicShapeSeen: aSet depth: anInteger - 1) ]. morph ]! ! !PPEpsilonParser methodsFor: '*petitgui-mondrian' stamp: 'lr 11/6/2009 18:42'! displayName ^ 'epsilon'! ! !PPCompositeParser methodsFor: '*petitgui-accessing' stamp: 'lr 11/6/2009 17:24'! productions | productions | productions := OrderedCollection new. PPCompositeParser instSize + 1 to: self class instSize do: [ :index | productions add: (self instVarAt: index) ]. ^ productions! ! !PPLiteralParser methodsFor: '*petitgui-mondrian' stamp: 'lr 11/7/2009 13:31'! displayName ^ literal asString! ! !PPParser methodsFor: '*petitgui-accessing' stamp: 'lr 11/6/2009 18:31'! displayColor ^ self isUnresolved ifTrue: [ Color red ] ifFalse: [ self isNullable ifTrue: [ Color blue ] ifFalse: [ Color black ] ]! ! !PPParser methodsFor: '*petitgui-accessing' stamp: 'lr 11/6/2009 18:31'! displayName ^ self name isNil ifFalse: [ self name asString ] ifTrue: [ self class name asString ]! ! !PPParser methodsFor: '*petitgui-accessing' stamp: 'lr 11/7/2009 14:55'! morphicShape ^ self morphicShapeSeen: IdentitySet new depth: 2! ! !PPParser methodsFor: '*petitgui-accessing' stamp: 'lr 11/7/2009 13:25'! morphicShapeSeen: aSet depth: anInteger ^ TextMorph new centered; autoFit: true; borderWidth: 1; borderColor: Color black; backgroundColor: Color white; textColor: (self isTerminal ifTrue: [ Color purple ] ifFalse: [ Color blue ]); contents: self displayName; yourself! ! !PPParser methodsFor: '*petitgui-accessing' stamp: 'lr 11/6/2009 16:52'! productions ^ #()! ! !PPSequenceParser methodsFor: '*petitgui-accessing' stamp: 'lr 11/7/2009 15:11'! morphicShapeSeen: aSet depth: anInteger | morph | ^ (anInteger < 1 or: [ aSet includes: self ]) ifTrue: [ super morphicShapeSeen: aSet depth: anInteger ] ifFalse: [ aSet add: self. morph := RectangleMorph new. morph borderWidth: 0; color: Color transparent; layoutPolicy: TableLayout new; cellPositioning: #leftCenter; listDirection: #leftToRight; hResizing: #shrinkWrap; vResizing: #spaceFill. morph addMorphBack: (LineMorph from: 0 @ 0 to: 20 @ 0 color: Color black width: 1) makeForwardArrow. self children do: [ :each | morph addMorphBack: (each morphicShapeSeen: aSet depth: anInteger - 1) ] separatedBy: [ morph addMorphBack: (LineMorph from: 0 @ 0 to: 20 @ 0 color: Color black width: 1) makeForwardArrow ]. morph addMorphBack: ((LineMorph from: 0 @ 0 to: 20 @ 0 color: Color black width: 1) "vResizing: #spaceFill;" makeForwardArrow; yourself). morph ]! ! Object subclass: #PPBrowser instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'PetitGui-Core'! !PPBrowser class methodsFor: 'instance-creation' stamp: 'lr 11/6/2009 16:32'! open ^ self new open! ! !PPBrowser methodsFor: 'as yet unclassified' stamp: 'lr 11/7/2009 14:36'! browserOn: aBrowser aBrowser title: 'PetitParser Browser'. aBrowser column: #parsers; column: [ :col | col row: #production; row: [ :row | row column: #first; column: #follow ] ] span: 2. aBrowser showOn: #parsers; using: [ aBrowser tree format: [ :parser | parser displayName ]; children: [ :parser | parser productions ] ]. aBrowser showOn: #production; from: #parsers -> #selectionPath; using: [ aBrowser text title: 'Source'; when: [ :parsers | parsers size > 1 ]; display: [ :parsers | parsers first class sourceCodeAt: parsers last name asSymbol ]; forSmalltalk: [ :parsers | parsers first class ]. aBrowser morph title: 'Graph'; display: [ :parsers | | morph | morph := ScrollPane new. morph scroller addMorph: parsers last morphicShape. morph ] ]. aBrowser showOn: #first; from: #parsers; using: [ aBrowser list format: [ :parser | parser displayName ]; display: [ :parser | parser firstSet ] ]. aBrowser showOn: #follow; from: #parsers; using: [ aBrowser list format: [ :parser | parser displayName ]; display: [ :parser | parser followSet ] ]! ! !PPBrowser methodsFor: 'as yet unclassified' stamp: 'lr 11/6/2009 16:41'! open | browser | browser := GLMTableLayoutBrowser new. self browserOn: browser. browser openOn: (PPCompositeParser allSubclasses collect: [ :class | class named: class name ])! ! !PPPredicateParser methodsFor: '*petitgui-mondrian' stamp: 'lr 11/7/2009 14:21'! displayName ^ predicateMessage! ! !PPFailingParser methodsFor: '*petitgui-accessing' stamp: 'lr 11/6/2009 18:43'! displayColor ^ Color red! ! !PPFailingParser methodsFor: '*petitgui-accessing' stamp: 'lr 11/6/2009 18:43'! displayName ^ message! ! !PPDelegateParser methodsFor: '*petitgui-accessing' stamp: 'lr 11/7/2009 14:58'! morphicShapeSeen: aSet depth: anInteger aSet add: self. ^ parser morphicShapeSeen: aSet depth: anInteger! ! !PPRepeatingParser methodsFor: '*petitgui-accessing' stamp: 'lr 11/7/2009 14:56'! morphicShapeSeen: aSet depth: anInteger | morph | ^ (anInteger < 1 or: [ aSet includes: self ]) ifTrue: [ super morphicShapeSeen: aSet depth: anInteger ] ifFalse: [ aSet add: self. morph := RectangleMorph new. morph borderWidth: 1; color: Color transparent; layoutPolicy: TableLayout new; listDirection: #leftToRight; wrapCentering: #center; hResizing: #shrinkWrap; vResizing: #shrinkWrap; layoutInset: 0 @ 5. morph addMorphBack: (LineMorph from: 0 @ 0 to: 20 @ 0 color: Color black width: 1) makeForwardArrow. morph addMorphBack: (parser morphicShapeSeen: aSet depth: anInteger - 1). morph addMorphBack: (LineMorph from: 0 @ 0 to: 20 @ 0 color: Color black width: 1) makeForwardArrow. morph ]! !