Refs #32919 -- Added assertion for token start in Lexer.create_token().

This adds an assertion in the code path where the method would otherwise
return None, which isn't allowed.
This commit is contained in:
Chris Jerdonek 2021-08-03 11:50:08 -04:00 committed by Mariusz Felisiak
parent 196a99da5d
commit 7ff72b5909
1 changed files with 3 additions and 3 deletions

View File

@ -383,9 +383,9 @@ class Lexer:
if block_content[:9] in ('verbatim', 'verbatim '):
self.verbatim = 'end%s' % block_content
return Token(TokenType.BLOCK, block_content, position, lineno)
elif token_start == COMMENT_TAG_START:
content = token_string[2:-2].strip()
return Token(TokenType.COMMENT, content, position, lineno)
assert token_start == COMMENT_TAG_START
content = token_string[2:-2].strip()
return Token(TokenType.COMMENT, content, position, lineno)
else:
return Token(TokenType.TEXT, token_string, position, lineno)