Bryan Bishop
a74462bc52
even better performance for read_line
2013-08-31 12:03:48 -05:00
Bryan Bishop
473bd192d9
better read_line performance in preprocessor
...
Jump out of read_line early if the line is an empty string or a newline.
2013-08-31 11:57:01 -05:00
Bryan Bishop
70be18427b
don't call load_pokecrystal_macros 2000 times
...
Also, don't call make_macro_table 2000 times by only calling it once and
passing the result.
2013-08-31 11:04:27 -05:00
Bryan Bishop
a429bce189
Merge branch 'master' into preprocessor-macro-function
2013-08-31 10:22:35 -05:00
Bryan Bishop
ba67d3ba46
Merge branch 'master' into preprocessor-asserts
2013-08-31 10:17:25 -05:00
Bryan Bishop
5815edf382
refactor preprocessor macros into a function
...
Remove the "macros" global and instead use a function to construct a
list of macros.
2013-08-31 10:13:17 -05:00
Bryan Bishop
ebb591a7ec
make a MacroException more verbose in preprocessor
2013-08-31 09:56:24 -05:00
Bryan Bishop
93514b1862
convert a macro_translator assert in preprocessor
...
AssertionError -> PreprocessorException
2013-08-31 09:54:03 -05:00
Bryan Bishop
95f7270141
raise MacroException instead of Exception
...
A more specific exception means that error handling can actually work in
the future.
2013-08-31 09:51:31 -05:00
Bryan Bishop
2c22d9220c
fix "raise Exception" formatting in preprocessor
2013-08-31 09:50:17 -05:00
Bryan Bishop
ecedde1993
replace an assert in macro_translator
...
Use a MacroException instead of an AssertionError.
2013-08-31 09:46:11 -05:00
Bryan Bishop
1ce2bccd37
generic preprocessor-specific exception classes
...
These are basic python Exception subclasses that can be used to throw
more specific errors and exceptions from within the preprocessor.
AssertionError is not a good idea.
2013-08-31 09:45:12 -05:00
Bryan Bishop
998fa0b198
remove the do_macro_sanity_check global
2013-08-31 09:37:55 -05:00
Bryan Bishop
0f28e96e4d
remove the show_original_lines global
2013-08-31 09:37:02 -05:00
Bryan Bishop
a6237d6825
remove an Exception from preprocessor
...
It wasn't meant to be left in there anyway.
2013-08-31 09:29:54 -05:00
Bryan Bishop
5e70ac56ea
remove ItemFragment from preprocessor
...
It's not required.
see #178
2013-08-30 18:36:14 -05:00
Bryan Bishop
69adf48a54
remove "skippable_macros" from preprocessor
...
The preprocessor no longer has the concept of skippable_macros and now
always skips any line that starts with "db" or "dw" because neither of
these should be treated as macros.
fixes #178
2013-08-30 18:27:03 -05:00
Bryan Bishop
8fe7f4c3a5
HACK: re-instate the ItemFragment macro hack
...
This is to fix the preprocessor temporarily. Maybe ItemFragment can be
removed completely.
2013-08-30 17:23:43 -05:00
Bryan Bishop
3fb03e9981
two more unused imports from preprocessor
2013-08-28 20:31:17 -05:00
Bryan Bishop
e4d3ea7256
don't use globals in the preprocessor
...
Macros are now passed around as lists and dicts.
2013-08-28 17:53:26 -05:00
Bryan Bishop
16bfc01124
use generic skippable macros in preprocessor
...
This removes TextEndingCommand from the preprocessor. Instead, there is
a generic concept of a skippable type of macro like "db".
This adds SkippableMacro to the preprocessor.
2013-08-28 17:18:29 -05:00
Bryan Bishop
b602cc9bd6
don't directly reference two macro classes
...
Ideally the macro classes will be removed from the preprocessor core
soon, there's no reason they should be infecting these functions.
2013-08-28 16:48:29 -05:00
Bryan Bishop
6d612c8828
remove MoneyByteParam from preprocessor
...
It didn't belong in there. All of the references were removed.
2013-08-28 16:33:27 -05:00
Bryan Bishop
a4782d9b5a
Merge branch 'master' into remove-another-moneybyteparam-special-case
2013-08-28 16:32:15 -05:00
Bryan Bishop
0236b59360
remove another MoneyByteParam special case
...
This updates the preprocessor to just look for a from_asm method on the
class for the parameter it's processing. If there's a from_asm method,
then it uses it to spit out the right asm.
2013-08-28 16:30:47 -05:00