Skip to content
This repository was archived by the owner on Apr 22, 2020. It is now read-only.

Commit a3672bb

Browse files
Fixed bug: Lua was not tokenizing strings or comments adjacent to punctuation properly.
1 parent 1239601 commit a3672bb

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

src/lang-lua.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,6 @@ PR.registerLangHandler(
5454
// An identifier
5555
[PR.PR_PLAIN, /^[a-z_]\w*/i],
5656
// A run of punctuation
57-
[PR.PR_PUNCTUATION, /^[^\w\t\n\r \xA0]+/]
57+
[PR.PR_PUNCTUATION, /^[^\w\t\n\r \xA0][^\w\t\n\r \xA0\"\-\+=]*/]
5858
]),
5959
['lua']);

tests/prettify_test.html

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -745,8 +745,10 @@ <h1>Bug 22 - Line numbers and other non-code spans in code</h1>
745745
<span class=nocode>10: </span>}</pre>
746746

747747
<h1>Bug 24 - LUA Syntax Highlighting</h1>
748-
<pre class="prettyprint lang-lua" id="issue24"
749-
>
748+
<pre class="prettyprint lang-lua" id="issue24">
749+
os=require("os")
750+
math=require("math")
751+
750752
-- Examples from the language reference
751753
a = 'alo\n123"'
752754
a = "alo\n123\&quot;"
@@ -1980,7 +1982,10 @@ <h1>CSS w/ language specified</h1>
19801982
'`END<span class="nocode">10: `END`PUN}`END'
19811983
),
19821984
issue24: (
1983-
'`COM-- Examples from the language reference`END`PLN<br>' +
1985+
'`PLNos`END`PUN=`END`PLNrequire`END`PUN(`END`STR"os"`END`PUN)`END`PLN<br>' +
1986+
'math`END`PUN=`END`PLNrequire`END`PUN(`END`STR"math"`END`PUN)`END`PLN<br>' +
1987+
'<br>' +
1988+
'`END`COM-- Examples from the language reference`END`PLN<br>' +
19841989
'&nbsp; &nbsp; &nbsp;a `END`PUN=`END`PLN `END`STR\'alo\\n123"\'`END' +
19851990
'`PLN<br>' +
19861991
'&nbsp; &nbsp; &nbsp;a `END`PUN=`END`PLN `END`STR"alo\\n123\\""`END' +

0 commit comments

Comments
 (0)