-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #164 from FPtje/fp/rework-multiline-comments
- Loading branch information
Showing
19 changed files
with
697 additions
and
170 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
-- Ambiguous without ; as foo(print)(a) is a valid call | ||
foo = function() end | ||
a, b = foo; | ||
(print)(a) | ||
|
||
-- NOT Ambiguous without ; as true(print)(a) is syntactically invalid | ||
a, b = true; | ||
(print)(a) | ||
|
||
-- Ambiguous without ; as foo(print)(a) is a valid call | ||
a, b = true, foo; | ||
(print)(a) | ||
|
||
-- Obviously not ambiguous without ; | ||
a, b = foo; | ||
print(a) | ||
|
||
-- Ambiguous without ; as foo()(print)(a) is a valid call | ||
foo(); | ||
(print)(a) | ||
|
||
a, b = foo, true; | ||
(print)(a) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
-- These should not be marked as multiline, because there is only one statement | ||
-- in the body of each example. | ||
timer.Create("name", 30, 0, function() if true then return end end) | ||
timer.Create("name", 30, 0, function() return end) | ||
timer.Create("name", 30, 0, function() end) | ||
timer.Create("name", 30, 0) | ||
|
||
func(function() if true then return end end) | ||
func(function() anything() end) | ||
|
||
-- These, on the other hand, _should_ be marked as multiline | ||
timer.Create("name", 30, 0, function() | ||
-- comment here | ||
if true then return end | ||
end) | ||
|
||
timer.Create("name", 30, 0, function() | ||
a = 1 | ||
return | ||
end) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
for num, ply in pairs(player.GetAll()) do --If the buddies are in the server then add them serverside | ||
if ply:SteamID() == v.steamid then | ||
-- update the name | ||
sql.Query("UPDATE FPP_Buddies SET name = " .. sql.SQLStr(ply:Nick()) .. " WHERE steamid = " .. sql.SQLStr(v.steamid) .. ";") | ||
FPP.Buddies[v.steamid].name = ply:Nick() | ||
RunConsoleCommand("FPP_SetBuddy", ply:UserID(), v.physgun, v.gravgun, v.toolgun, v.playeruse, v.entitydamage) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
a = {} | ||
a = {1} | ||
a = {1,2,3} | ||
a = { | ||
foo, bar; | ||
baz | ||
} | ||
a = { | ||
foo, bar; | ||
baz, | ||
} | ||
a = { | ||
foo, bar; | ||
baz; | ||
} | ||
a = { | ||
[1] = 1, | ||
[2] = 3; | ||
} | ||
a = { | ||
foo = 1, | ||
2, | ||
bar = 3 | ||
} | ||
a = { | ||
{1,2,3}, | ||
{1,2,3} | ||
} | ||
a = { | ||
[1] = 1, | ||
2, 3, | ||
[4] = 4 | ||
} | ||
a = { | ||
a, b; | ||
c | ||
} | ||
a = { | ||
--[[foo]] a, b; | ||
c | ||
} | ||
a = { | ||
-- foo | ||
a, b; | ||
c | ||
} | ||
a = { | ||
a-- foo | ||
, b; | ||
c | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
-- Comment before if-statement | ||
if false then -- same-line comment | ||
-- print("TODO") | ||
end | ||
|
||
if true then | ||
a = 2 -- bar | ||
end | ||
|
||
-- Comment before if-statement | ||
if false then --same-line comment | ||
-- if-statement with multiple statements | ||
a = 1 -- comment after a statement | ||
b = 2 | ||
end | ||
|
||
-- Comment before if-statement | ||
if true then --[[ multiline comment on same line]] return end | ||
|
||
-- Comment before if-statement | ||
if true then | ||
--[[ multiline comment on next line]] | ||
return | ||
end | ||
|
||
-- Comment before if-statement | ||
if true then | ||
return -- comment after return on same line | ||
end | ||
|
||
-- Comment before if-statement | ||
if true then | ||
return | ||
-- comment after return on new line | ||
end | ||
|
||
-- Comment before if-statement | ||
if true then | ||
return | ||
end -- comment after end | ||
|
||
if true --[[ comment in condition]] or false -- single line comment in condition | ||
then return end | ||
|
||
for var=1, 10, 1 do -- same-line comment | ||
-- print("TODO") | ||
end | ||
|
||
for k, v in pairs(player.GetAll()) do -- same-line comment | ||
-- print("TODO") | ||
end | ||
|
||
function foo() -- same-line-comment | ||
end | ||
|
||
local function foo() -- same-line-comment | ||
end | ||
|
||
function foo() | ||
-- Comment before return | ||
return 1, 2, 3 -- comment on same line as return | ||
-- comment after return | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
-- Ambiguous without ; as foo(print)(a) is a valid call | ||
foo = function() end | ||
a, b = foo; | ||
print(a) | ||
-- NOT Ambiguous without ; as true(print)(a) is syntactically invalid | ||
a, b = true | ||
print(a) | ||
-- Ambiguous without ; as foo(print)(a) is a valid call | ||
a, b = true, foo; | ||
print(a) | ||
-- Obviously not ambiguous without ; | ||
a, b = foo | ||
print(a) | ||
-- Ambiguous without ; as foo()(print)(a) is a valid call | ||
foo() | ||
print(a) | ||
a, b = foo, true | ||
print(a) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,5 @@ | ||
a({b}, function() end, function() end) -- comment | ||
a( | ||
{b}, | ||
function() end, -- comment | ||
function() end | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,5 @@ | ||
local table = {function() return nil end} -- comment | ||
local table = { | ||
function() | ||
return nil -- comment | ||
end | ||
} |
Oops, something went wrong.