Skip to content

Implement address compilation #57

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
16 changes: 14 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@
# sed

Rust reimplementation of the [sed utility](https://pubs.opengroup.org/onlinepubs/9799919799/utilities/sed.html)
with some [GNU sed](https://www.gnu.org/software/sed/manual/sed.html)
and [FreeBSD sed](https://man.freebsd.org/cgi/man.cgi?sed(1)) extensions.
with some [GNU sed](https://www.gnu.org/software/sed/manual/sed.html),
[FreeBSD sed](https://man.freebsd.org/cgi/man.cgi?sed(1)),
and other extensions.

## Installation

Expand All @@ -23,6 +24,17 @@ cd sed
cargo build --release
cargo run --release
```
## Extensions
### GNU
* Command-line arguments can be specified in long (`--`) form.
* Spaces can precede a regular expression modifier.

### BSD and GNU
* The second address in a range can be specified as a relative address with +N.

### Other
* Unicode characters can be specified in regular expression pattern, replacement
and transliteration sequences using `\uXXXX` or `\UXXXXXXXX` sequences.

## License

Expand Down
17 changes: 16 additions & 1 deletion src/uu/sed/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use std::path::PathBuf; // For file descriptors and equivalent

// Compilation and processing options provided mostly through the
// command-line interface
#[derive(Debug)]
#[derive(Debug, Default)]
pub struct CliOptions {
// Command-line flags with corresponding names
pub all_output_files: bool,
Expand Down Expand Up @@ -107,6 +107,21 @@ pub struct Command {
pub next: Option<Box<Command>>, // Pointer to next command
}

impl Default for Command {
fn default() -> Self {
Command {
code: '_',
addr1: None,
addr2: None,
non_select: false,
start_line: Some(0),
text: None,
data: CommandData::None,
next: None,
}
}
}

#[derive(Debug)]
pub enum CommandData {
None,
Expand Down
Loading
Loading