Skip to content

Commit

Permalink
Minor style changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Asger Gitz-Johansen committed Jun 15, 2019
1 parent 0323f3d commit 21ca7a7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
3 changes: 1 addition & 2 deletions src/PLCparser/AstToIR.hs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ compileStmt (Action_Call (Identifier s)) = do
compileStmt (If_Stmt c stms elsifs elseopt) = do
v <- compileExpNoMut c
k_if <- peekLabel >>= deferGoto . IR.If v
k_end <- sequentially compileStmt stms
k_end <- sequentially compileStmt stms
case (elsifs, elseopt) of
([],Else_None) -> return $ joinEnds [k_if, k_end]
_ -> do
Expand Down Expand Up @@ -309,7 +309,6 @@ visitExp' _ (Enot e1) = do
visitExp' False (Econst c) = do
n <- parseConstant c
v1 <- nextVar n
n <- parseConstant c
t_op <- IR.typeOperator IR.Assign n
tell [IR.Eval v1 t_op n]
return $ IR.Var v1
Expand Down
12 changes: 6 additions & 6 deletions src/PLCparser/IRToXml.hs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ findAllPlaces ((ProgLine l ins gl):xs) m k = findPlacesInstruction l ins m k ++
,(Place ll 0 (TI 0 0))
,(Place le 0 (TI 0 0))]
findPlacesInstruction l ins@(Call _ le) _ _ = [(Place l 0 $ invariant ins)
,(Place (l++"p") 0 (Tinf 0))]
,(Place (l++"p") 0 (Tinf 0))]
findPlacesInstruction l ins@(Unknown _) m k = [(Place l 0 $ getUnknownTiming m k ins)] -- TODO: Lookup the unknown in the map!
findPlacesGotoLabel :: Label -> [Place]
findPlacesGotoLabel (':':gl) = [(Place gl 0 $ time Return)]
Expand Down Expand Up @@ -190,11 +190,11 @@ findAllArcs (x:xs) m k = (findArcs x m k) ++ findAllArcs xs m k
findArcs (ProgLine l ins@(Case _ cs) gl) _ _= findCaseArcs l (nub . snd $ unzip cs) (removeColon gl)
where
findCaseArcs :: Label -> [Label] -> Label -> [Arc]
findCaseArcs l [] gl = [(ArcToT l (l++"Else") 1 $ time Jump)
,(ArcToP (l++"Else") gl 1)]
findCaseArcs l (cl:xs) gl = [(ArcToT l (l++"_"++cl) 1 $ time Jump)
,(ArcToP (l++"_"++cl) cl 1)] ++
findCaseArcs l xs gl
findCaseArcs l [] gl = [(ArcToT l (l++"Else") 1 $ time Jump)
,(ArcToP (l++"Else") gl 1)]
findCaseArcs l (cl:xs) gl = [(ArcToT l (l++"_"++cl) 1 $ time Jump)
,(ArcToP (l++"_"++cl) cl 1)] ++
findCaseArcs l xs gl
findArcs (ProgLine l ins@(Unknown _) gl) u k = [(ArcToT l l 1 $ getUnknownTiming m k ins )
,(ArcToP l (removeColon gl) 1)]

Expand Down

0 comments on commit 21ca7a7

Please sign in to comment.