Changed permission codes to only determine private/public/readonly

Changing permissions within the module was redundant and would have just
conflicted with the :mut type qualifier. This is easier to understand.
This commit is contained in:
Sasha Koshka
2022-08-18 12:09:17 -04:00
parent 15eb96e8ac
commit a548dcc585
5 changed files with 74 additions and 63 deletions

View File

@@ -96,12 +96,11 @@ func (lexer *LexingOperation) tokenizeAlphaBeginning () (err error) {
token.location.SetWidth(len(got))
if len(got) == 2 {
firstValid := got[0] == 'n' || got[0] == 'r' || got[0] == 'w'
secondValid := got[1] == 'n' || got[1] == 'r' || got[1] == 'w'
if firstValid && secondValid {
permission, isPermission := types.PermissionFrom(got)
if isPermission {
token.kind = TokenKindPermission
token.value = types.PermissionFrom(got)
token.value = permission
}
}

View File

@@ -126,10 +126,7 @@ func compareErr (
func TestTokenizeAll (test *testing.T) {
checkTokenSlice("../tests/lexer/all.arf", test,
quickToken(3, TokenKindSeparator, nil),
quickToken(2, TokenKindPermission, types.Permission {
Internal: types.ModeRead,
External: types.ModeWrite,
}),
quickToken(2, TokenKindPermission, types.PermissionReadWrite),
quickToken(2, TokenKindReturnDirection, nil),
quickToken(10, TokenKindInt, int64(-349820394)),
quickToken(9, TokenKindUInt, uint64(932748397)),