diff --git a/lexer/lexer.go b/lexer/lexer.go index 9f6f8ff..4cc7660 100644 --- a/lexer/lexer.go +++ b/lexer/lexer.go @@ -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 diff --git a/lexer/lexer_test.go b/lexer/lexer_test.go index 94aa630..27216d0 100644 --- a/lexer/lexer_test.go +++ b/lexer/lexer_test.go @@ -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 }, diff --git a/lexer/token.go b/lexer/token.go index cf18b66..43cd675 100644 --- a/lexer/token.go +++ b/lexer/token.go @@ -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: diff --git a/parser/parser_test.go b/parser/parser_test.go index efefe04..46c35e1 100644 --- a/parser/parser_test.go +++ b/parser/parser_test.go @@ -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 diff --git a/tests/lexer/all.arf b/tests/lexer/all.arf index da816d2..29834fe 100644 --- a/tests/lexer/all.arf +++ b/tests/lexer/all.arf @@ -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:.,..[]{} + - ++ -- * / @ ! % ~ < << > >> | || & && diff --git a/tests/parser/data/main.arf b/tests/parser/data/main.arf index 670fb17..8b03dcc 100644 --- a/tests/parser/data/main.arf +++ b/tests/parser/data/main.arf @@ -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