Commit Graph

59 Commits

Author SHA1 Message Date
Ioana Stanciu c56216f5a8 Updated copyright notices. 2023-05-23 17:01:06 +03:00
paulc 5df80ff38a Added missing precedence of the nullish operator.
Aligned operators precedence with JS.


git-svn-id: http://voip.null.ro/svn/yate@6511 acf43c95-373e-0410-b603-e72c3f656dc1
2021-08-11 10:52:33 +00:00
paulc d15456b72d Implemented the nullish concatenation and assignment operators.
Implemented the missing logical operation plus assignment.


git-svn-id: http://voip.null.ro/svn/yate@6504 acf43c95-373e-0410-b603-e72c3f656dc1
2021-07-08 14:53:44 +00:00
paulc 8efa8d07cd Fixed several issues exposed by the Microsoft compiler.
git-svn-id: http://voip.null.ro/svn/yate@6459 acf43c95-373e-0410-b603-e72c3f656dc1
2021-02-09 14:08:19 +00:00
oana 604e18f539 Bug fix: do not increase code line number when parsing '\n' from a string literal.
git-svn-id: http://voip.null.ro/svn/yate@6446 acf43c95-373e-0410-b603-e72c3f656dc1
2020-10-29 14:46:07 +00:00
oana 046cb195e9 Fix code line counting when parsing multi-line string.
git-svn-id: http://voip.null.ro/svn/yate@6444 acf43c95-373e-0410-b603-e72c3f656dc1
2020-10-23 08:11:53 +00:00
oana 83ef49437f Add tracking for Javascript object creation and destruction.
Add command that reports how many objects are still alive that have been created at the reported code line.
Fix constructor for ConfigFile.



git-svn-id: http://voip.null.ro/svn/yate@6442 acf43c95-373e-0410-b603-e72c3f656dc1
2020-10-21 11:01:31 +00:00
paulc 37c2b36722 Fixed parser clamping of large negative numbers.
Added hack to parse floating point numbers but store them as integers.


git-svn-id: http://voip.null.ro/svn/yate@6440 acf43c95-373e-0410-b603-e72c3f656dc1
2020-10-19 09:11:10 +00:00
paulc 23947f2f01 Fixed compile time bugs and warnings exposed by Visual Studio.
git-svn-id: http://voip.null.ro/svn/yate@6256 acf43c95-373e-0410-b603-e72c3f656dc1
2017-09-07 15:29:32 +00:00
paulc d02f2087b9 Fixed a GCC 6 build error: C++11 requires a space between literal and string macro.
git-svn-id: http://voip.null.ro/svn/yate@6084 acf43c95-373e-0410-b603-e72c3f656dc1
2016-01-20 10:23:35 +00:00
paulc 093e51fc39 Added support for JS getIntValue() min/max/clamp parameters.
git-svn-id: http://voip.null.ro/svn/yate@6023 acf43c95-373e-0410-b603-e72c3f656dc1
2015-08-27 10:56:06 +00:00
paulc 22dfd8e65a Reduce parsing time for very large scripts by limiting the simplification backtrace depth.
git-svn-id: http://voip.null.ro/svn/yate@5972 acf43c95-373e-0410-b603-e72c3f656dc1
2015-05-15 15:17:54 +00:00
paulc 068cd4cf31 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://voip.null.ro/svn/yate@5898 acf43c95-373e-0410-b603-e72c3f656dc1
2014-08-05 08:27:07 +00:00
oana 023ff203ce Fixed equal comparison for objects.
git-svn-id: http://voip.null.ro/svn/yate@5871 acf43c95-373e-0410-b603-e72c3f656dc1
2014-07-21 12:29:38 +00:00
oana 48c3ed7154 Do proper number conversion for arithmetic operations.
git-svn-id: http://voip.null.ro/svn/yate@5854 acf43c95-373e-0410-b603-e72c3f656dc1
2014-06-24 13:36:53 +00:00
oana 82d4ffb659 Added discrimination between boolean and integer values.
Return proper results for typeof and toString() calls for boolean values.



