Fix README example

This commit is contained in:
Rob Donnelly 2020-01-31 13:33:49 -08:00 committed by GitHub
parent 09fd5b2d35
commit ea445625a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -48,7 +48,7 @@ fn main() {
let includes: Vec<PathBuf> = Vec::new(); let includes: Vec<PathBuf> = Vec::new();
// Parse // Parse
let result = parse_sv(&path, &defines, &includes); let result = parse_sv(&path, &defines, &includes, false);
if let Ok((syntax_tree, _)) = result { if let Ok((syntax_tree, _)) = result {
// &SyntaxTree is iterable // &SyntaxTree is iterable
@ -62,13 +62,13 @@ fn main() {
let id = get_identifier(id).unwrap(); let id = get_identifier(id).unwrap();
// Original string can be got by SyntaxTree::get_str(self, locate: &Locate) // Original string can be got by SyntaxTree::get_str(self, locate: &Locate)
let id = syntax_tree.get_str(&id); let id = syntax_tree.get_str(&id).unwrap();
println!("module: {}", id); println!("module: {}", id);
} }
RefNode::ModuleDeclarationAnsi(x) => { RefNode::ModuleDeclarationAnsi(x) => {
let id = unwrap_node!(x, ModuleIdentifier).unwrap(); let id = unwrap_node!(x, ModuleIdentifier).unwrap();
let id = get_identifier(id).unwrap(); let id = get_identifier(id).unwrap();
let id = syntax_tree.get_str(&id); let id = syntax_tree.get_str(&id).unwrap();
println!("module: {}", id); println!("module: {}", id);
} }
_ => (), _ => (),