Commit Graph

211 Commits

Author SHA1 Message Date
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
paulc 60589c820d Properly dump 64 bit JS values for debugging and tracing.
Made possible to dump the linked code for debugging purpose.
Exposed accessors for more properties.


git-svn-id: http://yate.null.ro/svn/yate/trunk@5633 acf43c95-373e-0410-b603-e72c3f656dc1
2013-08-30 10:58:23 +00:00
paulc 80e69db19b Expose the sqlEscape() method to Javascript.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5632 acf43c95-373e-0410-b603-e72c3f656dc1
2013-08-28 13:39:31 +00:00
paulc 58df5ea11b Check the timestamps of all files included in Javascript.
On initialization reload scripts if any included file has changed.
Reload routing script only if it has changed.


git-svn-id: http://yate.null.ro/svn/yate/trunk@5631 acf43c95-373e-0410-b603-e72c3f656dc1
2013-08-28 13:19:42 +00:00
paulc 7c39b31458 Fixed warnings - mostly conversions - exposed by Visual C++ compiler.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5614 acf43c95-373e-0410-b603-e72c3f656dc1
2013-08-07 11:24:10 +00:00
paulc e81cbde58e More fixes related to 32 and 64 bit types usage in JS.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5613 acf43c95-373e-0410-b603-e72c3f656dc1
2013-08-07 10:18:23 +00:00
paulc 18ff43d395 Fixed 64 bit types usage in Javascript, was broken on 32 bit machines.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5612 acf43c95-373e-0410-b603-e72c3f656dc1
2013-08-07 09:49:52 +00:00
paulc c371a7037c Separated 32 and 64 bit constructors and assignments for String.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5611 acf43c95-373e-0410-b603-e72c3f656dc1
2013-08-06 15:42:44 +00:00
paulc cf5d0fd71a Changed license terms in each source file to reference an external file.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5609 acf43c95-373e-0410-b603-e72c3f656dc1
2013-08-06 13:38:10 +00:00
oana fd9593ce55 Improved speed of appending parsed operator codes to the operator codes list.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5593 acf43c95-373e-0410-b603-e72c3f656dc1
2013-08-01 07:34:21 +00:00
oana f7287c7d7b Resolve fields on expressions/non-objects also.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5586 acf43c95-373e-0410-b603-e72c3f656dc1
2013-07-17 14:47:33 +00:00
oana da23194709 Fix Array.pop() implementation in order to properly return objects.
Also, when building constant objects or array, set their name according to internal convention.



git-svn-id: http://yate.null.ro/svn/yate/trunk@5585 acf43c95-373e-0410-b603-e72c3f656dc1
2013-07-17 11:02:25 +00:00
oana 8de63f495f Bug fix: don't allow enumeration of the length property in Array.
Properly handle assignments to the Array.length property: if set to a value smaller than the previous length value, destroy all objects found at indexes greater than length.



