You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Vigil has a naïve implementation for parsing implore and swear statements. Here is the relevant section of the source, starting at line 82.
for line in source_lines:
line = re.sub(r'(\s*)implore (.*)', r'\1vigil_implore(\2, """\2""")', line)
line = re.sub(r'(\s*)swear (.*)', r'\1vigil_swear(\2, """\2""")', line)
source += line
Vigil is just passing in everything on a line after an implore or swear statement into a vigil_implore or vigil_swear function call. This will fail if you have multiline expressions in you code, such as in this very contrived example
implore n >= (1 +
3 -
4)
Python will interpret everything inside the parentheses as part of a single line, but f.readlines will not. If I understand correctly, Vigil will rewrite the above example thus:
Also, in Python you may put a \ before a newline and it will interpret the following line as if it were part of the current line. Vigil fails here for the same reason.
Vigil would be improved if it were able to parse these multiline expressions correctly.
The text was updated successfully, but these errors were encountered:
Or, perhaps, your coding style would be improved by adhering to Vigil's unspoken rules about swear and implore statements?
Why would you wish to divide yourself from a whole into parts? I believe that your code is immoral and must be punished!
In all seriousness, though, this would probably improve readability on long swear/implore statements. While, personally, I can't think of a particular reason that doesn't seem contrived, I'm sure someone will run into a valid use case eventually.
Vigil has a naïve implementation for parsing
implore
andswear
statements. Here is the relevant section of the source, starting at line 82.Vigil is just passing in everything on a line after an
implore
orswear
statement into avigil_implore
orvigil_swear
function call. This will fail if you have multiline expressions in you code, such as in this very contrived examplePython will interpret everything inside the parentheses as part of a single line, but
f.readlines
will not. If I understand correctly, Vigil will rewrite the above example thus:which is not syntactically valid.
Also, in Python you may put a
\
before a newline and it will interpret the following line as if it were part of the current line. Vigil fails here for the same reason.Vigil would be improved if it were able to parse these multiline expressions correctly.
The text was updated successfully, but these errors were encountered: