1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

remove as casts for basic types

This commit is contained in:
Alexander Medvednikov
2020-02-07 22:10:48 +01:00
parent f782388148
commit d66bc24e7f
8 changed files with 63 additions and 82 deletions

View File

@ -53,6 +53,7 @@ pub fn parse_stmt(text string, table &table.Table) ast.Stmt {
mut p := Parser{
scanner: s
table: table
pref: &pref.Preferences{}
}
p.init_parse_fns()
p.read_first_token()

View File

@ -97,23 +97,26 @@ fn (s mut Scanner) ident_name() string {
return name
}
const(
num_sep = `_` // char used as number separator
const (
num_sep = `_` // char used as number separator
)
fn filter_num_sep(txt byteptr, start int, end int) string {
mut b := malloc(end-start + 1) // add a byte for the endstring 0
mut i := start
mut i1 := 0
for i < end {
if txt[i] != num_sep {
b[i1]=txt[i]
i1++
unsafe{
mut b := malloc(end - start + 1) // add a byte for the endstring 0
mut i := start
mut i1 := 0
for i < end {
if txt[i] != num_sep {
b[i1] = txt[i]
i1++
}
i++
}
i++
b[i1] = 0 // C string compatibility
return string{
b,i1}
}
b[i1]=0 // C string compatibility
return string{b,i1}
}
fn (s mut Scanner) ident_bin_number() string {