Skip to content

Commit ebac7c1

Browse files
committed
fix: correct typos in function names and comments for consistency
1 parent dd48673 commit ebac7c1

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

tests/test.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ end)
409409

410410
testGroup("Miscellaneous")
411411

412-
testRunner("Parentesis-less function calls", function()
412+
testRunner("Parenthesis-less function calls", function()
413413
assert(compileAndRun([[
414414
local function f(x) return x end
415415
local value1 = #f"hello"

the-tiny-lua-compiler.lua

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1031,14 +1031,14 @@ function ParserMethods:consumeMethodCall(currentExpression)
10311031
return functionCallNode
10321032
end
10331033

1034-
function ParserMethods:consumeOptionalSemilcolon()
1034+
function ParserMethods:consumeOptionalSemicolon()
10351035
local nextToken = self:lookAhead(1)
10361036
if self:checkCharacter(";", nextToken) then
10371037
self:consume(1)
10381038
end
10391039
end
10401040

1041-
--// EXPRESSSION PARSERS //--
1041+
--// EXPRESSION PARSERS //--
10421042
function ParserMethods:parsePrimaryExpression()
10431043
if not self.currentToken then return end
10441044
local tokenType = self.currentToken.TYPE
@@ -1362,7 +1362,7 @@ function ParserMethods:parseFor()
13621362
end
13631363

13641364
function ParserMethods:parseFunction()
1365-
-- fuction <variable>[.<field>]:<method>(...)
1365+
-- function <variable>[.<field>]:<method>(...)
13661366
-- <codeblock>
13671367
-- end
13681368
self:consumeToken("Keyword", "function")
@@ -1458,7 +1458,7 @@ function ParserMethods:getNextNode()
14581458
else
14591459
node = self:parseFunctionCallOrVariableAssignment()
14601460
end
1461-
self:consumeOptionalSemilcolon()
1461+
self:consumeOptionalSemicolon()
14621462

14631463
return node
14641464
end
@@ -1529,7 +1529,7 @@ local unpack = (unpack or table.unpack)
15291529

15301530
local COMPILER_MIN_STACK_SIZE = 2 -- Registers 0/1 are always valid
15311531
local COMPILER_SETLIST_MAX = 50
1532-
local COMPILER_SIMPLE_ARICHMETIC_OPERATOR_LOOKUP = {
1532+
local COMPILER_SIMPLE_ARITHMETIC_OPERATOR_LOOKUP = {
15331533
["+"] = "ADD", ["-"] = "SUB",
15341534
["*"] = "MUL", ["/"] = "DIV",
15351535
["%"] = "MOD", ["^"] = "POW"
@@ -1637,7 +1637,6 @@ end
16371637
function CodeGeneratorMethods:deallocateRegisters(registers)
16381638
local registerLookup = createLookupTable(registers)
16391639
local amountOfRegistersToDeallocate = #registers
1640-
local registersToDellocate = {}
16411640
for i = 1, amountOfRegistersToDeallocate do
16421641
local register = self.nextFreeRegister - i
16431642
if not registerLookup[register] then
@@ -1961,8 +1960,8 @@ end
19611960

19621961
function CodeGeneratorMethods:compileBinaryOperatorNode(node, expressionRegister)
19631962
local nodeOperator = node.Operator
1964-
if COMPILER_SIMPLE_ARICHMETIC_OPERATOR_LOOKUP[nodeOperator] then
1965-
local opcode = COMPILER_SIMPLE_ARICHMETIC_OPERATOR_LOOKUP[nodeOperator]
1963+
if COMPILER_SIMPLE_ARITHMETIC_OPERATOR_LOOKUP[nodeOperator] then
1964+
local opcode = COMPILER_SIMPLE_ARITHMETIC_OPERATOR_LOOKUP[nodeOperator]
19661965
self:processExpressionNode(node.Left, expressionRegister)
19671966
local rightExpressionRegister = self:processExpressionNode(node.Right)
19681967
self:addInstruction(opcode, expressionRegister, expressionRegister, rightExpressionRegister)

0 commit comments

Comments
 (0)