Commit 982f6f23 authored by Kent Tamura's avatar Kent Tamura Committed by Commit Bot

xpath_grammar.y: Switch to C++ parser

We used non-standard alloca() in Bison-generated C parser because the
semantic union object contains raw pointers of Oilpan objects and they
need to be on stack.

We'd like to avoid non-standard alloca(), and would like to manage
lifetime of union member objects correctly. So, we switch to
Bison-generated C++ parser with 'variant' semantic object. It allocates
the stack of semantic objects in the normal heap, and correctly
construct and destruct each member objects.  We can use WTF::String and
blink::Persistent as members without any hacks.

* rule_bison.py
 Replace xpath_grammar_generated.hh with xpath_grammar_generated.h on
 preprocessor directives such as #include and #line.

* xml/BUILD.gn
 Move xpath_grammar_generated.* and xpath_parser.cc to a separated
 target, and it disables chromium-style clang plugin.
 chromium-style plugin produces errors on xpath_grammar_generated.h.

* xml/xpath_grammar.y
  Switch to C++ parser.
  Switch to 'variant' from 'union'.
  Add missing |$$ = $1|.
  Remove unnecessary DeleteString() calls.

* xml/xpath_parser.cc
  Adopt to the Bison-generated C++ parser.
  Remove unused |strings_| code.

* audit_non_blink_usage.py
  Allow xpathyy:: namespace in core/xml/.


