Keep file contents in memory
This commit is contained in:
parent
1170009b4f
commit
0eda941ed7
2 changed files with 4 additions and 2 deletions
|
|
@ -759,10 +759,11 @@ fn parse_command(p: Pair<'_, Rule>, file: &mut File) -> Result<()> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub fn parse_file(p: Pair<'_, Rule>) -> Result<File> {
|
||||
pub fn parse_file(p: Pair<'_, Rule>, contents: String) -> Result<File> {
|
||||
assert_eq!(p.as_rule(), Rule::file);
|
||||
|
||||
let mut file = File {
|
||||
contents,
|
||||
includes: vec![],
|
||||
timezone: None,
|
||||
commands: vec![],
|
||||
|
|
@ -787,5 +788,5 @@ pub fn parse(path: &Path, input: &str) -> Result<File> {
|
|||
let file_pair = pairs.next().unwrap();
|
||||
assert_eq!(pairs.next(), None);
|
||||
|
||||
parse_file(file_pair).map_err(|e| e.with_path(&pathstr))
|
||||
parse_file(file_pair, input.to_string()).map_err(|e| e.with_path(&pathstr))
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue