56 lines
1.4 KiB
Smalltalk
56 lines
1.4 KiB
Smalltalk
Extension { #name : 'PEGFsa' }
|
|
|
|
{ #category : '*PetitCompiler-GUI' }
|
|
PEGFsa >> gtGraphViewIn: composite [
|
|
<gtInspectorPresentationOrder: 0>
|
|
composite roassal2
|
|
title: 'Graph';
|
|
initializeView: [ RTMondrian new ];
|
|
painting: [ :view |
|
|
self viewGraphOn: view.
|
|
].
|
|
]
|
|
|
|
{ #category : '*PetitCompiler-GUI' }
|
|
PEGFsa >> gtStringViewIn: composite [
|
|
<gtInspectorPresentationOrder: 40>
|
|
|
|
composite text
|
|
title: 'Textual Representation';
|
|
display: [ :fsa | fsa asString ]
|
|
]
|
|
|
|
{ #category : '*PetitCompiler-GUI' }
|
|
PEGFsa >> viewGraphOn: b [
|
|
b shape circle size: 50.
|
|
b shape color: Color gray muchLighter muchLighter.
|
|
b shape withText: #gtName.
|
|
b nodes: (self nonFinalStates).
|
|
|
|
b shape circle size: 50.
|
|
b shape color: Color gray muchLighter.
|
|
b shape withText: #gtName.
|
|
b nodes: (self finalStates).
|
|
|
|
b shape arrowedLine.
|
|
b edges
|
|
connectToAll: [ :state |
|
|
state transitions select: [:t | (self isBackTransition:t) not]
|
|
thenCollect: #destination ]
|
|
labelled: [ :t | (self transitionFrom: t key to: t value) gtName ].
|
|
|
|
b shape arrowedLine.
|
|
b shape color: Color red.
|
|
b edges
|
|
connectToAll: [ :state |
|
|
state transitions select: [:t | (self isBackTransition: t) ]
|
|
thenCollect: #destination ]
|
|
labelled: [ :t | (self transitionFrom: t key to: t value) gtName ].
|
|
|
|
|
|
b layout horizontalTree .
|
|
b layout layout horizontalGap: 30.
|
|
|
|
^ b
|
|
]
|