Commit graph

876 commits

Author SHA1 Message Date
Sei Lisa
efc7f4406a Fix typo. Oops! 2014-07-31 01:34:34 +02:00
Sei Lisa
d1bbe26c49 vector v;<0,0,0>-v; triggered EParseTypeMismatch. Fixed. Also minor fixes.
Convert the self.__class__, which was terrible syntax, to the respective classes in the exceptions.

Fix the EInternal hack in the buitins.txt parser.
2014-07-31 01:25:15 +02:00
Sei Lisa
5e4c19e5ec Fix bug with adding immutable functions. 2014-07-30 23:36:35 +02:00
Sei Lisa
c724b53f20 Simplify main loop of lsloutput.py a bit 2014-07-30 16:01:23 +02:00
Sei Lisa
895e4f4668 Overall renaming of stuff to make it more understandable. 2014-07-30 16:00:00 +02:00
Sei Lisa
fb68273eed Turned everything upside down, and fixed a couple bugs.
Bugs fixed:
- %= and the new assignment operators were not emitting error on invalid types.
- List globals referenced in another global were duplicated entirely.
- Properly recognize -option in the command line.

Rest:
- Complete overhaul of the internal data structure.
  - Got rid of the symbol table plus mini-trees, and made everything one big tree plus an auxiliary symbol table.
  - No more special case hacks like using tuples instead of lists...
  - Got rid of the EXPR hack.
  - Dict-based, rather than list-based. Allows adding arbitrary data to any node or symbol entry.
- Added a few coverage tests for the new code.
- Return values can now be chained; the functions parameter requirement is gone. Still not fully convinced, though. My guess is that a parser object should be passed between functions instead. Will do for now.
2014-07-30 04:54:16 +02:00
Sei Lisa
5d4abf967d Comment changes - just make the idea more explicit. 2014-07-28 21:39:36 +02:00
Sei Lisa
3b4bf13a10 Add coverage for new stuff. 2014-07-28 21:19:23 +02:00
Sei Lisa
c748472187 Compress floats as much as possible. Also output NaN and Infinity as strings. 2014-07-28 20:38:44 +02:00
Sei Lisa
cd9fa96055 Format ELSE IF in a single line. 2014-07-28 19:36:01 +02:00
Sei Lisa
56d51b835c Hack to make identifiers in globals in non-global-expression mode work. 2014-07-28 19:20:36 +02:00
Sei Lisa
b441c1774f Fix incorrect warning when a global vector/quat/list contains an ident 2014-07-28 18:46:37 +02:00
Sei Lisa
02c84ca99c Add default options and option activation/deactivation. 2014-07-28 18:19:50 +02:00
Sei Lisa
443b5a2258 Fix bug where floats in global lists would be output as integers. 2014-07-28 18:13:48 +02:00
Sei Lisa
a6b3a0946f Enable foldtabs warning 2014-07-28 17:39:35 +02:00
Sei Lisa
538d9ab66e Change -o to -O; document "-" as stdin 2014-07-28 17:28:12 +02:00
Sei Lisa
d55f873fd5 Add tab warning and future option documentation. 2014-07-28 17:26:05 +02:00
Sei Lisa
6c00400d7d Add coverage for new preprocessor option. 2014-07-28 02:45:30 +02:00
Sei Lisa
108bbe5395 Some documentation rewordings. 2014-07-28 02:44:51 +02:00
Sei Lisa
eab0bec84b Add preprocessor skip option, command line options and help, options for all functions, and enhance parentheses removal. 2014-07-28 02:13:08 +02:00
Sei Lisa
ae94e80c34 Add a regression test for a case that failed before the globals fix. 2014-07-28 01:01:10 +02:00
Sei Lisa
8907a59d5f Fix remaining bug in optimizer, and minor fixes.
- Get rid of Fold().

- Handle globalmode properly. It was sometimes active during function calls.

- Change all warning() calls to not use Unicode, just in case the output is redirected to file.

