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 token.kind = TokenKindComma
lexer.addToken(token) lexer.addToken(token)
err = lexer.nextRune() 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 '[': case '[':
token := lexer.newToken() token := lexer.newToken()
token.kind = TokenKindLBracket token.kind = TokenKindLBracket

View File

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

View File

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

View File

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

View File

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

View File

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