Added a comma token

This commit is contained in:
Sasha Koshka 2022-08-15 14:50:09 -04:00
parent 608162fa92
commit 8b28fe5a4c
4 changed files with 10 additions and 1 deletions

View File

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

View File

@ -62,6 +62,7 @@ func TestTokenizeAll (test *testing.T) {
Token { kind: TokenKindName, value: "helloWorld" },
Token { kind: TokenKindColon },
Token { kind: TokenKindDot },
Token { kind: TokenKindComma },
Token { kind: TokenKindLBracket },
Token { kind: TokenKindRBracket },
Token { kind: TokenKindLBrace },

View File

@ -24,6 +24,7 @@ const (
TokenKindColon
TokenKindDot
TokenKindComma
TokenKindLBracket
TokenKindRBracket
@ -133,6 +134,8 @@ func (tokenKind TokenKind) Describe () (description string) {
description = "Colon"
case TokenKindDot:
description = "Dot"
case TokenKindComma:
description = "Comma"
case TokenKindLBracket:
description = "LBracket"
case TokenKindRBracket:

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:.,[]{}
+ - ++ -- * / @ ! % ~ < << > >> | || & &&