Skip to content

Commit 0fa76ab

Browse files
committed
Rewrite literal_nocapture parser without macros
1 parent 832b234 commit 0fa76ab

File tree

1 file changed

+17
-13
lines changed

1 file changed

+17
-13
lines changed

src/fallback.rs

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -966,19 +966,23 @@ fn literal(input: Cursor) -> PResult<Literal> {
966966
}
967967
}
968968

969-
named!(literal_nocapture -> (), alt!(
970-
string
971-
|
972-
byte_string
973-
|
974-
byte
975-
|
976-
character
977-
|
978-
float
979-
|
980-
int
981-
));
969+
fn literal_nocapture(input: Cursor) -> PResult<()> {
970+
if let Ok(ok) = string(input) {
971+
Ok(ok)
972+
} else if let Ok(ok) = byte_string(input) {
973+
Ok(ok)
974+
} else if let Ok(ok) = byte(input) {
975+
Ok(ok)
976+
} else if let Ok(ok) = character(input) {
977+
Ok(ok)
978+
} else if let Ok(ok) = float(input) {
979+
Ok(ok)
980+
} else if let Ok(ok) = int(input) {
981+
Ok(ok)
982+
} else {
983+
Err(LexError)
984+
}
985+
}
982986

983987
fn string(input: Cursor) -> PResult<()> {
984988
let input = skip_whitespace(input);

0 commit comments

Comments
 (0)