From 0415818aa793565631595046db2df9cf7e59d3f4 Mon Sep 17 00:00:00 2001 From: jakobst1n Date: Tue, 26 Dec 2023 23:29:47 +0100 Subject: Add stripping of first characters in comments --- src/journal_lib/parse/lexers/l_ledger.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/journal_lib/parse/lexers/l_ledger.py') diff --git a/src/journal_lib/parse/lexers/l_ledger.py b/src/journal_lib/parse/lexers/l_ledger.py index ec245f0..6bcd24e 100644 --- a/src/journal_lib/parse/lexers/l_ledger.py +++ b/src/journal_lib/parse/lexers/l_ledger.py @@ -181,6 +181,8 @@ class JournalLexer(LexWrapper): # Check if the comment is at the start of a line (considering whitespaces) line_start = t.lexer.lexdata.rfind("\n", 0, t.lexpos) + 1 pre_comment = t.lexer.lexdata[line_start : t.lexpos] + # Remove the leading characters + t.value = t.value.lstrip(" ;") # If the comment is at the start of a line, it's a standalone comment if pre_comment.isspace() or pre_comment == "": -- cgit v1.2.3