mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
new vh generation + simpler match statement
This commit is contained in:
@ -84,7 +84,7 @@ enum TokenKind {
|
||||
key_enum
|
||||
key_false
|
||||
key_for
|
||||
func
|
||||
key_fn
|
||||
key_global
|
||||
key_go
|
||||
key_goto
|
||||
@ -204,7 +204,7 @@ fn build_token_str() []string {
|
||||
s[TokenKind.key_for] = 'for'
|
||||
s[TokenKind.key_switch] = 'switch'
|
||||
s[TokenKind.key_case] = 'case'
|
||||
s[TokenKind.func] = 'fn'
|
||||
s[TokenKind.key_fn] = 'fn'
|
||||
s[TokenKind.key_true] = 'true'
|
||||
s[TokenKind.key_false] = 'false'
|
||||
s[TokenKind.key_continue] = 'continue'
|
||||
@ -252,12 +252,8 @@ fn (t TokenKind) str() string {
|
||||
}
|
||||
|
||||
fn (t TokenKind) is_decl() bool {
|
||||
// TODO i
|
||||
//return t in [.key_enum, .key_interface, .func, .typ, .key_const,
|
||||
//.key_import_const, .key_struct, .key_pub, .eof]
|
||||
return t == .key_enum || t == .key_interface || t == .func ||
|
||||
t == .key_struct || t == .key_type ||
|
||||
t == .key_const || t == .key_import_const || t == .key_pub || t == .eof
|
||||
return t in [TokenKind.key_enum, .key_interface, .key_fn,
|
||||
.key_struct ,.key_type, .key_const, .key_import_const, .key_pub, .eof]
|
||||
}
|
||||
|
||||
const (
|
||||
@ -284,3 +280,10 @@ fn (t []TokenKind) contains(val TokenKind) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
fn (t Token) str() string {
|
||||
if t.tok < .plus {
|
||||
return t.lit // string, number etc
|
||||
}
|
||||
return t.tok.str()
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user