mirror of https://github.com/zachjs/sv2v.git
Place <file>:<line>:<col> first in an error message
This is the same as most compilers (e.g. gcc and clang) but also verilog tools (e.g. yosys) output error mesasge in a standardized form. This form can immediately be parsed by IDE tools that can jumping through a list of error messages, placing the cursor at the given file position. This change simply re-arranges the error message printing to conform to that standard. Signed-off-by: Henner Zeller <h.zeller@acm.org>
This commit is contained in:
parent
191922e2a7
commit
e2f044ec4a
|
|
@ -541,7 +541,7 @@ lexicalError :: String -> Alex a
|
|||
lexicalError msg = do
|
||||
(pn, _, _, _) <- alexGetInput
|
||||
pos <- toTokPos pn
|
||||
alexError $ "Lexical error: " ++ msg ++ ", at " ++ show pos
|
||||
alexError $ show pos ++ ": Lexical error: " ++ msg
|
||||
|
||||
-- get the current user state
|
||||
get :: Alex AlexUserState
|
||||
|
|
|
|||
|
|
@ -1207,7 +1207,7 @@ DimFn :: { DimFn }
|
|||
parseError :: [Token] -> ExceptT String IO a
|
||||
parseError a = case a of
|
||||
[] -> throwError $ "Parse error: no tokens left to parse."
|
||||
Token t s p : _ -> throwError $ "Parse error: unexpected token '" ++ s ++ "' (" ++ show t ++ ") at " ++ show p ++ "."
|
||||
Token t s p : _ -> throwError $ show p ++ ": Parse error: unexpected token '" ++ s ++ "' (" ++ show t ++ ")."
|
||||
|
||||
genItemsToGenItem :: [GenItem] -> GenItem
|
||||
genItemsToGenItem [x] = x
|
||||
|
|
|
|||
Loading…
Reference in New Issue