Skip to content

Commit

Permalink
Working on none
Browse files Browse the repository at this point in the history
  • Loading branch information
DePasqualeOrg committed Oct 1, 2024
1 parent 9a879d0 commit b9d18be
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions Sources/Parser.swift
Original file line number Diff line number Diff line change
Expand Up @@ -187,21 +187,18 @@ func parse(tokens: [Token]) throws -> Program {
while typeof(.is) {
current += 1
let negate = typeof(.not)

if negate {
current += 1
}

var filter = try parsePrimaryExpression()

if let boolLiteralFlter = filter as? BoolLiteral {
filter = Identifier(value: String(boolLiteralFlter.value))
if let boolLiteralFilter = filter as? BoolLiteral {
filter = Identifier(value: String(boolLiteralFilter.value))
} else if let nullLiteralFilter = filter as? NullLiteral {
filter = Identifier(value: "none")
}

if let test = filter as? Identifier {
operand = TestExpression(operand: operand as! Expression, negate: negate, test: test)
}
else {
} else {
throw JinjaError.syntax("Expected identifier for the test")
}
}
Expand Down

0 comments on commit b9d18be

Please sign in to comment.