1
|
1 |
"{ Package: 'stx:goodies/smaCC' }"
|
|
2 |
|
|
3 |
"{ NameSpace: SmaCC }"
|
|
4 |
|
|
5 |
SmaCCSymbol subclass:#SmaCCNonTerminalSymbol
|
|
6 |
instanceVariableNames:'productions'
|
|
7 |
classVariableNames:''
|
|
8 |
poolDictionaries:''
|
|
9 |
category:'SmaCC-Parser Generator'
|
|
10 |
!
|
|
11 |
|
|
12 |
SmaCCNonTerminalSymbol comment:'SmaCCNonTerminalSymbol represents a non-terminal symbol in our grammar.
|
|
13 |
|
|
14 |
Instance Variables:
|
|
15 |
productions <SequenceableCollection of: SmaCCRHS> our rhs'' for the symbol'
|
|
16 |
!
|
|
17 |
|
|
18 |
|
|
19 |
!SmaCCNonTerminalSymbol methodsFor:'accessing'!
|
|
20 |
|
|
21 |
addProduction: aRHS
|
|
22 |
productions add: aRHS
|
|
23 |
!
|
|
24 |
|
|
25 |
calculateFirstTerminals
|
|
26 |
| initialSize |
|
|
27 |
initialSize := firstItems size.
|
|
28 |
productions isEmpty
|
|
29 |
ifTrue: [firstItems add: self class empty]
|
|
30 |
ifFalse: [productions do: [:each | firstItems addAll: each firstTerminals]].
|
|
31 |
^initialSize ~= firstItems size
|
|
32 |
!
|
|
33 |
|
|
34 |
positionOf: aRHS
|
|
35 |
^productions indexOf: aRHS
|
|
36 |
!
|
|
37 |
|
|
38 |
productionsDo: aBlock
|
|
39 |
productions do: aBlock
|
|
40 |
!
|
|
41 |
|
|
42 |
size
|
|
43 |
^productions size
|
|
44 |
! !
|
|
45 |
|
|
46 |
!SmaCCNonTerminalSymbol methodsFor:'initialize-release'!
|
|
47 |
|
|
48 |
name: aString
|
|
49 |
super name: aString.
|
|
50 |
productions := OrderedCollection new
|
|
51 |
! !
|
|
52 |
|
|
53 |
!SmaCCNonTerminalSymbol methodsFor:'public'!
|
|
54 |
|
|
55 |
isEmpty
|
|
56 |
^productions isEmpty
|
|
57 |
!
|
|
58 |
|
|
59 |
isTerminal
|
|
60 |
^false
|
|
61 |
! !
|
|
62 |
|
|
63 |
!SmaCCNonTerminalSymbol class methodsFor:'documentation'!
|
|
64 |
|
|
65 |
version
|
|
66 |
^ '$Header: /opt/data/cvs/stx/goodies/smaCC/SmaCC__SmaCCNonTerminalSymbol.st,v 1.1 2006-02-09 21:18:48 vranyj1 Exp $'
|
15
|
67 |
!
|
|
68 |
|
|
69 |
version_SVN
|
|
70 |
^ '$Id$'
|
1
|
71 |
! !
|