Print warning when a tab is discovered where it shouldn't be

This commit is contained in:
2022-08-10 01:22:53 -04:00
parent 0d2d10fe04
commit 245798f33d
3 changed files with 18 additions and 2 deletions

View File

@@ -59,8 +59,18 @@ func (lexer *LexingOperation) tokenizeSymbolBeginning () (err error) {
}
case '\t':
// indent level
// TODO: throw error if tab is not at line beginning, or after
// other tab
previousToken := lexer.tokens[len(lexer.tokens) - 1]
if !previousToken.Is(TokenKindNewline) ||
!previousToken.Is(TokenKindNewline) {
file.NewError (
lexer.file.Location(), 1,
"tab not used as indent",
file.ErrorKindWarn)
break
}
for lexer.char == '\t' {
lexer.addToken (Token {
kind: TokenKindIndent,