Merge pull request #18 from probablykasper/lexer-multiword
Improve multiword lexing
This commit is contained in:
commit
3137979d55
40
Cargo.lock
generated
40
Cargo.lock
generated
@ -1,5 +1,14 @@
|
||||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
[[package]]
|
||||
name = "aho-corasick"
|
||||
version = "0.7.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
version = "1.2.1"
|
||||
@ -17,6 +26,8 @@ name = "cpc"
|
||||
version = "1.6.0"
|
||||
dependencies = [
|
||||
"decimal",
|
||||
"regex",
|
||||
"unicode-segmentation",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -39,12 +50,35 @@ version = "0.2.93"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9385f66bf6105b241aa65a61cb923ef20efc665cb9f9bb50ac2f0c4b7f378d41"
|
||||
|
||||
[[package]]
|
||||
name = "memchr"
|
||||
version = "2.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b16bd47d9e329435e309c58469fe0791c2d0d1ba96ec0954152a5ae2b04387dc"
|
||||
|
||||
[[package]]
|
||||
name = "ord_subset"
|
||||
version = "3.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d7ce14664caf5b27f5656ff727defd68ae1eb75ef3c4d95259361df1eb376bef"
|
||||
|
||||
[[package]]
|
||||
name = "regex"
|
||||
version = "1.5.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d07a8629359eb56f1e2fb1652bb04212c072a87ba68546a04065d525673ac461"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"memchr",
|
||||
"regex-syntax",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex-syntax"
|
||||
version = "0.6.25"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b"
|
||||
|
||||
[[package]]
|
||||
name = "rustc-serialize"
|
||||
version = "0.3.24"
|
||||
@ -56,3 +90,9 @@ name = "serde"
|
||||
version = "1.0.125"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "558dc50e1a5a5fa7112ca2ce4effcb321b0300c0d4ccf0776a9f60cd89031171"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-segmentation"
|
||||
version = "1.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8895849a949e7845e06bd6dc1aa51731a103c42707010a5b591c0038fb73385b"
|
||||
|
||||
@ -14,3 +14,7 @@ categories = ["mathematics", "science", "parsing", "text-processing", "value-for
|
||||
|
||||
[dependencies]
|
||||
decimal = "2.1.0"
|
||||
unicode-segmentation = "1.8.0"
|
||||
|
||||
[dev-dependencies]
|
||||
regex = "1.5.4"
|
||||
|
||||
@ -32,7 +32,7 @@ Add `cpc` as a dependency in `Cargo.toml`.
|
||||
## API Usage
|
||||
|
||||
```rust
|
||||
use cpc::{eval};
|
||||
use cpc::eval;
|
||||
use cpc::units::Unit;
|
||||
|
||||
match eval("3m + 1cm", true, Unit::Celsius, false) {
|
||||
|
||||
1214
src/lexer.rs
1214
src/lexer.rs
File diff suppressed because it is too large
Load Diff
@ -8,7 +8,7 @@
|
||||
//!
|
||||
//! # Example usage
|
||||
//! ```rust
|
||||
//! use cpc::{eval};
|
||||
//! use cpc::eval;
|
||||
//! use cpc::units::Unit;
|
||||
//!
|
||||
//! match eval("3m + 1cm", true, Unit::Celsius, false) {
|
||||
@ -211,7 +211,7 @@ macro_rules! numtok {
|
||||
///
|
||||
/// Example:
|
||||
/// ```rust
|
||||
/// use cpc::{eval};
|
||||
/// use cpc::eval;
|
||||
/// use cpc::units::Unit;
|
||||
///
|
||||
/// match eval("3m + 1cm", true, Unit::Celsius, false) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user