mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
make sure scanner and parser both check BOM
This commit is contained in:
parent
6c85e285e7
commit
a485533dc9
@ -65,13 +65,9 @@ pub fn parse_stmt(text string, table &table.Table, scope &ast.Scope) ast.Stmt {
|
||||
}
|
||||
|
||||
pub fn parse_file(path string, table &table.Table) ast.File {
|
||||
// println('parse_file("$path")')
|
||||
text := os.read_file(path) or {
|
||||
panic(err)
|
||||
}
|
||||
mut stmts := []ast.Stmt
|
||||
mut p := Parser{
|
||||
scanner: scanner.new_scanner(text)
|
||||
scanner: scanner.new_scanner_file(path)
|
||||
table: table
|
||||
file_name: path
|
||||
pref: &pref.Preferences{}
|
||||
|
@ -43,7 +43,7 @@ mut:
|
||||
// string values when generating formatted code.
|
||||
}
|
||||
// new scanner from file.
|
||||
fn new_scanner_file(file_path string) &Scanner {
|
||||
pub fn new_scanner_file(file_path string) &Scanner {
|
||||
if !os.exists(file_path) {
|
||||
verror("$file_path doesn't exist")
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user