From 1390a3905342e497d4c92a46bf72e3d4ee0c65b1 Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Sun, 27 Oct 2019 14:05:50 +0300 Subject: [PATCH] clean up switch tokens --- vlib/compiler/parser.v | 12 ++++-------- vlib/compiler/token.v | 4 ---- vlib/gx/gx.v | 2 +- vlib/stbi/stbi.v | 2 +- 4 files changed, 6 insertions(+), 14 deletions(-) diff --git a/vlib/compiler/parser.v b/vlib/compiler/parser.v index d693262b66..6125fc25fd 100644 --- a/vlib/compiler/parser.v +++ b/vlib/compiler/parser.v @@ -957,8 +957,7 @@ fn (p mut Parser) statements_no_rcbr() string { } mut i := 0 mut last_st_typ := '' - for p.tok != .rcbr && p.tok != .eof && p.tok != .key_case && - p.tok != .key_default { + for p.tok != .rcbr && p.tok != .eof { // println('stm: '+p.tok.str()+', next: '+p.peek().str()) last_st_typ = p.statement(true) // println('last st typ=$last_st_typ') @@ -972,13 +971,8 @@ fn (p mut Parser) statements_no_rcbr() string { p.error('more than 50 000 statements in function `$p.cur_fn.name`') } } - if p.tok != .key_case && p.tok != .key_default && p.peek() != .arrow { // p.next() - p.check(.rcbr) - } - else { - // p.check(.rcbr) - } + p.check(.rcbr) //p.fmt_dec() p.close_scope() @@ -2565,6 +2559,7 @@ fn (p mut Parser) factor() string { typ = p.name_expr() return typ } + /* .key_default { p.next() p.next() @@ -2576,6 +2571,7 @@ fn (p mut Parser) factor() string { p.next() return 'T' } + */ .lpar { //p.gen('(/*lpar*/') p.gen('(') diff --git a/vlib/compiler/token.v b/vlib/compiler/token.v index 66e477159c..ddd84a3ac6 100644 --- a/vlib/compiler/token.v +++ b/vlib/compiler/token.v @@ -83,10 +83,8 @@ enum TokenKind { key_assert key_atomic key_break - key_case key_const key_continue - key_default key_defer key_else key_embed @@ -212,7 +210,6 @@ fn build_token_str() []string { s[TokenKind.key_type] = 'type' s[TokenKind.key_for] = 'for' s[TokenKind.key_switch] = 'switch' - s[TokenKind.key_case] = 'case' s[TokenKind.key_fn] = 'fn' s[TokenKind.key_true] = 'true' s[TokenKind.key_false] = 'false' @@ -222,7 +219,6 @@ fn build_token_str() []string { s[TokenKind.key_embed] = 'embed' s[TokenKind.key_unsafe] = 'unsafe' //Tokens[key_typeof] = 'typeof' - s[TokenKind.key_default] = 'default' s[TokenKind.key_enum] = 'enum' s[TokenKind.key_interface] = 'interface' s[TokenKind.key_pub] = 'pub' diff --git a/vlib/gx/gx.v b/vlib/gx/gx.v index 7b1270fa89..0996d69529 100644 --- a/vlib/gx/gx.v +++ b/vlib/gx/gx.v @@ -57,7 +57,7 @@ pub: mono bool } -struct Image { +pub struct Image { mut: obj voidptr pub: diff --git a/vlib/stbi/stbi.v b/vlib/stbi/stbi.v index 852fbed143..6d5cfc6eb0 100644 --- a/vlib/stbi/stbi.v +++ b/vlib/stbi/stbi.v @@ -11,7 +11,7 @@ module stbi #define STB_IMAGE_IMPLEMENTATION #include "stb_image.h" -struct Image { +pub struct Image { mut: width int height int