Added elipsis token
This commit is contained in:
parent
efb3bbe21b
commit
9e01eef45b
@ -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
|
||||
|
@ -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 },
|
||||
|
@ -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:
|
||||
|
@ -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
|
||||
|
@ -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:.,..[]{}
|
||||
+ - ++ -- * / @ ! % ~ < << > >> | || & &&
|
||||
|
@ -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
|
||||
|
Reference in New Issue
Block a user