Added Permission type

This commit is contained in:
Sasha Koshka 2022-08-10 12:52:20 -04:00
parent 488220f3a7
commit 2e965d6f68
2 changed files with 19 additions and 1 deletions

View File

@ -2,6 +2,7 @@ package lexer
import "testing" import "testing"
import "github.com/sashakoshka/arf/file" import "github.com/sashakoshka/arf/file"
import "github.com/sashakoshka/arf/types"
func TestTokenizeAll (test *testing.T) { func TestTokenizeAll (test *testing.T) {
file, err := file.Open("tests/lexer/all") file, err := file.Open("tests/lexer/all")
@ -18,7 +19,10 @@ func TestTokenizeAll (test *testing.T) {
correct := []Token { correct := []Token {
Token { kind: TokenKindSeparator }, Token { kind: TokenKindSeparator },
Token { kind: TokenKindPermission /* TODO: value */ }, Token { kind: TokenKindPermission, value: types.Permission {
Internal: types.ModeRead,
External: types.ModeWrite,
}},
Token { kind: TokenKindReturnDirection }, Token { kind: TokenKindReturnDirection },
Token { kind: TokenKindInt, value: -349820394 }, Token { kind: TokenKindInt, value: -349820394 },
Token { kind: TokenKindUInt, value: 932748397 }, Token { kind: TokenKindUInt, value: 932748397 },

14
types/permission.go Normal file
View File

@ -0,0 +1,14 @@
package types
type Mode int
const (
ModeRead = iota
ModeWrite
ModeNone
)
type Permission struct {
Internal Mode
External Mode
}