Add =~ and !~ operators on strings

`left =~ right` return true if left contains right, using Rust's
`String::contains`. `!~` is the negated version.

A new `apply_operator` function is added which decouples evaluation from
`Value::compare`. This returns a `Value` and opens the door to
implementing `+` for example, though it wouldn't be useful immediately.

The `operator!` macro had to be changed slightly as it would choke on
`~` in arguments.
This commit is contained in:
Belhorma Bendebiche
2019-11-21 12:18:00 -05:00
committed by Yehuda Katz
parent e4226def16
commit 8f9dd6516e
13 changed files with 30 additions and 91 deletions

View File

@ -11,5 +11,6 @@ pub use self::meta::{
pub use self::pretty::{
b, DebugDoc, DebugDocBuilder, PrettyDebug, PrettyDebugWithSource, ShellAnnotation,
};
pub use self::term_colored::TermColored;
pub use self::text::Text;
pub use self::tracable::{nom_input, NomSpan, TracableContext};