Commit 08c38e61 by Zachary Snow

support time literals as expressions

parent 1a394cff
......@@ -441,6 +441,7 @@ convertAsgn structs types (lhs, expr) =
(Implicit Unspecified [], Call (Just x) f args)
convertSubExpr (String s) = (Implicit Unspecified [], String s)
convertSubExpr (Number n) = (Implicit Unspecified [], Number n)
convertSubExpr (Time n) = (Implicit Unspecified [], Time n)
convertSubExpr (PSIdent x y) = (Implicit Unspecified [], PSIdent x y)
convertSubExpr (Repeat e es) =
(Implicit Unspecified [], Repeat e' es')
......
......@@ -426,6 +426,7 @@ traverseNestedExprsM mapper = exprMapper
exprMapper e >>= return . Right
em (String s) = return $ String s
em (Number s) = return $ Number s
em (Time s) = return $ Time s
em (Ident i) = return $ Ident i
em (PSIdent x y) = return $ PSIdent x y
em (Range e m (e1, e2)) = do
......
......@@ -39,6 +39,7 @@ type TypeOrExpr = Either Type Expr
data Expr
= String String
| Number String
| Time String
| Ident Identifier
| PSIdent Identifier Identifier
| Range Expr PartSelectMode Range
......@@ -62,6 +63,7 @@ data Expr
instance Show Expr where
show (Nil ) = ""
show (Number str ) = str
show (Time str ) = str
show (Ident str ) = str
show (PSIdent x y ) = printf "%s::%s" x y
show (String str ) = printf "\"%s\"" str
......
......@@ -1085,6 +1085,7 @@ Expr :: { Expr }
: "(" Expr ")" { $2 }
| String { String $1 }
| Number { Number $1 }
| Time { Time $1 }
| Identifier CallArgs { Call (Nothing) $1 $2 }
| Identifier "::" Identifier CallArgs { Call (Just $1) $3 $4 }
| DimsFn "(" TypeOrExpr ")" { DimsFn $1 $3 }
......
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