Sei Lisa
35687f1b0f
Expand a comment.
2017-01-04 05:07:50 +01:00
Sei Lisa
b8a27bbcd2
Check that the file exists instead of raising an ugly Python exception.
2016-12-26 03:00:22 +01:00
Sei Lisa
e3632d8a64
Create a list of valid optimizer options and check against it.
...
Validating the input options was badly needed.
2016-12-25 21:34:42 +01:00
Sei Lisa
e2ad14ee1b
Fix a few violations of our guidelines for Unicode handling.
...
Also use e.args[0] instead of e[0].
2016-12-25 20:49:56 +01:00
Sei Lisa
1162c202c4
Give informative error messages when exiting with an error.
2016-12-25 20:47:54 +01:00
Sei Lisa
0137d1ae52
Check -O help only when we're done processing options.
2016-12-25 20:43:24 +01:00
Sei Lisa
32840f4ad6
Add Clear to --optimizer-options, to unset all options.
2016-12-25 20:40:15 +01:00
Sei Lisa
b76063821b
Check for valid UTF-8 unconditionally.
...
The input script must be encoded in UTF-8. We had a check that was only activated when the preprocessor was called. Activate it always, as not doing so triggers an unhandled exception later on.
2016-12-25 20:29:43 +01:00
Sei Lisa
6f474c09d2
Fix wording of WarnTabs option
...
When we changed 'nofoldtabs' to 'warntabs', we changed the meaning to the opposite. However, the wording was still the old one. Make it right.
2016-12-25 19:21:16 +01:00
Sei Lisa
505f7777d4
Pass command line arguments to main function.
...
As opposed to reading them from sys.argv. That will facilitate unit testing of main() later.
2016-12-25 01:12:17 +01:00
Sei Lisa
39261cbfc8
Make Unicode some strings that should be, and improve error reporting in builtins.txt
...
Also work towards the convention that strings that represent text (possibly translatable) are in double quotes, not single.
2016-12-20 20:13:53 +01:00
Sei Lisa
a041faa7a8
Bump version.
2016-06-28 03:51:43 +02:00
Sei Lisa
980adff9c8
Make the -O options case-insensitive.
2016-06-28 03:45:39 +02:00
Sei Lisa
0c3ad9b938
Change skippreproc -> processpre, add #pragma option processing.
...
Usage:
Options are case insensitive.
2016-06-28 03:20:21 +02:00
Sei Lisa
6b45d4efcf
Add comment on the validity of the RE for detecting certain defines.
2016-06-27 21:03:18 +02:00
Sei Lisa
79dff25769
Update copyright years of some files; add legalese to seftable.txt
2016-06-27 20:06:41 +02:00
Sei Lisa
b7e6e6f7b1
Fix bug with tab handling.
...
Commit 5804a9a
introduced a bug where having the foldtabs option disabled (normal) prevented optimizations of functions. Fix it for good (hopefully). While on it, rename the nofoldtabs option to warntabs, making it default, and use it to disable a warning when there are tabs in a string.
2016-05-07 03:18:50 +02:00
Sei Lisa
95bd3209be
Fix reporting the last line on error if it doesn't end in \n.
...
If the last line of the file didn't end in LF, and an error was reported right in that line, two characters would be missing from that line in the output. Fixed.
2016-05-07 02:42:29 +02:00
Sei Lisa
697e80cb16
Rather than reproduce the broken behaviour, throw an error on missing default.
...
Changed my mind. This looks saner. Now, if the 'default:' label is missing, an error will be thrown by default. It has to be explicitly disabled if normal C-like behaviour is desired (namely to jump to the 'break' label if no condition is met).
2016-05-07 02:38:54 +02:00
Sei Lisa
b1b84a123e
Add broken FS switch behaviour for compatibility.
...
In the absence of a 'default' label within a switch, FS falls through to the first CASE label (or to the code before the first CASE if there's any).
This commit adds an option, active by default for FS compatibility, that mimics this broken behaviour, as well as a warning in case the 'default' label is absent, which also triggers another warning when the option is active.
2016-05-06 20:15:46 +02:00
Sei Lisa
dc98e477d7
Add 'nofoldtabs' option to disable warning when a function generates tabs
...
When a function folds to a string that contains a tab, e.g. llUnescapeURL("%09"), or to a list that contains a string that contains a tab, a warning is emitted unless the foldtabs option (which forces the optimization) is used. This option allows to quiet the warning without forcing the optimization.
2016-04-01 20:48:33 +02:00
Sei Lisa
ceb442e931
Improve error reporting, by printing the errored line and a caret (^), taking care to display the beginning of the token the error is at.
2016-01-02 03:39:47 +01:00
Sei Lisa
f97cef2a38
Add -T / --timestamp option to insert the generation timestamp
2015-12-25 19:04:24 +01:00
Sei Lisa
8a8e255239
Tidy up the code a bit more after that last fix.
2015-08-18 21:16:46 +02:00
Sei Lisa
ed6603c3cd
Remove unused import.
2015-08-17 05:21:34 +02:00
Sei Lisa
6b2c5b7e39
Fix preprocessor piping. Found by SungAli, diagnosed by SungAli and Sei Lisa.
2015-08-17 04:56:32 +02:00
Sei Lisa
8ca88013a8
Minor fixes (remove deprecated .message, delete a variable at the right point, delete another variable)
2015-06-04 22:57:13 +02:00
Sei Lisa
aad73fb71d
Added command line option to display the preprocessor output.
...
Will help identify the source line until preprocessor line tracking is implemented.
2015-05-06 02:45:37 +02:00
Sei Lisa
7d0ee20058
Option -p needs an argument.
2015-05-05 22:50:28 +02:00
Sei Lisa
1c16355187
Small wording change.
2015-04-15 22:52:49 +02:00
Sei Lisa
921955f321
Implement function overriding syntax extension, fixing a bug on the way.
...
The funcoverride option allows defining multiple functions with the same name, each overriding the former. That's for compatibility with Firestorm, whose optimizer does that.
While on it, fix a bug where defining a function whose name matches a library function was not reporting an error, and rename self.functions to self.funclibrary for clarity. It also brings consistency with other parts of the code and with the code documentation.
2015-03-27 00:35:37 +01:00
Sei Lisa
29d003b108
Add a comment about C backslash-return behaviour.
2015-03-24 21:56:35 +01:00
Sei Lisa
47eee0312b
Revamp and fixes of REs for pre-preprocessing.
...
Easier to follow and to maintain this way. Fixes known and potential bugs, plus potential lack of greediness.
2015-03-20 17:45:38 +01:00
Sei Lisa
cd1826e9e0
Bump version.
2015-03-19 04:31:47 +01:00
Sei Lisa
df8a8b4e9e
Revamp command line options to add mcpp mode with defaults.
...
Also remove stderr from subprocess call (let the subprocess do its own output to stderr without capturing and re-emitting it ourselves).
2015-03-19 04:11:29 +01:00
Sei Lisa
226f382c4f
Switch the predefined macros to variadic, to allow commas.
2015-03-17 19:41:36 +01:00
Sei Lisa
aea101a823
Add --precmd, bump version, report 'version N' instead of 'vN' on --version
2015-03-15 20:28:53 +01:00
Sei Lisa
f93e6d65a4
Deal with encoding issues, and simplify subprocess poll loop.
2015-03-15 20:01:41 +01:00
Sei Lisa
31b7048fc9
Remove debug info left by mistake.
2015-03-15 19:19:10 +01:00
Sei Lisa
3c962ef32b
Add external preprocessor invocation.
2015-03-15 06:18:55 +01:00
Sei Lisa
9e0ed0521b
Reorganize main to use getopt. Implement -o for output file and -O help.
...
Also --version and -h/--help.
2015-03-14 23:17:15 +01:00
Sei Lisa
defa9fde97
Typo in help
2015-03-07 22:55:25 +01:00
Sei Lisa
a9179f2779
Read the data files from the same path where the script resides.
2015-03-06 20:29:54 +01:00
Sei Lisa
50c2787ef4
Reorder the help lines to make better sense.
2015-03-06 02:56:58 +01:00
Sei Lisa
c68a1f4ad6
Add copyright notices to all files, to prepare the program for release.
2015-03-05 23:18:41 +01:00
Sei Lisa
d164b0fa44
Tweak the main help text.
2015-03-05 20:45:38 +01:00
Sei Lisa
cbcf60767a
Implement break/continue and switch().
...
While on it, reorganize the help text and enable 'dcr' by default.
2015-03-05 01:37:32 +01:00
Sei Lisa
a6127cf144
lazylistcompat idea ditched.
2015-03-04 00:40:07 +01:00
Sei Lisa
30c492d2b3
Oops, fix a format string fail (the help wasn't shown).
2015-03-03 19:58:40 +01:00
Sei Lisa
b73805e0ce
Add "lazy lists" assignment support (mylist[index] = value).
...
Add support for LAMBDA (empty) tree nodes while on it, that allow us to define private stuff at the top without caring about Loc.
2015-03-03 17:59:51 +01:00