Skip to content
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

Fix two bugs #26

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions metalua/compiler/ast_to_src.mlua
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ local op_preprec = {
{ "concat" },
{ "add", "sub" },
{ "mul", "div", "mod" },
{ "unary", "not", "len" },
{ "unary", "not", "len", "unm" },
{ "pow" },
{ "index" } }

Expand All @@ -149,7 +149,7 @@ local op_symbol = {
div = " / ", mod = " % ", pow = " ^ ",
concat = " .. ", eq = " == ", ne = " ~= ",
lt = " < ", le = " <= ", ["and"] = " and ",
["or"] = " or ", ["not"] = "not ", len = "# " }
["or"] = " or ", ["not"] = "not ", len = "# ", unm = "- "}

--------------------------------------------------------------------------------
-- Accumulate the source representation of AST `node' in
Expand Down
2 changes: 2 additions & 0 deletions metalua/grammar/lexer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,8 @@ function lexer :extract_short_string()
if x == '\\' then
if y == 'z' then -- Lua 5.2 \z
j = self.src :match ("^%s*()", j+1)
elseif y == '\r' then -- Only for windows \\\r\n case
j = self.src :match("^[\n]+()", j+1)
else
j=j+1 -- escaped char
end
Expand Down