Commit Graph

61 Commits

Author SHA1 Message Date
TomyLobo
e2f1abd7e4 Fixed the query functions not comparing data values at all for their return values.
Also made them accept RValue as well and added some test cases for them
and for the overloader bug i fixed last time.
2013-09-25 00:37:54 +02:00
TomyLobo
8badb09399 Added query{,Abs,Rel}(x,y,z,typevar,datavar) to the expression parser. 2013-09-21 19:44:56 +02:00
TomyLobo
eba1114b39 IntelliJ demanded attention. 2013-09-21 19:44:56 +02:00
TomyLobo
57bb5470eb Allowed usage of non-existant variables in all LValue expressions. 2013-09-21 19:44:55 +02:00
TomyLobo
4fa5daf974 Moved megabuf to the Functions class 2013-09-21 19:24:54 +02:00
TomyLobo
aef3b0024a Fixed the overloader 2013-09-21 19:24:53 +02:00
TomyLobo
cabced11a7 Removed some "final" qualifiers from static methods.
Also fixed some other warnings IntelliJ annoyed me with
2013-09-21 10:09:49 -04:00
TomyLobo
6f3fbdc963 Removed some debug prints. 2013-07-02 07:30:00 -04:00
TomyLobo
6c413289be Added [g]closest(x,y,z,index,count,stride) to the expression parser.
This function reads <count> x/y/z triplets from [g]megabuf, starting at <index> and advancing <stride> elements each time.
It then finds the element closest to the given coordinates.
2012-07-13 17:29:21 +02:00
TomyLobo
613f3884d4 Reorganized megabuf a bit. 2012-07-13 12:24:14 +02:00
TomyLobo
fd4e94220f Fixed a NullPointerException in ifs without an else.
The NPE occured if the condition was not optimizable to a constant.
2012-07-13 12:20:33 +02:00
zml2008
70205bfd11 Removed string.isEmpty() method calls 2011-12-27 13:21:55 -08:00
TomyLobo
376d3c8727 Added "and contributors" to all Copyright statements on the com.sk89q.worldedit.expression package. 2011-12-25 23:27:19 +01:00
TomyLobo
09589e2a79 Fixed switch treating continue like break. 2011-12-05 03:23:22 +01:00
TomyLobo
04a08e7e0c Improved Switch's optimizer. 2011-12-04 21:00:03 +01:00
TomyLobo
d55376e8a6 Added an optimizer and license/element comments for Switch. 2011-12-04 20:26:14 +01:00
TomyLobo
7a429e9932 Made Node.getPosition final and fixed some whitespace in LocalWorld. 2011-12-04 20:06:23 +01:00
TomyLobo
a8e64fd8bc Added switch/case to the expression parser.
Also added a test case.
2011-12-04 09:25:56 +01:00
TomyLobo
61b2ea4007 Added "switch" and "case" to the list of keywords so they can't be used as variable names. 2011-12-04 06:40:09 +01:00
TomyLobo
771d068826 Reduced indentation on a piece of code. 2011-12-01 20:20:49 +01:00
TomyLobo
af9e2da6d3 Simplified the statement parser, fixed a few quirks and adjusted a test case. 2011-11-30 09:18:53 +01:00
TomyLobo
9cdac001e3 Added a megabuf function to the expression parser, which works like gmegabuf, except that there is one buffer per Expression instance. 2011-11-30 05:27:11 +01:00
TomyLobo
c6518a9243 Added a way to retrieve the current expression instance. 2011-11-30 05:20:16 +01:00
TomyLobo
662e597f1a Moved temporary variable creation from Parser to Expression. 2011-11-30 04:45:48 +01:00
sk89q
11245014c8 Added @Override annotations. 2011-11-29 20:17:50 +01:00
TomyLobo
a6f0a48f84 Added a swap function to the expression parser. 2011-11-28 00:30:52 +01:00
TomyLobo
6aec096709 Fixed a comment. 2011-11-24 21:20:44 +01:00
TomyLobo
77bd86a203 Whitespace police 2011-11-24 21:07:14 +01:00
TomyLobo
c1e151ac19 Improved the expression parser's optimizer.
Added optimizers for Conditional, For, SimpleFor and While.
Improved the Sequence optimizer.
Removed the optimizer TODOs from Break and Return.
2011-11-24 21:00:09 +01:00
TomyLobo
05b427316d Changed signature of the optimize() method to return an RValue. 2011-11-24 20:50:07 +01:00
TomyLobo
7cbb7da80b Added the ternary operator. 2011-11-24 20:04:42 +01:00
TomyLobo
9456c9e58f Expression parser improvements
- Fixed calling nullary functions.
- Improved error reporting for missing functions
- Added random() and randint(max)
- Improved Sequence.optimize() to eliminate statements with no effect
- Adjusted a comment
2011-11-24 11:05:41 +01:00
TomyLobo
dfb729d5f1 Added license blocks and element comments to all expression parser classes.
Also updated some terminology
2011-11-24 03:55:06 +01:00
TomyLobo
71287299b5 Added a simple for loop to the expression parser.
Syntax: for (counter = first, last) { body }
Also added a test case.
2011-11-24 02:35:19 +01:00
TomyLobo
7e13b60a51 Cleanup 2011-11-23 04:48:40 +01:00
TomyLobo
1a57f6e95d Added return, break and continue. 2011-11-22 18:51:19 +01:00
TomyLobo
efc2209c0f Prevented overwriting built-in constants. 2011-11-22 17:47:44 +01:00
TomyLobo
5ef9df7feb Made it possible to leave parts of a for statement empty. 2011-11-22 16:56:41 +01:00
TomyLobo
e6e31d0b93 Moved some code around 2011-11-22 16:35:56 +01:00
TomyLobo
effbf9f79c Added for loops to the expression parser, java style.
Also:
- Added a test case for for
- Fixed Identifiable.id() for the runtime Nodes and added missing elements to the list in Identifiable.java.
- Factored keyword and character consumption into a common function.
2011-11-22 16:08:15 +01:00
TomyLobo
f217be0bdf Added while loops to the expression parser.
Also added a test case.
Iterations are currently limited to 256 maximum.
2011-11-22 06:16:23 +01:00
TomyLobo
aa43975e34 Added support for if/else to the expression parser. Basically same syntax as Java.
Also added a test case.
2011-11-22 05:12:32 +01:00
TomyLobo
5071885d10 Expression parser: Extended the index range of the megabuf function and renamed it to gmegabuf 2011-11-22 02:33:01 +01:00
TomyLobo
0c9c213e4e Added support for assignable function results.
Also:
- Added megabuf(index) as a first, temporary example
- Introduced a new Node class at the top of the hierarchy for the runtime.
- RValue and LValue are now interfaces
- Narrowed down some exception declarations
- Optimized the optimizer for functions
2011-11-20 17:41:38 +01:00
TomyLobo
a51bc28756 Added true and false constants to the expression parser. 2011-11-02 15:29:55 +01:00
TomyLobo
c2cd587a9b Added support for functions that take LValues and added rotate(x&,y&,angle) 2011-11-02 03:41:35 +01:00
TomyLobo
d3822ee345 Fixed postfix operator evaluation order. 2011-10-31 00:42:57 +01:00
TomyLobo
8e0539adf1 Parser improvements
- After a closing brace or a semicolon, a new expression starts. This fixes "{}-1" and ";-1" returning an error.
- Empty statements and empty block statements are now fully supported
- Renamed PrefixOperator to UnaryOperator
- Added postincrement(x++), postdecrement(x--) and factorial(x!) operators
2011-10-30 06:04:49 +01:00
TomyLobo
77d1317964 Added support for temporary variables 2011-10-29 21:07:31 +02:00
Wizjany
699807665d Cleanup 2011-10-29 11:57:45 -04:00