mirror of
https://github.com/minetest/minetest.git
synced 2024-09-27 15:00:30 +02:00
Translation updater: Add support for function call without parantheses
This is a special case in Lua: function call with single parameter.
This commit is contained in:
parent
c63c05b141
commit
914be0d73a
|
@ -133,6 +133,19 @@ pattern_lua_bracketed = re.compile(
|
|||
r'\[\[(.*?)\]\]' # [[ ... ]] string delimiters
|
||||
r'[\s,\)]', # Same as for pattern_lua_quoted
|
||||
re.DOTALL)
|
||||
# Handles like pattern_lua_quoted, but for single parameter (without parantheses)
|
||||
# See https://www.lua.org/pil/5.html for informations about single argument call
|
||||
pattern_lua_quoted_single = re.compile(
|
||||
r'(?:^|[\.=,{\(\s])' # Same as for pattern_lua_quoted
|
||||
r'N?F?S\s*' # Same as for pattern_lua_quoted, but without open parentheses
|
||||
r'(["\'])((?:\\\1|(?:(?!\1)).)*)(\1)', # Quoted string
|
||||
re.DOTALL)
|
||||
# Same as pattern_lua_quoted_single, but for [[ ... ]] string delimiters
|
||||
pattern_lua_bracketed_single = re.compile(
|
||||
r'(?:^|[\.=,{\(\s])' # Same as for pattern_lua_quoted
|
||||
r'N?F?S\s*' # Same as for pattern_lua_quoted_single
|
||||
r'\[\[(.*?)\]\]', # [[ ... ]] string delimiters
|
||||
re.DOTALL)
|
||||
|
||||
# Handles "concatenation" .. " of strings"
|
||||
pattern_concat = re.compile(r'["\'][\s]*\.\.[\s]*["\']', re.DOTALL)
|
||||
|
@ -279,6 +292,10 @@ def read_lua_file_strings(lua_file):
|
|||
strings.append(s[1])
|
||||
for s in pattern_lua_bracketed.findall(text):
|
||||
strings.append(s)
|
||||
for s in pattern_lua_quoted_single.findall(text):
|
||||
strings.append(s[1])
|
||||
for s in pattern_lua_bracketed_single.findall(text):
|
||||
strings.append(s)
|
||||
|
||||
for s in strings:
|
||||
found_bad = pattern_bad_luastring.search(s)
|
||||
|
|
Loading…
Reference in New Issue
Block a user