From 2e965d6f6823a57f02ea75b484358861c476541c Mon Sep 17 00:00:00 2001 From: Sasha Koshka Date: Wed, 10 Aug 2022 12:52:20 -0400 Subject: [PATCH] Added Permission type --- lexer/lexer_test.go | 6 +++++- types/permission.go | 14 ++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 types/permission.go diff --git a/lexer/lexer_test.go b/lexer/lexer_test.go index 26ffbc9..492ebfd 100644 --- a/lexer/lexer_test.go +++ b/lexer/lexer_test.go @@ -2,6 +2,7 @@ package lexer import "testing" import "github.com/sashakoshka/arf/file" +import "github.com/sashakoshka/arf/types" func TestTokenizeAll (test *testing.T) { file, err := file.Open("tests/lexer/all") @@ -18,7 +19,10 @@ func TestTokenizeAll (test *testing.T) { correct := []Token { 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: TokenKindInt, value: -349820394 }, Token { kind: TokenKindUInt, value: 932748397 }, diff --git a/types/permission.go b/types/permission.go new file mode 100644 index 0000000..ec59771 --- /dev/null +++ b/types/permission.go @@ -0,0 +1,14 @@ +package types + +type Mode int + +const ( + ModeRead = iota + ModeWrite + ModeNone +) + +type Permission struct { + Internal Mode + External Mode +}