TheDJ has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/173104

Change subject: Fix Lua comment blocks and string blocks.
......................................................................

Fix Lua comment blocks and string blocks.

- Match comments non-greedily instead of greedily
- Re-add support for block strings (similar to heredoc)

Bug: 73281
Change-Id: Ib7f6eeb2df17434740fb85cee955d76762b56fe5
---
M geshi/geshi/lua.php
1 file changed, 10 insertions(+), 3 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/SyntaxHighlight_GeSHi 
refs/changes/04/173104/1

diff --git a/geshi/geshi/lua.php b/geshi/geshi/lua.php
index f82ce3c..493c4bf 100644
--- a/geshi/geshi/lua.php
+++ b/geshi/geshi/lua.php
@@ -46,7 +46,13 @@
     'LANG_NAME' => 'Lua',
     'COMMENT_SINGLE' => array(1 => "--"),
     'COMMENT_MULTI' => array(),
-    'COMMENT_REGEXP' => array(1 => '/--\[(=*)\[.*\]\1\]/s'),
+    'COMMENT_REGEXP' => array(
+        // Multiline comments
+        2 => '/--\[(=*)\[.*?\]\1\]/s',
+        // Multi line literal strings (should not interpret escape sequences)
+        // Here because no STRING_REGEXP
+        3 => '/(?!--)\[(=*)\[.*?\]\1\]/s',
+    ),
     'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE,
     'QUOTEMARKS' => array("'", '"'),
     'ESCAPE_CHAR' => '',
@@ -127,8 +133,9 @@
             ),
         'COMMENTS' => array(
             1 => 'color: #808080; font-style: italic;',
-            //2 => 'color: #ff0000;',
-            'MULTI' => 'color: #808080; font-style: italic;'
+            2 => 'color: #808080; font-style: italic;',
+            // Actually a string
+            3 => 'color: #ff0000;',
             ),
         'ESCAPE_CHAR' => array(
             0 => 'color: #000099; font-weight: bold;',

-- 
To view, visit https://gerrit.wikimedia.org/r/173104
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib7f6eeb2df17434740fb85cee955d76762b56fe5
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/SyntaxHighlight_GeSHi
Gerrit-Branch: master
Gerrit-Owner: TheDJ <hartman.w...@gmail.com>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to