Skip to content

Commit

Permalink
Simplify Base64Parsing (#351)
Browse files Browse the repository at this point in the history
  • Loading branch information
jrudolph authored Feb 24, 2022
1 parent 81b7433 commit 8e3256c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions parboiled/src/main/scala/org/parboiled2/Base64Parsing.scala
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ trait Base64Parsing { this: Parser =>
def base64StringOrBlock(alphabet: CharPredicate, decoder: Decoder): Rule1[Array[Byte]] = {
val start = cursor
rule {
oneOrMore(alphabet) ~ run[Rule1[Array[Byte]]] {
oneOrMore(alphabet) ~ run {
decoder(input.sliceCharArray(start, cursor)) match {
case null => MISMATCH
case bytes => push(bytes)
Expand All @@ -62,7 +62,7 @@ trait Base64Parsing { this: Parser =>
private def base64(alphabet: CharPredicate, fillChar: Char, decoder: Decoder): Rule1[Array[Byte]] = {
val start = cursor
rule {
oneOrMore(alphabet) ~ zeroOrMore(ch(fillChar)) ~ run[Rule1[Array[Byte]]] {
oneOrMore(alphabet) ~ zeroOrMore(ch(fillChar)) ~ run {
decoder(input.sliceCharArray(start, cursor)) match {
case null => MISMATCH
case bytes => push(bytes)
Expand Down

0 comments on commit 8e3256c

Please sign in to comment.