Fixed some bad parsing behavior in a certain case

This commit is contained in:
Jamie Hardt
2019-10-09 16:45:48 -07:00
parent a3a3dba924
commit c9eef9d6ca
2 changed files with 5 additions and 3 deletions

View File

@@ -14,13 +14,13 @@ protools_text_export_grammar = Grammar(
files_section = files_header files_column_header file_record* block_ending files_section = files_header files_column_header file_record* block_ending
files_header = "F I L E S I N S E S S I O N" rs files_header = "F I L E S I N S E S S I O N" rs
files_column_header = "Filename " fs "Location" rs files_column_header = "Filename" isp fs "Location" rs
file_record = string_value fs string_value rs file_record = string_value fs string_value rs
clips_section = clips_header clips_column_header clip_record* block_ending clips_section = clips_header clips_column_header clip_record* block_ending
clips_header = "O N L I N E C L I P S I N S E S S I O N" rs clips_header = "O N L I N E C L I P S I N S E S S I O N" rs
clips_column_header = string_value fs string_value rs clips_column_header = string_value fs string_value rs
clip_record = string_value fs string_value fs "[" integer_value "]" rs clip_record = string_value fs string_value (fs "[" integer_value "]")? rs
plugin_listing = plugin_header plugin_column_header plugin_record* block_ending plugin_listing = plugin_header plugin_column_header plugin_record* block_ending
plugin_header = "P L U G - I N S L I S T I N G" rs plugin_header = "P L U G - I N S L I S T I N G" rs

View File

@@ -40,7 +40,9 @@ class DictionaryParserVisitor(NodeVisitor):
@staticmethod @staticmethod
def visit_clips_section(node, visited_children): def visit_clips_section(node, visited_children):
return list(map(lambda child: dict(clip_name=child[0], file=child[2], channel=child[5]), channel = next(iter(visited_children[2][5]), 1)
return list(map(lambda child: dict(clip_name=child[0], file=child[2], channel=channel),
visited_children[2])) visited_children[2]))
@staticmethod @staticmethod