Commit d91f3c05 authored by AdminXVII's avatar AdminXVII Committed by Michael Aaron Murphy
Browse files

feat: Disable unicode support by default + update deps

- Disable the regex's unicode feature by default
- Add a feature to Ion to enable it again
- Update the dependencies

Breaking Change: Perl-style character class are disabled (\w _et al._) and
there is no longer unicode support by default.
parent 73cd077b
This diff is collapsed.
......@@ -31,12 +31,13 @@ maintenance = { status = "experimental" }
advanced_arg_parsing = []
man = ["builtins-proc/man"]
piston = ["piston-ai_behavior", "piston_window", "piston2d-sprite"]
unicode = ["regex/unicode"]
[workspace]
members = [ "members/builtins-proc", "members/ranges", "members/scopes-rs", "members/types-rs" ]
[dev-dependencies]
criterion = "0.2"
criterion = "0.3"
serial_test = "*"
serial_test_derive = "*"
......@@ -66,7 +67,7 @@ err-derive = "0.1"
glob = "0.3"
liner = { git = "https://gitlab.redox-os.org/redox-os/liner" }
rand = "0.7"
regex = "1.2"
regex = { version = "1.3", default-features = false, features = ["std", "perf"] }
small = { git = "https://gitlab.redox-os.org/redox-os/small", features = ["std"] }
smallvec = "0.6"
unicode-segmentation = "1.3"
......@@ -79,7 +80,7 @@ itertools = "0.8"
lexical = "3.0"
object-pool = "0.3.1"
auto_enums = "0.5.5"
structopt = "0.2"
structopt = "0.3"
atty = "0.2"
permutate = "0.3"
xdg = "2.1"
......
......@@ -5,24 +5,15 @@ use itertools::Itertools;
const TEXT: &[u8] = include_bytes!("test.ion");
fn criterion_benchmark(c: &mut Criterion) {
let stmts = TEXT
.iter()
.cloned()
.batching(|lines| Terminator::new(lines).terminate())
.collect::<Vec<_>>();
c.bench(
"statement-splitter-throughput",
ParameterizedBenchmark::new(
"statement",
|b, script| {
b.iter(|| {
script.iter().flat_map(|cmd| StatementSplitter::new(cmd)).collect::<Vec<_>>()
})
},
vec![stmts],
)
.throughput(|script| Throughput::Bytes(script.len() as u32)),
);
let mut group = c.benchmark_group("statement-splitter-Throughput");
for stmt in TEXT.iter().cloned().batching(|lines| Terminator::new(lines).terminate()) {
group.throughput(Throughput::Bytes(stmt.len() as u64));
group.bench_with_input(BenchmarkId::new("statement", stmt.len()), &stmt, |b, stmt| {
b.iter(|| StatementSplitter::new(stmt).collect::<Vec<_>>())
});
}
}
criterion_group!(benches, criterion_benchmark);
......
......@@ -5,10 +5,13 @@ const TEXT: &str = include_str!("test.ion");
const EOF: &str = include_str!("herestring.ion");
fn criterion_benchmark(c: &mut Criterion) {
c.bench(
"terminator-throughput",
ParameterizedBenchmark::new(
"terminator",
let mut group = c.benchmark_group("terminator-Throughput");
for script in &[TEXT, EOF] {
group.throughput(Throughput::Bytes(script.len() as u64));
group.bench_with_input(
BenchmarkId::new("terminator", script.len()),
&script,
|b, script| {
b.iter(|| {
let mut bytes = script.bytes().peekable();
......@@ -17,10 +20,8 @@ fn criterion_benchmark(c: &mut Criterion) {
}
})
},
vec![TEXT, EOF],
)
.throughput(|script| Throughput::Bytes(script.len() as u32)),
);
}
}
criterion_group!(benches, criterion_benchmark);
......
......@@ -287,11 +287,13 @@ three two one two
one three one three
```
### regex_replace
### regex\_replace
Defaults to string variables. Equivalent to `replace`, but the first argument will be treated
as a regex.
**PS:** By default, unicode support will be disabled to trim the size of Ion. Add the "unicode" flag to enable it.
#### Examples
```sh
......
......@@ -27,9 +27,9 @@ use std::{
use xdg::BaseDirectories;
#[cfg(not(feature = "advanced_arg_parsing"))]
pub const MAN_ION: &str = r#"Ion - The Ion Shell 1.0.0-alpha
Ion is a commandline shell created to be a faster and easier to use alternative to the currently available shells. It is
not POSIX compliant.
pub const MAN_ION: &str = r#"ion 1.0.0-alpha
The fast, safe, modern rust shell. Ion is a commandline shell created to be a faster and easier to use alternative to
the currently available shells. It is not POSIX compliant.
USAGE:
ion [FLAGS] [OPTIONS] [args]...
......@@ -44,7 +44,7 @@ FLAGS:
OPTIONS:
-c <command> Evaluate given commands instead of reading from the commandline
-o <key_bindings> Shortcut layout. Valid options: "vi", "emacs"
-o <key-bindings> Shortcut layout. Valid options: "vi", "emacs"
ARGS:
<args>... Script arguments (@args). If the -c option is not specified, the first parameter is taken as a
......
......@@ -39,17 +39,11 @@ impl FromStr for KeyBindingsWrapper {
}
}
/// Ion is a commandline shell created to be a faster and easier to use alternative to the
/// currently available shells. It is not POSIX compliant.
/// The fast, safe, modern rust shell.
/// Ion is a commandline shell created to be a faster and easier to use
/// alternative to the currently available shells. It is not POSIX compliant.
#[cfg_attr(feature = "advanced_arg_parsing", derive(StructOpt))]
#[cfg_attr(
feature = "advanced_arg_parsing",
structopt(
name = "Ion - The Ion Shell",
author = "",
raw(setting = "structopt::clap::AppSettings::ColoredHelp")
)
)]
#[cfg_attr(feature = "advanced_arg_parsing", structopt(name = "Ion"))]
struct CommandLineArgs {
/// Shortcut layout. Valid options: "vi", "emacs"
#[cfg_attr(feature = "advanced_arg_parsing", structopt(short = "-o"))]
......
matches Foo '([A-Z])\w+' && echo true
matches foo '([A-Z])\w+' || echo false
matches Foo '([A-Z])[[:word:]]+' && echo true
matches foo '([A-Z])[[:word:]]+' || echo false
echo foo | cat
read foo <<< $(echo bar)
echo $foo
Ion - The Ion Shell 1.0.0-alpha
Ion is a commandline shell created to be a faster and easier to use alternative to the currently available shells. It is
not POSIX compliant.
ion 1.0.0-alpha
The fast, safe, modern rust shell. Ion is a commandline shell created to be a faster and easier to use alternative to
the currently available shells. It is not POSIX compliant.
USAGE:
ion [FLAGS] [OPTIONS] [args]...
......@@ -15,7 +15,7 @@ FLAGS:
OPTIONS:
-c <command> Evaluate given commands instead of reading from the commandline
-o <key_bindings> Shortcut layout. Valid options: "vi", "emacs"
-o <key-bindings> Shortcut layout. Valid options: "vi", "emacs"
ARGS:
<args>... Script arguments (@args). If the -c option is not specified, the first parameter is taken as a
......
matches Foo '([A-Z])\w+' && echo true
matches foo '([A-Z])\w+' || echo false
matches Foo '([A-Z])[[:word:]]+' && echo true
matches foo '([A-Z])[[:word:]]+' || echo false
echo foo | cat
read foo <<< $(echo bar)
echo $foo
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment