| Index: Source/bindings/scripts/blink_idl_parser.py
|
| diff --git a/Source/bindings/scripts/blink_idl_parser.py b/Source/bindings/scripts/blink_idl_parser.py
|
| index 0120654a5f44083573025fb02f43aaec2876e8aa..37c62c5669b952fb11c730fee264a5f8cefc4418 100644
|
| --- a/Source/bindings/scripts/blink_idl_parser.py
|
| +++ b/Source/bindings/scripts/blink_idl_parser.py
|
| @@ -95,6 +95,19 @@ for rule in REMOVED_RULES:
|
| production_name = 'p_' + rule
|
| delattr(IDLParser, production_name)
|
|
|
| +# The base name of cached lexer table generated by BlinkIDLLexer
|
| +LEX_TABLE_BASENAME = 'lextab'
|
| +
|
| +
|
| +def remove_cached_lex_table(outputdir):
|
| + table_files = [
|
| + os.path.join(outputdir, '%s.py' % LEX_TABLE_BASENAME),
|
| + os.path.join(outputdir, '%s.pyc' % LEX_TABLE_BASENAME),
|
| + ]
|
| + for table_file in table_files:
|
| + if os.path.exists(table_file):
|
| + os.unlink(table_file)
|
| +
|
|
|
| class BlinkIDLParser(IDLParser):
|
| # [1]
|
| @@ -440,12 +453,16 @@ class BlinkIDLParser(IDLParser):
|
| ################################################################################
|
|
|
| def main(argv):
|
| - # If file itself executed, cache parse table
|
| + # If file itself executed, cache parse table. Caching the parse table
|
| + # also caches lex table. Before caching these tables, we remove the
|
| + # previous cached lex table if exists so that the build system can keep
|
| + # track of dependencies. See http://crbug.com/397909
|
| try:
|
| outputdir = argv[1]
|
| except IndexError as err:
|
| print 'Usage: %s OUTPUT_DIR' % argv[0]
|
| return 1
|
| + remove_cached_lex_table(outputdir)
|
| # 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.
|
|
|