Commit 1f03c64e by Zachary Snow

convert Token to use record syntax

parent 91e3ac0f
...@@ -10,23 +10,11 @@ module Language.SystemVerilog.Parser.Tokens ...@@ -10,23 +10,11 @@ module Language.SystemVerilog.Parser.Tokens
( Token (..) ( Token (..)
, TokenName (..) , TokenName (..)
, Position (..) , Position (..)
, tokenString
, tokenName
, tokenPosition
, pattern TokenEOF , pattern TokenEOF
) where ) where
import Text.Printf import Text.Printf
tokenString :: Token -> String
tokenString (Token _ s _) = s
tokenName :: Token -> TokenName
tokenName (Token kw _ _) = kw
tokenPosition :: Token -> Position
tokenPosition (Token _ _ pos) = pos
pattern TokenEOF :: Token pattern TokenEOF :: Token
pattern TokenEOF = Token Unknown "" (Position "" 0 0) pattern TokenEOF = Token Unknown "" (Position "" 0 0)
...@@ -36,8 +24,11 @@ data Position ...@@ -36,8 +24,11 @@ data Position
instance Show Position where instance Show Position where
show (Position f l c) = printf "%s:%d:%d" f l c show (Position f l c) = printf "%s:%d:%d" f l c
data Token data Token = Token
= Token TokenName String Position { tokenName :: TokenName
, tokenString :: String
, tokenPosition :: Position
}
data TokenName data TokenName
= KW_dollar_bits = KW_dollar_bits
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment