diff options
author | bnewbold <bnewbold@robocracy.org> | 2016-12-19 00:46:53 -0800 |
---|---|---|
committer | bnewbold <bnewbold@robocracy.org> | 2016-12-19 00:46:53 -0800 |
commit | aefce10b8f05dc52017beb1d422ce7b2b97bd6a5 (patch) | |
tree | e076218f621f71cf5b5074c3ffdf485fb8271ca2 /modelica-parser-lalrpop/examples | |
parent | b41f79765ecc80454e5f964de34ed73fefa15e7c (diff) | |
download | modelthing-aefce10b8f05dc52017beb1d422ce7b2b97bd6a5.tar.gz modelthing-aefce10b8f05dc52017beb1d422ce7b2b97bd6a5.zip |
parser: make strip comments a function
Diffstat (limited to 'modelica-parser-lalrpop/examples')
-rw-r--r-- | modelica-parser-lalrpop/examples/parse_file.rs | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/modelica-parser-lalrpop/examples/parse_file.rs b/modelica-parser-lalrpop/examples/parse_file.rs index 53da285..fe87ef0 100644 --- a/modelica-parser-lalrpop/examples/parse_file.rs +++ b/modelica-parser-lalrpop/examples/parse_file.rs @@ -1,20 +1,15 @@ extern crate modelica_parser; -extern crate regex; use std::env; use std::io::Read; use std::fs::File; use std::process::exit; -use regex::Regex; fn main() { let args: Vec<String> = env::args().collect(); - // Match on comments: - // (?m) sets multi-line mode - let comment_re = Regex::new(r"(?m)(//.*)$").unwrap(); if args.len() <= 1 { println!("I'm a modelica parser! Pass me one or more files to parse..."); @@ -29,9 +24,7 @@ fn main() { continue; } - // Strip comments manually - let striped = comment_re.replace_all(&raw, ""); - + let striped = modelica_parser::strip_comments(&raw); let result = modelica_parser::parser::parse_file(&striped); match result { |