Make an argument for the line number switch optional.
This commit is contained in:
parent
03028889bd
commit
1503054994
@ -0,0 +1,3 @@
|
|||||||
|
#+BEGIN_SRC elisp -n -r -l "((%s))"
|
||||||
|
foo
|
||||||
|
#+END_SRC
|
@ -342,9 +342,10 @@ fn example_switches<'s>(input: OrgSource<'s>) -> Res<OrgSource<'s>, ExampleSwitc
|
|||||||
(SwitchState::Normal, "-n") => SwitchState::NewLineNumber,
|
(SwitchState::Normal, "-n") => SwitchState::NewLineNumber,
|
||||||
(SwitchState::Normal, "+n") => SwitchState::ContinuedLineNumber,
|
(SwitchState::Normal, "+n") => SwitchState::ContinuedLineNumber,
|
||||||
(SwitchState::NewLineNumber, _) => {
|
(SwitchState::NewLineNumber, _) => {
|
||||||
let val = word
|
let val = match word.parse::<LineNumber>() {
|
||||||
.parse::<LineNumber>()
|
Ok(val) => val,
|
||||||
.expect("TODO: I should be able to return CustomError from nom parsers.");
|
Err(_) => 1,
|
||||||
|
};
|
||||||
if val < 0 {
|
if val < 0 {
|
||||||
number_lines = Some(SwitchNumberLines::New(0));
|
number_lines = Some(SwitchNumberLines::New(0));
|
||||||
} else {
|
} else {
|
||||||
@ -354,9 +355,10 @@ fn example_switches<'s>(input: OrgSource<'s>) -> Res<OrgSource<'s>, ExampleSwitc
|
|||||||
SwitchState::Normal
|
SwitchState::Normal
|
||||||
}
|
}
|
||||||
(SwitchState::ContinuedLineNumber, _) => {
|
(SwitchState::ContinuedLineNumber, _) => {
|
||||||
let val = word
|
let val = match word.parse::<LineNumber>() {
|
||||||
.parse::<LineNumber>()
|
Ok(val) => val,
|
||||||
.expect("TODO: I should be able to return CustomError from nom parsers.");
|
Err(_) => 1,
|
||||||
|
};
|
||||||
if val < 0 {
|
if val < 0 {
|
||||||
number_lines = Some(SwitchNumberLines::Continued(0));
|
number_lines = Some(SwitchNumberLines::Continued(0));
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user