nushell/crates/nu-parser/src
Ian Manske aec41f3df0
Add Span merging functions (#12511)
# Description
This PR adds a few functions to `Span` for merging spans together:
- `Span::append`: merges two spans that are known to be in order.
- `Span::concat`: returns a span that encompasses all the spans in a
slice. The spans must be in order.
- `Span::merge`: merges two spans (no order necessary).
- `Span::merge_many`: merges an iterator of spans into a single span (no
order necessary).

These are meant to replace the free-standing `nu_protocol::span`
function.

The spans in a `LiteCommand` (the `parts`) should always be in order
based on the lite parser and lexer. So, the parser code sees the most
usage of `Span::append` and `Span::concat` where the order is known. In
other code areas, `Span::merge` and `Span::merge_many` are used since
the order between spans is often not known.
2024-05-16 22:34:49 +00:00
..
deparse.rs
exportable.rs
flatten.rs Fix syntax highlighting for not (#12815) 2024-05-10 07:09:44 +08:00
known_external.rs Add command_prelude module (#12291) 2024-03-26 21:17:30 +00:00
lex.rs make better messages for incomplete string (#12868) 2024-05-15 01:14:11 +00:00
lib.rs IO and redirection overhaul (#11934) 2024-03-14 15:51:55 -05:00
lite_parser.rs Add command_prelude module (#12291) 2024-03-26 21:17:30 +00:00
parse_keywords.rs Add Span merging functions (#12511) 2024-05-16 22:34:49 +00:00
parse_patterns.rs Add command_prelude module (#12291) 2024-03-26 21:17:30 +00:00
parse_shape_specs.rs Add command_prelude module (#12291) 2024-03-26 21:17:30 +00:00
parser.rs Add Span merging functions (#12511) 2024-05-16 22:34:49 +00:00
parser_path.rs Deprecate register and add plugin use (#12607) 2024-04-23 06:37:50 -05:00
type_check.rs Shrink the size of Expr (#12610) 2024-04-24 15:46:35 +00:00