From d515ede7da3b115632025bfb2cbfe7bcf685fde1 Mon Sep 17 00:00:00 2001 From: Lonami Exo Date: Thu, 30 Nov 2017 13:34:55 +0100 Subject: [PATCH] Fix TLParser not stripping inline comments --- telethon_generator/parser/tl_parser.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/telethon_generator/parser/tl_parser.py b/telethon_generator/parser/tl_parser.py index a08521db..8c24cbf4 100644 --- a/telethon_generator/parser/tl_parser.py +++ b/telethon_generator/parser/tl_parser.py @@ -17,11 +17,13 @@ class TLParser: # Read all the lines from the .tl file for line in file: + # Strip comments from the line + comment_index = line.find('//') + if comment_index != -1: + line = line[:comment_index] + line = line.strip() - - # Ensure that the line is not a comment - if line and not line.startswith('//'): - + if line: # Check whether the line is a type change # (types <-> functions) or not match = re.match('---(\w+)---', line)