mirror of
https://github.com/vlang/v.git
synced 2025-09-15 07:22:27 +03:00
C string literals (c'str'); bare builtin module; bare println()
This commit is contained in:
parent
0b3b241258
commit
96cde10696
7 changed files with 106 additions and 20 deletions
|
@ -2125,7 +2125,8 @@ fn format_str(_str string) string {
|
|||
|
||||
fn (p mut Parser) string_expr() {
|
||||
is_raw := p.tok == .name && p.lit == 'r'
|
||||
if is_raw {
|
||||
is_cstr := p.tok == .name && p.lit == 'c'
|
||||
if is_raw || is_cstr {
|
||||
p.next()
|
||||
}
|
||||
str := p.lit
|
||||
|
@ -2137,7 +2138,7 @@ fn (p mut Parser) string_expr() {
|
|||
Calling a C function sometimes requires a call to a string method
|
||||
C.fun('ssss'.to_wide()) => fun(string_to_wide(tos3("ssss")))
|
||||
*/
|
||||
if (p.calling_c && p.peek() != .dot) || p.pref.is_bare || (p.pref.translated && p.mod == 'main') {
|
||||
if (p.calling_c && p.peek() != .dot) || is_cstr || (p.pref.translated && p.mod == 'main') {
|
||||
p.gen('"$f"')
|
||||
}
|
||||
else if p.is_sql {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue