tmedwards / sugarcube-2

SugarCube is a free (gratis and libre) story format for Twine/Twee.
https://www.motoslave.net/sugarcube/2/
BSD 2-Clause "Simplified" License
185 stars 42 forks source link

Quotes inside comments in TwineScript are buggy #107

Closed cyrusfirheir closed 3 years ago

cyrusfirheir commented 3 years ago

Describe the bug. Opening a quote inside a comment in a macro head, and closing that same quote outside the macro causes the parser (the regex prolly?) to include everything between those quotes and throw.

To Reproduce:

<<set $var to {
   one: 1 /* open a ' quote */
}>>
<<= 'somestring>>

or

<<if $var is {
  one: 1 /* open a ' quote - ignore the stoopid usage, just wanted to demo it with a container */
}>><</if>>
<<= 'somestring'>>

Expected behavior. No errors >.<

Project details.

Desktop details.

Additional context. Found while hunting the cause of the bug in Wendy's project. Made me find a bug in T3LT too. It's got the same bug, given that it uses the same regex for the macros, and adapts a lot of the lexer code for argument parsing... But I think it's solely a problem with the regex, judging by how the extension reacts to it... I'll look into it myself too.

cyrusfirheir commented 3 years ago

Noice.

cyrusfirheir commented 3 years ago

O wait... No close until publish?