Skip to content

Commit 651d451

Browse files
committed
Fix Lua {Identifier} to exclude apostrophe
Also: - Redefine using Unicode {Letter} and {Number} classes.
1 parent eecab5c commit 651d451

File tree

4 files changed

+30
-4
lines changed

4 files changed

+30
-4
lines changed

src/org/opensolaris/opengrok/analysis/lua/Lua.lexh

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,33 @@
2222
* Portions Copyright (c) 2017, Chris Fraire <[email protected]>.
2323
*/
2424

25-
Identifier = [a-zA-Z_] [a-zA-Z0-9_\']*
25+
/*
26+
* Copyright © 1994–2017 Lua.org, PUC-Rio.
27+
*
28+
* Permission is hereby granted, free of charge, to any person obtaining a
29+
* copy of this software and associated documentation files (the "Software"),
30+
* to deal in the Software without restriction, including without limitation
31+
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
32+
* and/or sell copies of the Software, and to permit persons to whom the
33+
* Software is furnished to do so, subject to the following conditions:
34+
*
35+
* The above copyright notice and this permission notice shall be included in
36+
* all copies or substantial portions of the Software.
37+
*
38+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
39+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
40+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
41+
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
42+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
43+
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
44+
* DEALINGS IN THE SOFTWARE.
45+
*/
46+
47+
/*
48+
* "Names (also called identifiers) in Lua can be any string of letters,
49+
* digits, and underscores, not beginning with a digit...."
50+
*/
51+
Identifier = [\p{Letter}_] [\p{Letter}\p{Number}_]*
2652

2753
Number = ([0][xX][0-9a-fA-F]+ | [0-9]+\.[0-9]+ |
2854
[0-9][0-9_]*) ([eE][+-]?[0-9]+)?

test/org/opensolaris/opengrok/analysis/lua/sample.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ do
345345

346346

347347
function _M.get_body_info()
348-
local args, err_code, raw_body, req_mime = get_body_info()
348+
local args, err_code, raw_body, req_mime0 = get_body_info()
349349
if not raw_body then
350350
-- if our body was form-urlencoded and read via ngx.req.get_post_args()
351351
-- we need to retrieve the raw body because it was not retrieved by the

test/org/opensolaris/opengrok/analysis/lua/sample_xref.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@
353353
<a class="l" name="345" href="#345">345</a>
354354
<a class="l" name="346" href="#346">346</a>
355355
<a class="l" name="347" href="#347">347</a> <b>function</b> <a href="/source/s?defs=_M" class="intelliWindow-symbol" data-definition-place="undefined-in-file">_M</a>.<a class="d intelliWindow-symbol" href="#get_body_info" data-definition-place="defined-in-file">get_body_info</a>()
356-
<a class="l" name="348" href="#348">348</a> <b>local</b> <a href="/source/s?defs=args" class="intelliWindow-symbol" data-definition-place="undefined-in-file">args</a>, <a href="/source/s?defs=err_code" class="intelliWindow-symbol" data-definition-place="undefined-in-file">err_code</a>, <a href="/source/s?defs=raw_body" class="intelliWindow-symbol" data-definition-place="undefined-in-file">raw_body</a>, <a href="/source/s?defs=req_mime" class="intelliWindow-symbol" data-definition-place="undefined-in-file">req_mime</a> = <a class="d intelliWindow-symbol" href="#get_body_info" data-definition-place="defined-in-file">get_body_info</a>()
356+
<a class="l" name="348" href="#348">348</a> <b>local</b> <a href="/source/s?defs=args" class="intelliWindow-symbol" data-definition-place="undefined-in-file">args</a>, <a href="/source/s?defs=err_code" class="intelliWindow-symbol" data-definition-place="undefined-in-file">err_code</a>, <a href="/source/s?defs=raw_body" class="intelliWindow-symbol" data-definition-place="undefined-in-file">raw_body</a>, <a href="/source/s?defs=req_mime0" class="intelliWindow-symbol" data-definition-place="undefined-in-file">req_mime0</a> = <a class="d intelliWindow-symbol" href="#get_body_info" data-definition-place="defined-in-file">get_body_info</a>()
357357
<a class="l" name="349" href="#349">349</a> <b>if</b> <b>not</b> <a href="/source/s?defs=raw_body" class="intelliWindow-symbol" data-definition-place="undefined-in-file">raw_body</a> <b>then</b>
358358
<a class="hl" name="350" href="#350">350</a> <span class="c">-- if our body was form-urlencoded and read via ngx.req.get_post_args()</span>
359359
<a class="l" name="351" href="#351">351</a> <span class="c">-- we need to retrieve the raw body because it was not retrieved by the</span>

test/org/opensolaris/opengrok/analysis/lua/samplesymbols.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ get_body_info
177177
args
178178
err_code
179179
raw_body
180-
req_mime
180+
req_mime0
181181
get_body_info
182182
raw_body
183183
raw_body

0 commit comments

Comments
 (0)