Added elipsis token

This commit is contained in:
Sasha Koshka 2022-08-16 20:24:27 -04:00
parent efb3bbe21b
commit 9e01eef45b
6 changed files with 13 additions and 4 deletions

View File

@ -175,10 +175,15 @@ func (lexer *LexingOperation) tokenizeSymbolBeginning () (err error) {
lexer.addToken(token)
err = lexer.nextRune()
case '.':
err = lexer.nextRune()
if err != nil { return }
token := lexer.newToken()
token.kind = TokenKindDot
if lexer.char == '.' {
token.kind = TokenKindElipsis
err = lexer.nextRune()
}
lexer.addToken(token)
err = lexer.nextRune()
case ',':
token := lexer.newToken()
token.kind = TokenKindComma

View File

@ -63,6 +63,7 @@ func TestTokenizeAll (test *testing.T) {
Token { kind: TokenKindColon },
Token { kind: TokenKindDot },
Token { kind: TokenKindComma },
Token { kind: TokenKindElipsis },
Token { kind: TokenKindLBracket },
Token { kind: TokenKindRBracket },
Token { kind: TokenKindLBrace },

View File

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

View File

@ -47,7 +47,7 @@ data wr mutInteger:Int:mut 3202
data wr integerPointer:{Int}
data wr mutIntegerPointer:{Int}:mut
data wr integerArray16:{Int 16}
data wr integerArrayVariable:{Int ...}
data wr integerArrayVariable:{Int ..}
data wr integerArrayInitialized:{Int 16}
3948
293

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

View File

@ -11,7 +11,7 @@ data wr mutIntegerPointer:{Int}:mut
data wr integerArray16:{Int 16}
data wr integerArrayVariable:{Int ...}
data wr integerArrayVariable:{Int ..}
data wr integerArrayInitialized:{Int 16}
3948 293 293049 948 912