fmt: fix formatting backtick char literal
parent
c4f672454f
commit
50491670af
|
@ -40,15 +40,11 @@ pub fn fmt(file ast.File, table &table.Table) string {
|
|||
}
|
||||
f.cur_mod = 'main'
|
||||
for stmt in file.stmts {
|
||||
// TODO `if stmt is ast.Import`
|
||||
match stmt {
|
||||
ast.Import {
|
||||
if stmt is ast.Import {
|
||||
// Just remember the position of the imports for now
|
||||
f.import_pos = f.out.len
|
||||
// f.imports(f.file.imports)
|
||||
}
|
||||
else {}
|
||||
}
|
||||
f.stmt(stmt)
|
||||
}
|
||||
// for comment in file.comments { println('$comment.line_nr $comment.text') }
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
fn char_backtick() {
|
||||
`\``
|
||||
}
|
|
@ -5,7 +5,7 @@ fn fn_variadic(arg int, args ...string) {
|
|||
}
|
||||
|
||||
fn fn_with_assign_stmts() {
|
||||
a, b := fn_with_multi_return()
|
||||
_, _ := fn_with_multi_return()
|
||||
}
|
||||
|
||||
fn fn_with_multi_return() (int, string) {
|
||||
|
|
|
@ -5,7 +5,7 @@ fn fn_variadic(arg int, args... string) {
|
|||
}
|
||||
|
||||
fn fn_with_assign_stmts() {
|
||||
a,b := fn_with_multi_return()
|
||||
_,_ := fn_with_multi_return()
|
||||
}
|
||||
|
||||
fn fn_with_multi_return() (int,string) {
|
||||
|
|
|
@ -6,6 +6,7 @@ fn for_in_loop() {
|
|||
|
||||
fn for_in_loop_with_counter() {
|
||||
for i, item in arr {
|
||||
println(i)
|
||||
println(item)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ fn for_in_loop() {
|
|||
|
||||
fn for_in_loop_with_counter() {
|
||||
for i, item in arr {
|
||||
println(i)
|
||||
println(item)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -929,9 +929,6 @@ fn (s mut Scanner) ident_char() string {
|
|||
s.error('invalid character literal (more than one character)\n' + 'use quotes for strings, backticks for characters')
|
||||
}
|
||||
}
|
||||
if c == '\\`' {
|
||||
return '`'
|
||||
}
|
||||
// Escapes a `'` character
|
||||
return if c == "\'" { '\\' + c } else { c }
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue