all: remove broken escape sequences after $ in strings
parent
d71d9ad7c0
commit
62ee436944
|
@ -84,8 +84,8 @@ pub fn (mut b Builder) compile_c() {
|
|||
bundle_name := b.pref.out_name.split('/').last()
|
||||
bundle_id := if b.pref.bundle_id != '' { b.pref.bundle_id } else { 'app.vlang.$bundle_name' }
|
||||
display_name := if b.pref.display_name != '' { b.pref.display_name } else { bundle_name }
|
||||
os.mkdir('$display_name\.app')
|
||||
os.write_file('$display_name\.app/Info.plist', make_ios_plist(display_name, bundle_id,
|
||||
os.mkdir('${display_name}.app')
|
||||
os.write_file('${display_name}.app/Info.plist', make_ios_plist(display_name, bundle_id,
|
||||
bundle_name, 1))
|
||||
}
|
||||
b.cc()
|
||||
|
|
|
@ -439,7 +439,7 @@ fn (mut v Builder) cc() {
|
|||
// Output executable name
|
||||
if v.pref.os == .ios {
|
||||
bundle_name := v.pref.out_name.split('/').last()
|
||||
args << '-o "$v.pref.out_name\.app/$bundle_name"'
|
||||
args << '-o "${v.pref.out_name}.app/$bundle_name"'
|
||||
} else {
|
||||
args << '-o "$v.pref.out_name"'
|
||||
}
|
||||
|
|
|
@ -92,7 +92,7 @@ fn (mut b Builder) run_compiled_executable_and_exit() {
|
|||
os.exec('xcrun simctl boot $device')
|
||||
bundle_name := b.pref.out_name.split('/').last()
|
||||
display_name := if b.pref.display_name != '' { b.pref.display_name } else { bundle_name }
|
||||
os.exec('xcrun simctl install $device $display_name\.app')
|
||||
os.exec('xcrun simctl install $device ${display_name}.app')
|
||||
bundle_id := if b.pref.bundle_id != '' { b.pref.bundle_id } else { 'app.vlang.$bundle_name' }
|
||||
os.exec('xcrun simctl launch $device $bundle_id')
|
||||
} else {
|
||||
|
|
|
@ -2731,19 +2731,19 @@ fn (mut c Checker) hash_stmt(mut node ast.HashStmt) {
|
|||
|
||||
fn (mut c Checker) import_stmt(imp ast.Import) {
|
||||
for sym in imp.syms {
|
||||
name := '$imp.mod\.$sym.name'
|
||||
name := '${imp.mod}.$sym.name'
|
||||
if sym.kind == .fn_ {
|
||||
c.table.find_fn(name) or {
|
||||
c.error('module `$imp.mod` has no public fn named `$sym.name\()`', sym.pos)
|
||||
c.error('module `$imp.mod` has no public fn named `${sym.name}()`', sym.pos)
|
||||
}
|
||||
}
|
||||
if sym.kind == .type_ {
|
||||
if type_sym := c.table.find_type(name) {
|
||||
if type_sym.kind == .placeholder || !type_sym.is_public {
|
||||
c.error('module `$imp.mod` has no public type `$sym.name\{}`', sym.pos)
|
||||
c.error('module `$imp.mod` has no public type `$sym.name{}`', sym.pos)
|
||||
}
|
||||
} else {
|
||||
c.error('module `$imp.mod` has no public type `$sym.name\{}`', sym.pos)
|
||||
c.error('module `$imp.mod` has no public type `$sym.name{}`', sym.pos)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -77,7 +77,7 @@ fn (mut g Gen) gen_str_for_type_with_styp(typ table.Type, styp string) string {
|
|||
g.gen_str_for_union_sum_type(sym.info, styp, str_fn_name)
|
||||
}
|
||||
else {
|
||||
verror("could not generate string method $str_fn_name for type \'$styp\'")
|
||||
verror("could not generate string method $str_fn_name for type '$styp'")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -512,7 +512,7 @@ fn (mut g Gen) gen_str_for_union_sum_type(info table.SumType, styp string, str_f
|
|||
for typ in info.variants {
|
||||
mut value_fmt := '%.*s\\000'
|
||||
if typ == table.string_type {
|
||||
value_fmt = "\'$value_fmt\'"
|
||||
value_fmt = "'$value_fmt'"
|
||||
}
|
||||
typ_str := g.typ(typ)
|
||||
mut func_name := if typ_str in gen_fn_names { gen_fn_names[typ_str] } else { g.gen_str_for_type_with_styp(typ,
|
||||
|
|
|
@ -1612,7 +1612,7 @@ fn (mut p Parser) import_syms(mut parent ast.Import) {
|
|||
for p.tok.kind == .name {
|
||||
pos := p.tok.position()
|
||||
alias := p.check_name()
|
||||
name := '$parent.mod\.$alias'
|
||||
name := '${parent.mod}.$alias'
|
||||
if alias[0].is_capital() {
|
||||
idx := p.table.add_placeholder_type(name, .v)
|
||||
typ := table.new_type(idx)
|
||||
|
|
|
@ -579,9 +579,12 @@ fn (mut s Scanner) text_scan() token.Token {
|
|||
}
|
||||
// end of `$expr`
|
||||
// allow `'$a.b'` and `'$a.c()'`
|
||||
if s.is_inter_start && next_char == `\\` && s.look_ahead(2) !in [`n`, `\\`, `t`] {
|
||||
// s.warn('unknown escape sequence \\${s.look_ahead(2)}')
|
||||
}
|
||||
if s.is_inter_start && next_char == `(` {
|
||||
if s.look_ahead(2) != `)` {
|
||||
s.warn('use e.g. `\${f(expr)}` or `\$name\\(` instead of `\$f(expr)`')
|
||||
s.warn('use `\${f(expr)}` instead of `\$f(expr)`')
|
||||
}
|
||||
} else if s.is_inter_start && next_char != `.` {
|
||||
s.is_inter_end = true
|
||||
|
@ -1036,7 +1039,7 @@ fn (mut s Scanner) ident_string() string {
|
|||
s.error(r'cannot use `\x00` (NULL character) in the string literal')
|
||||
}
|
||||
}
|
||||
// ${var} (ignore in vfmt mode)
|
||||
// ${var} (ignore in vfmt mode) (skip \$)
|
||||
if prevc == `$` && c == `{` && !is_raw && s.count_symbol_before(s.pos - 2, slash) % 2 == 0 {
|
||||
s.is_inside_string = true
|
||||
// so that s.pos points to $ at the next step
|
||||
|
|
Loading…
Reference in New Issue