Commit Graph

20 Commits

Author SHA1 Message Date
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
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
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
TomyLobo
8797d8ac3c Added element comments to all classes of the expression parser.
Also fixed some id() implementations.
2011-10-29 17:24:11 +02:00
TomyLobo
93f073f264 Renamed Assignable to LValue and Invokable to RValue 2011-10-29 16:01:55 +02:00
TomyLobo
8ce3f4d77a Moved some code around in ParserProcessors.java 2011-10-29 04:20:13 +02:00
TomyLobo
f28401aecc Moved the sub-processors into a new class, ParserProcessors. 2011-10-28 20:34:48 +02:00
TomyLobo
d9b86025d3 Parser refactorings
- Made all sub-processors static
- Made statement (combined) assignment parsing right-associative
- Added a stub for the ternary operator
- Fixed position value on Sequences
2011-10-28 00:37:18 +02:00
TomyLobo
ee79abff67 The expression parser can now parse more than a simple expression
- Added sequencing (; and {}).
- Added =, +=, -=, *=, /=, %=, ^= to the expression parser. (left-associative for now, will change later)
- Added pre-increment(++) and pre-decrement(--) operators.
- Adjusted/added tests.
2011-10-27 19:16:46 +02:00
TomyLobo
c2191f4fc7 Generalized the Lexer a bit more and renamed a function in the parser. 2011-10-25 18:45:52 +02:00
TomyLobo
d93d85cd37 Added an expression parser. 2011-10-18 01:04:04 +02:00