|
1 "{ Package: 'stx:goodies/petitparser/compiler/tests/extras' }" |
|
2 |
|
3 "{ NameSpace: Smalltalk }" |
|
4 |
|
5 PPCLRPContainedElement subclass:#PPCLRPMachine |
|
6 instanceVariableNames:'initState name body currentState scope triggeredTransition |
|
7 compareStates compareTransitions' |
|
8 classVariableNames:'' |
|
9 poolDictionaries:'' |
|
10 category:'PetitCompiler-Extras-Tests-LRP' |
|
11 ! |
|
12 |
|
13 |
|
14 !PPCLRPMachine class methodsFor:'instance creation'! |
|
15 |
|
16 name: aString body: anArray |
|
17 |retval| |
|
18 retval := self new. |
|
19 retval name: aString. |
|
20 retval body: anArray. |
|
21 ^retval |
|
22 ! ! |
|
23 |
|
24 !PPCLRPMachine methodsFor:'accessing'! |
|
25 |
|
26 allTransitions |
|
27 ^self body select:[:item | item isKindOf: PPCLRPTransition] |
|
28 ! |
|
29 |
|
30 body |
|
31 ^ body |
|
32 ! |
|
33 |
|
34 body: anObject |
|
35 body := anObject. |
|
36 body do: [ :aBodyElement| aBodyElement container: self ]. |
|
37 ! |
|
38 |
|
39 containerMachine |
|
40 self container isNil |
|
41 ifTrue: [ ^nil ] |
|
42 ifFalse: [ ^self container container ] |
|
43 ! |
|
44 |
|
45 eps |
|
46 ^self body select:[:item | item isMemberOf: PPCLRPEpsilonTransition] |
|
47 ! |
|
48 |
|
49 events |
|
50 ^self body select:[:item | item class = PPCLRPEvent] |
|
51 ! |
|
52 |
|
53 machines |
|
54 ^self body select:[:item | item class = PPCLRPMachine] |
|
55 ! |
|
56 |
|
57 myVarsAndParentVars |
|
58 |
|
59 |recblock | |
|
60 recblock := [ ]. |
|
61 recblock := [ :aMachine| |variables| |
|
62 aMachine ifNil:[ |
|
63 OrderedCollection new. |
|
64 ] ifNotNil: [ |
|
65 variables := recblock value: aMachine containerMachine. |
|
66 variables addAll: (aMachine variables collect:[:aVarNode| aVarNode name]). |
|
67 variables |
|
68 ] |
|
69 ]. |
|
70 |
|
71 ^recblock value: self. |
|
72 |
|
73 ! |
|
74 |
|
75 name |
|
76 ^ name |
|
77 ! |
|
78 |
|
79 name: anObject |
|
80 name := anObject |
|
81 ! |
|
82 |
|
83 ontime |
|
84 ^self body select:[:item | item isMemberOf: PPCLRPTimeoutTransition] |
|
85 ! |
|
86 |
|
87 states |
|
88 ^self body select:[:item | item class = PPCLRPState] |
|
89 ! |
|
90 |
|
91 transitions |
|
92 ^self body select:[:item | item isMemberOf: PPCLRPTransition] |
|
93 ! |
|
94 |
|
95 variables |
|
96 ^self body select:[:item | item class = PPCLRPVariable] |
|
97 ! |
|
98 |
|
99 wildtrans |
|
100 ^self body select:[:item | item class = PPCLRPWildcardTransition] |
|
101 ! ! |
|
102 |
|
103 !PPCLRPMachine methodsFor:'error handing'! |
|
104 |
|
105 onErrorNode: aBlock parser: aPPCLRPParser |
|
106 |
|
107 ^body do: [ :aNode| aNode onErrorNode: aBlock parser: aPPCLRPParser] |
|
108 ! ! |
|
109 |
|
110 !PPCLRPMachine methodsFor:'printing'! |
|
111 |
|
112 printOn: aStream |
|
113 aStream nextPutAll: 'PPCLRPMachine '. |
|
114 aStream nextPutAll: self name. |
|
115 aStream nextPutAll: ' : '. |
|
116 aStream nextPutAll: self body asString. |
|
117 |
|
118 ! ! |
|
119 |
|
120 !PPCLRPMachine methodsFor:'visiting'! |
|
121 |
|
122 acceptVisitor: aPPCLRPNodeVisitor |
|
123 aPPCLRPNodeVisitor visitMachineNode: self. |
|
124 ! ! |
|
125 |
|
126 !PPCLRPMachine class methodsFor:'documentation'! |
|
127 |
|
128 version_HG |
|
129 |
|
130 ^ '$Changeset: <not expanded> $' |
|
131 ! ! |
|
132 |