git-svn-id: http://yate.null.ro/svn/yate/trunk@5584 acf43c95-373e-0410-b603-e72c3f656dc1
2013-07-16 13:47:17 +00:00
oana 631b11c48e Fixed constructors for constant objects and arrays, avoid enumeration of prototype methods.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5581 acf43c95-373e-0410-b603-e72c3f656dc1
2013-07-15 11:26:02 +00:00
oana 008f6d5e67 Also update array length when assigning values through the array subscript operator.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5580 acf43c95-373e-0410-b603-e72c3f656dc1
2013-07-11 13:25:09 +00:00
oana 59f4159cbf Bug fix: set the number of expected separators to 0 when parsing for an instruction that does not start with {, reset it to the previous value when the parsing of the instruction has finished.
Fixes parsing of if { if { instr1; } else instr2; instr3;} blocks of code and the likes.



git-svn-id: http://yate.null.ro/svn/yate/trunk@5521 acf43c95-373e-0410-b603-e72c3f656dc1
2013-06-04 13:18:05 +00:00
marian ab173307a5 Removed not exisintg debug enabler variable from debug message.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5471 acf43c95-373e-0410-b603-e72c3f656dc1
2013-04-18 10:32:17 +00:00
paulc cbdaee13e9 Fixed a conversion on 32 bit platforms.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5470 acf43c95-373e-0410-b603-e72c3f656dc1
2013-04-17 15:55:24 +00:00
paulc 1cd5d7fccd Fixed the constructors and get... methods of Javascript Date object.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5469 acf43c95-373e-0410-b603-e72c3f656dc1
2013-04-17 15:42:40 +00:00
oana ad310cfdea Added class ParsePoint for keeping a context while parsing code.
Changed the Javascript parser to use this object.
This patch fixes issues with incorrect parsing of imbricated if... else/if {} else {} or any of the combinations including a if else construct.



git-svn-id: http://yate.null.ro/svn/yate/trunk@5464 acf43c95-373e-0410-b603-e72c3f656dc1
2013-04-12 15:07:19 +00:00
paulc bd5f61a24d Added Javascript pseudo-method toString() for base conversion.
Fixed stack alignment in JS parseInt()


git-svn-id: http://yate.null.ro/svn/yate/trunk@5451 acf43c95-373e-0410-b603-e72c3f656dc1
2013-04-12 13:32:48 +00:00
oana 74e91f9598 Bug fix for printing on output generated code. Also display label indexes when dumping the code.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5450 acf43c95-373e-0410-b603-e72c3f656dc1
2013-04-12 13:29:19 +00:00
paulc 3b49b78ecb Added a shared static list of Atom strings and an YATOM macro.
This speeds up signifficantly the Yate RTTI on compilers that HAVE_BLOCK_RETURN.
Made the String comparison operator inline to shave off a few cycles.
Fast handle the comparison in identity case.


git-svn-id: http://yate.null.ro/svn/yate/trunk@5449 acf43c95-373e-0410-b603-e72c3f656dc1
2013-04-12 13:19:14 +00:00
paulc 1c83cdffbc Added a jump entries table to speed up Javascript function calls.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5446 acf43c95-373e-0410-b603-e72c3f656dc1
2013-04-12 12:56:45 +00:00
paulc 2f19c830c2 Store ExpOperations in JsObjects so the value type is preserved.
Automatically convert database results to numbers if possible.
Added faster method ExpOperation::typeOf()


git-svn-id: http://yate.null.ro/svn/yate/trunk@5444 acf43c95-373e-0410-b603-e72c3f656dc1
2013-04-12 12:54:30 +00:00
paulc b3c4c0c694 Added support for tracing Javascript execution in KCacheGrind format.
Fixed line counting for a possible keyword or identifier at end of line.


git-svn-id: http://yate.null.ro/svn/yate/trunk@5439 acf43c95-373e-0410-b603-e72c3f656dc1
2013-04-12 12:46:21 +00:00
paulc ea2a3db828 Skip over target label of jump in unlinked JS code.
This makes the instructions behave the same as in linked code.


git-svn-id: http://yate.null.ro/svn/yate/trunk@5438 acf43c95-373e-0410-b603-e72c3f656dc1
2013-04-12 12:43:27 +00:00
paulc 834c5693f5 Fixed a signed / unsigned conversion on 64 bit architectures.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5410 acf43c95-373e-0410-b603-e72c3f656dc1
2013-02-15 10:08:30 +00:00
oana 2d65f043cb Do linking (jump resolving) for Javascript code.
Added configuration parameter to enable/disable linking.



git-svn-id: http://yate.null.ro/svn/yate/trunk@5407 acf43c95-373e-0410-b603-e72c3f656dc1
2013-02-14 14:37:20 +00:00
andrei 6017a4c07e Bug Fixed. Resolve objects variables.
Thanks to ximik777 for reporting it.


git-svn-id: http://yate.null.ro/svn/yate/trunk@5404 acf43c95-373e-0410-b603-e72c3f656dc1
2013-02-13 11:49:35 +00:00
oana 6df78f9dcb Lock context while evaluating instructions.
Don't do context initialization everytime the execution of the script is reset.



git-svn-id: http://yate.null.ro/svn/yate/trunk@5403 acf43c95-373e-0410-b603-e72c3f656dc1
2013-02-12 15:47:54 +00:00
andrei ea4e876a1b Changed operators precedences.
Fixed postfix operators parse.


git-svn-id: http://yate.null.ro/svn/yate/trunk@5402 acf43c95-373e-0410-b603-e72c3f656dc1
2013-02-12 12:52:24 +00:00
andrei 71bec128e8 Added methods:
Math.random([int min, int max]);
    Array.indexOf(Object obj [, int fromPos]);
    Array.sort([compareCallback])
    String.split(char c [,int maxResults]);
    String.startsWith(String match [, int fromPos]);
    String.endsWith(String match [, int fromPos]);
    String.toLower();
    String.toUpper();
    String.trim(); 
to JavaScript API.


git-svn-id: http://yate.null.ro/svn/yate/trunk@5400 acf43c95-373e-0410-b603-e72c3f656dc1
2013-02-12 10:16:12 +00:00
andrei f06d62838b Added operator delete.
Bug Fix. Do not remove undefined variables from stack.


git-svn-id: http://yate.null.ro/svn/yate/trunk@5397 acf43c95-373e-0410-b603-e72c3f656dc1
2013-02-12 09:48:29 +00:00
paulc 9ce3a36256 Added methods to detect UTF-8 BOM at start of strings.
Strip UTF-8 BOM from start of configuration, XML and Javascript files.


git-svn-id: http://yate.null.ro/svn/yate/trunk@5393 acf43c95-373e-0410-b603-e72c3f656dc1
2013-02-07 17:10:39 +00:00
oana 9b14f323a2 Fixed parsing of code blocks that do not contain braces, like if (..) if (..) if ( ).
git-svn-id: http://yate.null.ro/svn/yate/trunk@5391 acf43c95-373e-0410-b603-e72c3f656dc1
2013-02-01 16:22:00 +00:00
oana 667a6a8176 Bug fix: properly iterate objects with for...of loop when iterating on another object's field.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5389 acf43c95-373e-0410-b603-e72c3f656dc1
2013-01-29 14:14:53 +00:00
paulc 164a1df870 Perform top level name resolution only on JS call contexts on stack.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5381 acf43c95-373e-0410-b603-e72c3f656dc1
2013-01-23 15:24:06 +00:00
oana f7a0ef30ae FixedArray.join() and Array.pop() implementations. Replaced incorrect use of toString().
git-svn-id: http://yate.null.ro/svn/yate/trunk@5380 acf43c95-373e-0410-b603-e72c3f656dc1
2013-01-21 11:03:06 +00:00
paulc 84f8bacd59 Date.now() is a static function, not a member method.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5334 acf43c95-373e-0410-b603-e72c3f656dc1
2012-11-20 17:14:51 +00:00
paulc 1848fe201f Added support for calling object methods by variable.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5332 acf43c95-373e-0410-b603-e72c3f656dc1
2012-11-20 16:11:38 +00:00
paulc 5cf83a06a5 Check the barrier flag when returning from a Javascript function.
This prevents misinterpreting function values on stack as return address.


git-svn-id: http://yate.null.ro/svn/yate/trunk@5330 acf43c95-373e-0410-b603-e72c3f656dc1
2012-11-20 16:05:55 +00:00
paulc b0bd59fbbc Fixed boolean evaluation for objects and function objects.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5329 acf43c95-373e-0410-b603-e72c3f656dc1
2012-11-20 16:03:44 +00:00
paulc 86f2ad7475 Fixed parsing of code blocks that don't end in semicolon like: { if (...) if (...) { } }
Improved code generation debugging.


git-svn-id: http://yate.null.ro/svn/yate/trunk@5314 acf43c95-373e-0410-b603-e72c3f656dc1
2012-11-01 11:18:11 +00:00
paulc 06e3f127f2 Fixed Javascript line counting.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5313 acf43c95-373e-0410-b603-e72c3f656dc1
2012-10-31 17:11:15 +00:00
paulc 81d8d5458c Fixed calling object member functions.
Fixed handling "this" in constructors.


git-svn-id: http://yate.null.ro/svn/yate/trunk@5312 acf43c95-373e-0410-b603-e72c3f656dc1
2012-10-30 09:08:33 +00:00
paulc eaa99e2eef Improved scripting debugging.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5311 acf43c95-373e-0410-b603-e72c3f656dc1
2012-10-30 09:00:43 +00:00
paulc a8bf6d5a53 Fixed "unused returned value" compiler warning.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5200 acf43c95-373e-0410-b603-e72c3f656dc1
2012-07-16 12:35:02 +00:00
paulc 16d4b8b3c0 Fixed a harmless signed / unsigned comparation.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5163 acf43c95-373e-0410-b603-e72c3f656dc1
2012-06-29 09:23:50 +00:00
paulc 7dc121ddee Added possibility to rename the null wrapper.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5161 acf43c95-373e-0410-b603-e72c3f656dc1
2012-06-28 18:21:13 +00:00
paulc 78d4083555 Fixed a memory leak in switch/case matching.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5158 acf43c95-373e-0410-b603-e72c3f656dc1
2012-06-27 15:16:34 +00:00
paulc 8ca7c90e8a Fixed deep copying member functions of inline objects.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5157 acf43c95-373e-0410-b603-e72c3f656dc1
2012-06-27 14:44:05 +00:00
paulc e57c6dc740 Deep copy inline objects and arrays when placing them in a context.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5154 acf43c95-373e-0410-b603-e72c3f656dc1
2012-06-26 16:40:38 +00:00
paulc 5bbbe0ead9 Fixed the call context creation, was double wrapping the scope and this objects.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5152 acf43c95-373e-0410-b603-e72c3f656dc1
2012-06-26 13:31:30 +00:00
paulc 207552e4ea Fixed Array.push() method that was not copying objects correctly and not copying non-objects at all.
Added some more XDEBUG for iterators.


git-svn-id: http://yate.null.ro/svn/yate/trunk@5149 acf43c95-373e-0410-b603-e72c3f656dc1
2012-06-25 15:41:47 +00:00
paulc 788ed299f7 Fixed parsing of { objects } as expressions.
Fixed parsing of "var" declarations.
Fixed indexing and fields of expressions.
Small improvement to speed up the simplification of large code.


git-svn-id: http://yate.null.ro/svn/yate/trunk@5146 acf43c95-373e-0410-b603-e72c3f656dc1
2012-06-22 14:06:16 +00:00
paulc 5c0ea47ea4 Added helper methods to check if a value is null or undefined.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5144 acf43c95-373e-0410-b603-e72c3f656dc1
2012-06-22 08:31:22 +00:00
paulc 2df0b6d33f Added support for asynchronous execution from the script.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5143 acf43c95-373e-0410-b603-e72c3f656dc1
2012-06-21 13:26:11 +00:00
paulc 3eea280e85 Fixed line counting in /* ... */ comments.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5140 acf43c95-373e-0410-b603-e72c3f656dc1
2012-06-20 15:49:27 +00:00
paulc 8be6ed4c46 Added public method to pause a script.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5139 acf43c95-373e-0410-b603-e72c3f656dc1
2012-06-20 15:48:03 +00:00
paulc 2caa4e7f56 Only install global functions during code initialization if they are not installed.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5137 acf43c95-373e-0410-b603-e72c3f656dc1
2012-06-20 13:25:36 +00:00
paulc 80bc17ebe7 Added support for non-JS NamedList in JsObject that is overriden in JsMessage.
Separate method is used to store the key names for iterating over unsafe lists.
Implemented handling of Yate messages and their parameters in module.


git-svn-id: http://yate.null.ro/svn/yate/trunk@5135 acf43c95-373e-0410-b603-e72c3f656dc1
2012-06-19 18:55:45 +00:00
paulc a5a434f6cb Keep the prototype as an internal __proto__ property.
Exclude properties starting with two underlines from iterators.


git-svn-id: http://yate.null.ro/svn/yate/trunk@5131 acf43c95-373e-0410-b603-e72c3f656dc1
2012-06-18 17:17:43 +00:00
paulc c446eb8d2e Changed the way native objects' constructors are called.
Added proper cleanup in module.
Added script unload hook onUnload() that just needs be defined.


git-svn-id: http://yate.null.ro/svn/yate/trunk@5128 acf43c95-373e-0410-b603-e72c3f656dc1
2012-06-18 13:52:21 +00:00
paulc f5e76ddb6b Changed the way callback JS functions are called.
Added a global Javascript loader.
Moved the main routing script to the [global] section.


git-svn-id: http://yate.null.ro/svn/yate/trunk@5127 acf43c95-373e-0410-b603-e72c3f656dc1
2012-06-16 23:21:13 +00:00
paulc 0e96a42e96 Fixed handling of function arguments.
Added separate function for calling a script function.


git-svn-id: http://yate.null.ro/svn/yate/trunk@5125 acf43c95-373e-0410-b603-e72c3f656dc1
2012-06-16 21:03:40 +00:00
paulc 6c7cd05970 Implemented for (variable of object) that iterates over values, not keys.
Improved debugging when compiled with DEBUG or XDEBUG.


git-svn-id: http://yate.null.ro/svn/yate/trunk@5120 acf43c95-373e-0410-b603-e72c3f656dc1
2012-06-15 10:43:48 +00:00
paulc b9b8249d9a Always use the full setParam replacement when doing assignment in a script.
Fixes the impossibility to replace an object or function with a simple type.
NamedList::setParam(const char*,const char*) does not replace an existing parameter which may be a subclass of NamedString.


git-svn-id: http://yate.null.ro/svn/yate/trunk@5119 acf43c95-373e-0410-b603-e72c3f656dc1
2012-06-15 10:40:06 +00:00
paulc 9da1a5e3db Implemented conditional and iterative for instruction.
Fixed parsing of semicolons.
Improved debugging information.


git-svn-id: http://yate.null.ro/svn/yate/trunk@5117 acf43c95-373e-0410-b603-e72c3f656dc1
2012-06-14 15:31:45 +00:00
paulc d56df7706e Fixed parsing of { object } subexpressions.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5116 acf43c95-373e-0410-b603-e72c3f656dc1
2012-06-13 15:10:35 +00:00
paulc 85a1524c79 Implemented switch instruction that can match RegExp or dialplan pattern.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5115 acf43c95-373e-0410-b603-e72c3f656dc1
2012-06-13 14:44:41 +00:00
paulc 26020fb6ad Fixed documentation comments
git-svn-id: http://yate.null.ro/svn/yate/trunk@5114 acf43c95-373e-0410-b603-e72c3f656dc1
2012-06-13 14:11:37 +00:00
paulc 3f12d732b3 Pass objects for parsing nested instructions in expressions.
Added specific Javascript parsers for nested instructions.


git-svn-id: http://yate.null.ro/svn/yate/trunk@5091 acf43c95-373e-0410-b603-e72c3f656dc1
2012-06-04 18:06:39 +00:00
paulc 9d285e2543 Fixed the nesting of some instruction parsers.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5089 acf43c95-373e-0410-b603-e72c3f656dc1
2012-06-01 15:54:30 +00:00
paulc f068b6fe13 Moved last the code fragment of the debug message of runCompile so it's easy to read.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5088 acf43c95-373e-0410-b603-e72c3f656dc1
2012-06-01 15:53:50 +00:00
paulc 6454430308 Moved longer Javascript instruction parsers to separate functions.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5085 acf43c95-373e-0410-b603-e72c3f656dc1
2012-05-31 17:41:24 +00:00
paulc 347fda3973 Added separate methods to retrieve the numeric and boolean values from an operation.
Fixed the null object to evaluate to false.


git-svn-id: http://yate.null.ro/svn/yate/trunk@5082 acf43c95-373e-0410-b603-e72c3f656dc1
2012-05-30 19:10:14 +00:00
paulc 7b7b3abdf9 Added string properties and methods that apply to all non-JS objects.
Fixed the name resolution to allow the pseudo properties.


git-svn-id: http://yate.null.ro/svn/yate/trunk@5081 acf43c95-373e-0410-b603-e72c3f656dc1
2012-05-30 17:48:13 +00:00
paulc 24670814da Implemented identity checking, proper null and undefined values.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5080 acf43c95-373e-0410-b603-e72c3f656dc1
2012-05-30 13:18:34 +00:00
paulc 64c9808103 Fixed object assignment to object fields.
Added dump_r and print_r methods of Engine to aid in debugging.


git-svn-id: http://yate.null.ro/svn/yate/trunk@5078 acf43c95-373e-0410-b603-e72c3f656dc1
2012-05-30 08:32:47 +00:00
paulc 86384d16e5 Made JsRegExp object public, added constructor.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5075 acf43c95-373e-0410-b603-e72c3f656dc1
2012-05-28 16:10:41 +00:00
paulc a9975c435b Added source file name and line number to compiled bytecode and operands.
Report the location in compile and runtime errors.


git-svn-id: http://yate.null.ro/svn/yate/trunk@5074 acf43c95-373e-0410-b603-e72c3f656dc1
2012-05-28 13:48:25 +00:00
paulc eddb462738 Added code to parse inline [ arrays ] and { objects }.
Added separate methods to parse constants.
Made JsArray public because it's needed in many places.


git-svn-id: http://yate.null.ro/svn/yate/trunk@5073 acf43c95-373e-0410-b603-e72c3f656dc1
2012-05-24 17:15:34 +00:00
paulc 06cf56e116 Proper String and Regexp parsing and escaping.
Added parsing of dialplan style %pattern% that is converted internally to regexp.
This allows for example %+1xxxxxxxxxx% to be same as /^\+1[0-9]{10}$/i


git-svn-id: http://yate.null.ro/svn/yate/trunk@5070 acf43c95-373e-0410-b603-e72c3f656dc1
2012-05-22 10:06:50 +00:00
paulc a73a045ffc Reverted SVN commit 5066 (dialplan patterns).
git-svn-id: http://yate.null.ro/svn/yate/trunk@5068 acf43c95-373e-0410-b603-e72c3f656dc1
2012-05-18 21:15:39 +00:00
paulc 8e65d6c769 Added parsing of dialplan style %patterns% that are converted internally to a regexp.
This allows for example %+1xxxxxxxxxx% to be same as /^\+1[0-9]{10}$/


git-svn-id: http://yate.null.ro/svn/yate/trunk@5066 acf43c95-373e-0410-b603-e72c3f656dc1
2012-05-18 14:57:58 +00:00
paulc 97c2a7e6bb Moved helper functions to static methods of JsObject so code can be reused.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5063 acf43c95-373e-0410-b603-e72c3f656dc1
2012-05-15 14:43:15 +00:00
paulc 1667d0bbc3 Limited the length of the debugging output from expression parser.
Fixed the string limit for single char in a few places, it had to be %.1s instead of %1s.


git-svn-id: http://yate.null.ro/svn/yate/trunk@5062 acf43c95-373e-0410-b603-e72c3f656dc1
2012-05-15 14:13:56 +00:00
paulc a404c48189 Fixed parsing of if ... else blocks.
Improved debugging of expression parser.


git-svn-id: http://yate.null.ro/svn/yate/trunk@5061 acf43c95-373e-0410-b603-e72c3f656dc1
2012-05-15 13:57:05 +00:00
paulc 04e12d0985 Fixed prototypal inheritance and constructors.
Fixed Array length - it's a property not a method.


git-svn-id: http://yate.null.ro/svn/yate/trunk@5059 acf43c95-373e-0410-b603-e72c3f656dc1
2012-05-14 19:51:36 +00:00
paulc ad0f68b964 Work in progress: added methods of Array class and const Object / Array parser.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5057 acf43c95-373e-0410-b603-e72c3f656dc1
2012-05-11 16:15:20 +00:00
paulc 1eec7eb43b Moved some Js objects implementation in another file.
Renamed Engine.Debug and Engine.Output to lower case to avoid confusion with constants.


git-svn-id: http://yate.null.ro/svn/yate/trunk@5035 acf43c95-373e-0410-b603-e72c3f656dc1
2012-05-02 15:11:48 +00:00
paulc 49e1f5586d Moved declaration of some of the JS methods in the proper static initializer.
git-svn-id: http://yate.null.ro/svn/yate/trunk@4954 acf43c95-373e-0410-b603-e72c3f656dc1
2012-03-05 09:53:31 +00:00
paulc ed193a3432 Got rid of the useless ScriptEvaluator class, made instead some ExpEvaluator methods public.
Fixed parsing of function declarations.


git-svn-id: http://yate.null.ro/svn/yate/trunk@4933 acf43c95-373e-0410-b603-e72c3f656dc1
2012-02-20 15:46:19 +00:00
paulc 7ff45c9506 Fixed warnings exposed by Visual C++
git-svn-id: http://yate.null.ro/svn/yate/trunk@4924 acf43c95-373e-0410-b603-e72c3f656dc1
2012-02-17 17:22:02 +00:00
paulc a242f792c5 Updated scripting code.
git-svn-id: http://yate.null.ro/svn/yate/trunk@4921 acf43c95-373e-0410-b603-e72c3f656dc1
2012-02-17 16:19:17 +00:00
marian 348568f767 Fixed cast.
git-svn-id: http://yate.null.ro/svn/yate/trunk@4895 acf43c95-373e-0410-b603-e72c3f656dc1
2012-02-10 16:03:43 +00:00
marian 9e14e20ed5 Fixed export directive.
git-svn-id: http://yate.null.ro/svn/yate/trunk@4894 acf43c95-373e-0410-b603-e72c3f656dc1
2012-02-10 16:03:25 +00:00
paulc 5b773e7c5a Added partial universal scripting implementation with Javascript support.
git-svn-id: http://yate.null.ro/svn/yate/trunk@4892 acf43c95-373e-0410-b603-e72c3f656dc1
2012-02-10 14:53:55 +00:00