diff options
author | Michaël Zasso <targos@protonmail.com> | 2019-08-01 08:38:30 +0200 |
---|---|---|
committer | Michaël Zasso <targos@protonmail.com> | 2019-08-01 12:53:56 +0200 |
commit | 2dcc3665abf57c3607cebffdeeca062f5894885d (patch) | |
tree | 4f560748132edcfb4c22d6f967a7e80d23d7ea2c /deps/v8/src/torque/earley-parser.h | |
parent | 1ee47d550c6de132f06110aa13eceb7551d643b3 (diff) | |
download | node-new-2dcc3665abf57c3607cebffdeeca062f5894885d.tar.gz |
deps: update V8 to 7.6.303.28
PR-URL: https://github.com/nodejs/node/pull/28016
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Refael Ackermann (רפאל פלחי) <refack@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Diffstat (limited to 'deps/v8/src/torque/earley-parser.h')
-rw-r--r-- | deps/v8/src/torque/earley-parser.h | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/deps/v8/src/torque/earley-parser.h b/deps/v8/src/torque/earley-parser.h index 16d3e92571..9d9cfb02c0 100644 --- a/deps/v8/src/torque/earley-parser.h +++ b/deps/v8/src/torque/earley-parser.h @@ -54,6 +54,8 @@ enum class ParseResultHolderBase::TypeId { kOptionalLabelBlockPtr, kNameAndTypeExpression, kNameAndExpression, + kConditionalAnnotation, + kOptionalConditionalAnnotation, kClassFieldExpression, kStructFieldExpression, kStdVectorOfNameAndTypeExpression, @@ -64,6 +66,7 @@ enum class ParseResultHolderBase::TypeId { kOptionalStdString, kStdVectorOfStatementPtr, kStdVectorOfDeclarationPtr, + kStdVectorOfStdVectorOfDeclarationPtr, kStdVectorOfExpressionPtr, kExpressionWithSource, kParameterList, @@ -189,6 +192,15 @@ inline base::Optional<ParseResult> DefaultAction( return child_results->Next(); } +template <class T, Action action> +inline Action AsSingletonVector() { + return [](ParseResultIterator* child_results) -> base::Optional<ParseResult> { + auto result = action(child_results); + if (!result) return result; + return ParseResult{std::vector<T>{(*result).Cast<T>()}}; + }; +} + // A rule of the context-free grammar. Each rule can have an action attached to // it, which is executed after the parsing is finished. class Rule final { @@ -303,10 +315,13 @@ class Item { void CheckAmbiguity(const Item& other, const LexerResult& tokens) const; MatchedInput GetMatchedInput(const LexerResult& tokens) const { - return {tokens.token_contents[start_].begin, - start_ == pos_ ? tokens.token_contents[start_].begin - : tokens.token_contents[pos_ - 1].end, - tokens.token_contents[start_].pos}; + const MatchedInput& start = tokens.token_contents[start_]; + const MatchedInput& end = start_ == pos_ ? tokens.token_contents[start_] + : tokens.token_contents[pos_ - 1]; + CHECK_EQ(start.pos.source, end.pos.source); + SourcePosition combined{start.pos.source, start.pos.start, end.pos.end}; + + return {start.begin, end.end, combined}; } // We exclude {prev_} and {child_} from equality and hash computations, |