Commit graph

14 commits

Author SHA1 Message Date
tstarling 54cedd69b8 Introduced standalone interpreter, implemented module isolation
* Introduced a Lua implementation based on shelling out to a standard Lua binary.
* Bundled several Lua binaries for common platforms. I haven't added a 32-bit Linux binary yet, but that will come.
* Refactored the existing Lua class, bringing out functionality common to all Lua implementations into a set of common base classes.
* Moved the bulk of the implementation-specific functionality into a set of "interpreter" classes.
* Renamed LuaSandboxEngine to Scribunto_LuaSandboxEngine
* Don't create an engine object unconditionally when the ParserLimitReport hook is called.
* Implemented isolation of module global variable namespaces. This means that separate {{#invoke}} calls can't pass data to each other -- this was a desired feature in planning since it allows more flexibility in wikitext parser design. Isolation for mw.import() means that modules cannot accidentally create global variables which affect other modules -- exports are solely via the return value.

Change-Id: I3fa35651fe5b1fbfd85adeadc220b1ea31cd6f0b
2012-04-13 20:45:26 +10:00
Demon 6ff6b7c1ac Adding .gitreview
Change-Id: I1722237f2822855bf4f51c51d1265b58d442d312
2012-04-06 13:46:17 -04:00
Tim Starling a1e4c450cb File moves for extension rename, and removed unused directory 2012-04-06 05:06:27 +00:00
Tim Starling 30622e86fe More changes for extension rename 2012-04-06 05:04:30 +00:00
Tim Starling 925045a669 * Removed scriptlinks table. It just seemed the same as templatelinks to me, and tl_namespace can be used if you want to separate out modules.
* Used Parser::fetchTemplateAndTitle() to get modules and register them in templatelinks. Most of the logic was previously duplicated.
* Changed the configuration and factory functions to allow for the possibility of multiple engines coexisting on the one wiki.
* Made the $parser parameter optional, to improve debugging in the case where a parser is needed but parsing has not started. Removed all $wgParser references.
* Renamed Scripting::getEngine() to getParserEngine() and resetEngine() to resetParserEngine()
* Removed setOptions() and updateOptions(). If you want to change the options, you can always make a new instance.
* Renamed getModule() to fetchModuleFromParser()
* Simplified module constructor parameters and member variable list
* Fixed spelling error langauge -> language
* Renamed a few variables for clarity: $module -> $moduleName, $function -> $functionName
* Renamed getLimitsReport() to getLimitReport() as it is in Parser
* Use an accessor for getting LuaSandboxEngineModule::$contents
* Renamed configuration variable maxCPU to cpuLimit
* Include the full message name as a parameter to ScriptingException. This makes it easier to find messages in the i18n file, and it makes it easier to find invocation points when a translator wants to know how a message is used. Adding the message name as a comment on the same line seems like a waste of space when you can just make it an actual parameter.
* Reduce the number of formal parameters to ScriptingException::__construct(), since there is already too many and we may want to add more things later, such as backtraces with hyperlinks and other such stuff.
* Include the code location as $2 unconditionally so that there is less chance of getting the parameters wrong
* Shortened some message names. Wrote English text for messages without it.
2012-04-05 07:58:02 +00:00
Tim Starling 64474eb0fa * Remove old-fashioned "m" prefix from member variables
* Make ScriptingEngineBase::getDefaultOptions() non-abstract since there is a reasonable default behaviour which can be implemented
2012-04-05 03:53:05 +00:00
Tim Starling 63e989ad8b Rename i18n files per documented conventions 2012-04-04 06:19:58 +00:00
Tim Starling c8f4d0a213 First-pass cleanup:
* Removed ScriptingEngineBase::load(), inappropriate interface specification, only used by child classes and more properly defined by them
* Fixed inappropriate use of final
* Fixed case of a class constant to conform with MediaWiki conventions
* Use a factory function interface for module creation instead of a class name accessor
* Don't pass unnecessary $engine parameter to ScriptingFunctionBase::__construct(). Pass parent object as the first parameter per convention.
* Fixed unnecessary reference parameter in doRunHook()
* Have LuaSandboxEngineFunction::call() return the first result or null, per the base class documentation, instead of imploding. 
* Use strval() to avoid a warning in case call() returns an array or object
* Improved some comments
2012-04-04 06:10:32 +00:00
Tim Starling be72db112a * Added missing message scripting-exception-common-toofewargs
* In importModule(), don't catch exceptions since that luasandbox bug is fixed now
* Use the chunkName parameter to loadString to get more informative error messages
2012-04-04 05:10:47 +00:00
vvv 03bf6ce779 Add integration with CodeEditor extension. 2012-02-06 22:14:47 +00:00
vvv eb6f95b6ce Drop an empty file. 2012-02-06 21:49:39 +00:00
vvv 78fc58f457 Define namespace constants after whole configuration was loaded. This allows $wgScriptingNamespaceNumbers to be defined just like any other configuration variable. 2012-01-29 19:50:34 +00:00
Sam Reed fa2dd80ead Use get accessors
Add/Improve documentation

Remove trailing whitespace
2012-01-28 16:46:15 +00:00
vvv b960075a55 Commiting the initial revision of the Scripting extension, a framework that allows programming languages to be embedded regardless of what are those languages actually are and how they are interpreted.
This is a very raw version, and it misses most messages (even in English!) and probably needs some more work.
2012-01-28 16:22:18 +00:00