mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
fmt: add EOL
This commit is contained in:
parent
639dc02cc8
commit
ee2f1652b5
@ -54,7 +54,7 @@ pub fn fmt(file ast.File, table &table.Table) string {
|
||||
// for comment in file.comments { println('$comment.line_nr $comment.text') }
|
||||
f.imports(f.file.imports) // now that we have all autoimports, handle them
|
||||
res := f.out.str().trim_space() + '\n'
|
||||
return res[..f.import_pos] + f.out_imports.str() + res[f.import_pos..]
|
||||
return res[..f.import_pos] + f.out_imports.str() + res[f.import_pos..] + '\n'
|
||||
}
|
||||
|
||||
/*
|
||||
@ -933,3 +933,4 @@ fn (var f Fmt) mark_module_as_used(name string) {
|
||||
f.used_imports << mod
|
||||
// println('marking module $mod as used')
|
||||
}
|
||||
|
||||
|
@ -18,9 +18,11 @@ const (
|
||||
'default'
|
||||
'do'
|
||||
'double'
|
||||
'extern', 'float', 'inline', 'int', 'long', 'register', 'restrict', 'short', 'signed'
|
||||
'sizeof'
|
||||
'static', 'switch', 'typedef', 'union', 'unsigned', 'void', 'volatile', 'while']
|
||||
'extern'
|
||||
'float'
|
||||
'inline', 'int', 'long', 'register', 'restrict', 'short', 'signed', 'sizeof', 'static'
|
||||
'switch'
|
||||
'typedef', 'union', 'unsigned', 'void', 'volatile', 'while']
|
||||
)
|
||||
|
||||
fn foo(t token.Token) {
|
||||
@ -2930,3 +2932,4 @@ fn (g Gen) type_to_fmt(typ table.Type) string {
|
||||
}
|
||||
return '%d'
|
||||
}
|
||||
|
||||
|
@ -72,3 +72,4 @@ fn test_x64() {
|
||||
exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -419,9 +419,7 @@ pub fn (var p Parser) stmt() ast.Stmt {
|
||||
expr := p.expr(0)
|
||||
// mut call_expr := &ast.CallExpr(0) // TODO
|
||||
match expr {
|
||||
ast.CallExpr {
|
||||
// call_expr = it
|
||||
}
|
||||
ast.CallExpr { // call_expr = it }
|
||||
else {}
|
||||
}
|
||||
return ast.GoStmt{
|
||||
@ -602,7 +600,8 @@ pub fn (var p Parser) name_expr() ast.Expr {
|
||||
// type cast. TODO: finish
|
||||
// if name in table.builtin_type_names {
|
||||
if (name in p.table.type_idxs || name_w_mod in p.table.type_idxs) && !(name in ['C.stat',
|
||||
'C.sigaction']) {
|
||||
'C.sigaction'
|
||||
]) {
|
||||
// TODO handle C.stat()
|
||||
var to_typ := p.parse_type()
|
||||
if p.is_amp {
|
||||
@ -1216,3 +1215,4 @@ fn (p &Parser) new_true_expr() ast.Expr {
|
||||
fn verror(s string) {
|
||||
util.verror('parser error', s)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user