shithub: pokecrystal

Download patch

ref: 93514b18629fe42c0a2688dac57d90998ea5daaa
parent: 95f7270141cbdb32c7d178a8a89a822e66e3a113
author: Bryan Bishop <[email protected]>
date: Sat Aug 31 05:54:03 EDT 2013

convert a macro_translator assert in preprocessor

AssertionError -> PreprocessorException

--- a/preprocessor.py
+++ b/preprocessor.py
@@ -534,9 +534,15 @@
         else:
             allowed_lengths = [allowed_length]
 
-        assert len(params) in allowed_lengths, \
-               "mismatched number of parameters on this line: " + \
-               original_line
+        if len(params) not in allowed_lengths:
+            raise PreprocessorException(
+                "mismatched number of parameters ({count}, instead of any of {allowed}) on this line: {line}"
+                .format(
+                    count=len(params),
+                    allowed=allowed_lengths,
+                    line=original_line,
+                )
+            )
 
     # --- end of ridiculously long sanity check ---