mirror of https://github.com/zachjs/sv2v.git
improve `line error message
This commit is contained in:
parent
ad98c14547
commit
9f180f91e5
|
|
@ -1002,7 +1002,10 @@ handleDirective (posOrig, _, _, strOrig) len = do
|
|||
let Just line = readMaybe lineStr :: Maybe Int
|
||||
let Just level = readMaybe levelStr :: Maybe Int
|
||||
return (line, filename, level)
|
||||
_ -> lexicalError $ "unexpected tokens following `begin_keywords: " ++ show toks
|
||||
_ -> lexicalError $
|
||||
"unexpected tokens types following `line: "
|
||||
++ show (map tokenName toks) ++ "; should be: "
|
||||
++ show [Lit_number, Lit_string, Lit_number]
|
||||
let filename = init $ tail quotedFilename
|
||||
setCurrentFile filename
|
||||
(AlexPn f _ c, prev, _, str) <- alexGetInput
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ module Language.SystemVerilog.Parser.Tokens
|
|||
, TokenName (..)
|
||||
, Position (..)
|
||||
, tokenString
|
||||
, tokenName
|
||||
) where
|
||||
|
||||
import Text.Printf
|
||||
|
|
@ -17,6 +18,9 @@ import Text.Printf
|
|||
tokenString :: Token -> String
|
||||
tokenString (Token _ s _) = s
|
||||
|
||||
tokenName :: Token -> TokenName
|
||||
tokenName (Token kw _ _) = kw
|
||||
|
||||
data Position
|
||||
= Position String Int Int
|
||||
deriving Eq
|
||||
|
|
|
|||
Loading…
Reference in New Issue