( syntax_output )
| 81 | |
| 82 | |
| 83 | def _SyntaxGroupsFromOutput( syntax_output ): |
| 84 | group_name_to_group = _CreateInitialGroupMap() |
| 85 | lines = syntax_output.split( '\n' ) |
| 86 | looking_for_group = True |
| 87 | |
| 88 | current_group = None |
| 89 | for line in lines: |
| 90 | if not line: |
| 91 | continue |
| 92 | |
| 93 | match = SYNTAX_GROUP_REGEX.search( line ) |
| 94 | if match: |
| 95 | if looking_for_group: |
| 96 | looking_for_group = False |
| 97 | else: |
| 98 | group_name_to_group[ current_group.name ] = current_group |
| 99 | |
| 100 | current_group = SyntaxGroup( match.group( 'group_name' ), |
| 101 | [ match.group( 'content' ).strip() ] ) |
| 102 | else: |
| 103 | if looking_for_group: |
| 104 | continue |
| 105 | |
| 106 | if line[ 0 ] == ' ' or line[ 0 ] == '\t': |
| 107 | current_group.lines.append( line.strip() ) |
| 108 | |
| 109 | if current_group: |
| 110 | group_name_to_group[ current_group.name ] = current_group |
| 111 | return group_name_to_group |
| 112 | |
| 113 | |
| 114 | def _CreateInitialGroupMap(): |
no test coverage detected