Remove entity participle struct tags

This commit is contained in:
Sasha Koshka 2024-02-05 15:17:59 -05:00
parent decc5939a1
commit f7636ab410
5 changed files with 66 additions and 66 deletions

View File

@ -23,7 +23,7 @@ type Statement interface {
type Variable struct {
// Syntax
Position errors.Position
Name string `parser:" @Ident "`
Name string
// Semantics
Declaration *Declaration
@ -42,8 +42,8 @@ func (this *Variable) String () string {
// expression.
type Declaration struct {
Position errors.Position
Name string `parser:" @Ident "`
Ty Type `parser:" ':' @@ "`
Name string
Ty Type
}
func (*Declaration) expression(){}
func (*Declaration) statement(){}
@ -61,9 +61,9 @@ func (this *Declaration) String () string {
type Call struct {
// Syntax
Position errors.Position
Module string `parser:" (@Ident '::')? "`
Name string `parser:" '[' @Ident "`
Arguments []Expression `parser:" @@* ']' "`
Module string
Name string
Arguments []Expression
// Semantics
Function *Function
@ -92,9 +92,9 @@ func (this *Call) String () string {
type MethodCall struct {
// Syntax
Position errors.Position
Source *Variable `parser:" @@ '.' "`
Name string `parser:" '[' @Ident "`
Arguments []Expression `parser:" @@* ']' "`
Source *Variable
Name string
Arguments []Expression
// Semantics
Method *Method
@ -126,8 +126,8 @@ func (this *MethodCall) String () string {
type Subscript struct {
// Syntax
Position errors.Position
Slice Expression `parser:" '[' '.' @@ "`
Offset Expression `parser:" @@ ']' "`
Slice Expression
Offset Expression
// Semantics
Ty Type
@ -146,9 +146,9 @@ func (this *Subscript) String () string {
type Slice struct {
// Syntax
Position errors.Position
Slice Expression `parser:" '[' '\\\\' @@ "`
Start Expression `parser:" @@? "`
End Expression `parser:" ':' @@? ']' "`
Slice Expression
Start Expression
End Expression
}
func (*Slice) expression(){}
func (*Slice) statement(){}
@ -169,7 +169,7 @@ func (this *Slice) String () string {
// of type Index. A length is never a valid location expression.
type Length struct {
// Syntax
Slice Expression `parser:" '[' '#' @@ ']' "`
Slice Expression
// Semantics
Ty Type
@ -189,7 +189,7 @@ func (this *Length) String () string {
type Dereference struct {
// Syntax
Position errors.Position
Pointer Expression `parser:" '[' '.' @@ ']' "`
Pointer Expression
// Semantics
Ty Type
@ -211,7 +211,7 @@ func (this *Dereference) String () string {
type Reference struct {
// Syntax
Position errors.Position
Value Expression `parser:" '[' '@' @@ ']' "`
Value Expression
// Semantics
Ty Type
@ -228,8 +228,8 @@ func (this *Reference) String () string {
// interface. A value cast is never a valid location expression.
type ValueCast struct {
Position errors.Position
Ty Type `parser:" '[' '~' @@ "`
Value Expression `parser:" @@ ']' "`
Ty Type
Value Expression
}
func (*ValueCast) expression(){}
func (*ValueCast) statement(){}
@ -244,8 +244,8 @@ func (this *ValueCast) String () string {
// location expression.
type BitCast struct {
Position errors.Position
Ty Type `parser:" '[' '~~' @@ "`
Value Expression `parser:" @@ ']' "`
Ty Type
Value Expression
}
func (*BitCast) expression(){}
func (*BitCast) statement(){}
@ -261,8 +261,8 @@ func (this *BitCast) String () string {
type Operation struct {
// Syntax
Position errors.Position
Operator Operator `parser:" '[' @('++' | '+' | '--' | '-' | '*' | '/' | '%' | '!!' | '||' | '&&' | '^^' | '!' | '|' | '&' | '^' | '<<' | '>>' | '<' | '>' | '<=' | '>=' | '=') "`
Arguments []Expression `parser:" @@+ ']' "`
Operator Operator
Arguments []Expression
// Semantics
Ty Type
@ -286,7 +286,7 @@ func (this *Operation) String () string {
type Block struct {
// Syntax
Position errors.Position
Steps []Statement `parser:" '{' @@* '}' "`
Steps []Statement
// Semantics
Ty Type
@ -313,8 +313,8 @@ func (this *Block) String () string {
type MemberAccess struct {
// Syntax
Position errors.Position
Source *Variable `parser:" @@ "`
Member string `parser:" '.' @Ident "`
Source *Variable
Member string
// Semantics
Ty Type
@ -334,9 +334,9 @@ func (this *MemberAccess) String () string {
type IfElse struct {
// Syntax
Position errors.Position
Condition Expression `parser:" 'if' @@ "`
True Expression `parser:" 'then' @@ "`
False Expression `parser:" ('else' @@)? "`
Condition Expression
True Expression
False Expression
// Semantics
Ty Type
@ -362,7 +362,7 @@ func (this *IfElse) String () string {
type Loop struct {
// Syntax
Position errors.Position
Body Expression `parser:" 'loop' @@ "`
Body Expression
// Semantics
Ty Type
@ -379,7 +379,7 @@ func (this *Loop) String () string {
type Break struct {
// Syntax
Position errors.Position
Value Expression `parser:" '[' 'break' @@? ']' "`
Value Expression
// Semantics
Loop *Loop
@ -402,7 +402,7 @@ func (this *Break) String () string {
type Return struct {
// Syntax
Position errors.Position
Value Expression `parser:" '[' 'return' @@? ']' "`
Value Expression
// Semantics
Declaration TopLevel
@ -424,8 +424,8 @@ func (this *Return) String () string {
// location expression.
type Assignment struct {
Position errors.Position
Location Expression `parser:" @@ "`
Value Expression `parser:" '=' @@ "`
Location Expression
Value Expression
}
func (*Assignment) statement(){}
func (this *Assignment) String () string {

View File

@ -12,7 +12,7 @@ import "git.tebibyte.media/sashakoshka/fspl/errors"
type LiteralInt struct {
// Syntax
Position errors.Position
Value int `parser:" @Int "`
Value int
// Semantics
Ty Type
@ -31,7 +31,7 @@ func (this *LiteralInt) String () string {
type LiteralFloat struct {
// Syntax
Position errors.Position
Value float64 `parser:" @Float "`
Value float64
// Semantics
Ty Type
@ -61,7 +61,7 @@ func (this *LiteralFloat) String () string {
type LiteralString struct {
// Syntax
Position errors.Position
ValueUTF8 string `parser:" @String "`
ValueUTF8 string
ValueUTF16 []uint16
ValueUTF32 []rune
@ -95,7 +95,7 @@ func (this *LiteralString) String () string {
type LiteralArray struct {
// Syntax
Position errors.Position
Elements []Expression `parser:" '(' '*' @@* ')' "`
Elements []Expression
// Semantics
Ty Type
@ -121,7 +121,7 @@ func (this *LiteralArray) String () string {
type LiteralStruct struct {
// Syntax
Position errors.Position
Members []*Member `parser:" '(' @@* ')' "`
Members []*Member
// Semantics
Ty Type
@ -147,7 +147,7 @@ func (this *LiteralStruct) String () string {
type LiteralBoolean struct {
// Syntax
Position errors.Position
Value *Boolean `parser:" @('true' | 'false') "`
Value *Boolean
// Semantics
Ty Type
@ -173,7 +173,7 @@ func (this *Boolean) Capture (values []string) error {
type LiteralNil struct {
// Syntax
Position errors.Position
Value string `parser:" @'nil' "`
Value string
// Semantics
Ty Type

View File

@ -10,9 +10,9 @@ import "git.tebibyte.media/sashakoshka/fspl/errors"
type Signature struct {
// Syntax
Position errors.Position
Name string `parser:" '[' @Ident "`
Arguments []*Declaration `parser:" @@* ']' "`
Return Type `parser:" ( ':' @@ )? "`
Name string
Arguments []*Declaration
Return Type
// Semantics
ArgumentOrder []string
@ -49,8 +49,8 @@ func (this *Signature) Equals (ty Type) bool {
// literals.
type Member struct {
Position errors.Position
Name string `parser:" @Ident "`
Value Expression `parser:" ':' @@ "`
Name string
Value Expression
}
func (this *Member) String () string {
return fmt.Sprint(this.Name, ":", this.Value)

View File

@ -37,9 +37,9 @@ func (this *Access) Capture (values []string) error {
type Typedef struct {
// Syntax
Position errors.Position
Acc *Access `parser:" @('-' | '~' | '+')? "`
Name string `parser:" @TypeIdent "`
Type Type `parser:" ':' @@ "`
Acc *Access
Name string
Type Type
// Semantics
Methods map[string] *Method
@ -67,10 +67,10 @@ func (this *Typedef) String () string {
type Function struct {
// Syntax
Position errors.Position
Acc *Access `parser:" @('-' | '~' | '+')? "`
Signature *Signature `parser:" @@ "`
LinkName string `parser:" @String? "`
Body Expression `parser:" ( '=' @@ )? "`
Acc *Access
Signature *Signature
LinkName string
Body Expression
// Semantics
Scope
@ -98,11 +98,11 @@ func (this *Function) String () string {
type Method struct {
// Syntax
Position errors.Position
Acc *Access `parser:" @('-' | '~' | '+')? "`
TypeName string `parser:" @TypeIdent "`
Signature *Signature `parser:" '.' @@ "`
LinkName string `parser:" @String? "`
Body Expression `parser:" ( '=' @@ )? "`
Acc *Access
TypeName string
Signature *Signature
LinkName string
Body Expression
// Semantics
Scope

View File

@ -16,8 +16,8 @@ type Type interface {
// TypeNamed refers to a user-defined or built in named type.
type TypeNamed struct {
Position errors.Position
Module string `parser:" (@Ident '::')? "`
Name string `parser:" @TypeIdent "`
Module string
Name string
Type Type
}
func (*TypeNamed) ty(){}
@ -36,7 +36,7 @@ func (this *TypeNamed) Equals (ty Type) bool {
// TypePointer is a pointer to another type.
type TypePointer struct {
Position errors.Position
Referenced Type `parser:" '*' @@ "`
Referenced Type
}
func (*TypePointer) ty(){}
func (this *TypePointer) String () string {
@ -52,7 +52,7 @@ func (this *TypePointer) Equals (ty Type) bool {
// runtime.
type TypeSlice struct {
Position errors.Position
Element Type `parser:" '*' ':' @@ "`
Element Type
}
func (*TypeSlice) ty(){}
func (this *TypeSlice) String () string {
@ -68,8 +68,8 @@ func (this *TypeSlice) Equals (ty Type) bool {
// value unless a pointer is used.
type TypeArray struct {
Position errors.Position
Length int `parser:" @Int "`
Element Type `parser:" ':' @@ "`
Length int
Element Type
}
func (*TypeArray) ty(){}
func (this *TypeArray) String () string {
@ -88,7 +88,7 @@ func (this *TypeArray) Equals (ty Type) bool {
type TypeStruct struct {
// Syntax
Position errors.Position
Members []*Declaration `parser:" '(' @@+ ')' "`
Members []*Declaration
// Semantics
MemberOrder []string
@ -123,7 +123,7 @@ func (this *TypeStruct) Equals (ty Type) bool {
type TypeInterface struct {
// Syntax
Position errors.Position
Behaviors []*Signature `parser:" '(' @@+ ')' "`
Behaviors []*Signature
// Semantics
BehaviorOrder []string