Expand Gotlin language and tooling
This commit is contained in:
parent
8f4f858d86
commit
de1262b4cf
41 changed files with 6059 additions and 379 deletions
|
|
@ -49,6 +49,13 @@ func (l *lexer) next() (token, error) {
|
|||
for l.pos < len(l.src) && unicode.IsDigit(l.src[l.pos]) {
|
||||
l.pos++
|
||||
}
|
||||
if l.pos+1 < len(l.src) && l.src[l.pos] == '.' && unicode.IsDigit(l.src[l.pos+1]) {
|
||||
l.pos++
|
||||
for l.pos < len(l.src) && unicode.IsDigit(l.src[l.pos]) {
|
||||
l.pos++
|
||||
}
|
||||
return token{kind: tokenFloat, lexeme: string(l.src[start:l.pos]), pos: start}, nil
|
||||
}
|
||||
return token{kind: tokenInt, lexeme: string(l.src[start:l.pos]), pos: start}, nil
|
||||
case ch == '"':
|
||||
l.pos++
|
||||
|
|
@ -77,11 +84,18 @@ func (l *lexer) next() (token, error) {
|
|||
return token{kind: tokenLBrace, lexeme: "{", pos: start}, nil
|
||||
case '}':
|
||||
return token{kind: tokenRBrace, lexeme: "}", pos: start}, nil
|
||||
case '[':
|
||||
return token{kind: tokenLBracket, lexeme: "[", pos: start}, nil
|
||||
case ']':
|
||||
return token{kind: tokenRBracket, lexeme: "]", pos: start}, nil
|
||||
case ',':
|
||||
return token{kind: tokenComma, lexeme: ",", pos: start}, nil
|
||||
case '.':
|
||||
return token{kind: tokenDot, lexeme: ".", pos: start}, nil
|
||||
case ':':
|
||||
if l.match(':') {
|
||||
return token{kind: tokenDoubleColon, lexeme: "::", pos: start}, nil
|
||||
}
|
||||
return token{kind: tokenColon, lexeme: ":", pos: start}, nil
|
||||
case ';':
|
||||
return token{kind: tokenSemicolon, lexeme: ";", pos: start}, nil
|
||||
|
|
@ -131,6 +145,11 @@ func (l *lexer) next() (token, error) {
|
|||
if l.match('&') {
|
||||
return token{kind: tokenAnd, lexeme: "&&", pos: start}, nil
|
||||
}
|
||||
return token{kind: tokenAmp, lexeme: "&", pos: start}, nil
|
||||
case '@':
|
||||
return token{kind: tokenAt, lexeme: "@", pos: start}, nil
|
||||
case '?':
|
||||
return token{kind: tokenQuestion, lexeme: "?", pos: start}, nil
|
||||
case '|':
|
||||
if l.match('|') {
|
||||
return token{kind: tokenOr, lexeme: "||", pos: start}, nil
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue