summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2021-10-20 20:27:31 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2021-10-20 20:27:31 +0000
commit09bc9917a041380e67db8ddab2e7705ea434344b (patch)
treea15777fde8b58a72979d8939decbd3da01527cd6
parentb67fa300bd249c91c77b9ecbb334ddc9f97f6a52 (diff)
parentf8576eaeb69deccdc83e44f3d0d516c0ae9788a4 (diff)
downloadcexpr-09bc9917a041380e67db8ddab2e7705ea434344b.tar.gz
Snap for 7842265 from f8576eaeb69deccdc83e44f3d0d516c0ae9788a4 to simpleperf-release
Change-Id: I84c09342da860f3acb24da71605bed8255487be8
-rw-r--r--Cargo.toml2
-rw-r--r--patches/nom7.patch84
-rw-r--r--src/expr.rs12
-rw-r--r--src/literal.rs2
4 files changed, 92 insertions, 8 deletions
diff --git a/Cargo.toml b/Cargo.toml
index 8f6dcc2..a3067d0 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -21,7 +21,7 @@ keywords = ["C", "expression", "parser"]
license = "Apache-2.0/MIT"
repository = "https://github.com/jethrogb/rust-cexpr"
[dependencies.nom]
-version = "6"
+version = "7"
features = ["std"]
default-features = false
[dev-dependencies.clang-sys]
diff --git a/patches/nom7.patch b/patches/nom7.patch
new file mode 100644
index 0000000..5ba703d
--- /dev/null
+++ b/patches/nom7.patch
@@ -0,0 +1,84 @@
+diff --git a/Cargo.toml b/Cargo.toml
+index 8f6dcc2..a3067d0 100644
+--- a/Cargo.toml
++++ b/Cargo.toml
+@@ -21,7 +21,7 @@ keywords = ["C", "expression", "parser"]
+ license = "Apache-2.0/MIT"
+ repository = "https://github.com/jethrogb/rust-cexpr"
+ [dependencies.nom]
+-version = "6"
++version = "7"
+ features = ["std"]
+ default-features = false
+ [dev-dependencies.clang-sys]
+diff --git a/src/expr.rs b/src/expr.rs
+index 5dce3c7..7f7e458 100644
+--- a/src/expr.rs
++++ b/src/expr.rs
+@@ -308,7 +308,7 @@ impl<'a> PRef<'a> {
+ pair(complete(one_of_punctuation(&["*", "/", "%"][..])), |i| {
+ self.unary(i)
+ }),
+- acc,
++ move || acc.clone(),
+ |mut acc, (op, val): (&[u8], EvalResult)| {
+ match op[0] as char {
+ '*' => acc *= &val,
+@@ -327,7 +327,7 @@ impl<'a> PRef<'a> {
+ pair(complete(one_of_punctuation(&["+", "-"][..])), |i| {
+ self.mul_div_rem(i)
+ }),
+- acc,
++ move || acc.clone(),
+ |mut acc, (op, val): (&[u8], EvalResult)| {
+ match op[0] as char {
+ '+' => acc += &val,
+@@ -345,7 +345,7 @@ impl<'a> PRef<'a> {
+ pair(complete(one_of_punctuation(&["<<", ">>"][..])), |i| {
+ self.add_sub(i)
+ }),
+- acc,
++ move || acc.clone(),
+ |mut acc, (op, val): (&[u8], EvalResult)| {
+ match op {
+ b"<<" => acc <<= &val,
+@@ -361,7 +361,7 @@ impl<'a> PRef<'a> {
+ let (input, acc) = self.shl_shr(input)?;
+ numeric(fold_many0(
+ preceded(complete(p("&")), |i| self.shl_shr(i)),
+- acc,
++ move || acc.clone(),
+ |mut acc, val: EvalResult| {
+ acc &= &val;
+ acc
+@@ -373,7 +373,7 @@ impl<'a> PRef<'a> {
+ let (input, acc) = self.and(input)?;
+ numeric(fold_many0(
+ preceded(complete(p("^")), |i| self.and(i)),
+- acc,
++ move || acc.clone(),
+ |mut acc, val: EvalResult| {
+ acc ^= &val;
+ acc
+@@ -385,7 +385,7 @@ impl<'a> PRef<'a> {
+ let (input, acc) = self.xor(input)?;
+ numeric(fold_many0(
+ preceded(complete(p("|")), |i| self.xor(i)),
+- acc,
++ move || acc.clone(),
+ |mut acc, val: EvalResult| {
+ acc |= &val;
+ acc
+diff --git a/src/literal.rs b/src/literal.rs
+index b74699f..68e85c7 100644
+--- a/src/literal.rs
++++ b/src/literal.rs
+@@ -224,7 +224,7 @@ fn c_string(i: &[u8]) -> nom::IResult<&[u8], Vec<u8>> {
+ map(escaped_char, |c: CChar| c.into()),
+ map(is_not([b'\\', b'"']), |c: &[u8]| c.into()),
+ )),
+- Vec::new(),
++ Vec::new,
+ |mut v: Vec<u8>, res: Vec<u8>| {
+ v.extend_from_slice(&res);
+ v
diff --git a/src/expr.rs b/src/expr.rs
index 5dce3c7..7f7e458 100644
--- a/src/expr.rs
+++ b/src/expr.rs
@@ -308,7 +308,7 @@ impl<'a> PRef<'a> {
pair(complete(one_of_punctuation(&["*", "/", "%"][..])), |i| {
self.unary(i)
}),
- acc,
+ move || acc.clone(),
|mut acc, (op, val): (&[u8], EvalResult)| {
match op[0] as char {
'*' => acc *= &val,
@@ -327,7 +327,7 @@ impl<'a> PRef<'a> {
pair(complete(one_of_punctuation(&["+", "-"][..])), |i| {
self.mul_div_rem(i)
}),
- acc,
+ move || acc.clone(),
|mut acc, (op, val): (&[u8], EvalResult)| {
match op[0] as char {
'+' => acc += &val,
@@ -345,7 +345,7 @@ impl<'a> PRef<'a> {
pair(complete(one_of_punctuation(&["<<", ">>"][..])), |i| {
self.add_sub(i)
}),
- acc,
+ move || acc.clone(),
|mut acc, (op, val): (&[u8], EvalResult)| {
match op {
b"<<" => acc <<= &val,
@@ -361,7 +361,7 @@ impl<'a> PRef<'a> {
let (input, acc) = self.shl_shr(input)?;
numeric(fold_many0(
preceded(complete(p("&")), |i| self.shl_shr(i)),
- acc,
+ move || acc.clone(),
|mut acc, val: EvalResult| {
acc &= &val;
acc
@@ -373,7 +373,7 @@ impl<'a> PRef<'a> {
let (input, acc) = self.and(input)?;
numeric(fold_many0(
preceded(complete(p("^")), |i| self.and(i)),
- acc,
+ move || acc.clone(),
|mut acc, val: EvalResult| {
acc ^= &val;
acc
@@ -385,7 +385,7 @@ impl<'a> PRef<'a> {
let (input, acc) = self.xor(input)?;
numeric(fold_many0(
preceded(complete(p("|")), |i| self.xor(i)),
- acc,
+ move || acc.clone(),
|mut acc, val: EvalResult| {
acc |= &val;
acc
diff --git a/src/literal.rs b/src/literal.rs
index b74699f..68e85c7 100644
--- a/src/literal.rs
+++ b/src/literal.rs
@@ -224,7 +224,7 @@ fn c_string(i: &[u8]) -> nom::IResult<&[u8], Vec<u8>> {
map(escaped_char, |c: CChar| c.into()),
map(is_not([b'\\', b'"']), |c: &[u8]| c.into()),
)),
- Vec::new(),
+ Vec::new,
|mut v: Vec<u8>, res: Vec<u8>| {
v.extend_from_slice(&res);
v