Update nom_locate to 2.0.0

This commit is contained in:
dalance 2020-04-01 15:34:48 +09:00
parent 2c63dcaeba
commit 99b28d8f6e
6 changed files with 22 additions and 23 deletions

View File

@ -3,6 +3,7 @@
## [Unreleased](https://github.com/dalance/sv-parser/compare/v0.6.4...Unreleased) - ReleaseDate
* [Fixed] casting parse error [#8](https://github.com/dalance/sv-parser/issues/8)
* [Changed] update nom_locate to 2.0.0
## [v0.6.4](https://github.com/dalance/sv-parser/compare/v0.6.3...v0.6.4) - 2020-03-12

View File

@ -18,12 +18,12 @@ default = []
trace = ["nom-tracable/trace"]
[dependencies]
nom = "5.0.0"
nom_locate = "1.0.0"
nom-greedyerror = "0.1.0"
nom-packrat = "0.3.0"
nom-recursive = {version = "0.1.1", features = ["tracer128"]}
nom-tracable = "0.4.1"
str-concat = "0.2.0"
nom = "5"
nom_locate = "2"
nom-greedyerror = "0.2"
nom-packrat = "0.4"
nom-recursive = {version = "0.2", features = ["tracer128"]}
nom-tracable = "0.5"
str-concat = "0.2"
sv-parser-macros = {version = "^0.6.4", path = "../sv-parser-macros"}
sv-parser-syntaxtree = {version = "^0.6.4", path = "../sv-parser-syntaxtree"}

View File

@ -54,7 +54,7 @@ pub struct SpanInfo {
pub recursive_info: RecursiveInfo,
}
pub type Span<'a> = nom_locate::LocatedSpanEx<&'a str, SpanInfo>;
pub type Span<'a> = nom_locate::LocatedSpan<&'a str, SpanInfo>;
pub type IResult<T, U> = nom::IResult<T, U, GreedyError<T>>;
impl HasRecursiveInfo for SpanInfo {

View File

@ -427,14 +427,12 @@ pub(crate) fn current_version() -> Option<VersionSpecifier> {
// -----------------------------------------------------------------------------
pub(crate) fn concat<'a>(a: Span<'a>, b: Span<'a>) -> Option<Span<'a>> {
let c = unsafe { str_concat::concat(a.fragment, b.fragment) };
let c = unsafe { str_concat::concat(a.fragment(), b.fragment()) };
if let Ok(c) = c {
Some(Span {
offset: a.offset,
line: a.line,
fragment: c,
extra: a.extra,
})
let ret = unsafe {
Span::new_from_raw_offset(a.location_offset(), a.location_line(), c, a.extra)
};
Some(ret)
} else {
None
}
@ -454,7 +452,7 @@ pub(crate) fn is_keyword(s: &Span) -> bool {
None => KEYWORDS_1800_2017,
};
for k in keywords {
if &s.fragment == k {
if s.fragment() == k {
return true;
}
}
@ -463,8 +461,8 @@ pub(crate) fn is_keyword(s: &Span) -> bool {
pub(crate) fn into_locate(s: Span) -> Locate {
Locate {
offset: s.offset,
line: s.line,
len: s.fragment.len(),
offset: s.location_offset(),
line: s.location_line(),
len: s.fragment().len(),
}
}

View File

@ -18,8 +18,8 @@ default = []
trace = ["sv-parser-parser/trace"]
[dependencies]
nom = "5.0.0"
nom-greedyerror = "0.1.0"
nom = "5"
nom-greedyerror = "0.2"
sv-parser-error = {version = "^0.6.4", path = "../sv-parser-error"}
sv-parser-parser = {version = "^0.6.4", path = "../sv-parser-parser"}
sv-parser-syntaxtree = {version = "^0.6.4", path = "../sv-parser-syntaxtree"}

View File

@ -23,8 +23,8 @@ default = []
trace = ["sv-parser-parser/trace"]
[dependencies]
nom = "5.0.0"
nom-greedyerror = "0.1.0"
nom = "5"
nom-greedyerror = "0.2"
sv-parser-error = {version = "^0.6.4", path = "../sv-parser-error"}
sv-parser-parser = {version = "^0.6.4", path = "../sv-parser-parser"}
sv-parser-pp = {version = "^0.6.4", path = "../sv-parser-pp"}