-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Scanner: convert strings and numbers to their runtime values
this adds 'Object' and replaces 'Maybe String' with 'Maybe Object' for the literal in 'Token'
- Loading branch information
Showing
3 changed files
with
13 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module Object where | ||
|
||
data Object = Number Double | String String deriving (Show) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
module Token where | ||
|
||
import TokenType | ||
import Object | ||
|
||
data Token = Token | ||
{ t_type :: TokenType | ||
, t_lexeme :: String | ||
, t_literal :: Maybe String -- TODO: Convert to runtime value | ||
, t_literal :: Maybe Object | ||
, t_line :: Int | ||
} deriving (Show) |