Added ( and ) tokens
This commit is contained in:
parent
767bf81b85
commit
42a51477ec
@ -192,6 +192,16 @@ func (lexer *LexingOperation) tokenizeSymbolBeginning () (err error) {
|
||||
token.kind = TokenKindComma
|
||||
lexer.addToken(token)
|
||||
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 '[':
|
||||
token := lexer.newToken()
|
||||
token.kind = TokenKindLBracket
|
||||
|
@ -138,6 +138,8 @@ func TestTokenizeAll (test *testing.T) {
|
||||
quickToken(1, TokenKindDot, nil),
|
||||
quickToken(1, TokenKindComma, nil),
|
||||
quickToken(2, TokenKindElipsis, nil),
|
||||
quickToken(1, TokenKindLParen, nil),
|
||||
quickToken(1, TokenKindRParen, nil),
|
||||
quickToken(1, TokenKindLBracket, nil),
|
||||
quickToken(1, TokenKindRBracket, nil),
|
||||
quickToken(1, TokenKindLBrace, nil),
|
||||
|
@ -28,6 +28,8 @@ const (
|
||||
TokenKindElipsis
|
||||
TokenKindComma
|
||||
|
||||
TokenKindLParen
|
||||
TokenKindRParen
|
||||
TokenKindLBracket
|
||||
TokenKindRBracket
|
||||
TokenKindLBrace
|
||||
@ -166,6 +168,10 @@ func (tokenKind TokenKind) Describe () (description string) {
|
||||
description = "Elipsis"
|
||||
case TokenKindComma:
|
||||
description = "Comma"
|
||||
case TokenKindLParen:
|
||||
description = "LParen"
|
||||
case TokenKindRParen:
|
||||
description = "RParen"
|
||||
case TokenKindLBracket:
|
||||
description = "LBracket"
|
||||
case TokenKindRBracket:
|
||||
|
@ -73,9 +73,11 @@ func (parser *ParsingOperation) parseEnumMembers (
|
||||
if err != nil { return }
|
||||
|
||||
// parse default value
|
||||
if !parser.token.Is(lexer.TokenKindNewline) {
|
||||
member.value, err = parser.parseArgument()
|
||||
into.members = append(into.members, member)
|
||||
if err != nil { return }
|
||||
}
|
||||
|
||||
err = parser.expect(lexer.TokenKindNewline)
|
||||
if err != nil { return }
|
||||
|
@ -69,4 +69,3 @@ func (parser *ParsingOperation) parseType () (what Type, err error) {
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -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:.,..()[]{}
|
||||
+ - ++ -- * / @ ! % %= ~ ~= = == != < <= << <<= > >= >> >>= | |= || & &= && ^ ^=
|
||||
|
Reference in New Issue
Block a user