-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Updated the translator to use gsub("%S", "")
instead of `gsub("%S",…
#303
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at the examples, the only weird thing is that there is a lack of space before the =
.
We could also treat specially. If the first character after the region is a =
and the last character in the region is a space, then preserve that space.
f3f9bf1
to
5dfd8f2
Compare
pallene/translator.lua
Outdated
-- Remove the type annotation but exclude the next token. | ||
self:add_whitespace(decl.type.loc.pos, decl.end_loc.pos - 1) | ||
-- self:add_whitespace(decl.type.loc.pos, decl.end_loc.pos - 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These 3 comments are now outdated. We could just remove them.
5dfd8f2
to
eca2bbd
Compare
… " ")` Fixes issue #277. If we remove the non-whitespace characters instead of simply replacing them with spaces it produces a more pleasant-looking output. For example, ``` function f(x: integer) ``` becomes ``` function (x) ``` instead of ``` function f(x ) ``` Column numbers are not be preserved but line numbers are. This is okay because Lua error messages do not show column numbers, they only show line numbers.
eca2bbd
to
c12cb87
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great!
… " ")`
Fixes issue #277. If we remove the non-whitespace characters instead of simply replacing them with
spaces it produces a more pleasant-looking output. For example,
becomes
instead of
Column numbers are not be preserved but line numbers are. This is okay because Lua error messages
do not show column numbers, they only show line numbers.