mediawiki-extensions-AbuseF.../includes/parser
Daimona Eaytoy aa867bd370 Better handling of function params in CachingParser
This patch includes various fixes to how func arguments are handled in
CachingParser:
- Add a comment about a future improvement of checkSyntax, which we
  could limit to try building the AST.
- Having enough args for each function is now also checked when
  building the AST. This allows implementing the previous point without
  stopping to report notenoughargs at syntaxcheck-time (otherwise it'd be
  a runtime error). And it also ensure that we check for the params count
  inside skipped branches, e.g. inside if/else: these were already only
  discovered at runtime in CachingParser. The old parser is not affected
  by this change, because when checking syntax it will always execute
  all branches, and at runtime it will skip braces altogether.
- Fix arg count for CachingParser, which previously added a bogus param
  in case of a function called without parameters. This was fixed for
  the other parser in I484fe2994292970276150d2e417801453339e540, and I
  just ported the updated fix. Also note that the CachingParser was
  already failing for e.g. `count()`, but instead of complaining about
  missing arguments, it failed hard when trying to pass NULL to
  evalNode.
- Fixed some tests not to use setExpectedException, which caused the
  previous point to remain unnoticed: calling that method prevents the
  loop from continuing, and thus only the AbuseFilterParser part was
  being executed. The new implementation checks the exception ID and is
  thus more future-proof if the i18n message changes.
- Fixed some function names in error reporting for the old parser.
- The arg count is now checked outside of the function handlers, thus
  it's no more necessary to call checkEnoughArguments at the beginning
  of each handler. This also produces clearer error messages in case of
  aliases (e.g. set/set_var).
- Check the args count even if some of the args are DUNDEFINED. This is
  much easier now that the check is outside of the handler. This will
  make syntax check fail for e.g. `contains_any(added_lines)`.

Bug: T156095
Change-Id: I446a307e5395ea8cc8ec5ca5d5390b074bea2f24
2019-08-20 15:32:02 +00:00
..
AbuseFilterCachingParser.php Better handling of function params in CachingParser 2019-08-20 15:32:02 +00:00
AbuseFilterParser.php Better handling of function params in CachingParser 2019-08-20 15:32:02 +00:00
AbuseFilterTokenizer.php Move non-decimal numbers deprecation logging 2019-08-03 16:57:24 +00:00
AFPData.php Make some other AFPData methods non-static 2019-08-12 14:40:51 +02:00
AFPException.php Move various classes to their own files 2016-12-17 11:40:10 -08:00
AFPParserState.php Revert "Revert "Add typehinting for every object-only parameter"" 2018-11-15 10:09:16 +01:00
AFPToken.php Add doc for every class member 2019-03-17 11:40:24 +01:00
AFPTreeNode.php Restore unit tests for CachingParser and fix it 2019-05-25 10:55:24 +02:00
AFPTreeParser.php Better handling of function params in CachingParser 2019-08-20 15:32:02 +00:00
AFPUserVisibleException.php Ban variable variables 2019-08-11 01:47:35 +00:00