Change-Id: I1b4f3a224dca058bee83518573d1482259f221bf
Bug: 1032320
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1961464
Commit-Queue: Kent Tamura <tkent@chromium.org>
Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#725348}
parent ee30600f
......@@ -98,15 +98,24 @@ for outputHTry in outputHTries:
assert outputHTmp != None
def modifyFile(path, prefixLines, suffixLines):
def modifyFile(path, prefixLines, suffixLines, replace_list=[]):
prefixLines = map(lambda s: s + '\n', prefixLines)
suffixLines = map(lambda s: s + '\n', suffixLines)
with open(path, 'r') as f:
oldLines = f.readlines()
for i in range(len(oldLines)):
for src, dest in replace_list:
oldLines[i] = oldLines[i].replace(src, dest)
newLines = prefixLines + oldLines + suffixLines
with open(path, 'w') as f:
f.writelines(newLines)
# The generated files contain references to the original "foo.hh" for #include and
# #line. We replace them with "foo.h".
(output_h_basename, output_h_tmp_ext) = os.path.splitext(outputHTmp)
output_h_basename = os.path.basename(output_h_basename)
common_replace_list = [(output_h_basename + output_h_tmp_ext, output_h_basename + '.h')]
# Rewrite the generated header with #include guards.
kClangFormatDisableLine = "// clang-format off"
outputH = os.path.join(outputDir, newInputRoot + '.h')
......@@ -115,8 +124,10 @@ modifyFile(outputHTmp,
[kClangFormatDisableLine,
'#ifndef %s' % headerGuard,
'#define %s' % headerGuard,
], ['#endif // %s' % headerGuard]
], ['#endif // %s' % headerGuard],
replace_list=common_replace_list
)
os.rename(outputHTmp, outputH)
modifyFile(outputCpp, [kClangFormatDisableLine], [])
modifyFile(outputCpp, [kClangFormatDisableLine], [],
replace_list=common_replace_list)
......@@ -5,6 +5,9 @@
import("//third_party/blink/renderer/core/core.gni")
blink_core_sources("xml") {
deps = [
":xpath_generated",
]
sources = [
"document_xml_tree_viewer.cc",
"document_xml_tree_viewer.h",
......@@ -35,12 +38,9 @@ blink_core_sources("xml") {
"xpath_expression_node.h",
"xpath_functions.cc",
"xpath_functions.h",
"xpath_grammar_generated.cc",
"xpath_grammar_generated.h",
"xpath_node_set.cc",
"xpath_node_set.h",
"xpath_ns_resolver.h",
"xpath_parser.cc",
"xpath_parser.h",
"xpath_path.cc",
"xpath_path.h",
......@@ -67,3 +67,12 @@ blink_core_sources("xml") {
"xslt_unicode_sort.h",
]
}
blink_core_sources("xpath_generated") {
sources = [
"xpath_grammar_generated.cc",
"xpath_grammar_generated.h",
"xpath_parser.cc",
]
configs -= [ "//build/config/clang:find_bad_constructs" ]
}
......@@ -40,6 +40,15 @@
* //third_party/bison. See https://crbug.com/1028421.
*/
%require "3.4"
%language "c++"
%code requires {
#include "third_party/blink/renderer/platform/heap/persistent.h"
}
%{
#include "third_party/blink/renderer/core/xml/xpath_functions.h"
......@@ -50,83 +59,67 @@
#include "third_party/blink/renderer/core/xml/xpath_step.h"
#include "third_party/blink/renderer/core/xml/xpath_variable_reference.h"
// The union below must be located on the stack because it contains raw
// pointers to Oilpan objects. crbug.com/961413
#define YYSTACK_USE_ALLOCA 1
// Bison's bug? YYSTACK_ALLOC is not defined if _MSC_VER.
#if defined(_MSC_VER)
#define YYSTACK_ALLOC _alloca
#endif
#define YYENABLE_NLS 0
#define YYLTYPE_IS_TRIVIAL 1
#define YY_EXCEPTIONS 0
#define YYDEBUG 0
#define YYMAXDEPTH 10000
using blink::xpath::Step;
%}
%define api.pure full
%define api.parser.class { YyParser }
%parse-param { blink::xpath::Parser* parser }
%union
{
blink::xpath::Step::Axis axis;
blink::xpath::Step::NodeTest* node_test;
blink::xpath::NumericOp::Opcode num_op;
blink::xpath::EqTestOp::Opcode eq_op;
String* str;
blink::xpath::Expression* expr;
blink::HeapVector<blink::Member<blink::xpath::Predicate>>* pred_list;
blink::HeapVector<blink::Member<blink::xpath::Expression>>* arg_list;
blink::xpath::Step* step;
blink::xpath::LocationPath* location_path;
}
%{
static int xpathyylex(YYSTYPE* yylval) { return blink::xpath::Parser::Current()->Lex(yylval); }
static void xpathyyerror(void*, const char*) { }
%define api.value.type variant
%}
%left <num_op> MULOP
%left <eq_op> EQOP RELOP
%left <blink::xpath::NumericOp::Opcode> MULOP
%left <blink::xpath::EqTestOp::Opcode> EQOP RELOP
%left PLUS MINUS
%left OR AND
%token <axis> AXISNAME
%token <str> NODETYPE PI FUNCTIONNAME LITERAL
%token <str> VARIABLEREFERENCE NUMBER
%token <blink::xpath::Step::Axis> AXISNAME
%token <String> NODETYPE PI FUNCTIONNAME LITERAL
%token <String> VARIABLEREFERENCE NUMBER
%token DOTDOT SLASHSLASH
%token <str> NAMETEST
%token <String> NAMETEST
%token XPATH_ERROR
%type <location_path> LocationPath
%type <location_path> AbsoluteLocationPath
%type <location_path> RelativeLocationPath
%type <step> Step
%type <axis> AxisSpecifier
%type <step> DescendantOrSelf
%type <node_test> NodeTest
%type <expr> Predicate
%type <pred_list> OptionalPredicateList
%type <pred_list> PredicateList
%type <step> AbbreviatedStep
%type <expr> Expr
%type <expr> PrimaryExpr
%type <expr> FunctionCall
%type <arg_list> ArgumentList
%type <expr> Argument
%type <expr> UnionExpr
%type <expr> PathExpr
%type <expr> FilterExpr
%type <expr> OrExpr
%type <expr> AndExpr
%type <expr> EqualityExpr
%type <expr> RelationalExpr
%type <expr> AdditiveExpr
%type <expr> MultiplicativeExpr
%type <expr> UnaryExpr
%type <blink::Persistent<blink::xpath::LocationPath>> LocationPath
%type <blink::Persistent<blink::xpath::LocationPath>> AbsoluteLocationPath
%type <blink::Persistent<blink::xpath::LocationPath>> RelativeLocationPath
%type <blink::Persistent<blink::xpath::Step>> Step
%type <blink::xpath::Step::Axis> AxisSpecifier
%type <blink::Persistent<blink::xpath::Step>> DescendantOrSelf
%type <blink::Persistent<blink::xpath::Step::NodeTest>> NodeTest
%type <blink::Persistent<blink::xpath::Expression>> Predicate
%type <blink::Persistent<blink::HeapVector<blink::Member<blink::xpath::Predicate>>>> OptionalPredicateList
%type <blink::Persistent<blink::HeapVector<blink::Member<blink::xpath::Predicate>>>> PredicateList
%type <blink::Persistent<blink::xpath::Step>> AbbreviatedStep
%type <blink::Persistent<blink::xpath::Expression>> Expr
%type <blink::Persistent<blink::xpath::Expression>> PrimaryExpr
%type <blink::Persistent<blink::xpath::Expression>> FunctionCall
%type <blink::Persistent<blink::HeapVector<blink::Member<blink::xpath::Expression>>>> ArgumentList
%type <blink::Persistent<blink::xpath::Expression>> Argument
%type <blink::Persistent<blink::xpath::Expression>> UnionExpr
%type <blink::Persistent<blink::xpath::Expression>> PathExpr
%type <blink::Persistent<blink::xpath::Expression>> FilterExpr
%type <blink::Persistent<blink::xpath::Expression>> OrExpr
%type <blink::Persistent<blink::xpath::Expression>> AndExpr
%type <blink::Persistent<blink::xpath::Expression>> EqualityExpr
%type <blink::Persistent<blink::xpath::Expression>> RelationalExpr
%type <blink::Persistent<blink::xpath::Expression>> AdditiveExpr
%type <blink::Persistent<blink::xpath::Expression>> MultiplicativeExpr
%type <blink::Persistent<blink::xpath::Expression>> UnaryExpr
%code {
static int xpathyylex(xpathyy::YyParser::semantic_type* yylval) {
return blink::xpath::Parser::Current()->Lex(yylval);
}
namespace xpathyy {
void YyParser::error(const std::string&) { }
}
}
%%
......@@ -134,17 +127,20 @@ Expr:
OrExpr
{
parser->top_expr_ = $1;
$$ = $1;
}
;
LocationPath:
RelativeLocationPath
{
$$ = $1;
$$->SetAbsolute(false);
}
|
AbsoluteLocationPath
{
$$ = $1;
$$->SetAbsolute(true);
}
;
......@@ -176,11 +172,13 @@ RelativeLocationPath:
|
RelativeLocationPath '/' Step
{
$$ = $1;
$$->AppendStep($3);
}
|
RelativeLocationPath DescendantOrSelf Step
{
$$ = $1;
$$->AppendStep($2);
$$->AppendStep($3);
}
......@@ -199,7 +197,7 @@ Step:
{
AtomicString local_name;
AtomicString namespace_uri;
if (!parser->ExpandQName(*$1, local_name, namespace_uri)) {
if (!parser->ExpandQName($1, local_name, namespace_uri)) {
parser->got_namespace_error_ = true;
YYABORT;
}
......@@ -208,7 +206,6 @@ Step:
$$ = blink::MakeGarbageCollected<Step>(Step::kChildAxis, Step::NodeTest(Step::NodeTest::kNameTest, local_name, namespace_uri), *$2);
else
$$ = blink::MakeGarbageCollected<Step>(Step::kChildAxis, Step::NodeTest(Step::NodeTest::kNameTest, local_name, namespace_uri));
parser->DeleteString($1);
}
|
AxisSpecifier NodeTest OptionalPredicateList
......@@ -223,7 +220,7 @@ Step:
{
AtomicString local_name;
AtomicString namespace_uri;
if (!parser->ExpandQName(*$2, local_name, namespace_uri)) {
if (!parser->ExpandQName($2, local_name, namespace_uri)) {
parser->got_namespace_error_ = true;
YYABORT;
}
......@@ -232,7 +229,6 @@ Step:
$$ = blink::MakeGarbageCollected<Step>($1, Step::NodeTest(Step::NodeTest::kNameTest, local_name, namespace_uri), *$3);
else
$$ = blink::MakeGarbageCollected<Step>($1, Step::NodeTest(Step::NodeTest::kNameTest, local_name, namespace_uri));
parser->DeleteString($2);
}
|
AbbreviatedStep
......@@ -250,27 +246,22 @@ AxisSpecifier:
NodeTest:
NODETYPE '(' ')'
{
if (*$1 == "node")
if ($1 == "node")
$$ = blink::MakeGarbageCollected<Step::NodeTest>(Step::NodeTest::kAnyNodeTest);
else if (*$1 == "text")
else if ($1 == "text")
$$ = blink::MakeGarbageCollected<Step::NodeTest>(Step::NodeTest::kTextNodeTest);
else if (*$1 == "comment")
else if ($1 == "comment")
$$ = blink::MakeGarbageCollected<Step::NodeTest>(Step::NodeTest::kCommentNodeTest);
parser->DeleteString($1);
}
|
PI '(' ')'
{
$$ = blink::MakeGarbageCollected<Step::NodeTest>(Step::NodeTest::kProcessingInstructionNodeTest);
parser->DeleteString($1);
}
|
PI '(' LITERAL ')'
{
$$ = blink::MakeGarbageCollected<Step::NodeTest>(Step::NodeTest::kProcessingInstructionNodeTest, $3->StripWhiteSpace());
parser->DeleteString($1);
parser->DeleteString($3);
$$ = blink::MakeGarbageCollected<Step::NodeTest>(Step::NodeTest::kProcessingInstructionNodeTest, $3.StripWhiteSpace());
}
;
......@@ -281,6 +272,9 @@ OptionalPredicateList:
}
|
PredicateList
{
$$ = $1;
}
;
PredicateList:
......@@ -292,6 +286,7 @@ PredicateList:
|
PredicateList Predicate
{
$$ = $1;
$$->push_back(blink::MakeGarbageCollected<blink::xpath::Predicate>($2));
}
;
......@@ -325,8 +320,7 @@ AbbreviatedStep:
PrimaryExpr:
VARIABLEREFERENCE
{
$$ = blink::MakeGarbageCollected<blink::xpath::VariableReference>(*$1);
parser->DeleteString($1);
$$ = blink::MakeGarbageCollected<blink::xpath::VariableReference>($1);
}
|
'(' Expr ')'
......@@ -336,14 +330,12 @@ PrimaryExpr:
|
LITERAL
{
$$ = blink::MakeGarbageCollected<blink::xpath::StringExpression>(*$1);
parser->DeleteString($1);
$$ = blink::MakeGarbageCollected<blink::xpath::StringExpression>($1);
}
|
NUMBER
{
$$ = blink::MakeGarbageCollected<blink::xpath::Number>($1->ToDouble());
parser->DeleteString($1);
$$ = blink::MakeGarbageCollected<blink::xpath::Number>($1.ToDouble());
}
|
FunctionCall
......@@ -352,18 +344,16 @@ PrimaryExpr:
FunctionCall:
FUNCTIONNAME '(' ')'
{
$$ = blink::xpath::CreateFunction(*$1);
$$ = blink::xpath::CreateFunction($1);
if (!$$)
YYABORT;
parser->DeleteString($1);
}
|
FUNCTIONNAME '(' ArgumentList ')'
{
$$ = blink::xpath::CreateFunction(*$1, *$3);
$$ = blink::xpath::CreateFunction($1, *$3);
if (!$$)
YYABORT;
parser->DeleteString($1);
}
;
......@@ -376,6 +366,7 @@ ArgumentList:
|
ArgumentList ',' Argument
{
$$ = $1;
$$->push_back($3);
}
;
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -39,6 +39,9 @@
namespace blink {
namespace xpath {
using xpathyy::YyParser;
using TokenType = xpathyy::YyParser::token;
Parser* Parser::current_parser_ = nullptr;
enum XMLCat { kNameStart, kNameCont, kNotPartOfName };
......@@ -119,20 +122,20 @@ bool Parser::IsBinaryOperatorContext() const {
switch (last_token_type_) {
case 0:
case '@':
case AXISNAME:
case TokenType::AXISNAME:
case '(':
case '[':
case ',':
case AND:
case OR:
case MULOP:
case TokenType::AND:
case TokenType::OR:
case TokenType::MULOP:
case '/':
case SLASHSLASH:
case TokenType::SLASHSLASH:
case '|':
case PLUS:
case MINUS:
case EQOP:
case RELOP:
case TokenType::PLUS:
case TokenType::MINUS:
case TokenType::EQOP:
case TokenType::RELOP:
return false;
default:
return true;
......@@ -190,12 +193,12 @@ Token Parser::LexString() {
if (value.IsNull())
value = "";
++next_pos_; // Consume the char.
return Token(LITERAL, value);
return Token(TokenType::LITERAL, value);
}
}
// Ouch, went off the end -- report error.
return Token(XPATH_ERROR);
return Token(TokenType::XPATH_ERROR);
}
Token Parser::LexNumber() {
......@@ -216,7 +219,8 @@ Token Parser::LexNumber() {
}
}
return Token(NUMBER, data_.Substring(start_pos, next_pos_ - start_pos));
return Token(TokenType::NUMBER,
data_.Substring(start_pos, next_pos_ - start_pos));
}
bool Parser::LexNCName(String& name) {
......@@ -292,62 +296,69 @@ Token Parser::NextTokenInternal() {
case '.': {
char next = PeekAheadHelper();
if (next == '.')
return MakeTokenAndAdvance(DOTDOT, 2);
return MakeTokenAndAdvance(TokenType::DOTDOT, 2);
if (next >= '0' && next <= '9')
return LexNumber();
return MakeTokenAndAdvance('.');
}
case '/':
if (PeekAheadHelper() == '/')
return MakeTokenAndAdvance(SLASHSLASH, 2);
return MakeTokenAndAdvance(TokenType::SLASHSLASH, 2);
return MakeTokenAndAdvance('/');
case '+':
return MakeTokenAndAdvance(PLUS);
return MakeTokenAndAdvance(TokenType::PLUS);
case '-':
return MakeTokenAndAdvance(MINUS);
return MakeTokenAndAdvance(TokenType::MINUS);
case '=':
return MakeTokenAndAdvance(EQOP, EqTestOp::kOpcodeEqual);
return MakeTokenAndAdvance(TokenType::EQOP, EqTestOp::kOpcodeEqual);
case '!':
if (PeekAheadHelper() == '=')
return MakeTokenAndAdvance(EQOP, EqTestOp::kOpcodeNotEqual, 2);
return Token(XPATH_ERROR);
if (PeekAheadHelper() == '=') {
return MakeTokenAndAdvance(TokenType::EQOP, EqTestOp::kOpcodeNotEqual,
2);
}
return Token(TokenType::XPATH_ERROR);
case '<':
if (PeekAheadHelper() == '=')
return MakeTokenAndAdvance(RELOP, EqTestOp::kOpcodeLessOrEqual, 2);
return MakeTokenAndAdvance(RELOP, EqTestOp::kOpcodeLessThan);
if (PeekAheadHelper() == '=') {
return MakeTokenAndAdvance(TokenType::RELOP,
EqTestOp::kOpcodeLessOrEqual, 2);
}
return MakeTokenAndAdvance(TokenType::RELOP, EqTestOp::kOpcodeLessThan);
case '>':
if (PeekAheadHelper() == '=')
return MakeTokenAndAdvance(RELOP, EqTestOp::kOpcodeGreaterOrEqual, 2);
return MakeTokenAndAdvance(RELOP, EqTestOp::kOpcodeGreaterThan);
if (PeekAheadHelper() == '=') {
return MakeTokenAndAdvance(TokenType::RELOP,
EqTestOp::kOpcodeGreaterOrEqual, 2);
}
return MakeTokenAndAdvance(TokenType::RELOP,
EqTestOp::kOpcodeGreaterThan);
case '*':
if (IsBinaryOperatorContext())
return MakeTokenAndAdvance(MULOP, NumericOp::kOP_Mul);
return MakeTokenAndAdvance(TokenType::MULOP, NumericOp::kOP_Mul);
++next_pos_;
return Token(NAMETEST, "*");
return Token(TokenType::NAMETEST, "*");
case '$': { // $ QName
next_pos_++;
String name;
if (!LexQName(name))
return Token(XPATH_ERROR);
return Token(VARIABLEREFERENCE, name);
return Token(TokenType::XPATH_ERROR);
return Token(TokenType::VARIABLEREFERENCE, name);
}
}
String name;
if (!LexNCName(name))
return Token(XPATH_ERROR);
return Token(TokenType::XPATH_ERROR);
SkipWS();
// If we're in an operator context, check for any operator names
if (IsBinaryOperatorContext()) {
if (name == "and") // ### hash?
return Token(AND);
return Token(TokenType::AND);
if (name == "or")
return Token(OR);
return Token(TokenType::OR);
if (name == "mod")
return Token(MULOP, NumericOp::kOP_Mod);
return Token(TokenType::MULOP, NumericOp::kOP_Mod);
if (name == "div")
return Token(MULOP, NumericOp::kOP_Div);
return Token(TokenType::MULOP, NumericOp::kOP_Div);
}
// See whether we are at a :
......@@ -360,9 +371,9 @@ Token Parser::NextTokenInternal() {
// It might be an axis name.
Step::Axis axis;
if (IsAxisName(name, axis))
return Token(AXISNAME, axis);
return Token(TokenType::AXISNAME, axis);
// Ugh, :: is only valid in axis names -> error
return Token(XPATH_ERROR);
return Token(TokenType::XPATH_ERROR);
}
// Seems like this is a fully qualified qname, or perhaps the * modified
......@@ -370,13 +381,13 @@ Token Parser::NextTokenInternal() {
SkipWS();
if (PeekCurHelper() == '*') {
next_pos_++;
return Token(NAMETEST, name + ":*");
return Token(TokenType::NAMETEST, name + ":*");
}
// Make a full qname.
String n2;
if (!LexNCName(n2))
return Token(XPATH_ERROR);
return Token(TokenType::XPATH_ERROR);
name = name + ":" + n2;
}
......@@ -388,16 +399,16 @@ Token Parser::NextTokenInternal() {
// Either node type of function name
if (IsNodeTypeName(name)) {
if (name == "processing-instruction")
return Token(PI, name);
return Token(TokenType::PI, name);
return Token(NODETYPE, name);
return Token(TokenType::NODETYPE, name);
}
// Must be a function name.
return Token(FUNCTIONNAME, name);
return Token(TokenType::FUNCTIONNAME, name);
}
// At this point, it must be NAMETEST.
return Token(NAMETEST, name);
return Token(TokenType::NAMETEST, name);
}
Token Parser::NextToken() {
......@@ -422,29 +433,28 @@ void Parser::Reset(const String& data) {
}
int Parser::Lex(void* data) {
YYSTYPE* yylval = static_cast<YYSTYPE*>(data);
auto* yylval = static_cast<YyParser::semantic_type*>(data);
Token tok = NextToken();
switch (tok.type) {
case AXISNAME:
yylval->axis = tok.axis;
case TokenType::AXISNAME:
yylval->build<Step::Axis>() = tok.axis;
break;
case MULOP:
yylval->num_op = tok.numop;
case TokenType::MULOP:
yylval->build<NumericOp::Opcode>() = tok.numop;
break;
case RELOP:
case EQOP:
yylval->eq_op = tok.eqop;
case TokenType::RELOP:
case TokenType::EQOP:
yylval->build<EqTestOp::Opcode>() = tok.eqop;
break;
case NODETYPE:
case PI:
case FUNCTIONNAME:
case LITERAL:
case VARIABLEREFERENCE:
case NUMBER:
case NAMETEST:
yylval->str = new String(tok.str);
RegisterString(yylval->str);
case TokenType::NODETYPE:
case TokenType::PI:
case TokenType::FUNCTIONNAME:
case TokenType::LITERAL:
case TokenType::VARIABLEREFERENCE:
case TokenType::NUMBER:
case TokenType::NAMETEST:
yylval->build<String>() = String(tok.str);
break;
}
......@@ -478,12 +488,10 @@ Expression* Parser::ParseStatement(const String& statement,
Parser* old_parser = current_parser_;
current_parser_ = this;
int parse_error = xpathyyparse(this);
int parse_error = YyParser(this).parse();
current_parser_ = old_parser;
if (parse_error) {
strings_.clear();
top_expr_ = nullptr;
if (got_namespace_error_)
......@@ -496,28 +504,11 @@ Expression* Parser::ParseStatement(const String& statement,
"The string '" + statement + "' is not a valid XPath expression.");
return nullptr;
}
DCHECK_EQ(strings_.size(), 0u);
Expression* result = top_expr_;
top_expr_ = nullptr;
return result;
}
void Parser::RegisterString(String* s) {
if (!s)
return;
DCHECK(!strings_.Contains(s));
strings_.insert(base::WrapUnique(s));
}
void Parser::DeleteString(String* s) {
if (!s)
return;
DCHECK(strings_.Contains(s));
strings_.erase(s);
}
} // namespace xpath
} // namespace blink
......@@ -84,9 +84,6 @@ class Parser {
Member<Expression> top_expr_;
bool got_namespace_error_;
void RegisterString(String*);
void DeleteString(String*);
private:
bool IsBinaryOperatorContext() const;
......@@ -114,7 +111,6 @@ class Parser {
int last_token_type_;
Member<XPathNSResolver> resolver_;
HashSet<std::unique_ptr<String>> strings_;
DISALLOW_COPY_AND_ASSIGN(Parser);
};
......@@ -122,5 +118,4 @@ class Parser {
} // namespace blink
int xpathyyparse(blink::xpath::Parser*);
#endif
......@@ -596,6 +596,12 @@ _CONFIG = [
'base::ScopedAllowBaseSyncPrimitives',
],
},
{
'paths': ['third_party/blink/renderer/core/xml'],
'allowed': [
'xpathyy::.+',
],
},
{
'paths': [
'third_party/blink/renderer/modules/device_orientation/',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment