Skip to content

Commit e662758

Browse files
Following original style, and adding back something I accidentally deleted.
1 parent cb70333 commit e662758

3 files changed

Lines changed: 13 additions & 6 deletions

File tree

src/prometheus/enums.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ Enums.Conventions = {
6565
"repeat", "return", "then", "true", "until", "while"
6666
},
6767

68-
SymbolChars = chararray("+-*/%^#=~<>(){}[];:,.`"),
68+
SymbolChars = chararray("+-*/%^#=~<>(){}[];:,."),
6969
MaxSymbolLength = 3,
7070
Symbols = {
7171
"+", "-", "*", "/", "%", "^", "#",

src/prometheus/parser.lua

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,6 @@ function Parser:statement(scope, currentLoop)
322322

323323
-- Local Variable Declaration
324324
local ids = self:nameList(scope);
325-
326325
local expressions = {};
327326
if(consume(self, TokenKind.Symbol, "=")) then
328327
expressions = self:exprList(scope);
@@ -549,6 +548,11 @@ function Parser:funcName(scope)
549548
table.insert(indices, expect(self, TokenKind.Ident).value);
550549
end
551550

551+
if(consume(self, TokenKind.Symbol, ":")) then
552+
table.insert(indices, expect(self, TokenKind.Ident).value);
553+
passSelf = true;
554+
end
555+
552556
return {
553557
scope = baseScope,
554558
id = baseId,

src/prometheus/unparser.lua

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -684,11 +684,14 @@ function Unparser:unparseExpression(expression, tabbing)
684684
if (self.luaVersion == LuaVersion.LuaU) then
685685
k = AstKind.IfElseExpression
686686
if(expression.kind == k) then
687-
local expr = self:unparseExpression(expression.condition)
688-
local trueexpr = self:unparseExpression(expression.true_value)
689-
push("if ", expr, " then ", trueexpr);
687+
push(self:unparseExpression(expression.condition));
688+
push(" then ")
689+
push(self:unparseExpression(expression.true_value))
690690
for _, elseifexp in pairs(expression.elseifs) do
691-
push(" elseif ", self:unparseExpression(elseifexp.condition), " then ", self:unparseExpression(elseifexp.value))
691+
push(" elseif ")
692+
push(self:unparseExpression(elseifexp.condition))
693+
push(" then ")
694+
push(self:unparseExpression(elseifexp.value))
692695
end
693696
push(" else ");
694697
push(self:unparseExpression(expression.false_value));

0 commit comments

Comments
 (0)