add explicit unknown token error message

This commit is contained in:
Zachary Snow 2025-11-01 22:04:34 -04:00
parent 60c0819bf4
commit c1ce7d067b
3 changed files with 6 additions and 2 deletions

View File

@ -509,6 +509,8 @@ postProcess stack (Token Id_escaped str pos : ts) =
where where
t' = Token Id_escaped str' pos t' = Token Id_escaped str' pos
str' = (++ " ") $ init str str' = (++ " ") $ init str
postProcess _ (Token Unknown str pos : _) =
throwError $ show pos ++ ": unknown token '" ++ str ++ "'"
postProcess [] (t : ts) = do postProcess [] (t : ts) = do
ts' <- postProcess [] ts ts' <- postProcess [] ts
return $ t : ts' return $ t : ts'

View File

@ -1,4 +1,5 @@
// pattern: Parse error: unexpected token '`' // pattern: unknown token '`'
// location: double_backtick.sv:4:5
module top; module top;
`` ``
endmodule endmodule

View File

@ -1,4 +1,5 @@
// pattern: Parse error // pattern: unknown token '`'
// location: stray_escaped_vendor_comment.sv:4:6
module top; module top;
/``* some awful garbage *``/ /``* some awful garbage *``/
endmodule endmodule