paulc
3aeb6687d5
Fixed a GCC 6 build error: C++11 requires a space between literal and string macro.
...
git-svn-id: http://yate.null.ro/svn/yate/trunk@6084 acf43c95-373e-0410-b603-e72c3f656dc1
2016-01-20 10:23:35 +00:00
paulc
d2f52af2f6
Added JS Array.lastIndexOf() method.
...
Fixed fromIndex behavior for indexOf() and lastIndexOf().
Added optional extra parameter to allow searching a field in an array of objects.
git-svn-id: http://yate.null.ro/svn/yate/trunk@6050 acf43c95-373e-0410-b603-e72c3f656dc1
2015-10-01 15:15:09 +00:00
paulc
f632f0b034
Added JS Object.keys() static method.
...
git-svn-id: http://yate.null.ro/svn/yate/trunk@6039 acf43c95-373e-0410-b603-e72c3f656dc1
2015-09-16 17:33:28 +00:00
paulc
79f5b70ca5
Added static Engine.replaceParams() that replaces object properties in a ${template} string.
...
git-svn-id: http://yate.null.ro/svn/yate/trunk@6030 acf43c95-373e-0410-b603-e72c3f656dc1
2015-09-04 20:04:02 +00:00
paulc
3a638df554
Fixed the JS Array unshift() to not crash when called with no arguments.
...
git-svn-id: http://yate.null.ro/svn/yate/trunk@6025 acf43c95-373e-0410-b603-e72c3f656dc1
2015-08-31 08:06:14 +00:00
paulc
307a7c09ef
Added support for JS getIntValue() min/max/clamp parameters.
...
git-svn-id: http://yate.null.ro/svn/yate/trunk@6023 acf43c95-373e-0410-b603-e72c3f656dc1
2015-08-27 10:56:06 +00:00
paulc
5b980e2793
Added prototypes to parsed JSON objects and arrays.
...
git-svn-id: http://yate.null.ro/svn/yate/trunk@6020 acf43c95-373e-0410-b603-e72c3f656dc1
2015-08-21 13:07:19 +00:00
paulc
9bc5a3d84a
Made the maximum script file size configurable at runtime and increased default to 500000.
...
git-svn-id: http://yate.null.ro/svn/yate/trunk@5976 acf43c95-373e-0410-b603-e72c3f656dc1
2015-06-01 13:34:50 +00:00
paulc
91963d7659
Allow the return {inline:object}; syntax.
...
git-svn-id: http://yate.null.ro/svn/yate/trunk@5975 acf43c95-373e-0410-b603-e72c3f656dc1
2015-05-19 12:29:16 +00:00
paulc
d8462545d7
Resolve to undefined members of inline objects or arrays that have an undefined right hand variable.
...
git-svn-id: http://yate.null.ro/svn/yate/trunk@5974 acf43c95-373e-0410-b603-e72c3f656dc1
2015-05-19 11:56:31 +00:00
paulc
b7281eaade
Reduce parsing time for very large scripts by limiting the simplification backtrace depth.
...
git-svn-id: http://yate.null.ro/svn/yate/trunk@5972 acf43c95-373e-0410-b603-e72c3f656dc1
2015-05-15 15:17:54 +00:00
paulc
d7e12fc50c
Implemented JS Function apply() and call() methods.
...
git-svn-id: http://yate.null.ro/svn/yate/trunk@5937 acf43c95-373e-0410-b603-e72c3f656dc1
2015-02-10 12:02:20 +00:00
paulc
77556d15c3
Fixed script line counting when an identifier is last item on a line.
...
Fixed line numbers of function calls to match the function identifier.
Fixed line numbers for parts of expressions spanning multiple lines.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5898 acf43c95-373e-0410-b603-e72c3f656dc1
2014-08-05 08:27:07 +00:00
paulc
2a07a7217a
Cast away type in some switch instructions to avoid compiler warnings.
...
git-svn-id: http://yate.null.ro/svn/yate/trunk@5887 acf43c95-373e-0410-b603-e72c3f656dc1
2014-07-29 11:11:05 +00:00
paulc
05ebe9d1f9
Added JsObject constructor that populates prototype from a context.
...
Added JsRegExp contructor from existing Regexp.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5873 acf43c95-373e-0410-b603-e72c3f656dc1
2014-07-22 11:02:44 +00:00
oana
4da094e87e
Fixed equal comparison for objects.
...
git-svn-id: http://yate.null.ro/svn/yate/trunk@5871 acf43c95-373e-0410-b603-e72c3f656dc1
2014-07-21 12:29:38 +00:00
paulc
a598cee5fc
Added Javascript Array.isArray()
...
git-svn-id: http://yate.null.ro/svn/yate/trunk@5870 acf43c95-373e-0410-b603-e72c3f656dc1
2014-07-18 11:07:19 +00:00
paulc
9b6259ac82
Added native JSON parser and stringifier.
...
git-svn-id: http://yate.null.ro/svn/yate/trunk@5869 acf43c95-373e-0410-b603-e72c3f656dc1
2014-07-14 08:06:41 +00:00
paulc
9599d6dbb7
When evaluating naked JsObject fields wrap them in an ExpWrapper.
...
git-svn-id: http://yate.null.ro/svn/yate/trunk@5867 acf43c95-373e-0410-b603-e72c3f656dc1
2014-07-11 16:24:15 +00:00
paulc
cb382e02a2
Fixed assignment operation changed in Rev. 5856.
...
Report the ExpOperation types in Engine.print_r().
git-svn-id: http://yate.null.ro/svn/yate/trunk@5857 acf43c95-373e-0410-b603-e72c3f656dc1
2014-06-25 16:04:00 +00:00
oana
3047c9b55b
Fix loss of boolean type information through assignment due to changes in commit 5854.
...
Do proper cloning on ExpOperation when resolving fields and do proper detection for number conversion on boolean values.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5856 acf43c95-373e-0410-b603-e72c3f656dc1
2014-06-25 14:09:32 +00:00
oana
7a41ecce69
Do proper number conversion for arithmetic operations.
...
git-svn-id: http://yate.null.ro/svn/yate/trunk@5854 acf43c95-373e-0410-b603-e72c3f656dc1
2014-06-24 13:36:53 +00:00
oana
1ea753395a
Bug fix: do proper resolving for null object in object and array initializers.
...
Do not copy the singleton null object, provide a clone instead.
While doing object parameter resolving, do not alter prototypes for frozen objects.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5849 acf43c95-373e-0410-b603-e72c3f656dc1
2014-06-20 11:27:12 +00:00
paulc
7c72c1ba6a
Ignore final commas in Array and Object initializers.
...
Handle successive commas in Array initializers by inserting undefined.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5840 acf43c95-373e-0410-b603-e72c3f656dc1
2014-06-11 10:39:34 +00:00
oana
01d170e8c4
Replaced commentary with a shorter version.
...
git-svn-id: http://yate.null.ro/svn/yate/trunk@5838 acf43c95-373e-0410-b603-e72c3f656dc1
2014-06-06 15:02:56 +00:00
oana
82edff8d9e
Bug fix: avoid returning arbitrary values for functions that have no return value. Return undefined instead.
...
git-svn-id: http://yate.null.ro/svn/yate/trunk@5837 acf43c95-373e-0410-b603-e72c3f656dc1
2014-06-06 11:57:05 +00:00
oana
e1285e0a68
Leave Javascript array data untouched if sorting fails. Slightly optimized the native sort procedure for Javascript array.
...
git-svn-id: http://yate.null.ro/svn/yate/trunk@5835 acf43c95-373e-0410-b603-e72c3f656dc1
2014-05-19 15:01:29 +00:00
oana
eadca3e467
Bug fix: check that we extract a valid pointer from the stack when running the compare function for Array.sort().
...
This avoids segmentation faults caused by a callback compare function for Array.sort() which doesn't return anything. Instead, signal a runtime error.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5833 acf43c95-373e-0410-b603-e72c3f656dc1
2014-05-16 10:40:56 +00:00
marian
d5b3ce3fb7
Added parser method used to obtain a 'null' object reference.
...
git-svn-id: http://yate.null.ro/svn/yate/trunk@5830 acf43c95-373e-0410-b603-e72c3f656dc1
2014-05-14 09:05:33 +00:00
oana
06536919fe
Added support for Javascript RegExp constructor from string.
...
git-svn-id: http://yate.null.ro/svn/yate/trunk@5825 acf43c95-373e-0410-b603-e72c3f656dc1
2014-04-18 13:37:49 +00:00
oana
0b7aacf102
Added discrimination between boolean and integer values.
...
Return proper results for typeof and toString() calls for boolean values.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5819 acf43c95-373e-0410-b603-e72c3f656dc1
2014-04-09 13:52:54 +00:00
paulc
410dd9a8c6
Fixed the type of the result of Array.indexOf(), must be number.
...
git-svn-id: http://yate.null.ro/svn/yate/trunk@5812 acf43c95-373e-0410-b603-e72c3f656dc1
2014-04-01 13:25:17 +00:00
oana
63a85d3bf2
Fixed implementation of Array.splice() and Array.slice() functions.
...
git-svn-id: http://yate.null.ro/svn/yate/trunk@5800 acf43c95-373e-0410-b603-e72c3f656dc1
2014-03-14 16:08:31 +00:00
paulc
0e603be619
Added and extra include path (defaulting to config dir) for JS scripts.
...
Engine runtime parameters can be used in javascript.conf for script paths.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5799 acf43c95-373e-0410-b603-e72c3f656dc1
2014-03-14 14:45:41 +00:00
paulc
fca0d0f1d9
Fixed a memory leak in JS Array.concat(Array), wrapper object was not destroyed.
...
git-svn-id: http://yate.null.ro/svn/yate/trunk@5798 acf43c95-373e-0410-b603-e72c3f656dc1
2014-03-14 10:35:29 +00:00
oana
3f359c0a11
Use new JsArray constructor in the implementation of Array methods.
...
git-svn-id: http://yate.null.ro/svn/yate/trunk@5797 acf43c95-373e-0410-b603-e72c3f656dc1
2014-03-14 10:09:15 +00:00
oana
6d2de9dfc8
Bug fix: properly set prototype property on JS Array objects.
...
Added JsObject::setPrototype() in order to set an objects prototype from given context.
Added new JsArray constructor which set its own prototype. Replaced use of constructor which returned Array prototype with this contructor.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5796 acf43c95-373e-0410-b603-e72c3f656dc1
2014-03-13 13:10:56 +00:00
paulc
b0b2021a27
Added proper constructor for JS Array object.
...
git-svn-id: http://yate.null.ro/svn/yate/trunk@5789 acf43c95-373e-0410-b603-e72c3f656dc1
2014-02-26 12:25:53 +00:00
paulc
3669db3d7b
Correctly parse numbers with sign, in that case sthe sign is not an unary operator.
...
git-svn-id: http://yate.null.ro/svn/yate/trunk@5788 acf43c95-373e-0410-b603-e72c3f656dc1
2014-02-26 12:25:13 +00:00
paulc
632070e047
Fixed implementation of JS Array concat() and reverse() methods.
...
git-svn-id: http://yate.null.ro/svn/yate/trunk@5759 acf43c95-373e-0410-b603-e72c3f656dc1
2014-02-06 10:02:01 +00:00
paulc
5efdfb17dc
Fixed JS Array.pop() and unshift()
...
git-svn-id: http://yate.null.ro/svn/yate/trunk@5758 acf43c95-373e-0410-b603-e72c3f656dc1
2014-02-05 17:22:09 +00:00
paulc
4f9ea57ca1
Fixed JS Array.shift(), was breaking non-string values.
...
Marked pop(), concat(), reverse(), unshift() in need of fixing.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5757 acf43c95-373e-0410-b603-e72c3f656dc1
2014-02-05 16:49:01 +00:00
paulc
37a72e4bc1
Added copyright notices to sources and scripts missing them.
...
Updated copyright notices for 2014.
Fixed end of lines in many files.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5755 acf43c95-373e-0410-b603-e72c3f656dc1
2014-02-05 11:42:17 +00:00
oana
6bffe6163b
Bug fix: report parser error when parsing expressions like 'a.' (parsing of field operator without subsequent field name).
...
Also do not parse fields that do not start with a letter or characters '_'/'$'.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5655 acf43c95-373e-0410-b603-e72c3f656dc1
2013-09-17 14:34:43 +00:00
paulc
9545926d43
Set the proper current file name when starting to parse a JS file.
...
Changed a local variable name to avoid hiding a method with same name.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5653 acf43c95-373e-0410-b603-e72c3f656dc1
2013-09-16 12:55:49 +00:00
oana
849eabe9a7
Do not stop resolving a variable until all variable fields have been resolved.
...
Resolving a variable now returns a container and the rest of fields that are to be applied onto the container. There is one exception to this and that is when a variable was resolved to a string and the last field to be applied is a native string/number field or function.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5643 acf43c95-373e-0410-b603-e72c3f656dc1
2013-09-10 14:19:05 +00:00
oana
c8f18f9d15
Fixed compile warnings which appear when compiling with xdebug.
...
git-svn-id: http://yate.null.ro/svn/yate/trunk@5642 acf43c95-373e-0410-b603-e72c3f656dc1
2013-09-09 15:26:27 +00:00
paulc
0726a64df9
Allow loading up to 256KB of script.
...
git-svn-id: http://yate.null.ro/svn/yate/trunk@5636 acf43c95-373e-0410-b603-e72c3f656dc1
2013-08-30 14:58:25 +00:00
paulc
ef1ad20f05
Removed a leftover debug message.
...
git-svn-id: http://yate.null.ro/svn/yate/trunk@5635 acf43c95-373e-0410-b603-e72c3f656dc1
2013-08-30 12:55:40 +00:00
paulc
f22543845a
Fixed some of the cases related to script change detection.
...
git-svn-id: http://yate.null.ro/svn/yate/trunk@5634 acf43c95-373e-0410-b603-e72c3f656dc1
2013-08-30 12:53:24 +00:00