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

cgen: lots of fixes

This commit is contained in:
Alexander Medvednikov
2020-03-15 00:46:08 +01:00
parent 50ed4004f4
commit 843bb6dac1
15 changed files with 107 additions and 79 deletions

View File

@ -349,10 +349,10 @@ fn (s mut Scanner) scan() ScanRes {
if s.inter_end {
if s.text[s.pos] == s.quote {
s.inter_end = false
return scan_res(.str, '')
return scan_res(.string, '')
}
s.inter_end = false
return scan_res(.str, s.ident_string())
return scan_res(.string, s.ident_string())
}
s.skip_whitespace()
// end of file
@ -473,7 +473,7 @@ fn (s mut Scanner) scan() ScanRes {
return scan_res(.question, '')
}
single_quote, double_quote {
return scan_res(.str, s.ident_string())
return scan_res(.string, s.ident_string())
}
`\`` {
// ` // apostrophe balance comment. do not remove
@ -513,9 +513,9 @@ fn (s mut Scanner) scan() ScanRes {
s.pos++
if s.text[s.pos] == s.quote {
s.inside_string = false
return scan_res(.str, '')
return scan_res(.string, '')
}
return scan_res(.str, s.ident_string())
return scan_res(.string, s.ident_string())
}
else {
return scan_res(.rcbr, '')
@ -558,19 +558,19 @@ fn (s mut Scanner) scan() ScanRes {
// println( 'file: ' + @FILE + ' | line: ' + @LINE + ' | fn: ' + @FN)
// ... which is useful while debugging/tracing
if name == 'FN' {
return scan_res(.str, s.fn_name)
return scan_res(.string, s.fn_name)
}
if name == 'FILE' {
return scan_res(.str, cescaped_path(os.realpath(s.file_path)))
return scan_res(.string, cescaped_path(os.realpath(s.file_path)))
}
if name == 'LINE' {
return scan_res(.str, (s.line_nr + 1).str())
return scan_res(.string, (s.line_nr + 1).str())
}
if name == 'COLUMN' {
return scan_res(.str, (s.current_column()).str())
return scan_res(.string, (s.current_column()).str())
}
if name == 'VHASH' {
return scan_res(.str, vhash())
return scan_res(.string, vhash())
}
if !is_key(name) {
s.error('@ must be used before keywords (e.g. `@type string`)')