Skip to content

Instantly share code, notes, and snippets.

@CaptainPRICE
Last active May 17, 2019 17:40
Show Gist options
  • Save CaptainPRICE/17681965616597561d0b1ab914bc11f7 to your computer and use it in GitHub Desktop.
Save CaptainPRICE/17681965616597561d0b1ab914bc11f7 to your computer and use it in GitHub Desktop.
A test source code to be converted from GLua into Lua syntax. Regex users tryhard. If you ever come up with the Regex solution that would convert such code from GLua into Lua syntax (without breaking any of the code including comments), please do let me know.
// Convert me into Lua syntax
// using Regex./*
if (!false != !!!(!false)
||not !'\"\\'
)/*&&"!||false!=true\
*/then
local _=MsgN(
"!*/es\"cap[==[!i[[ng!=]'!=\'*/"&&"/*!es\"cap[==[!i[[ng!=]'!=\'\
'\34Regex fails hard\34\\/*\
!nope"||!(
"!es\"cap[==[!i[[ng!=]'!=\'*/"||"/*\
Regex replace fails hard\\!not\
\"!!yep")!=
!false and !1 or 0)/*
// "
*/end--&&"
print(!/* without*/not true)
/*breaking
/ * "code \"** /
and comments!
if (!false != !!!(!false)
||not !'\"\\'
)//&&"!||false!=true\
'then
local _=print(
"!*es\"cap[==[!i[[ng!=]'!=\'*"&&"/*!es\"cap[==[!i[[ng!=]'!=\'\
\34Regex fails hard\34\\/*\
!"||!(
"!es\"cap[==[!i[[ng!=]'!=\'*"||"/*\
Regex replace fails hard\\!not\
\"!!yep")!=
!false and !1 or 0)/*
// "
* //end--&&"
print(!/* without*not true)
"*/
Msg([===[
// Convert me into Lua syntax
// using Regex./*
//(!]===[{/*
if (!false != !!!(!false)
||not !'\"\\'
)//&&*/||"\
then
local _=print(
"!*/es\"cap[==[!i[[ng!=]'!=\'*/"&&"/*!es\"cap]==]!i[[ng!=]'!=\'\
\34Regex fails hard\34\
!nope"||!(
"!es\"cap[==[!i[[ng!=]'!=\'*/"||"/*\
Regex replace fails hard\\!not\
\"!!yep")!=
!false!=true and !1 or 0)/*"\
// "[===]
*/end--&&"
print(!/* without*/not true)
/*breaking
/ * "code \"** /
and comments!
!(the end)!=[[true]]&&true||false]===])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment