Commit Graph

43 Commits (df7468ffa27b46f074b0f9c6d6c7be4e09164c88)

Author SHA1 Message Date
UbitUmarov 8b1a174430 ****DANGER**** try to make LSL_Types.key to work. bin/ScriptEngines contents must be deleted to recompile scripts. Needs more testing on all uses of key type ****DANGER**** 2016-09-21 14:04:23 +01:00
UbitUmarov 2a0df34087 Xengine: and fix line count again 2016-08-31 14:36:07 +01:00
UbitUmarov 0f993a1278 Xengine: also missed a few newlines account 2016-08-31 10:39:01 +01:00
UbitUmarov eca0ebab9d Xengine: forgot to do the indent on map too 2016-08-31 10:25:19 +01:00
UbitUmarov 3db81d87d6 Xengine: fix intermediate csharpe source identation. Not sure why i care, compiler sure doesn't and only we bother to create this files on code gen debug 2016-08-31 09:42:03 +01:00
UbitUmarov 5afc5fe343 Xengine: try to reduce memory pressure of scripts compile. Still ugly code, possible mistakes, but i need to share it before i loose it :) ) 2016-08-31 09:15:08 +01:00
Justin Clark-Casey (justincc) a0d6705fe6 Fix issue with LSL jumps screwing up the C# compiler error -> LSL code position map and leading to invalid error line numbers/columns
This is because jump statement generation was mistakenly inserting its own line without updating the csharp positions in CSCodeGenerator.
This is Aleric Inglewood's patch in http://opensimulator.org/mantis/view.php?id=7195 but applied to opensim itself rather than the defunct code generation in opensim-libs.  Thanks!
This patch also adds a regression test for this case from myself.
2014-06-18 22:24:36 +01:00
Justin Clark-Casey (justincc) 9bae636ff0 Fix issues where reported LSL compiler error line numbers do not match the script.
This is probably due to changes in the layout of the generated script preamble (using statements etc, ) in c8afc852 (Jan 17 2013).
Re-enabled existing regression test that exercises at least one case of this.
2014-05-24 00:12:23 +01:00
Robert Adams 87ee0c395e Fix problem with modInvoke defined integer constants being build into
scripts as boxed integers rather than proper reference to a new LSLInteger.
This fixes an exception when using a registered integer constant in
a script.
2013-08-02 09:44:01 -07:00
Justin Clark-Casey (justincc) 5ac84a3793 Fix issue where lsl -> c# generation in co-operative termination mode did not correctly handle single statement versions of for, while and do-while loops.
Add regression tests to validate the fix.
This problem will not affect the default abort termination mode.
2013-01-30 03:52:22 +00:00
Justin Clark-Casey (justincc) c6ba27d096 Fix bug in generating termination checks in compound statement for loop.
Add regression test for this case.
2013-01-22 01:23:10 +00:00
Justin Clark-Casey (justincc) c8afc8523b Implement non-wait co-operative termination of scripts for XEngine in addition to termination on wait.
This involves inserting opensim_reserved_CheckForCoopTermination() calls in lsl -> c# translation at any place where the script could be in a loop with no wait calls.
These places are for, while, do-while, label, user function call and manual event function call.
Call goes through to an XEngineScriptBase which extends ScriptBase.
IEngine is extended to supply necessary engine-specific parent class references and constructor parameters to Compiler.
Unfortunately, since XEngineScriptBase has to be passed WaitHandle in its constructor, older compiled scripts will fail to load with an error on the OpenSim console.
Such scripts will need to be recompiled, either by removing all *.dll files from the bin/ScriptEngines/<region-id> or by setting DeleteScriptsOnStartup = true in [XEngine] for one run.
Automatic recompilation may be implemented in a later commit.
This feature should not yet be used, default remains termination with Thread.Abort() which will work as normal once scripts are recompiled.
2013-01-17 23:39:09 +00:00
Mic Bowman a76a289d11 Adds support to ScriptModuleComms for region modules to export
constants to the script engine.
2012-07-31 10:45:37 -07:00
Mic Bowman 8b5298a62e Protect the scriptmodulecomms interface. 2012-03-15 13:37:43 -07:00
Mic Bowman 402ff75d78 Adds a new script command 'modInvoke' to invoke registered functions
from region modules. The LSL translator is extended to generate the
modInvoke format of commands for directly inlined function calls.

A region module can register a function Test() with the name "Test".
LSL code can call that function as "Test()". The compiler will translate
that invocation into modInvoke("Test", ...)
2012-03-15 13:16:02 -07:00
Justin Clark-Casey (justincc) 85198a45cb Fix off by one error in script error reporting. 2012-03-06 02:01:47 +00:00
Justin Clark-Casey (justincc) 038d1bf742 Add a regression test to compile and start a script. Remove Path.GetDirectoryName when getting assembly loading path in Compiler.CompileFromDotNetText().
The Path.GetDirectoryName call in Compiler.CompileFromDotNetText is unnecessary since AppDomain.CurrentDomain.BaseDirectory is always a directory.
Later path concatenation is already done by Path.Combine() which handles any trailing slash.
Removing Path.GetDirectoryName() will not affect the runtime but allows NUnit to work since it doesn't add a trailing slash to AppDomain.CurrentDomain.BaseDirectory.
2012-02-07 17:44:37 +00:00
Melanie 1876ce90af FINALLY! Script compile errors now appear in the script error pane,
not in a funky debug window.
2009-12-22 09:24:01 +00:00
Justin Clark-Casey (justincc) 8f0db68424 Fix http://opensimulator.org/mantis/view.php?id=3874 - parenthesis in for statements cause script compile failures
This fixes a problem in OpenSim where statements of the form

for ((i = 0); (i < 10); (++i)) { ... }

do not compile even though they are valid lsl.
2009-11-20 18:39:39 +00:00
Jeff Ames a23d64dec1 Formatting cleanup. 2009-06-10 04:28:56 +00:00
Mike Mazur cda6b24668 Skip lone ident statments or for-loop assignments
SL's LSL supports lone idents:

    integer x;
    x;

as well as lone idents in for-loop assignments:

    for (x; x < 10; x++) { ... }

while those are errors in C# (MONO at least). This patch skips lone
idents in such places.

Fixes Mantis #3042.
2009-06-07 10:22:55 +00:00
Mike Mazur 48bc2f3a42 Allow empty assignment in for-loop
For loops with no assignment are no longer syntax errors. For example,
this is now valid:

    for ( ; i < 10; i++) { ... }

Corresponding changes to lsl.{lexer,parser} in r99 in opensim-libs.

Fixes Mantis #2501. Fixes Mantis #2884.
2009-06-07 10:22:41 +00:00
Jeff Ames 840de6c036 Minor: Change OpenSim to OpenSimulator in older copyright headers and LICENSE.txt. 2009-06-01 06:37:14 +00:00
Charles Krinke ed7256ac0c Fixes Mantis #3187. Thank you kindly, DoranZemlja for a patch that:
Deals with the multiple warning side affect introduced earlier.
2009-02-25 04:29:02 +00:00
Charles Krinke 08c76989a7 Mantis#3187. Thank you kindly, DoranZemlja for a patch that:
Adds a warning for an LSL construct that exploits a
popular list memory saving hack.
2009-02-23 02:43:51 +00:00
Mike Mazur a42499c947 Thanks DoranZemlja for a patch implementing non-shortcircuiting in
logical and and logical or in LSL. Fixes Mantis #3174.
2009-02-20 07:40:36 +00:00
Mike Mazur 9a33a4733e Thanks Tommi Laukkanen for a patch that allows the
CSCodeGeneratorTest.TestStringsWithEscapedQuotesAndComments unit test to
pass on Windows. Fixes Mantis #3104.
2009-02-09 00:59:02 +00:00
Melanie Thielker 9e4fc8e03a Mantis #2571
Thank you, idb, for a patch that fixes the jump function in LSL.
2008-11-06 23:10:49 +00:00
Mike Mazur 6e14d1005a Prefix LSL variables which are C# keywords with @ instead of _ when translating from LSL to C#. Thanks idb for the patch. Fix issue 2546. 2008-11-04 01:30:39 +00:00
Melanie Thielker 44852158f2 Mantis #2518
Thank you, idb, for a patch that fixes the conflicts of lsl identifiers
with c# keywords
2008-11-01 23:50:19 +00:00
Melanie Thielker 638cce09d1 Restore "friendly errors" to the XEngine 2008-10-07 21:59:56 +00:00
Melanie Thielker 85068dae60 Add friendly error messages to both engines. 2008-09-27 05:31:43 +00:00
Jeff Ames 3f79e6b3e7 Update svn properties, formatting cleanup. 2008-09-23 23:14:00 +00:00
Melanie Thielker d95794d05c Refactor XEngine parser as per suggestions from mikem 2008-09-23 13:28:17 +00:00
Melanie Thielker 2fbebbb644 First batch of the unit test changes for the new constants semantics
in XEngine. This turned out to be a lot of work to catch up.
2008-09-02 06:02:14 +00:00
Melanie Thielker e2a0a04beb Remove the ((bool)()) cast, since it can make c# barf 2008-09-02 04:15:06 +00:00
Melanie Thielker 146f469524 Add an explicit cast to bool for the if expression so that any base types
that slip in will not cause it to break
2008-09-02 00:03:16 +00:00
Melanie Thielker a5d2674a43 This is an attempt to fix the handling of constants in LSL.
It wraps constants in new LSLType(x), so that lists with
constant values are processed correctly. Contains changes to
the lsl.parser.cs that are not (yet) reflected in opensim-libs,
since this experimental patch affects XEngine only. Also contains
nuts.
2008-09-01 23:33:12 +00:00
Mike Mazur eef3864278 Fix issue 1860; exception thrown in the parser on if/if-else/for/while/do-while
statements with no body.
2008-07-31 01:27:33 +00:00
Mike Mazur ba17b0df27 First version of position mapping between LSL <-> C# implemented. 2008-07-23 02:51:45 +00:00
Melanie Thielker d85774c101 Patch #9142 (No mantis)
Add a config option to OpenSim.ini to select between script compilers
in the XEngine without recompile.
Set UseNewCompiler=true in OpenSim.ini and try it out.
Creates the ICodeConverter interface and adapts the new compiler to it.
2008-07-12 01:34:36 +00:00
Johan Berntsson d41c1f40a8 Patch from Mike: errors from the LSL/C# compilers are now reported to the user in-world 2008-07-10 05:40:45 +00:00
Johan Berntsson a73e3b4e3f another patch from Mike: the llscript compiler is now available in XEngine as well. Thanks Mike 2008-07-08 03:02:11 +00:00