Java Reference
In-Depth Information
/
Visitor code for Marker 19 on page 302
/
procedure
visit
(EnumDefining enumde f )
typeRe f
new TypeDescriptor( enumType )
45
nextval
0
foreach id enumde f . constantNames do
46
if currentSymbolTable . declaredLocally( id . name )
then
call
47
error
(” Name cannot be redeclared :”
, id . name )
id . type errorType
id . attributesRe f null
else
attr
new Attributes( enumAttributes )
attr . enumType typeRe f
attr . myValue nextval
nextval nextval +
48
1
call currentSymbolTable . enterSymbol( id . name , attr )
id . type typeRe f
id . attributesRe f attr
call typeRe f . appendToConstList( id . name , attr )
49
enumde f . type typeRe f
50
end
Figure 8.23:
visit
method in TypeVisitor for EnumDefining.
EnumDefining
type
constantNames
IdentifierList
. . .
Identifier
Identifier
ids
Figure 8.24: Abstract Syntax Tree for an Enumeration Type
 
 
Search WWH ::




Custom Search