Skip to content

Commit

Permalink
[BUG] lexer: line continuations with single line comments had duplica…
Browse files Browse the repository at this point in the history
…ted new lines
  • Loading branch information
Patitotective committed Oct 13, 2022
1 parent 4ef2383 commit 0c41b40
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion kdl.nimble
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Package

version = "0.2.1"
version = "0.2.2"
author = "Patitotective"
description = "KDL document language Nim implementation"
license = "MIT"
Expand Down
4 changes: 2 additions & 2 deletions src/kdl/lexer.nim
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ proc tokenSingleLineComment*() {.lexing: tkEmpty.} =
lexer.consume 2
while not lexer.eof(): # Consume until a new line or EOF
if lexer.tokenNewLine():
if lexer.tokenNewLine(addToStack = addToStack):
break
lexer.consume()
Expand All @@ -386,7 +386,7 @@ proc tokenLineCont*() {.lexing: tkLineCont.} =
lexer.consume()
lexer.skipwhitespaces()
if not lexer.tokenSingleLineComment() and not lexer.tokenNewLine(addToStack = false):
if not lexer.tokenSingleLineComment(addToStack = false) and not lexer.tokenNewLine(addToStack = false):
lexer.error "Expected a new line"
proc tokenLitMatches() {.lexing: tkEmpty.} =
Expand Down
2 changes: 1 addition & 1 deletion tests/test_cases/examples/website.kdl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ html lang="en" {
meta \
name="description" \
content="kdl is a document language, mostly based on SDLang, with xml-like semantics that looks like you're invoking a bunch of CLI commands!"
title "kdl - Kat's Document Language"
title "kdl - Kat's Document Language" // Comment
link rel="stylesheet" href="/styles/global.css"
}
body {
Expand Down

0 comments on commit 0c41b40

Please sign in to comment.