From 4cc31c837d9d4e153b767727fb813cba594a747c Mon Sep 17 00:00:00 2001 From: dalance Date: Thu, 23 Mar 2023 09:42:04 +0900 Subject: [PATCH] Update nom to 7 --- CHANGELOG.md | 2 + sv-parser-error/Cargo.toml | 2 +- sv-parser-macros/Cargo.toml | 2 +- sv-parser-parser/Cargo.toml | 18 ++++---- sv-parser-parser/src/expressions/numbers.rs | 50 +++++++++++++-------- sv-parser-pp/Cargo.toml | 12 ++--- sv-parser-syntaxtree/Cargo.toml | 4 +- sv-parser/Cargo.toml | 14 +++--- 8 files changed, 59 insertions(+), 45 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f8a2720..58c52e2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## [Unreleased](https://github.com/dalance/sv-parser/compare/v0.13.0...Unreleased) - ReleaseDate +* [Changed] update nom to 7 + ## [v0.13.0](https://github.com/dalance/sv-parser/compare/v0.12.3...v0.13.0) - 2023-02-08 * [Added] Improvement: Handle non-UTF8 files [#79](https://github.com/dalance/sv-parser/pull/79) diff --git a/sv-parser-error/Cargo.toml b/sv-parser-error/Cargo.toml index e06efb4..83a57df 100644 --- a/sv-parser-error/Cargo.toml +++ b/sv-parser-error/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sv-parser-error" -version = "0.13.0" +version = "0.12.2" authors = ["dalance@gmail.com"] repository = "https://github.com/dalance/sv-parser" keywords = ["parser", "verilog", "systemverilog"] diff --git a/sv-parser-macros/Cargo.toml b/sv-parser-macros/Cargo.toml index 1a1625a..3f72d7e 100644 --- a/sv-parser-macros/Cargo.toml +++ b/sv-parser-macros/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sv-parser-macros" -version = "0.13.0" +version = "0.12.2" authors = ["dalance@gmail.com"] repository = "https://github.com/dalance/sv-parser" keywords = ["parser", "verilog", "systemverilog"] diff --git a/sv-parser-parser/Cargo.toml b/sv-parser-parser/Cargo.toml index b8898f7..e6f7f54 100644 --- a/sv-parser-parser/Cargo.toml +++ b/sv-parser-parser/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sv-parser-parser" -version = "0.13.0" +version = "0.12.2" authors = ["dalance@gmail.com"] repository = "https://github.com/dalance/sv-parser" keywords = ["parser", "verilog", "systemverilog"] @@ -21,12 +21,12 @@ default = [] trace = ["nom-tracable/trace"] [dependencies] -nom = "6" -nom_locate = "3" -nom-greedyerror = "0.3" -nom-packrat = "0.5" -nom-recursive = {version = "0.3", features = ["tracer128"]} -nom-tracable = "0.7" +nom = "7" +nom_locate = "4" +nom-greedyerror = "0.5" +nom-packrat = "0.7" +nom-recursive = {version = "0.5", features = ["tracer128"]} +nom-tracable = "0.9" str-concat = "0.2" -sv-parser-macros = {version = "^0.13.0", path = "../sv-parser-macros"} -sv-parser-syntaxtree = {version = "^0.13.0", path = "../sv-parser-syntaxtree"} +sv-parser-macros = {version = "^0.12.2", path = "../sv-parser-macros"} +sv-parser-syntaxtree = {version = "^0.12.2", path = "../sv-parser-syntaxtree"} diff --git a/sv-parser-parser/src/expressions/numbers.rs b/sv-parser-parser/src/expressions/numbers.rs index 03eb149..4e0d763 100644 --- a/sv-parser-parser/src/expressions/numbers.rs +++ b/sv-parser-parser/src/expressions/numbers.rs @@ -136,9 +136,11 @@ pub(crate) fn non_zero_unsigned_number(s: Span) -> IResult IResult { let (s, a) = is_a("123456789")(s)?; - let (s, a) = fold_many0(alt((tag("_"), digit1)), a, |acc, item| { - concat(acc, item).unwrap() - })(s)?; + let (s, a) = fold_many0( + alt((tag("_"), digit1)), + || a, + |acc, item| concat(acc, item).unwrap(), + )(s)?; Ok((s, into_locate(a))) } @@ -234,9 +236,11 @@ pub(crate) fn unsigned_number_exact(s: Span) -> IResult { #[tracable_parser] pub(crate) fn unsigned_number_impl(s: Span) -> IResult { let (s, a) = digit1(s)?; - let (s, a) = fold_many0(alt((tag("_"), digit1)), a, |acc, item| { - concat(acc, item).unwrap() - })(s)?; + let (s, a) = fold_many0( + alt((tag("_"), digit1)), + || a, + |acc, item| concat(acc, item).unwrap(), + )(s)?; Ok((s, into_locate(a))) } @@ -250,9 +254,11 @@ pub(crate) fn binary_value(s: Span) -> IResult { #[tracable_parser] pub(crate) fn binary_value_impl(s: Span) -> IResult { let (s, a) = is_a("01xXzZ?")(s)?; - let (s, a) = fold_many0(alt((tag("_"), is_a("01xXzZ?"))), a, |acc, item| { - concat(acc, item).unwrap() - })(s)?; + let (s, a) = fold_many0( + alt((tag("_"), is_a("01xXzZ?"))), + || a, + |acc, item| concat(acc, item).unwrap(), + )(s)?; Ok((s, into_locate(a))) } @@ -266,9 +272,11 @@ pub(crate) fn octal_value(s: Span) -> IResult { #[tracable_parser] pub(crate) fn octal_value_impl(s: Span) -> IResult { let (s, a) = is_a("01234567xXzZ?")(s)?; - let (s, a) = fold_many0(alt((tag("_"), is_a("01234567xXzZ?"))), a, |acc, item| { - concat(acc, item).unwrap() - })(s)?; + let (s, a) = fold_many0( + alt((tag("_"), is_a("01234567xXzZ?"))), + || a, + |acc, item| concat(acc, item).unwrap(), + )(s)?; Ok((s, into_locate(a))) } @@ -284,7 +292,7 @@ pub(crate) fn hex_value_impl(s: Span) -> IResult { let (s, a) = is_a("0123456789abcdefABCDEFxXzZ?")(s)?; let (s, a) = fold_many0( alt((tag("_"), is_a("0123456789abcdefABCDEFxXzZ?"))), - a, + || a, |acc, item| concat(acc, item).unwrap(), )(s)?; Ok((s, into_locate(a))) @@ -352,9 +360,11 @@ pub(crate) fn x_number(s: Span) -> IResult { #[tracable_parser] pub(crate) fn x_number_impl(s: Span) -> IResult { let (s, a) = tag_no_case("x")(s)?; - let (s, a) = fold_many0(alt((tag("_"), is_a("_"))), a, |acc, item| { - concat(acc, item).unwrap() - })(s)?; + let (s, a) = fold_many0( + alt((tag("_"), is_a("_"))), + || a, + |acc, item| concat(acc, item).unwrap(), + )(s)?; Ok((s, into_locate(a))) } @@ -368,9 +378,11 @@ pub(crate) fn z_number(s: Span) -> IResult { #[tracable_parser] pub(crate) fn z_number_impl(s: Span) -> IResult { let (s, a) = alt((tag_no_case("z"), tag("?")))(s)?; - let (s, a) = fold_many0(alt((tag("_"), is_a("_"))), a, |acc, item| { - concat(acc, item).unwrap() - })(s)?; + let (s, a) = fold_many0( + alt((tag("_"), is_a("_"))), + || a, + |acc, item| concat(acc, item).unwrap(), + )(s)?; Ok((s, into_locate(a))) } diff --git a/sv-parser-pp/Cargo.toml b/sv-parser-pp/Cargo.toml index fae52d3..f079cb0 100644 --- a/sv-parser-pp/Cargo.toml +++ b/sv-parser-pp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sv-parser-pp" -version = "0.13.0" +version = "0.12.2" authors = ["dalance@gmail.com"] repository = "https://github.com/dalance/sv-parser" keywords = ["parser", "verilog", "systemverilog"] @@ -21,8 +21,8 @@ default = [] trace = ["sv-parser-parser/trace"] [dependencies] -nom = "6" -nom-greedyerror = "0.3" -sv-parser-error = {version = "^0.13.0", path = "../sv-parser-error"} -sv-parser-parser = {version = "^0.13.0", path = "../sv-parser-parser"} -sv-parser-syntaxtree = {version = "^0.13.0", path = "../sv-parser-syntaxtree"} +nom = "7" +nom-greedyerror = "0.5" +sv-parser-error = {version = "^0.12.2", path = "../sv-parser-error"} +sv-parser-parser = {version = "^0.12.2", path = "../sv-parser-parser"} +sv-parser-syntaxtree = {version = "^0.12.2", path = "../sv-parser-syntaxtree"} diff --git a/sv-parser-syntaxtree/Cargo.toml b/sv-parser-syntaxtree/Cargo.toml index 8f55a66..1cf1e37 100644 --- a/sv-parser-syntaxtree/Cargo.toml +++ b/sv-parser-syntaxtree/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sv-parser-syntaxtree" -version = "0.13.0" +version = "0.12.2" authors = ["dalance@gmail.com"] repository = "https://github.com/dalance/sv-parser" keywords = ["parser", "verilog", "systemverilog"] @@ -18,7 +18,7 @@ doctest = false tag = false [dependencies] -sv-parser-macros = {version = "^0.13.0", path = "../sv-parser-macros"} +sv-parser-macros = {version = "^0.12.2", path = "../sv-parser-macros"} [build-dependencies] regex = "1" diff --git a/sv-parser/Cargo.toml b/sv-parser/Cargo.toml index dcdf7b3..2c7ba5b 100644 --- a/sv-parser/Cargo.toml +++ b/sv-parser/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sv-parser" -version = "0.13.0" +version = "0.12.2" authors = ["dalance@gmail.com"] repository = "https://github.com/dalance/sv-parser" keywords = ["parser", "verilog", "systemverilog"] @@ -26,12 +26,12 @@ default = [] trace = ["sv-parser-parser/trace"] [dependencies] -nom = "6" -nom-greedyerror = "0.3" -sv-parser-error = {version = "^0.13.0", path = "../sv-parser-error"} -sv-parser-parser = {version = "^0.13.0", path = "../sv-parser-parser"} -sv-parser-pp = {version = "^0.13.0", path = "../sv-parser-pp"} -sv-parser-syntaxtree = {version = "^0.13.0", path = "../sv-parser-syntaxtree"} +nom = "7" +nom-greedyerror = "0.5" +sv-parser-error = {version = "^0.12.2", path = "../sv-parser-error"} +sv-parser-parser = {version = "^0.12.2", path = "../sv-parser-parser"} +sv-parser-pp = {version = "^0.12.2", path = "../sv-parser-pp"} +sv-parser-syntaxtree = {version = "^0.12.2", path = "../sv-parser-syntaxtree"} [dev-dependencies] structopt = "0.3.2"