git-svn-id: http://voip.null.ro/svn/yate@5819 acf43c95-373e-0410-b603-e72c3f656dc1
2014-04-09 13:52:54 +00:00
paulc 072f8d720c Correctly parse numbers with sign, in that case sthe sign is not an unary operator.
git-svn-id: http://voip.null.ro/svn/yate@5788 acf43c95-373e-0410-b603-e72c3f656dc1
2014-02-26 12:25:13 +00:00
paulc d56cecb40e 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://voip.null.ro/svn/yate@5755 acf43c95-373e-0410-b603-e72c3f656dc1
2014-02-05 11:42:17 +00:00
oana c1dcd17eea 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://voip.null.ro/svn/yate@5655 acf43c95-373e-0410-b603-e72c3f656dc1
2013-09-17 14:34:43 +00:00
oana 50693ae1cf Fixed compile warnings which appear when compiling with xdebug.
git-svn-id: http://voip.null.ro/svn/yate@5642 acf43c95-373e-0410-b603-e72c3f656dc1
2013-09-09 15:26:27 +00:00
paulc cad5b5eb13 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://voip.null.ro/svn/yate@5633 acf43c95-373e-0410-b603-e72c3f656dc1
2013-08-30 10:58:23 +00:00
paulc c572fbbce3 Fixed warnings - mostly conversions - exposed by Visual C++ compiler.
git-svn-id: http://voip.null.ro/svn/yate@5614 acf43c95-373e-0410-b603-e72c3f656dc1
2013-08-07 11:24:10 +00:00
paulc e498bdc20f Fixed 64 bit types usage in Javascript, was broken on 32 bit machines.
git-svn-id: http://voip.null.ro/svn/yate@5612 acf43c95-373e-0410-b603-e72c3f656dc1
2013-08-07 09:49:52 +00:00
paulc 18e10bfd69 Changed license terms in each source file to reference an external file.
git-svn-id: http://voip.null.ro/svn/yate@5609 acf43c95-373e-0410-b603-e72c3f656dc1
2013-08-06 13:38:10 +00:00
oana f132e90ed2 Improved speed of appending parsed operator codes to the operator codes list.
git-svn-id: http://voip.null.ro/svn/yate@5593 acf43c95-373e-0410-b603-e72c3f656dc1
2013-08-01 07:34:21 +00:00
oana be6e043b38 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://voip.null.ro/svn/yate@5521 acf43c95-373e-0410-b603-e72c3f656dc1
2013-06-04 13:18:05 +00:00
oana 62835337f7 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://voip.null.ro/svn/yate@5464 acf43c95-373e-0410-b603-e72c3f656dc1
2013-04-12 15:07:19 +00:00
oana da6852cc02 Bug fix for printing on output generated code. Also display label indexes when dumping the code.
git-svn-id: http://voip.null.ro/svn/yate@5450 acf43c95-373e-0410-b603-e72c3f656dc1
2013-04-12 13:29:19 +00:00
paulc 7c8b2d4c38 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://voip.null.ro/svn/yate@5449 acf43c95-373e-0410-b603-e72c3f656dc1
2013-04-12 13:19:14 +00:00
paulc d8759879e5 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://voip.null.ro/svn/yate@5444 acf43c95-373e-0410-b603-e72c3f656dc1
2013-04-12 12:54:30 +00:00
paulc 521146c088 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://voip.null.ro/svn/yate@5439 acf43c95-373e-0410-b603-e72c3f656dc1
2013-04-12 12:46:21 +00:00
oana 9ef4472415 Do linking (jump resolving) for Javascript code.
Added configuration parameter to enable/disable linking.



git-svn-id: http://voip.null.ro/svn/yate@5407 acf43c95-373e-0410-b603-e72c3f656dc1
2013-02-14 14:37:20 +00:00
andrei b269368c51 Changed operators precedences.
Fixed postfix operators parse.


git-svn-id: http://voip.null.ro/svn/yate@5402 acf43c95-373e-0410-b603-e72c3f656dc1
2013-02-12 12:52:24 +00:00
paulc b92a1a66cb Fixed boolean evaluation for objects and function objects.
git-svn-id: http://voip.null.ro/svn/yate@5329 acf43c95-373e-0410-b603-e72c3f656dc1
2012-11-20 16:03:44 +00:00
paulc 8484eff3e7 Fixed parsing of code blocks that don't end in semicolon like: { if (...) if (...) { } }
Improved code generation debugging.


