update nom
authoralfadur
Tue, 22 Jun 2021 01:57:50 +0300
changeset 15801 f57a3d48072b
parent 15800 6af892a0a4b8
child 15802 d5c37e78ab83
update nom
rust/hedgewars-server/Cargo.toml
rust/hedgewars-server/src/protocol/parser.rs
rust/hedgewars-server/src/server/haskell.rs
--- a/rust/hedgewars-server/Cargo.toml	Tue Jun 22 01:41:33 2021 +0300
+++ b/rust/hedgewars-server/Cargo.toml	Tue Jun 22 01:57:50 2021 +0300
@@ -16,11 +16,11 @@
 mio = { version = "0.7", features = ["os-poll", "net"] }
 slab = "0.4"
 netbuf = "0.4"
-nom = "5.1"
+nom = "6.2"
 env_logger = "0.8"
 log = "0.4"
 base64 = "0.13"
-bitflags = "1.1"
+bitflags = "1.2"
 serde = "1.0"
 serde_yaml = "0.8"
 serde_derive = "1.0"
@@ -28,4 +28,4 @@
 mysql = { version = "15.0", optional = true }
 
 [dev-dependencies]
-proptest = "0.9"
+proptest = "1.0"
--- a/rust/hedgewars-server/src/protocol/parser.rs	Tue Jun 22 01:41:33 2021 +0300
+++ b/rust/hedgewars-server/src/protocol/parser.rs	Tue Jun 22 01:57:50 2021 +0300
@@ -12,7 +12,7 @@
     character::complete::{newline, not_line_ending},
     combinator::{map, peek},
     error::{ErrorKind, ParseError},
-    multi::separated_list,
+    multi::separated_list0,
     sequence::{delimited, pair, preceded, terminated, tuple},
     Err, IResult,
 };
@@ -211,7 +211,7 @@
         name: &'a str,
         parser: F,
         constructor: G,
-    ) -> impl Fn(&'a [u8]) -> HwResult<'a, HwProtocolMessage>
+    ) -> impl FnMut(&'a [u8]) -> HwResult<'a, HwProtocolMessage>
     where
         F: Fn(&[u8]) -> HwResult<T>,
         G: Fn(T) -> HwProtocolMessage,
@@ -249,7 +249,7 @@
         name: &'a str,
         parser: F,
         constructor: G,
-    ) -> impl Fn(&'a [u8]) -> HwResult<'a, HwProtocolMessage>
+    ) -> impl FnMut(&'a [u8]) -> HwResult<'a, HwProtocolMessage>
     where
         F: Fn(&'a [u8]) -> HwResult<'a, T>,
         G: Fn(T) -> HwProtocolMessage,
@@ -308,7 +308,7 @@
                     tag_no_case("RND"),
                     alt((
                         map(peek(end_of_message), |_| vec![]),
-                        preceded(spaces, separated_list(spaces, cmd_arg)),
+                        preceded(spaces, separated_list0(spaces, cmd_arg)),
                     )),
                 ),
                 Rnd,
@@ -322,7 +322,7 @@
         name: &'a str,
         parser: F,
         constructor: G,
-    ) -> impl Fn(&'a [u8]) -> HwResult<'a, GameCfg>
+    ) -> impl FnMut(&'a [u8]) -> HwResult<'a, GameCfg>
     where
         F: Fn(&[u8]) -> HwResult<T>,
         G: Fn(T) -> GameCfg,
@@ -354,7 +354,7 @@
                         a_line,
                         alt((
                             map(peek(end_of_message), |_| None),
-                            map(preceded(newline, separated_list(newline, a_line)), Some),
+                            map(preceded(newline, separated_list0(newline, a_line)), Some),
                         )),
                     ),
                     |(name, values)| GameCfg::Scheme(name, values.unwrap_or_default()),
--- a/rust/hedgewars-server/src/server/haskell.rs	Tue Jun 22 01:41:33 2021 +0300
+++ b/rust/hedgewars-server/src/server/haskell.rs	Tue Jun 22 01:57:50 2021 +0300
@@ -3,7 +3,7 @@
     bytes::complete::{escaped_transform, is_not, tag, take_while, take_while1},
     character::{is_alphanumeric, is_digit, is_space},
     combinator::{map, map_res},
-    multi::{many0, separated_list},
+    multi::{many0, separated_list0},
     sequence::{delimited, pair, preceded, separated_pair, terminated},
     ExtendInto, IResult,
 };
@@ -159,10 +159,10 @@
 fn surrounded<'a, P, O>(
     prefix: &'static str,
     suffix: &'static str,
-    parser: P,
-) -> impl Fn(&'a [u8]) -> HaskellResult<'a, O>
+    mut parser: P,
+) -> impl FnMut(&'a [u8]) -> HaskellResult<'a, O>
 where
-    P: Fn(&'a [u8]) -> HaskellResult<'a, O>,
+    P: FnMut(&'a [u8]) -> HaskellResult<'a, O>,
 {
     move |input| {
         delimited(
@@ -285,14 +285,14 @@
 
 fn tuple(input: &[u8]) -> HaskellResult<HaskellValue> {
     map(
-        surrounded("(", ")", separated_list(comma, value)),
+        surrounded("(", ")", separated_list0(comma, value)),
         HaskellValue::Tuple,
     )(input)
 }
 
 fn list(input: &[u8]) -> HaskellResult<HaskellValue> {
     map(
-        surrounded("[", "]", separated_list(comma, value)),
+        surrounded("[", "]", separated_list0(comma, value)),
         HaskellValue::List,
     )(input)
 }
@@ -316,7 +316,7 @@
         map(
             pair(
                 identifier,
-                surrounded("{", "}", separated_list(comma, named_field)),
+                surrounded("{", "}", separated_list0(comma, named_field)),
             ),
             |(name, mut fields)| HaskellValue::Struct {
                 name,