Did the same thing but with permissions
This commit is contained in:
parent
3f7c779e2b
commit
e0a04e68e3
@ -4,6 +4,7 @@ import "git.tebibyte.media/arf/arf/types"
|
|||||||
import "git.tebibyte.media/arf/arf/lexer"
|
import "git.tebibyte.media/arf/arf/lexer"
|
||||||
import "git.tebibyte.media/arf/arf/infoerr"
|
import "git.tebibyte.media/arf/arf/infoerr"
|
||||||
|
|
||||||
|
// parseEnumSection parses an enumerated type section.
|
||||||
func (parser *ParsingOperation) parseEnumSection () (
|
func (parser *ParsingOperation) parseEnumSection () (
|
||||||
section *EnumSection,
|
section *EnumSection,
|
||||||
err error,
|
err error,
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package parser
|
package parser
|
||||||
|
|
||||||
import "git.tebibyte.media/arf/arf/file"
|
import "git.tebibyte.media/arf/arf/file"
|
||||||
|
import "git.tebibyte.media/arf/arf/types"
|
||||||
import "git.tebibyte.media/arf/arf/infoerr"
|
import "git.tebibyte.media/arf/arf/infoerr"
|
||||||
|
|
||||||
// locatable allows a tree node to have a location.
|
// locatable allows a tree node to have a location.
|
||||||
@ -21,7 +22,8 @@ func (trait locatable) NewError (
|
|||||||
) (
|
) (
|
||||||
err infoerr.Error,
|
err infoerr.Error,
|
||||||
) {
|
) {
|
||||||
return infoerr.NewError(trait.location, message, kind)
|
err = infoerr.NewError(trait.location, message, kind)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// nameable allows a tree node to have a name.
|
// nameable allows a tree node to have a name.
|
||||||
@ -41,5 +43,16 @@ type typeable struct {
|
|||||||
|
|
||||||
// Type returns the type of the node.
|
// Type returns the type of the node.
|
||||||
func (trait typeable) Type () (what Type) {
|
func (trait typeable) Type () (what Type) {
|
||||||
return trait.what
|
what = trait.what
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// permissionable allows a node to have a permission.
|
||||||
|
type permissionable struct {
|
||||||
|
permission types.Permission
|
||||||
|
}
|
||||||
|
|
||||||
|
func (trait permissionable) Permission () (permission types.Permission) {
|
||||||
|
permission = trait.permission
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package parser
|
package parser
|
||||||
|
|
||||||
import "git.tebibyte.media/arf/arf/file"
|
import "git.tebibyte.media/arf/arf/file"
|
||||||
import "git.tebibyte.media/arf/arf/types"
|
|
||||||
|
|
||||||
// SyntaxTree represents an abstract syntax tree. It covers an entire module. It
|
// SyntaxTree represents an abstract syntax tree. It covers an entire module. It
|
||||||
// can be expected to be syntactically correct, but it might not be semantically
|
// can be expected to be syntactically correct, but it might not be semantically
|
||||||
@ -151,9 +150,9 @@ type DataSection struct {
|
|||||||
locatable
|
locatable
|
||||||
nameable
|
nameable
|
||||||
typeable
|
typeable
|
||||||
|
permissionable
|
||||||
|
|
||||||
permission types.Permission
|
value Argument
|
||||||
value Argument
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TypeSection represents a blind type definition.
|
// TypeSection represents a blind type definition.
|
||||||
@ -161,8 +160,8 @@ type TypeSection struct {
|
|||||||
locatable
|
locatable
|
||||||
nameable
|
nameable
|
||||||
typeable
|
typeable
|
||||||
|
permissionable
|
||||||
|
|
||||||
permission types.Permission
|
|
||||||
defaultValue Argument
|
defaultValue Argument
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -171,9 +170,9 @@ type ObjtMember struct {
|
|||||||
locatable
|
locatable
|
||||||
nameable
|
nameable
|
||||||
typeable
|
typeable
|
||||||
|
permissionable
|
||||||
|
|
||||||
bitWidth uint64
|
bitWidth uint64
|
||||||
permission types.Permission
|
|
||||||
defaultValue Argument
|
defaultValue Argument
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -181,9 +180,9 @@ type ObjtMember struct {
|
|||||||
type ObjtSection struct {
|
type ObjtSection struct {
|
||||||
locatable
|
locatable
|
||||||
nameable
|
nameable
|
||||||
|
permissionable
|
||||||
inherits Identifier
|
inherits Identifier
|
||||||
|
|
||||||
permission types.Permission
|
|
||||||
members []ObjtMember
|
members []ObjtMember
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -199,9 +198,9 @@ type EnumSection struct {
|
|||||||
locatable
|
locatable
|
||||||
nameable
|
nameable
|
||||||
typeable
|
typeable
|
||||||
|
permissionable
|
||||||
|
|
||||||
permission types.Permission
|
members []EnumMember
|
||||||
members []EnumMember
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// FaceBehavior represents a behavior of an interface section.
|
// FaceBehavior represents a behavior of an interface section.
|
||||||
@ -217,9 +216,9 @@ type FaceBehavior struct {
|
|||||||
type FaceSection struct {
|
type FaceSection struct {
|
||||||
locatable
|
locatable
|
||||||
nameable
|
nameable
|
||||||
|
permissionable
|
||||||
inherits Identifier
|
inherits Identifier
|
||||||
|
|
||||||
permission types.Permission
|
|
||||||
behaviors map[string] FaceBehavior
|
behaviors map[string] FaceBehavior
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -270,7 +269,7 @@ type FuncOutput struct {
|
|||||||
type FuncSection struct {
|
type FuncSection struct {
|
||||||
locatable
|
locatable
|
||||||
nameable
|
nameable
|
||||||
permission types.Permission
|
permissionable
|
||||||
|
|
||||||
receiver *Declaration
|
receiver *Declaration
|
||||||
inputs []Declaration
|
inputs []Declaration
|
||||||
|
@ -2,7 +2,6 @@ package parser
|
|||||||
|
|
||||||
import "git.tebibyte.media/arf/arf/types"
|
import "git.tebibyte.media/arf/arf/types"
|
||||||
import "git.tebibyte.media/arf/arf/lexer"
|
import "git.tebibyte.media/arf/arf/lexer"
|
||||||
// import "git.tebibyte.media/arf/arf/infoerr"
|
|
||||||
|
|
||||||
// parseTypeSection parses a blind type definition, meaning it can inherit from
|
// parseTypeSection parses a blind type definition, meaning it can inherit from
|
||||||
// anything including primitives, but cannot define structure.
|
// anything including primitives, but cannot define structure.
|
||||||
|
Reference in New Issue
Block a user