Commit graph

36 commits

Author SHA1 Message Date
Sam Reed ee97278b4d Add some braces and also some documentation 2011-12-19 23:44:11 +00:00
Happy-melon f274e42be1 Follow-up r81074:
* subclass ConvertError and ExprError from MWException
* invoking the parser for error messages clears state and exposes strip markers, and the error messages should be in the content language anyway
* clean up the magic word list
2011-01-29 13:54:02 +00:00
Sam Reed 5fa066a6e9 Start removing/fixing calls to deprecated methods in WMF used extensions 2010-10-29 15:14:44 +00:00
Siebrand Mazeland 20888253e0 * remove MediaWiki pre-1.8 compatibility and remove SprintfDateCompat.php
* bump version to 1.4.0
* run stylize.php
2010-10-02 22:36:34 +00:00
Chad Horohoe 7d289782c8 Revert r66934 (Removing wfLoadExtensionMessages() from everything). I disagree on principle...we branch extensions for this very reason. But people want trunk extensions compatible for several versions back, meh. 2010-05-27 15:56:53 +00:00
Chad Horohoe 1813ce38bb Large commit. Removed 800+ references to no-op wfLoadExtensionMessages() 2010-05-26 22:25:32 +00:00
Andrew Garrett e7bb4501f4 Revert Expr.php to r40762 for now -- still some errors that need tracking down and fixing. 2009-02-18 05:57:38 +00:00
Andrew Garrett baaf9def26 Fix division by zero handling for BC -- 0 != "0.00" 2009-02-18 05:36:55 +00:00
Brion Vibber 47042d2584 fix regression -- bc compat check was reversed; attempting to call bcpow() when no bc :) 2009-02-18 05:23:56 +00:00
Andrew Garrett 5a331c7c28 Handle precision=0 correctly in bcround (it's the default anyway!) 2009-02-18 05:12:01 +00:00
Roan Kattouw 3c6bd5a6ec ParserFunctions: Fix undefined variable warnings introduced in r47205 2009-02-16 10:08:31 +00:00
Andrew Garrett 67ad2159a1 Fix handling of 0, 0.0, 0.00 etc in logical functions. 2009-02-13 00:28:40 +00:00
Andrew Garrett 29f573fe22 Per Simetrical on code review, fix confused implementation of log (just convert to doubles and use the inaccurate floating-point math for now), and move initialisation to doExpression, instead of haveBC. 2009-02-12 23:49:30 +00:00
Andrew Garrett d9fd747f2d Revert "Adds explicit round-off checking to operations that are sensitive to floating point vs. integer round-off errors.", et al. ( r46683, r46671 )
Reimplement, but better! Use BC Math library where possible, for fixed-point math operations. The tolerance aspect has been included by doing math internally at 16 digits, but discarding the last two digits for the purpose of comparison.
2009-02-12 22:29:32 +00:00
Andrew Garrett 54de74c0ef Fix glaring fatal. 2009-02-06 21:18:32 +00:00
Robert Rohde a0fdcf7415 Adds explicit fractional tolerance checks to comparison functions. Currently set to 1e-10.
Addresses concerns related to r46671.
2009-02-01 18:40:26 +00:00
Robert Rohde 8f6382337c Adds explicit round-off checking to operations that are sensitive to floating point vs. integer round-off errors.
Where applied, it assumes that any floating point number that is an integer to within one part in 10^10 should be replaced with that integer.
2009-02-01 03:56:24 +00:00
Aryeh Gregor d8a4a48904 (bug 15349) Accept more types of minuses in #expr
{{#expr:1 − 2}} and {{#expr:1 − 2}} now work, in the same vein as {{#ifexpr:3 < 4|...}} does.  This allows human-formatted template values to work more reliably when fed to #expr.  Patch by Doug Strain.
2008-09-12 22:06:58 +00:00
Raimond Spekking 6bab1db29b * (bug 13216 ) Add trigonometrical functions sin, cos, tan, asin, acos, atan and exp, ln, abs, floor, trunc, ceil, ^, and the constants pi and e.
This should help to avoid complicate templates which simulates these functions for geocoding purposes.
Patch by Rene Kijewski
2008-04-23 15:08:39 +00:00
Andrew Garrett 559348494d Allow expr parser function to accept exponent input (i.e. 3e8). It seems silly to output in a format that we don't accept as input. 2008-03-28 11:59:12 +00:00
Siebrand Mazeland 04a88ee436 * use wfLoadExtensionMessages
* remove some unneeded blackslashes in messages (caused malformed error message)
* put Magic in separate file
* delay message loading
* add version in extension credits, remove EOL whitespace
* update Translate extension
2008-01-13 01:06:28 +00:00
Tim Starling e1ca28d2f9 * Strip comments early, before template expansion. This mimics the behaviour in the old parser. Added parser tests demonstrating the regression this fixes. The syntactic effect is fairly elegant, with comments taking effect at source level, as expected. The removeHTMLcomments() and preprocessToDom() passes could be merged at a later date.
* No need for comment stripping in Expr.php anymore
* Updated srvus() to roughly account for these changes
* Gave comment handling its own preprocessor tag, and split off comment handling from extensionSubstitution(). This only applies for the non-HTML modes, since in HTML mode, comments are stripped early. 
* Strip comments from template argument names (PPFrame::newChild).
2007-12-17 15:07:25 +00:00
Tim Starling f06807863c * Object versions of #ifexpr, #switch and #ifexist
* Fix for lack of StubObject in ~1.7
* Ignore HTML comments in expressions, which may now appear due to the parse order change
2007-12-09 08:11:38 +00:00
Raimond Spekking 5944437cb1 Use <strong> not <span>, per hint of Simetrical on wikitech-l. Thanks. 2007-11-19 15:37:49 +00:00
Raimond Spekking e470229df5 * (bug 8773) Make error messages from expr.php localizable
** Move error messages to ParserFunctions.i18n.php
** Rename 'expr_...' to 'pfunc_expr_...' to be consistent with other messages which are localizable already
* Add CSS class 'error' to output of error messages
2007-11-16 08:02:24 +00:00
Brion Vibber 6f8f28792c Renormalize invalid utf-8 byte in error message.
Would be better to work with an entire character, but it isn't that big a deal. :)
2007-08-31 14:08:16 +00:00
Aryeh Gregor ddab9b72ee Extensions too! 2007-06-29 01:36:09 +00:00
Antoine Musso ccc136f753 remove some ending whitespaces 2007-01-06 20:56:46 +00:00
Brion Vibber c8e0d935c0 fix line endings 2007-01-05 02:13:39 +00:00
Tim Starling 2477d59ae4 Exception-based error handling for expressions, plus a few other tweaks. Patch by AzaToth. 2006-11-21 07:22:13 +00:00
Jimmy Collins d6b7f6f759 update for XHTML conformance 2006-07-07 18:01:48 +00:00
Tim Starling 3092bf1db5 Proper handling of division by zero 2006-04-12 04:00:46 +00:00
Tim Starling 4265df9c9a Yay! Synonyms for all! 2006-04-07 00:23:46 +00:00
Tim Starling c592fdf295 fixed stack check 2006-04-06 08:46:34 +00:00
Tim Starling a49014ff5a * Better error reporting
* Inequality operators
* rand function
2006-04-06 08:14:56 +00:00
Tim Starling 6d93dfe6b8 Mathematical expressions and conditional constructs implemented as parser functions. Documentation to follow. 2006-04-05 13:22:51 +00:00