Added some missing occam operators to the various lists
This commit is contained in:
parent
29a41fce72
commit
d782c91ed0
|
@ -737,6 +737,9 @@ operatorNames =
|
||||||
,"/\\"
|
,"/\\"
|
||||||
,"\\/"
|
,"\\/"
|
||||||
,"><"
|
,"><"
|
||||||
|
,"BITNOT"
|
||||||
|
,"BITAND"
|
||||||
|
,"BITOR"
|
||||||
,"<<"
|
,"<<"
|
||||||
,">>"
|
,">>"
|
||||||
,"AND"
|
,"AND"
|
||||||
|
|
|
@ -875,6 +875,9 @@ operatorArity "AFTER" = JustDyadic
|
||||||
operatorArity "/\\" = JustDyadic
|
operatorArity "/\\" = JustDyadic
|
||||||
operatorArity "\\/" = JustDyadic
|
operatorArity "\\/" = JustDyadic
|
||||||
operatorArity "><" = JustDyadic
|
operatorArity "><" = JustDyadic
|
||||||
|
operatorArity "BITNOT" = JustMonadic
|
||||||
|
operatorArity "BITAND" = JustDyadic
|
||||||
|
operatorArity "BITOR" = JustDyadic
|
||||||
operatorArity "<<" = JustDyadic
|
operatorArity "<<" = JustDyadic
|
||||||
operatorArity ">>" = JustDyadic
|
operatorArity ">>" = JustDyadic
|
||||||
operatorArity "AND" = JustDyadic
|
operatorArity "AND" = JustDyadic
|
||||||
|
@ -897,16 +900,22 @@ isAssocOperator _ = False
|
||||||
udOperator :: (String -> Bool) -> OccParser A.Name
|
udOperator :: (String -> Bool) -> OccParser A.Name
|
||||||
udOperator isOp = do m <- md
|
udOperator isOp = do m <- md
|
||||||
n <- genToken test
|
n <- genToken test
|
||||||
return $ A.Name m $
|
return $ A.Name m $ translate n
|
||||||
-- Turn REM into \ now, to save effort later:
|
|
||||||
if (n == "REM")
|
|
||||||
then "\\"
|
|
||||||
else n
|
|
||||||
where
|
where
|
||||||
test (Token _ (TokReserved name))
|
test (Token _ (TokReserved name))
|
||||||
= if isOp name then Just name else Nothing
|
= if isOp name then Just name else Nothing
|
||||||
test _ = Nothing
|
test _ = Nothing
|
||||||
|
|
||||||
|
-- Turn REM into \ now, to save effort later (and similar for some of the other
|
||||||
|
-- operators that are synonyms of each other). This does prevent overloading
|
||||||
|
-- REM different to \ (for example), but we think this is ok:
|
||||||
|
translate :: String -> String
|
||||||
|
translate "REM" = "\\"
|
||||||
|
translate "BITNOT" = "~"
|
||||||
|
translate "BITAND" = "/\\"
|
||||||
|
translate "BITOR" = "\\/"
|
||||||
|
translate op = op
|
||||||
|
|
||||||
conversion :: OccParser A.Expression
|
conversion :: OccParser A.Expression
|
||||||
conversion
|
conversion
|
||||||
= do m <- md
|
= do m <- md
|
||||||
|
|
Loading…
Reference in New Issue
Block a user