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" } ...@@ -31,12 +31,13 @@ maintenance = { status = "experimental" }
advanced_arg_parsing = [] advanced_arg_parsing = []
man = ["builtins-proc/man"] man = ["builtins-proc/man"]
piston = ["piston-ai_behavior", "piston_window", "piston2d-sprite"] piston = ["piston-ai_behavior", "piston_window", "piston2d-sprite"]
unicode = ["regex/unicode"]
[workspace] [workspace]
members = [ "members/builtins-proc", "members/ranges", "members/scopes-rs", "members/types-rs" ] members = [ "members/builtins-proc", "members/ranges", "members/scopes-rs", "members/types-rs" ]
[dev-dependencies] [dev-dependencies]
criterion = "0.2" criterion = "0.3"
serial_test = "*" serial_test = "*"
serial_test_derive = "*" serial_test_derive = "*"
...@@ -66,7 +67,7 @@ err-derive = "0.1" ...@@ -66,7 +67,7 @@ err-derive = "0.1"
glob = "0.3" glob = "0.3"
liner = { git = "https://gitlab.redox-os.org/redox-os/liner" } liner = { git = "https://gitlab.redox-os.org/redox-os/liner" }
rand = "0.7" 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"] } small = { git = "https://gitlab.redox-os.org/redox-os/small", features = ["std"] }
smallvec = "0.6" smallvec = "0.6"
unicode-segmentation = "1.3" unicode-segmentation = "1.3"
...@@ -79,7 +80,7 @@ itertools = "0.8" ...@@ -79,7 +80,7 @@ itertools = "0.8"
lexical = "3.0" lexical = "3.0"
object-pool = "0.3.1" object-pool = "0.3.1"
auto_enums = "0.5.5" auto_enums = "0.5.5"
structopt = "0.2" structopt = "0.3"
atty = "0.2" atty = "0.2"
permutate = "0.3" permutate = "0.3"
xdg = "2.1" xdg = "2.1"
......
...@@ -5,24 +5,15 @@ use itertools::Itertools; ...@@ -5,24 +5,15 @@ use itertools::Itertools;
const TEXT: &[u8] = include_bytes!("test.ion"); const TEXT: &[u8] = include_bytes!("test.ion");
fn criterion_benchmark(c: &mut Criterion) { fn criterion_benchmark(c: &mut Criterion) {
let stmts = TEXT let mut group = c.benchmark_group("statement-splitter-Throughput");
.iter()
.cloned() for stmt in TEXT.iter().cloned().batching(|lines| Terminator::new(lines).terminate()) {
.batching(|lines| Terminator::new(lines).terminate()) group.throughput(Throughput::Bytes(stmt.len() as u64));
.collect::<Vec<_>>();
c.bench( group.bench_with_input(BenchmarkId::new("statement", stmt.len()), &stmt, |b, stmt| {
"statement-splitter-throughput", b.iter(|| StatementSplitter::new(stmt).collect::<Vec<_>>())
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)),
);
} }
criterion_group!(benches, criterion_benchmark); criterion_group!(benches, criterion_benchmark);
......
...@@ -5,10 +5,13 @@ const TEXT: &str = include_str!("test.ion"); ...@@ -5,10 +5,13 @@ const TEXT: &str = include_str!("test.ion");
const EOF: &str = include_str!("herestring.ion"); const EOF: &str = include_str!("herestring.ion");
fn criterion_benchmark(c: &mut Criterion) { fn criterion_benchmark(c: &mut Criterion) {
c.bench( let mut group = c.benchmark_group("terminator-Throughput");
"terminator-throughput", for script in &[TEXT, EOF] {
ParameterizedBenchmark::new( group.throughput(Throughput::Bytes(script.len() as u64));
"terminator",
group.bench_with_input(
BenchmarkId::new("terminator", script.len()),
&script,
|b, script| { |b, script| {
b.iter(|| { b.iter(|| {
let mut bytes = script.bytes().peekable(); let mut bytes = script.bytes().peekable();
...@@ -17,10 +20,8 @@ fn criterion_benchmark(c: &mut Criterion) { ...@@ -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); criterion_group!(benches, criterion_benchmark);
......
...@@ -287,11 +287,13 @@ three two one two ...@@ -287,11 +287,13 @@ three two one two
one three one three one three one three
``` ```
### regex_replace ### regex\_replace
Defaults to string variables. Equivalent to `replace`, but the first argument will be treated Defaults to string variables. Equivalent to `replace`, but the first argument will be treated
as a regex. 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 #### Examples
```sh ```sh
......
...@@ -27,9 +27,9 @@ use std::{ ...@@ -27,9 +27,9 @@ use std::{
use xdg::BaseDirectories; use xdg::BaseDirectories;
#[cfg(not(feature = "advanced_arg_parsing"))] #[cfg(not(feature = "advanced_arg_parsing"))]
pub const MAN_ION: &str = r#"Ion - The Ion Shell 1.0.0-alpha pub const MAN_ION: &str = r#"ion 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 The fast, safe, modern rust shell. Ion is a commandline shell created to be a faster and easier to use alternative to
not POSIX compliant. the currently available shells. It is not POSIX compliant.
USAGE: USAGE:
ion [FLAGS] [OPTIONS] [args]... ion [FLAGS] [OPTIONS] [args]...
...@@ -44,7 +44,7 @@ FLAGS: ...@@ -44,7 +44,7 @@ FLAGS:
OPTIONS: OPTIONS:
-c <command> Evaluate given commands instead of reading from the commandline -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:
<args>... Script arguments (@args). If the -c option is not specified, the first parameter is taken as a <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 { ...@@ -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 /// The fast, safe, modern rust shell.
/// currently available shells. It is not POSIX compliant. /// 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", derive(StructOpt))]
#[cfg_attr( #[cfg_attr(feature = "advanced_arg_parsing", structopt(name = "Ion"))]
feature = "advanced_arg_parsing",
structopt(
name = "Ion - The Ion Shell",
author = "",
raw(setting = "structopt::clap::AppSettings::ColoredHelp")
)
)]
struct CommandLineArgs { struct CommandLineArgs {
/// Shortcut layout. Valid options: "vi", "emacs" /// Shortcut layout. Valid options: "vi", "emacs"
#[cfg_attr(feature = "advanced_arg_parsing", structopt(short = "-o"))] #[cfg_attr(feature = "advanced_arg_parsing", structopt(short = "-o"))]
......
matches Foo '([A-Z])\w+' && echo true matches Foo '([A-Z])[[:word:]]+' && echo true
matches foo '([A-Z])\w+' || echo false matches foo '([A-Z])[[:word:]]+' || echo false
echo foo | cat echo foo | cat
read foo <<< $(echo bar) read foo <<< $(echo bar)
echo $foo echo $foo
Ion - The Ion Shell 1.0.0-alpha ion 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 The fast, safe, modern rust shell. Ion is a commandline shell created to be a faster and easier to use alternative to
not POSIX compliant. the currently available shells. It is not POSIX compliant.
USAGE: USAGE:
ion [FLAGS] [OPTIONS] [args]... ion [FLAGS] [OPTIONS] [args]...
...@@ -15,7 +15,7 @@ FLAGS: ...@@ -15,7 +15,7 @@ FLAGS:
OPTIONS: OPTIONS:
-c <command> Evaluate given commands instead of reading from the commandline -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:
<args>... Script arguments (@args). If the -c option is not specified, the first parameter is taken as a <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])[[:word:]]+' && echo true
matches foo '([A-Z])\w+' || echo false matches foo '([A-Z])[[:word:]]+' || echo false
echo foo | cat echo foo | cat
read foo <<< $(echo bar) read foo <<< $(echo bar)
echo $foo 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