Merge pull request #3 from rfdonnelly/patch-1

Fix README example
This commit is contained in:
dalance 2020-04-01 11:57:15 +09:00 committed by GitHub
commit b02656a88f
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();
// Parse
let result = parse_sv(&path, &defines, &includes);
let result = parse_sv(&path, &defines, &includes, false);
if let Ok((syntax_tree, _)) = result {
// &SyntaxTree is iterable
@ -62,13 +62,13 @@ fn main() {
let id = get_identifier(id).unwrap();
// 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);
}
RefNode::ModuleDeclarationAnsi(x) => {
let id = unwrap_node!(x, ModuleIdentifier).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);
}
_ => (),