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::ContinuedLineNumber,
|
||||
(SwitchState::NewLineNumber, _) => {
|
||||
let val = word
|
||||
.parse::<LineNumber>()
|
||||
.expect("TODO: I should be able to return CustomError from nom parsers.");
|
||||
let val = match word.parse::<LineNumber>() {
|
||||
Ok(val) => val,
|
||||
Err(_) => 1,
|
||||
};
|
||||
if val < 0 {
|
||||
number_lines = Some(SwitchNumberLines::New(0));
|
||||
} else {
|
||||
@ -354,9 +355,10 @@ fn example_switches<'s>(input: OrgSource<'s>) -> Res<OrgSource<'s>, ExampleSwitc
|
||||
SwitchState::Normal
|
||||
}
|
||||
(SwitchState::ContinuedLineNumber, _) => {
|
||||
let val = word
|
||||
.parse::<LineNumber>()
|
||||
.expect("TODO: I should be able to return CustomError from nom parsers.");
|
||||
let val = match word.parse::<LineNumber>() {
|
||||
Ok(val) => val,
|
||||
Err(_) => 1,
|
||||
};
|
||||
if val < 0 {
|
||||
number_lines = Some(SwitchNumberLines::Continued(0));
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user