Added ( and ) tokens

This commit is contained in:
Sasha Koshka 2022-09-13 17:04:43 -04:00
parent 767bf81b85
commit 42a51477ec
6 changed files with 24 additions and 5 deletions

View File

@ -192,6 +192,16 @@ func (lexer *LexingOperation) tokenizeSymbolBeginning () (err error) {
token.kind = TokenKindComma
lexer.addToken(token)
err = lexer.nextRune()
case '(':
token := lexer.newToken()
token.kind = TokenKindLParen
lexer.addToken(token)
err = lexer.nextRune()
case ')':
token := lexer.newToken()
token.kind = TokenKindRParen
lexer.addToken(token)
err = lexer.nextRune()
case '[':
token := lexer.newToken()
token.kind = TokenKindLBracket

View File

@ -138,6 +138,8 @@ func TestTokenizeAll (test *testing.T) {
quickToken(1, TokenKindDot, nil),
quickToken(1, TokenKindComma, nil),
quickToken(2, TokenKindElipsis, nil),
quickToken(1, TokenKindLParen, nil),
quickToken(1, TokenKindRParen, nil),
quickToken(1, TokenKindLBracket, nil),
quickToken(1, TokenKindRBracket, nil),
quickToken(1, TokenKindLBrace, nil),

View File

@ -28,6 +28,8 @@ const (
TokenKindElipsis
TokenKindComma
TokenKindLParen
TokenKindRParen
TokenKindLBracket
TokenKindRBracket
TokenKindLBrace
@ -166,6 +168,10 @@ func (tokenKind TokenKind) Describe () (description string) {
description = "Elipsis"
case TokenKindComma:
description = "Comma"
case TokenKindLParen:
description = "LParen"
case TokenKindRParen:
description = "RParen"
case TokenKindLBracket:
description = "LBracket"
case TokenKindRBracket:

View File

@ -73,9 +73,11 @@ func (parser *ParsingOperation) parseEnumMembers (
if err != nil { return }
// parse default value
member.value, err = parser.parseArgument()
into.members = append(into.members, member)
if err != nil { return }
if !parser.token.Is(lexer.TokenKindNewline) {
member.value, err = parser.parseArgument()
into.members = append(into.members, member)
if err != nil { return }
}
err = parser.expect(lexer.TokenKindNewline)
if err != nil { return }

View File

@ -69,4 +69,3 @@ func (parser *ParsingOperation) parseType () (what Type, err error) {
return
}

View File

@ -1,3 +1,3 @@
:arf
--- rw -> -349820394 932748397 239485.37520 "hello world!\n" 'E' helloWorld:.,..[]{}
--- rw -> -349820394 932748397 239485.37520 "hello world!\n" 'E' helloWorld:.,..()[]{}
+ - ++ -- * / @ ! % %= ~ ~= = == != < <= << <<= > >= >> >>= | |= || & &= && ^ ^=