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

filepath: path separator (#3756)

This commit is contained in:
yuyi
2020-02-18 03:31:23 +08:00
committed by GitHub
parent 6079025985
commit 6849a4e770
26 changed files with 105 additions and 99 deletions

View File

@@ -11,6 +11,7 @@ import (
v.pref
term
os
filepath
)
const (
@@ -56,7 +57,7 @@ pub fn parse_stmt(text string, table &table.Table, scope &ast.Scope) ast.Stmt {
pref: &pref.Preferences{}
scope: scope
// scope: &ast.Scope{start_pos: 0, parent: 0}
}
p.init_parse_fns()
p.read_first_token()
@@ -309,7 +310,7 @@ pub fn (p mut Parser) stmt() ast.Stmt {
return ast.ExprStmt{
expr: expr
// typ: typ
}
}
}
@@ -392,7 +393,7 @@ pub fn (p &Parser) error(s string) {
print_backtrace()
mut path := p.file_name
// Get relative path
workdir := os.getwd() + os.path_separator
workdir := os.getwd() + filepath.separator
if path.starts_with(workdir) {
path = path.replace(workdir, '')
}
@@ -1049,10 +1050,10 @@ fn (p mut Parser) if_expr() ast.Expr {
stmts: stmts
else_stmts: else_stmts
// typ: typ
pos: p.tok.position()
// left: left
}
return node
}
@@ -1439,10 +1440,10 @@ fn (p mut Parser) var_decl() ast.VarDecl {
node := ast.VarDecl{
name: name
expr: expr // p.expr(token.lowest_prec)
is_mut: is_mut
// typ: typ
pos: p.tok.position()
}
p.scope.register_var(node)
@@ -1561,7 +1562,7 @@ fn (p mut Parser) match_expr() ast.Expr {
blocks: blocks
match_exprs: match_exprs
// typ: typ
cond: cond
}
return node