Commit Graph

65 Commits

Author SHA1 Message Date
Michael Schmidt 11c54624ee
Use terser (#3407) 2022-03-22 22:32:52 +01:00
Frank de Jonge 4c3f196976
PHP: Added `readonly` keyword (#3349)
Co-authored-by: RunDevelopment <mitchi5000.ms@googlemail.com>
2022-03-22 10:35:27 +01:00
Michael Schmidt 3c61c8f7ce
ESLint: Added `regexp/no-useless-flag` rule (#3150) 2021-10-14 14:01:11 +02:00
Michael Schmidt ee62a08023
PHP: Removed useless keyword tokens (#3121) 2021-10-05 21:23:44 +02:00
Michael Schmidt e2630d890e
ESLint: Added `regexp/sort-alternatives` rule (#3093) 2021-09-26 11:52:18 +02:00
Michael Schmidt e8d3b50330
ESLint: Added `regexp/strict` rule (#2944) 2021-06-27 14:56:07 +02:00
Michael Schmidt 18a00828a2
ESLint: Added regexp plugin (#2924) 2021-06-13 19:53:03 +02:00
Michael Schmidt 87d7939064
PHP: Fixed functions with namespaces (#2889) 2021-05-17 16:28:00 +02:00
Michael Schmidt cf3755cb1d
PHP: Fixed string interpolation (#2864) 2021-05-01 14:26:52 +02:00
Daniel Wilkowski e0ee93f138
PHP: Added missing PHP 7.4 `fn` keyword (#2858) 2021-04-14 15:23:06 +02:00
Michael Schmidt 7e8cd40d72
PHP: Fixed methods with keyword names + minor improvements (#2818) 2021-04-03 11:14:13 +02:00
Tom Pavelec 8019e2f675
PHP: Improved constant support for PHP 8.1 enums (#2770)
This improves the highlighting of PHP 8.1 enums and class constants.
2021-02-19 17:41:31 +01:00
Ayesh Karunaratne f79b0eefbb
PHP: Added support for PHP 8.1 enums (#2752) 2021-02-18 14:35:36 +01:00
Tom Pavelec 04ef309c30
PHP: Class names at the start of a string are now highlighted correctly (#2731)
Some class names at the start of the input string were not detected correctly due to the way greedy matching works. This fixes the issue by splitting the `class-name` rule into two rules, one before and one after the `keyword` rule that interfered and caused the issue.
2021-01-20 20:12:58 +01:00
Ayesh Karunaratne 01af04ed2b
PHP: Numeral syntax improvements (#2701)
Improves numeral literal handling in the Prism PHP component in two ways:

1. Since PHP 7.4, it is possible to use [underscore numeric separator](https://php.watch/versions/7.4/underscore_numeric_separator). Prism correctly handles this for decimal numbers, but not for binary, octal, and hex numerals although PHP supports the underscore separator for binary, octal, and hex numeric literals as well.
2. In upcoming PHP 8.1, PHP supports an [explicit octal numeral prefix `0o`/`0O`](https://php.watch/versions/8.1/explicit-octal-notation). The existing `0` prefix is not removed.

This commit updates the PHP number regex to accommodate both cases above, and expands the tests for new syntax.
2021-01-06 20:01:16 +01:00
Michael Schmidt 37b9c9a178
PHP: Fixed exponential backtracking (#2684) 2020-12-31 14:10:09 +01:00
Michael Schmidt e644178b8b
Added test for polynomial backtracking (#2597) 2020-12-28 18:19:11 +01:00
Michael Schmidt c2f6a64426
Fixed multiple cases of vulnerable regexes (#2584) 2020-10-25 23:42:25 +01:00
Tom Pavelec df922d908d
PHP: Added support for PHP 8.0 features (#2591) 2020-10-16 22:20:59 +02:00
Tom Pavelec 38808e6478
PHP: Added support for PHP 7.4 + other major improvements (#2566) 2020-10-13 14:03:42 +02:00
Ayesh Karunaratne 1761513e3d
PHP: Added `match` keyword (PHP 8.0) (#2574)
PHP introduces a new [`match` keyword in PHP 8.0](https://php.watch/versions/8.0/match-expression).
2020-10-05 13:01:19 +02:00
Michael Schmidt 7a554b5f89
Fixed several cases of exponential backtracking (#2268) 2020-04-16 22:27:54 +02:00
Michael Schmidt 24c8f83325
PHP: Fixed exponential runtime of a pattern (#2157)
This fixes the exponential runtime of the pattern used to identify PHP code embedded in HTML.
2020-01-05 19:56:14 +01:00
Michael Schmidt ad3fa443df
Inlined some unnecessary rest properties (#2082)
This inlines a few unnecessary `rest` properties.
2019-10-16 11:44:14 +02:00
Michael Schmidt 3e00bb9c41
Rebuilt Prism (#1794)
This is a rebuilt of Prism to update minified files.
2019-03-07 15:22:30 +01:00
Michael Schmidt 289ddd9b3b
PHP: Fixed closing tag issue (#1652)
This fixes that PHP's closing tag (`?>`) was detected inside strings and comments.
2019-02-28 21:56:01 +01:00
volado 439e3bd7e1 Made false, true, and null constants in PHP (#1694)
- This adds the `constant` alias to `false` and `true`.
- `null` is no longer `keyword` but a `constant`.
2019-01-10 22:54:01 +01:00
volado 55fb0f8e2e Update PHP keywords (#1690)
This removes PHP 4 specific keywords and adds new PHP keywords.

Keywords previously classified as functions are now classified as keywords.
2019-01-03 15:22:02 +01:00
volado f1026b4bf0 Improve recognition of constants in PHP (#1688)
The pattern for PHP constants now have to be a valid identifier and recognizes single-letter names.
2019-01-02 23:41:36 +01:00
Michael Schmidt 9dfec340c7 `insertBefore` now correctly updates references (#1531)
Removes some workarounds for misplacing the reference when using `insertBefore`.
2018-08-18 16:04:51 -04:00
Golmote 5f9c078a10
Make ERB, Handlebars, PHP and Smarty highlight properly in NodeJS (#1367) 2018-03-25 13:46:42 +02:00
Golmote ad25d2214b PHP: Fix shell-comment failure now that strings are greedy 2018-03-03 21:41:19 +01:00
Golmote 5d7223c996 PHP: Add support for Heredoc and Nowdoc strings 2018-03-03 21:39:51 +01:00
Golmote 9f1f8d678b PHP: Add support for string interpolation inside double-quoted strings. Fix #1146 2018-03-03 20:53:08 +01:00
Golmote 9a542a0049 PHP: Add support for multi-line strings. Fix #1233 2017-11-28 19:41:58 +01:00
Golmote 5235f18edf PHP: Don't use captures if not needed 2017-10-22 15:12:42 +02:00
Andreas Rohner 36bc560edc Check for possible pre-existing marker strings in PHP 2017-05-13 09:34:37 +02:00
Andreas Rohner 3ce74880fe Add support for the <?= delimiter in PHP 2017-05-08 22:27:19 +02:00
Andreas Rohner 84107fabe0 Use different replacement marker for PHP, because curly braces are
highlighted as punctuation in JavaScript and CSS.
2017-05-08 22:26:45 +02:00
Andreas Rohner 0a00d7f728 Fix the PHP language
This patch is an attempt to fix the PHP language, when it is combined
with markup.

The problem is, that markup has a higher priority than all other tokens.
This leads to weird errors, where HTML tags are highlighted inside of
comments #197. One solution to this was to set the `greedy` flag for the
comment token, but this leads to far worse errors like #1097.

This patch should fix both issues #197 and #1097, by switching the
grammar to markup on the fly. One potential problem is, that it relies
on the `<?php` tag to detect if markup is present. So if a PHP file
contains only markup and no PHP code at all, the result will look
broken.
2017-05-08 22:26:01 +02:00
Golmote 65cbaa9516 Run gulp after #1107 2017-05-08 13:27:57 +02:00
Golmote 86aa3d2164 Revert #998 + run normalize-whitespace and remove-initial-line-feed plugins in the before-sanity-check hook. Fix #1018 (see issue for discussion) 2016-09-01 23:43:11 +02:00
Golmote d8fefde697 Don't restore env.code from backupCode in Handlebars, PHP and Smarty components 2016-07-12 09:09:52 +02:00
Golmote 318aab39fa Make PHP comments greedy. Fix #197 2016-07-05 19:00:52 +02:00
Golmote 895bf46b87 Properly escape special replacement patterns ($) in Handlebars, PHP and Smarty. Fix #772 2015-09-20 16:25:21 +02:00
Golmote f9d94520e2 PHP: Simplified patterns 2015-08-29 23:16:25 +02:00
Golmote b1fd5bdcee Removed unused global flag in all grammars 2015-03-10 08:27:53 +01:00
Golmote 00955466fd PHP : Handle shell-like comment after strings because they are less common than strings containing hashes 2015-01-29 07:49:18 +01:00
Andreas Rohner b1cc49d887 Update minified and auto generated files 2014-08-23 20:02:02 +02:00
Andreas Rohner 312e989c15 Fix line-numbers for PHP in markup
The problem is, that inline php code can be anywhere inside of a HTML
element. To properly highlight this the php language implementation
temporarily replaces all inline php code in `env.code` with something
like `{{PHP0}}`. After the markup highlighting is finished it replaces
it again with the real code, but it leaves `env.code` corrupted.
Since the line-numbers plugin uses `env.code` to count the number of
lines, the result will be broken.

So to fix this, it must be ensured, that `env.code` is restored before
the line-numbers plugin uses it.
2014-08-19 20:02:17 +02:00