- Cosmetic fixes and TODO items.
2014-07-27 23:33:20 +02:00
Sei Lisa
7f6351c5e6 Fix prob with output to pipe. Change output logic.
Now a return status of 0 doesn't invoke sys.exit.
2014-07-27 23:31:48 +02:00
Sei Lisa
64e5d0dc92 Check that it's a variable definition before collapsing or giving warning. 2014-07-27 22:04:15 +02:00
Sei Lisa
100de9c8e9 Fix output of lists < 5 elements 2014-07-27 21:23:57 +02:00
Sei Lisa
3dd73f218f Fix a few more statements missing. 2014-07-27 21:05:57 +02:00
Sei Lisa
dde3c08f61 Add TODO item: skip preprocessor directives. 2014-07-27 21:05:01 +02:00
Sei Lisa
0f55129f71 Add important comment 2014-07-27 21:04:31 +02:00
Sei Lisa
6af4f40752 Add TODO items 2014-07-27 20:48:37 +02:00
Sei Lisa
1747028211 Finish coverage tests. 2014-07-27 20:26:24 +02:00
Sei Lisa
7623c444a8 Forgot empty statement. Also make warning more prominent. 2014-07-27 20:14:25 +02:00
Sei Lisa
19ca34d7e0 Expand the test case to include more coverage. Triggers errors. 2014-07-27 20:13:12 +02:00
Sei Lisa
e57c21a73a Fix FIELD and IDENT in globals. 2014-07-27 20:03:57 +02:00
Sei Lisa
30efb5d14c Bug fix: look up library functions too! 2014-07-27 19:18:05 +02:00
Sei Lisa
f3339b0906 Fix an infinite recursion by disallowing forward globals in global var defs. 2014-07-27 18:42:55 +02:00
Sei Lisa
716374eb83 Add test cases that failed without the previous commit. 2014-07-27 18:08:18 +02:00
Sei Lisa
c483d5ea71 Bunch of bug fixes. 2014-07-27 18:07:35 +02:00
Sei Lisa
f1656c41aa Import 'warning' from lslparse instead of redefining. Cosmetic fixes. 2014-07-27 18:05:11 +02:00
Sei Lisa
26ab4f0382 Fix class definitions to make sense (le-sigh - python quirk) 2014-07-27 17:40:26 +02:00
Sei Lisa
f5444bb83d Update coverage tests. Add optimizer test. Rename classes (cosmetic). 2014-07-27 13:52:55 +02:00
Sei Lisa
124a2823a0 builtins.txt was not named as the source of some errors. Fixed. 2014-07-27 13:49:18 +02:00
Sei Lisa
609df368f3 Fix a case with list mode for globals. 2014-07-27 13:47:18 +02:00
Sei Lisa
beb413420d Disable the debug code 2014-07-27 13:44:13 +02:00
Sei Lisa
0b74093255 Fix tuple mess, typecast bug, and boolean bug.
Fix the tuple mess with the right approach. The EXPR tuple should not be changed, only the content.

Fix bug with typecasts. (NOTE: Debug code active)

Fix bug where <= and >= were returning bool instead of int.
2014-07-27 13:43:16 +02:00
Sei Lisa
d856f62253 Fix optsigns treatment. 2014-07-27 04:31:45 +02:00
Sei Lisa
6e1357f4f3 Handle type cast optimization in the output module (easiest). 2014-07-27 04:24:14 +02:00
Sei Lisa
d98e145090 Add missing operators & returns, remove typecast bogus optimization. 2014-07-27 04:15:12 +02:00
Sei Lisa
33440f5dd4 Fold vector/rotation/list expressions into constants. 2014-07-27 03:17:38 +02:00
Sei Lisa
4f7933aa3b Remove "drunk" comment. 2014-07-27 02:56:35 +02:00
Sei Lisa
b76ae99616 Fixes and folding improvements to the FOR loop.
Added an utility function to fold a list of expressions and completely remove the unused members. No known use besides FOR.
2014-07-27 02:52:16 +02:00