Commit Graph
37 Commits
Author SHA1 Message Date
Martin Carlberg b3e6eb74b2 Fixed: Reset all the macros when compiling a new file in the default implementation of the macro store. 2013-05-16 12:07:44 +02:00
Martin Carlberg ee9b04944a Merge branch 'master' of https://github.com/cappuccino/cappuccino into preprocess 2013-05-06 16:24:54 +02:00
Martin Carlberg 14ee789df4 Fixed: Mark correct column position in 'Expected a Semicolon' errors in the parser. 2013-04-24 10:12:42 +02:00
Aparajita Fishman 7ec660c509 New: record the source filename in SyntaxError. 2013-04-20 13:24:50 -04:00
Martin Carlberg 689ab09555 New: Now supports 'defined' operator, which lets you check whether macros are defined in the middle of an ‘#if’.
Also the evaluation of expressions are now lazy.
2013-04-11 09:37:40 +02:00
Martin Carlberg 30ee1ad8cd New: Handles line continue token '\' on lines starting with '#'
We now support lines like this:
#define StopButtonTitle() \
        CPLocalizedString(@"Stop", @"Stop button title")
2013-04-11 09:32:41 +02:00
Martin Carlberg 84df301f3e New: #if macro statement works for simple literals but not for macro identifiers and defined keyword 2013-03-28 22:43:26 +01:00
Martin Carlberg 2751f4fea9 New: Added missed #ifdef derective 2013-03-27 14:52:05 +01:00
Martin Carlberg c21cfeb28e New: Added #ifdef, #ifndef, #else, #endif and #undef macro derectives 2013-03-27 14:50:55 +01:00
Martin Carlberg ecc1e774b9 New: Added macro/identifier concatenation with the '##' operator
Example:
#define first Martin
#define second Carlberg
var first##second = 13;

Compiles to:
var MartinCarlberg = 13;

Example 2:
#define _function(inline) function inline { return _##inline; }
#define _CGPointMake(x_, y_) { x:x_, y:y_ }
_function(CGPointMake(x, y))

Compiles to:
function CGPointMake (x, y) {
  return {x: x, y: y};
}
2013-03-20 21:00:36 +01:00
Martin Carlberg 0c982b0999 Fixed: An ExpressionStatement with a Send message expression can be parsed wrongly
When a statement ends without a semicolon and a Send message expression is on the next line it was wrongly parsed as a single Send message expression. It should be an ExpressionStatement with a Send message expression inside.
2013-03-17 20:52:21 +01:00
Martin Carlberg 22cdbd7ec7 Merge branch 'master' of https://github.com/cappuccino/cappuccino into preprocess
Conflicts:
	Objective-J/ObjJAcornCompiler.js
	Objective-J/acorn.js
2013-03-12 11:20:56 +01:00
Martin Carlberg 362f3b890e Added first try for compiler to generate code 2013-03-12 09:22:26 +01:00
Alexander Ljungberg b53616ead3 New: @deref(<any idempotent expression>).
This change makes it possible to @deref any expression, such as a conditional expression, as long as the expression doesn't have side effects.

The reason not to allow dereferencing of expressions with side effects is that we might need to evaluate the expression twice in certain uses of deref, which is not obvious when you look at the deref operator in plain code.
2013-03-10 17:32:28 +00:00
Alexander Ljungberg 34faf362d1 New: @ref and @deref in Objective-J 2.0. 2013-03-10 12:17:43 +00:00
Martin Carlberg c17053f71a Removed test line 2013-02-26 08:53:12 +01:00
Alexander Ljungberg 472848da91 New: array literals in Objective-J 2.0.
Array literals look like `@[a, b, c]`.

This syntax is supported for completeness and source compatibility, but are not terribly useful since standard JavaScript arrays are toll-free bridged to CPArray.

Array literals could be handy if you're replacing CPArray with your own implementation.
2013-02-25 14:57:05 +00:00
Alexander Ljungberg 5200f945fe New: dictionary literals in Objective-J 2.0. 2013-02-25 14:24:29 +00:00
Martin Carlberg e8e87b3b83 Added recursive token transformer and preprocessor tokenizer 2013-02-24 22:26:27 +01:00
Martin Carlberg 340f1e3258 Made the acorn parser able to run outside of the Cappuccino world 2013-02-24 22:25:00 +01:00
Martin Carlberg 699ef14b4e Merge with latest acorn compiler 2013-02-21 12:57:19 +01:00
Alexander Ljungberg 181c4ad3c6 Support IBOutlet as a synonym to @outlet.
Without this fix the new compiler would treat IBOutlet as the type and expect the next token to be the ivar name.

This fix make the new compiler treat IBOutlet the same as @outlet.
2013-01-30 15:48:30 +00:00
Martin Carlberg 201c7637f6 Fixed new compiler to output better formatted error messages 2013-01-22 15:38:02 +01:00
Alexander Ljungberg 5ec9cf7faf Fixed: "in" could not be a parameter in a message.
With the new compiler, messages such as `[a in:b]` could not be sent, the "in:" parameter throwing an unexpected token error. This was true both if "in" was the first argument or any of the subsequent parameters (such as in `[a something:X in:Y]`).
2013-01-21 02:11:51 +00:00
Martin Carlberg 6fbab322cf Fixed warning messages in compiler 2013-01-18 14:25:05 +01:00
Martin Carlberg e78f211e8a Added @class and @global declaration and will now make a warning if class or global is not declared. 2013-01-14 18:36:39 +01:00
Martin Carlberg 77d66fa0c9 Fix for: Track spaces will take the spaces after the next token instead of the current. Also do "delete" of property instead of setting it to null for cleaner AST tree. 2013-01-13 22:08:42 +01:00
Martin Carlberg a652fdf8d2 Fix for: Track comments will take the comment after the next token instead of the current. Also do "delete" of property instead of setting it to null for cleaner AST tree. 2013-01-13 22:08:29 +01:00
Aparajita FishmanandMartin Carlberg 85481225a3 Use a better error message for missing semicolons, trailing whitespace elimination 2013-01-13 22:06:18 +01:00
Martin Carlberg 957b34d169 Added the option trackSpaces to attach spacesBefore and spacesAfter properties to AST nodes. 2013-01-08 22:23:34 +01:00
Martin Carlberg 79d2ac0566 Fixed some comments and removed unwanted spaces 2013-01-08 22:19:55 +01:00
Martin Carlberg 547f9ff61f Merge with latest from Acorn master 2013-01-08 22:18:19 +01:00
Martin Carlberg 9f0da2ec41 Fixed spelling error 2013-01-08 22:13:36 +01:00
Martin Carlberg c755dc3ed9 Added some more detailed error messages in parser 2013-01-08 17:00:54 +01:00
Martin Carlberg cfe718f4ef Handle preprocessor lines like "#pragma" 2013-01-07 20:29:35 +01:00
Martin Carlberg bf32b90702 Allow signed, unsigned, char, short, int and long to be an identifier 2013-01-07 20:29:13 +01:00
Martin Carlberg 9cb14d6db3 Added new faster compiler based on acorn parser 2013-01-07 09:59:10 +01:00