Skip to content

Commit

Permalink
Implement word-ending operator
Browse files Browse the repository at this point in the history
  • Loading branch information
sammdot committed Apr 21, 2021
1 parent 3224aea commit acd85f0
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/translation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ fn operator(input: &str) -> IResult<&str, Object> {
)), tag("}")))(input)?;
Ok((input, match oper {
"^" => Object::AttachRaw,
"$" => Object::WordEnd,
"*" => Object::RetroToggleStar,
"*+" => Object::RepeatLastStroke,
"*?" => Object::RetroInsertSpace,
Expand Down Expand Up @@ -370,6 +371,7 @@ pub fn format_plover_to_rtf(tl: &str) -> String {
_ => match obj {
Object::Noop => "{\\*\\cxplvrnop}",
Object::Cancel => "{\\*\\cxplvrcancel}",
Object::WordEnd => "{\\*\\cxplvrwdend}",
Object::DeleteStroke => "\\cxdstroke ",
Object::RepeatLastStroke => "{\\*\\cxplvrrpt}",
Object::RetroToggleStar => "{\\*\\cxplvrast}",
Expand Down
1 change: 1 addition & 0 deletions src/translation_model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ pub enum ParagraphMode {
pub enum Object {
Cancel,
Noop,
WordEnd,
DeleteStroke,
RepeatLastStroke,
RetroToggleStar,
Expand Down
2 changes: 2 additions & 0 deletions src/translation_parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ fn no_arg_group(input: &str) -> IResult<&str, Object> {
Ok((input, match label {
"cxplvrnop" => Object::Noop,
"cxplvrcancel" => Object::Cancel,
"cxplvrwdend" => Object::WordEnd,
"cxplvrast" => Object::RetroToggleStar,
"cxplvrrpt" => Object::RepeatLastStroke,
"cxplvrrtisp" => Object::RetroInsertSpace,
Expand Down Expand Up @@ -280,6 +281,7 @@ pub fn format_rtf_to_plover(tl: &str) -> String {
_ => match obj {
Object::Cancel => "{}",
Object::Noop => "{#}",
Object::WordEnd => "{$}",
Object::DeleteStroke => "=undo",
Object::RepeatLastStroke => "{*+}",
Object::RetroToggleStar => "{*}",
Expand Down

0 comments on commit acd85f0

Please sign in to comment.