mirror of
https://github.com/zaphar/ucg.git
synced 2025-07-23 18:29:50 -04:00
CLEANUP: Cleanup some todos and unused code.
This commit is contained in:
parent
5e6da71ff2
commit
0fc8c537f9
@ -9,23 +9,7 @@ extern crate ucglib;
|
||||
use bencher::Bencher;
|
||||
//use cpuprofiler::PROFILER;
|
||||
|
||||
macro_rules! bench_parse {
|
||||
($parsemac:ident($i:expr), $b:expr) => {
|
||||
bench_parse!($i, $parsemac, $b)
|
||||
};
|
||||
($i:expr, $f:expr, $b:expr) => {
|
||||
let input = nom_locate::LocatedSpan::new($i);
|
||||
let val = tokenize(input).unwrap();
|
||||
$b.iter(|| {
|
||||
$f(TokenIter {
|
||||
source: val.as_slice(),
|
||||
})
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
use ucglib::parse::*;
|
||||
use ucglib::tokenizer::*;
|
||||
|
||||
fn do_parse(i: &str) {
|
||||
parse(nom_locate::LocatedSpan::new(i));
|
||||
@ -81,7 +65,6 @@ fn parse_complex_tuple_list(b: &mut Bencher) {
|
||||
// .unwrap();
|
||||
let input = "[{foo=1}, {bar=2}, {quux=4}];";
|
||||
b.iter(|| do_parse(input));
|
||||
//bench_parse!(non_op_expression(input), b);
|
||||
//PROFILER.lock().unwrap().stop().unwrap();
|
||||
}
|
||||
|
||||
@ -93,7 +76,6 @@ fn parse_complex_nested_list(b: &mut Bencher) {
|
||||
// .unwrap();
|
||||
let input = "[[1,2], [3,4], [4,5]];";
|
||||
b.iter(|| do_parse(input));
|
||||
//bench_parse!(non_op_expression(input), b);
|
||||
//PROFILER.lock().unwrap().stop().unwrap();
|
||||
}
|
||||
|
||||
|
@ -744,11 +744,6 @@ named!(pub non_op_expression<TokenIter, Expression, error::Error>,
|
||||
trace_nom!(simple_expression))
|
||||
);
|
||||
|
||||
// TODO(jwall): Because we have to parse an op_expression before a non_op_expression
|
||||
// this parser is really slow. The reason is that the op_expression is unable to fail
|
||||
// quickly enough and wastes a lot of parsing time before it realizes that this is not
|
||||
// an operator expression. Fixing this probably means hand rolling this parsing
|
||||
// function so we can identify early whether this is an op_expression or not.
|
||||
named!(pub expression<TokenIter, Expression, error::Error>,
|
||||
alt_complete!(trace_nom!(op_expression) | trace_nom!(non_op_expression))
|
||||
);
|
||||
|
Loading…
x
Reference in New Issue
Block a user