syntax-tree-accessors #2
@ -42,9 +42,8 @@ func (parser *ParsingOperation) parseArgument () (argument Argument, err error)
 | 
				
			|||||||
				return
 | 
									return
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			
 | 
								
 | 
				
			||||||
			declaration := Declaration {
 | 
								declaration := Declaration { }
 | 
				
			||||||
				what: what,
 | 
								declaration.what = what
 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
			declaration.setName(identifier.trail[0])
 | 
								declaration.setName(identifier.trail[0])
 | 
				
			||||||
			declaration.setLocation(argument.Location())
 | 
								declaration.setLocation(argument.Location())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -43,3 +43,18 @@ func (trait nameable) Name () (name string) {
 | 
				
			|||||||
func (trait *nameable) setName (name string) {
 | 
					func (trait *nameable) setName (name string) {
 | 
				
			||||||
	trait.name = name
 | 
						trait.name = name
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// typeable allows a node to have a type.
 | 
				
			||||||
 | 
					type typeable struct {
 | 
				
			||||||
 | 
						what Type
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Type returns the type of the node.
 | 
				
			||||||
 | 
					func (trait typeable) Type () (what Type) {
 | 
				
			||||||
 | 
						return trait.what
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// setType sets the type of the node.
 | 
				
			||||||
 | 
					func (trait *typeable) setType (what Type) () {
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -309,7 +309,7 @@ func (section *TypeSection) ToString (indent int) (output string) {
 | 
				
			|||||||
		"type ",
 | 
							"type ",
 | 
				
			||||||
		section.permission.ToString(), " ",
 | 
							section.permission.ToString(), " ",
 | 
				
			||||||
		section.name, ":",
 | 
							section.name, ":",
 | 
				
			||||||
		section.inherits.ToString())
 | 
							section.what.ToString())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	isComplexInitialization :=
 | 
						isComplexInitialization :=
 | 
				
			||||||
		section.defaultValue.kind == ArgumentKindObjectInitializationValues ||
 | 
							section.defaultValue.kind == ArgumentKindObjectInitializationValues ||
 | 
				
			||||||
 | 
				
			|||||||
@ -62,7 +62,7 @@ type Type struct {
 | 
				
			|||||||
type Declaration struct {
 | 
					type Declaration struct {
 | 
				
			||||||
	locatable
 | 
						locatable
 | 
				
			||||||
	nameable
 | 
						nameable
 | 
				
			||||||
	what Type
 | 
						typeable
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// ObjectInitializationValues represents a list of object member initialization
 | 
					// ObjectInitializationValues represents a list of object member initialization
 | 
				
			||||||
@ -150,8 +150,8 @@ type Argument struct {
 | 
				
			|||||||
type DataSection struct {
 | 
					type DataSection struct {
 | 
				
			||||||
	locatable
 | 
						locatable
 | 
				
			||||||
	nameable
 | 
						nameable
 | 
				
			||||||
 | 
						typeable
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	what       Type
 | 
					 | 
				
			||||||
	permission types.Permission
 | 
						permission types.Permission
 | 
				
			||||||
	value      Argument
 | 
						value      Argument
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -160,8 +160,8 @@ type DataSection struct {
 | 
				
			|||||||
type TypeSection struct {
 | 
					type TypeSection struct {
 | 
				
			||||||
	locatable
 | 
						locatable
 | 
				
			||||||
	nameable
 | 
						nameable
 | 
				
			||||||
 | 
						typeable
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	inherits     Type
 | 
					 | 
				
			||||||
	permission   types.Permission
 | 
						permission   types.Permission
 | 
				
			||||||
	defaultValue Argument
 | 
						defaultValue Argument
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -170,8 +170,8 @@ type TypeSection struct {
 | 
				
			|||||||
type ObjtMember struct {
 | 
					type ObjtMember struct {
 | 
				
			||||||
	locatable
 | 
						locatable
 | 
				
			||||||
	nameable
 | 
						nameable
 | 
				
			||||||
 | 
						typeable
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	what         Type
 | 
					 | 
				
			||||||
	bitWidth     uint64
 | 
						bitWidth     uint64
 | 
				
			||||||
	permission   types.Permission
 | 
						permission   types.Permission
 | 
				
			||||||
	defaultValue Argument
 | 
						defaultValue Argument
 | 
				
			||||||
@ -181,8 +181,8 @@ type ObjtMember struct {
 | 
				
			|||||||
type ObjtSection struct {
 | 
					type ObjtSection struct {
 | 
				
			||||||
	locatable
 | 
						locatable
 | 
				
			||||||
	nameable
 | 
						nameable
 | 
				
			||||||
 | 
						inherits Identifier
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	inherits     Identifier
 | 
					 | 
				
			||||||
	permission   types.Permission
 | 
						permission   types.Permission
 | 
				
			||||||
	members      []ObjtMember
 | 
						members      []ObjtMember
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -198,8 +198,8 @@ type EnumMember struct {
 | 
				
			|||||||
type EnumSection struct {
 | 
					type EnumSection struct {
 | 
				
			||||||
	locatable
 | 
						locatable
 | 
				
			||||||
	nameable
 | 
						nameable
 | 
				
			||||||
 | 
						typeable
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	what       Type
 | 
					 | 
				
			||||||
	permission types.Permission
 | 
						permission types.Permission
 | 
				
			||||||
	members    []EnumMember
 | 
						members    []EnumMember
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -31,7 +31,7 @@ func (parser *ParsingOperation) parseTypeSection () (
 | 
				
			|||||||
	if err != nil { return }
 | 
						if err != nil { return }
 | 
				
			||||||
	err = parser.nextToken()
 | 
						err = parser.nextToken()
 | 
				
			||||||
	if err != nil { return }
 | 
						if err != nil { return }
 | 
				
			||||||
	section.inherits, err = parser.parseType()
 | 
						section.what, err = parser.parseType()
 | 
				
			||||||
	if err != nil { return }
 | 
						if err != nil { return }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// parse default values
 | 
						// parse default values
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user