Commit graph

356 commits

Author SHA1 Message Date
Sei Lisa
9c926b6fec Fix obsolete comment.
There was a time where I decided that the tree would be stored inside the symbol table, as values for the global symbols. I changed my mind later and separated them, but that comment remained.
2015-03-09 01:07:55 +01:00
Sei Lisa
6a0eebf157 Implement a couple subtleties of the lexer in the handling of strings.
First, a string does not have its own context, it's a regular expression, therefore if there isn't a matching closing quote until EOF, it's not an unterminated string. It plainly *isn't* a string.

Second, the string lexer searches for either the regexp '[^"\\]' (any character except a double quote or a backslash) or the regexp '\\.', that is, a backslash followed by an "any character" meta. But the "any character" meta does NOT match a newline. The consequence is that a '\' followed by a newline cancels the matching, and the whole thing is not considered a string.

Isolated double quotes are then plain ignored as many other characters.

An example illustrating both cases:
```
default
{
    state_entry()
    {
        string msg = "Hello, Avatar!";
        llOwnerSay"(msg); // the opening quote will be ignored
        // the following backslash at EOL cancels the previous double quote: \
        llOwnerSay(llGetKey(")); // Unterminated string; unmatched so ignored.
    }
}
```
2015-03-08 16:53:58 +01:00
Sei Lisa
defa9fde97 Typo in help 2015-03-07 22:55:25 +01:00
Sei Lisa
1e8b77bf50 Rather than generating random identifiers for locals, prefix them with 'loc_'.
Should help improving readability of the optimized script.
2015-03-07 14:51:51 +01:00
Sei Lisa
a292846d28 Fix missing scope table index when generating the call to lazy_list_set. 2015-03-07 14:50:25 +01:00
Sei Lisa
562154e7aa Remove the symbol table entry too when removing a global state/function/var. 2015-03-07 14:33:11 +01:00
Sei Lisa
b112494311 Support for other IDEs 2015-03-07 13:52:44 +01:00
Sei Lisa
2b56d06e60 Comment on lack of location info of warnings. 2015-03-07 13:41:20 +01:00
Sei Lisa
59cdd64228 Warn about float constants that can't be represented in globals. Also don't duplicate the globals warnings. 2015-03-06 23:26:58 +01:00
Sei Lisa
c1d837674c Forgot to exclude globals from this optimization somehow. 2015-03-06 22:55:28 +01:00
Sei Lisa
7c35cf64df Mention OS X command to pipe to clipboard. 2015-03-06 20:35:05 +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
ac9f0c30a5 More tweaks to README.md 2015-03-06 20:26:44 +01:00
Sei Lisa
109d2b4324 README.md tweaks++ 2015-03-06 19:03:03 +01:00
Sei Lisa
e9d8af6e11 llGetKey example replaced with llGetOwner. 2015-03-06 03:44:21 +01:00
Sei Lisa
9e9997bc98 More README.md tweaks 2015-03-06 03:42:11 +01:00
Sei Lisa
7cedd7e157 Improvements to README.md 2015-03-06 03:22:06 +01:00
Sei Lisa
a304cf989c Add README.md 2015-03-06 02:58:29 +01:00
Sei Lisa
50c2787ef4 Reorder the help lines to make better sense. 2015-03-06 02:56:58 +01:00
Sei Lisa
ed17d3330d Updated builtins.txt and builtins.txt.dat 2015-03-05 23:37:43 +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
33de6c0efc Comment typo, brackets->braces. 2015-03-05 20:18:13 +01:00
Sei Lisa
308ca7c8ff Add support for 'break n;' and 'continue n;'. Also simplify the break/continue stacks handling code and fix some bugs. 2015-03-05 20:12:32 +01:00
Sei Lisa
d4035b0723 Add incompatibility note on JSON. 2015-03-05 18:48:28 +01:00
Sei Lisa
e5cb37dfe4 For now, enable the RE 2015-03-05 14:42:02 +01:00
Sei Lisa
f730843762 More TODO tweaking. 2015-03-05 06:20:11 +01:00
Sei Lisa
7fb345b222 'case' needed to be in the list of 4-char words to avoid. Also tweak a comment. 2015-03-05 06:18:53 +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
a36715f121 Add reference source, comments. 2015-03-04 02:01:03 +01:00
Sei Lisa
8b9676e5dc Fix missing 'paramscope', remove commented out old body, simplify. 2015-03-04 01:51:08 +01:00
Sei Lisa
a6127cf144 lazylistcompat idea ditched. 2015-03-04 00:40:07 +01:00
Sei Lisa
87b6002b6c Fix the bug detected in llListReplaceList. 2015-03-04 00:31:55 +01:00
Sei Lisa
8ea6ae50fd Replace the lazy_list_set function with a more compact one. 2015-03-03 20:00:40 +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
Sei Lisa
7e521780d6 Two more optimizations TODO 2015-03-03 17:49:57 +01:00
Sei Lisa
e36fc83b39 Noted important bug in llListReplaceList 2015-03-03 17:26:50 +01:00
Sei Lisa
0b55f6e64d Oops, the operator is !, not - 2015-03-03 02:20:31 +01:00
Sei Lisa
05d46e9ac3 Optimize comparisons of the form int>2147483647 or int<-2147483648 and expand (>=, <=, !=) to !(<, >, ==) respectively. 2015-03-03 02:16:00 +01:00
Sei Lisa
493aed6c39 Optimize (-a)*b or a*(-b) to -(a*b), revisiting the expression.
This obviates the need for (-a)*(-b) because it will be simplified automatically. It also enables (a+1)*b-1 to be simplified to just ~(~a*b). Still missing simplifying a*b+b to (a+1)*b, but that's more complicated.
2015-03-03 01:46:53 +01:00
Sei Lisa
22a1a2e8ba Document the change to the symtab structure. 2015-03-03 00:51:48 +01:00
Sei Lisa
01f2bba2f4 Make *-2 and *2 only work for local variables. Needed an adition to the parser. 2015-03-03 00:49:14 +01:00
Sei Lisa
d8f42a5071 Remove obsolete comment about parentheses (they are now implicit). 2015-03-03 00:47:15 +01:00
Sei Lisa
c650ad26f8 Comment changes only. 2015-03-02 23:28:14 +01:00
Sei Lisa
3b7e461d82 Convert [x] -> (list)x except in globals. 2015-02-28 22:48:11 +01:00
Sei Lisa
831296eddc Minor shortening of name to fit in line 2015-02-28 21:46:19 +01:00
Sei Lisa
762bf1f27b Add some FIXMEs and TODOs, remove comment that no longer makes sense. 2015-02-28 20:39:23 +01:00
Sei Lisa
0ca5a8f5b0 Fix typo that made function calls be wrapped in parentheses on output.
No biggie, but what's right is right.
2015-02-28 20:37:59 +01:00
Sei Lisa
e30a4ea25d Fix addstrings option (oops). 2015-02-28 20:37:18 +01:00