git-svn-id: http://voip.null.ro/svn/yate@5314 acf43c95-373e-0410-b603-e72c3f656dc1
2012-11-01 11:18:11 +00:00
paulc 76303f7036 Fixed Javascript line counting.
git-svn-id: http://voip.null.ro/svn/yate@5313 acf43c95-373e-0410-b603-e72c3f656dc1
2012-10-31 17:11:15 +00:00
paulc b753adbd7d Improved scripting debugging.
git-svn-id: http://voip.null.ro/svn/yate@5311 acf43c95-373e-0410-b603-e72c3f656dc1
2012-10-30 09:00:43 +00:00
paulc 0c1463af1c Fixed "unused returned value" compiler warning.
git-svn-id: http://voip.null.ro/svn/yate@5200 acf43c95-373e-0410-b603-e72c3f656dc1
2012-07-16 12:35:02 +00:00
paulc 574dc50802 Deep copy inline objects and arrays when placing them in a context.
git-svn-id: http://voip.null.ro/svn/yate@5154 acf43c95-373e-0410-b603-e72c3f656dc1
2012-06-26 16:40:38 +00:00
paulc 3dcef54cd1 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://voip.null.ro/svn/yate@5146 acf43c95-373e-0410-b603-e72c3f656dc1
2012-06-22 14:06:16 +00:00
paulc 4521c9abd1 Implemented for (variable of object) that iterates over values, not keys.
Improved debugging when compiled with DEBUG or XDEBUG.


git-svn-id: http://voip.null.ro/svn/yate@5120 acf43c95-373e-0410-b603-e72c3f656dc1
2012-06-15 10:43:48 +00:00
paulc e92a171fc3 Implemented conditional and iterative for instruction.
Fixed parsing of semicolons.
Improved debugging information.


git-svn-id: http://voip.null.ro/svn/yate@5117 acf43c95-373e-0410-b603-e72c3f656dc1
2012-06-14 15:31:45 +00:00
paulc c39d803c83 Fixed parsing of { object } subexpressions.
git-svn-id: http://voip.null.ro/svn/yate@5116 acf43c95-373e-0410-b603-e72c3f656dc1
2012-06-13 15:10:35 +00:00
paulc 73f5c05389 Implemented switch instruction that can match RegExp or dialplan pattern.
git-svn-id: http://voip.null.ro/svn/yate@5115 acf43c95-373e-0410-b603-e72c3f656dc1
2012-06-13 14:44:41 +00:00
paulc 7f5b22b1b6 Pass objects for parsing nested instructions in expressions.
Added specific Javascript parsers for nested instructions.


git-svn-id: http://voip.null.ro/svn/yate@5091 acf43c95-373e-0410-b603-e72c3f656dc1
2012-06-04 18:06:39 +00:00
paulc a493719861 Moved last the code fragment of the debug message of runCompile so it's easy to read.
git-svn-id: http://voip.null.ro/svn/yate@5088 acf43c95-373e-0410-b603-e72c3f656dc1
2012-06-01 15:53:50 +00:00
paulc 03b989b6c5 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://voip.null.ro/svn/yate@5082 acf43c95-373e-0410-b603-e72c3f656dc1
2012-05-30 19:10:14 +00:00
paulc d13ca844cc 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://voip.null.ro/svn/yate@5081 acf43c95-373e-0410-b603-e72c3f656dc1
2012-05-30 17:48:13 +00:00
paulc 1867402066 Implemented identity checking, proper null and undefined values.
git-svn-id: http://voip.null.ro/svn/yate@5080 acf43c95-373e-0410-b603-e72c3f656dc1
2012-05-30 13:18:34 +00:00
paulc cb19a8c2d3 Added source file name and line number to compiled bytecode and operands.
Report the location in compile and runtime errors.


git-svn-id: http://voip.null.ro/svn/yate@5074 acf43c95-373e-0410-b603-e72c3f656dc1
2012-05-28 13:48:25 +00:00