Commit 59ef51dbc3c7787611c421808e657ae03d113557

Michael Schmidt 2021-12-10T14:33:36

PHP extras: Improved `scope` and `this` (#3243)

diff --git a/components/prism-php-extras.js b/components/prism-php-extras.js
index c62c42c..ead82a6 100644
--- a/components/prism-php-extras.js
+++ b/components/prism-php-extras.js
@@ -1,11 +1,14 @@
 Prism.languages.insertBefore('php', 'variable', {
-	'this': /\$this\b/,
+	'this': {
+		pattern: /\$this\b/,
+		alias: 'keyword'
+	},
 	'global': /\$(?:GLOBALS|HTTP_RAW_POST_DATA|_(?:COOKIE|ENV|FILES|GET|POST|REQUEST|SERVER|SESSION)|argc|argv|http_response_header|php_errormsg)\b/,
 	'scope': {
 		pattern: /\b[\w\\]+::/,
 		inside: {
-			keyword: /parent|self|static/,
-			punctuation: /::|\\/
+			'keyword': /\b(?:parent|self|static)\b/,
+			'punctuation': /::|\\/
 		}
 	}
 });
diff --git a/components/prism-php-extras.min.js b/components/prism-php-extras.min.js
index e60a99e..50fc6a2 100644
--- a/components/prism-php-extras.min.js
+++ b/components/prism-php-extras.min.js
@@ -1 +1 @@
-Prism.languages.insertBefore("php","variable",{this:/\$this\b/,global:/\$(?:GLOBALS|HTTP_RAW_POST_DATA|_(?:COOKIE|ENV|FILES|GET|POST|REQUEST|SERVER|SESSION)|argc|argv|http_response_header|php_errormsg)\b/,scope:{pattern:/\b[\w\\]+::/,inside:{keyword:/parent|self|static/,punctuation:/::|\\/}}});
\ No newline at end of file
+Prism.languages.insertBefore("php","variable",{this:{pattern:/\$this\b/,alias:"keyword"},global:/\$(?:GLOBALS|HTTP_RAW_POST_DATA|_(?:COOKIE|ENV|FILES|GET|POST|REQUEST|SERVER|SESSION)|argc|argv|http_response_header|php_errormsg)\b/,scope:{pattern:/\b[\w\\]+::/,inside:{keyword:/\b(?:parent|self|static)\b/,punctuation:/::|\\/}}});
\ No newline at end of file