|
definition: |
showGoStat :: Int -> GoStat -> String
showGoStat n (GoConstDecl ids t []) = (indent n) ++ "const "
++ (showGoCommaList id ids) ++ " " ++ t ++ "\n"
showGoStat n (GoConstDecl ids t exprs@(_:_)) = (indent n) ++ "const "
++ (showGoCommaList id ids) ++ " " ++ t ++ " = "
++ (showGoCommaList showGoExpr exprs) ++ "\n"
showGoStat n (GoVarDecl ids t []) = (indent n) ++ "var "
++ (showGoCommaList id ids) ++ " " ++ t ++ "\n"
showGoStat n (GoVarDecl ids t exprs@(_:_)) = (indent n) ++ "var "
++ (showGoCommaList id ids) ++ " " ++ t ++ " = "
++ (showGoCommaList showGoExpr exprs) ++ "\n"
showGoStat n (GoShortVarDecl ids exprs) = (indent n)
++ (showGoCommaList id ids) ++ " := "
++ (showGoCommaList showGoExpr exprs) ++ "\n"
showGoStat n (GoExprStat expr) = (indent n) ++ (showGoExpr expr)
++ "\n"
showGoStat n (GoAssign exprs1 op exprs2) = (indent n)
++ (showGoCommaList showGoExpr exprs1) ++ " " ++ op ++ " "
++ (showGoCommaList showGoExpr exprs2) ++ "\n"
showGoStat _ (GoEmpty) = "\n"
showGoStat n (GoReturn []) = (indent n) ++ "return\n"
showGoStat n (GoReturn exprs@(_:_)) = (indent n) ++ "return( "
++ (showGoCommaList showGoExpr exprs) ++ " )\n"
showGoStat n (GoBreak) = (indent n) ++ "break\n"
showGoStat n (GoContinue) = (indent n) ++ "continue\n"
showGoStat n (GoBlock stats) = (indent n) ++ "{\n"
++ (concatMap (showGoStat (n+1)) stats) ++ (indent n) ++ "}\n"
showGoStat n (GoIf expr block1 block2) = (indent n) ++ "if( "
++ (showGoExpr expr) ++ " ){\n" ++ (concatMap (showGoStat (n+1)) block1)
++ (indent n) ++ "}else {\n" ++ (concatMap (showGoStat (n+1)) block2)
++ (indent n) ++ "}\n"
showGoStat n (GoExprSwitch expr branches) = (indent n) ++ "switch "
++ (showGoExpr expr) ++ "{\n"
++ (concatMap (goShowExprBranch (n+1)) branches) ++ (indent n) ++ "}\n"
|
|
demand: |
argument 2 |
|
deterministic: |
deterministic operation |
|
documentation: |
Shows a Go statement as a string in Go syntax with indenting. @param n - number of spaces to indent @param gostat - the Go statement to show |
|
failfree: |
(_, _) |
|
indeterministic: |
referentially transparent operation |
|
infix: |
no fixity defined |
|
iotype: |
{(_,{GoConstDecl}) |-> _ || (_,{GoVarDecl}) |-> _ || (_,{GoShortVarDecl}) |-> _ || (_,{GoExprStat}) |-> _ || (_,{GoAssign}) |-> _ || (_,{GoEmpty}) |-> {:} || (_,{GoReturn}) |-> _ || (_,{GoBreak}) |-> _ || (_,{GoContinue}) |-> _ || (_,{GoBlock}) |-> _ || (_,{GoIf}) |-> _ || (_,{GoExprSwitch}) |-> _}
|
|
name: |
showGoStat |
|
precedence: |
no precedence defined |
|
result-values: |
_ |
|
signature: |
Prelude.Int -> Language.Go.Types.GoStat -> String |
|
solution-complete: |
operation might suspend on free variables |
|
terminating: |
possibly non-terminating |
|
totally-defined: |
possibly non-reducible on same data term |