mirror of
https://github.com/nushell/nushell.git
synced 2025-02-08 06:30:00 +01:00
closes #9111 # Description this pr improves parsing of values with units (`filesizes`, `durations` and any other **future values**) by: 1. allowing underscores in the value part ```nu > 42kb # okay > 42_sec # okay > 1_000_000mib # okay > 69k_b # not okay, underscores not allowed in the unit ``` 2. improving error messages involving these values ```nu > sleep 40-sec # before Error: nu::parser::parse_mismatch × Parse mismatch during operation. ╭─[entry #42:1:1] 1 │ sleep 40-sec · ──┬── · ╰── expected duration with valid units ╰──── # now Error: × duration value must be a number ╭─[entry #41:1:1] 1 │ sleep 40-sec · ─┬─ · ╰── not a number ╰──── ``` 3. unifying parsing of these values. now all of these use one function # User-Facing Changes filesizes and durations can now have underscores for readability
28 lines
789 B
Rust
28 lines
789 B
Rust
mod deparse;
|
|
mod eval;
|
|
mod flatten;
|
|
mod known_external;
|
|
mod lex;
|
|
mod lite_parser;
|
|
mod parse_keywords;
|
|
mod parse_patterns;
|
|
mod parser;
|
|
mod type_check;
|
|
|
|
pub use deparse::{escape_for_script_arg, escape_quote_string};
|
|
pub use flatten::{
|
|
flatten_block, flatten_expression, flatten_pipeline, flatten_pipeline_element, FlatShape,
|
|
};
|
|
pub use known_external::KnownExternal;
|
|
pub use lex::{lex, lex_signature, Token, TokenContents};
|
|
pub use lite_parser::{lite_parse, LiteBlock, LiteElement};
|
|
pub use parse_keywords::*;
|
|
|
|
pub use parser::{
|
|
is_math_expression_like, parse, parse_block, parse_expression, parse_external_call,
|
|
parse_unit_value, trim_quotes, trim_quotes_str, unescape_unquote_string, DURATION_UNIT_GROUPS,
|
|
};
|
|
|
|
#[cfg(feature = "plugin")]
|
|
pub use parse_keywords::parse_register;
|