mirror of https://github.com/zachjs/sv2v.git
support for arithmetic shifts
This commit is contained in:
parent
d4c6c0d014
commit
d34dc7dfeb
|
|
@ -228,6 +228,8 @@ data BinOp
|
|||
| Le
|
||||
| Gt
|
||||
| Ge
|
||||
| ShiftAL
|
||||
| ShiftAR
|
||||
deriving Eq
|
||||
|
||||
instance Show BinOp where
|
||||
|
|
@ -250,6 +252,8 @@ instance Show BinOp where
|
|||
Le -> "<="
|
||||
Gt -> ">"
|
||||
Ge -> ">="
|
||||
ShiftAL -> "<<<"
|
||||
ShiftAR -> ">>>"
|
||||
|
||||
instance Show Expr where
|
||||
show x = case x of
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@ string { Token Lit_string _ _ }
|
|||
%left "&" "~&"
|
||||
%left "==" "!=" "===" "!=="
|
||||
%left "<" "<=" ">" ">="
|
||||
%left "<<" ">>"
|
||||
%left "<<" ">>" "<<<" ">>>"
|
||||
%left "+" "-"
|
||||
%left "*" "/" "%"
|
||||
%left UPlus UMinus "!" "~" RedOps
|
||||
|
|
@ -420,6 +420,8 @@ Expr :: { Expr }
|
|||
| Expr "*" Expr { BinOp Mul $1 $3 }
|
||||
| Expr "/" Expr { BinOp Div $1 $3 }
|
||||
| Expr "%" Expr { BinOp Mod $1 $3 }
|
||||
| Expr "<<<" Expr { BinOp ShiftAL $1 $3 }
|
||||
| Expr ">>>" Expr { BinOp ShiftAR $1 $3 }
|
||||
| "!" Expr { UniOp Not $2 }
|
||||
| "~" Expr { UniOp BWNot $2 }
|
||||
| "+" Expr %prec UPlus { UniOp UAdd $2 }
|
||||
|
|
|
|||
Loading…
Reference in New Issue