Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2208)

Unified Diff: bindings/scripts/blink_idl_parser.py

Issue 581453002: Dartium Roll 38 roll (Closed) Base URL: https://dart.googlecode.com/svn/third_party/WebCore
Patch Set: Sync'd w/ r 182210 Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « bindings/scripts/blink_idl_lexer.py ('k') | bindings/scripts/code_generator_v8.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: bindings/scripts/blink_idl_parser.py
diff --git a/bindings/scripts/blink_idl_parser.py b/bindings/scripts/blink_idl_parser.py
index 6b205f2421c0c3f18ac2d51bad1fdce7988fe697..59218a8fd85bd332ae1a7da1814c4bda53a65280 100644
--- a/bindings/scripts/blink_idl_parser.py
+++ b/bindings/scripts/blink_idl_parser.py
@@ -71,6 +71,7 @@ from idl_parser.idl_parser import IDLParser, ListFromConcat
from idl_parser.idl_parser import ParseFile as parse_file
from blink_idl_lexer import BlinkIDLLexer
+import blink_idl_lexer
# Explicitly set starting symbol to rule defined only in base parser.
@@ -332,23 +333,17 @@ class BlinkIDLParser(IDLParser):
elif len(p) == 3:
p[0] = ListFromConcat(self.BuildTrue('NULLABLE'), p[2])
- # [b76.1] Add support for compound Extended Attribute values (A&B and A|B)
+ # [b94] Add support for OR Extended Attribute values "A|B"
def p_ExtendedAttributeIdentList(self, p):
- """ExtendedAttributeIdentList : identifier '=' identifier '&' IdentAndList
+ """ExtendedAttributeIdentList : identifier '=' '(' IdentifierList ')'
| identifier '=' identifier '|' IdentOrList"""
- value = self.BuildAttribute('VALUE', p[3] + p[4] + p[5])
- p[0] = self.BuildNamed('ExtAttribute', p, 1, value)
-
- # [b76.2] A&B&C
- def p_IdentAndList(self, p):
- """IdentAndList : identifier '&' IdentAndList
- | identifier"""
- if len(p) > 3:
- p[0] = p[1] + p[2] + p[3]
+ if type(p[4]) is list:
+ value = self.BuildAttribute('VALUE', ','.join(p[4]))
else:
- p[0] = p[1]
+ value = self.BuildAttribute('VALUE', p[3] + p[4] + p[5])
+ p[0] = self.BuildNamed('ExtAttribute', p, 1, value)
- # [b76.3] A|B|C
+ # [b94.1] A|B|C
def p_IdentOrList(self, p):
"""IdentOrList : identifier '|' IdentOrList
| identifier"""
@@ -380,6 +375,8 @@ class BlinkIDLParser(IDLParser):
def __init__(self,
# common parameters
debug=False,
+ # local parameters
+ rewrite_tables=False,
# idl_parser parameters
lexer=None, verbose=False, mute_error=False,
# yacc parameters
@@ -394,6 +391,11 @@ class BlinkIDLParser(IDLParser):
write_tables = True
if outputdir:
picklefile = picklefile or os.path.join(outputdir, 'parsetab.pickle')
+ if rewrite_tables:
+ try:
+ os.unlink(picklefile)
+ except OSError:
+ pass
lexer = lexer or BlinkIDLLexer(debug=debug,
outputdir=outputdir,
@@ -433,13 +435,17 @@ class BlinkIDLParser(IDLParser):
################################################################################
def main(argv):
- # If file itself executed, cache parse table
+ # If file itself executed, cache lex/parse tables
try:
outputdir = argv[1]
except IndexError as err:
print 'Usage: %s OUTPUT_DIR' % argv[0]
return 1
- parser = BlinkIDLParser(outputdir=outputdir)
+ blink_idl_lexer.main(argv)
+ # Important: rewrite_tables=True causes the cache file to be deleted if it
+ # exists, thus making sure that PLY doesn't load it instead of regenerating
+ # the parse table.
+ parser = BlinkIDLParser(outputdir=outputdir, rewrite_tables=True)
if __name__ == '__main__':
« no previous file with comments | « bindings/scripts/blink_idl_lexer.py ('k') | bindings/scripts/code_generator_v8.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698