| OLD | NEW |
| 1 # Copyright 2012 the V8 project authors. All rights reserved. | 1 # Copyright 2012 the V8 project authors. All rights reserved. |
| 2 # Redistribution and use in source and binary forms, with or without | 2 # Redistribution and use in source and binary forms, with or without |
| 3 # modification, are permitted provided that the following conditions are | 3 # modification, are permitted provided that the following conditions are |
| 4 # met: | 4 # met: |
| 5 # | 5 # |
| 6 # * Redistributions of source code must retain the above copyright | 6 # * Redistributions of source code must retain the above copyright |
| 7 # notice, this list of conditions and the following disclaimer. | 7 # notice, this list of conditions and the following disclaimer. |
| 8 # * Redistributions in binary form must reproduce the above | 8 # * Redistributions in binary form must reproduce the above |
| 9 # copyright notice, this list of conditions and the following | 9 # copyright notice, this list of conditions and the following |
| 10 # disclaimer in the documentation and/or other materials provided | 10 # disclaimer in the documentation and/or other materials provided |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 _AddOutcome(result, m) | 99 _AddOutcome(result, m) |
| 100 elif type(mapped) == str: | 100 elif type(mapped) == str: |
| 101 _AddOutcome(result, mapped) | 101 _AddOutcome(result, mapped) |
| 102 else: | 102 else: |
| 103 result.add(new) | 103 result.add(new) |
| 104 | 104 |
| 105 | 105 |
| 106 def _ParseOutcomeList(rule, outcomes, target_dict, variables): | 106 def _ParseOutcomeList(rule, outcomes, target_dict, variables): |
| 107 result = set([]) | 107 result = set([]) |
| 108 if type(outcomes) == str: | 108 if type(outcomes) == str: |
| 109 outcomes = [outcomes] | 109 outcomes = [outcomes] |
| 110 for item in outcomes: | 110 for item in outcomes: |
| 111 if type(item) == str: | 111 if type(item) == str: |
| 112 _AddOutcome(result, item) | 112 _AddOutcome(result, item) |
| 113 elif type(item) == list: | 113 elif type(item) == list: |
| 114 if not eval(item[0], variables): continue | 114 if not eval(item[0], variables): continue |
| 115 for outcome in item[1:]: | 115 for outcome in item[1:]: |
| 116 assert type(outcome) == str | 116 assert type(outcome) == str |
| 117 _AddOutcome(result, outcome) | 117 _AddOutcome(result, outcome) |
| 118 else: | 118 else: |
| 119 assert False | 119 assert False |
| (...skipping 18 matching lines...) Expand all Loading... |
| 138 if not eval(section[0], variables): continue | 138 if not eval(section[0], variables): continue |
| 139 section = section[1] | 139 section = section[1] |
| 140 assert type(section) == dict | 140 assert type(section) == dict |
| 141 for rule in section: | 141 for rule in section: |
| 142 assert type(rule) == str | 142 assert type(rule) == str |
| 143 if rule[-1] == '*': | 143 if rule[-1] == '*': |
| 144 _ParseOutcomeList(rule, section[rule], wildcards, variables) | 144 _ParseOutcomeList(rule, section[rule], wildcards, variables) |
| 145 else: | 145 else: |
| 146 _ParseOutcomeList(rule, section[rule], rules, variables) | 146 _ParseOutcomeList(rule, section[rule], rules, variables) |
| 147 return rules, wildcards | 147 return rules, wildcards |
| OLD | NEW |