diff options
Diffstat (limited to 'parser.fun')
-rw-r--r-- | parser.fun | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -178,6 +178,7 @@ functor Parser(structure Tree: TREE; structure P: PPC; StmtDoWhile of stmt * exprAug | StmtReturn of exprAug option | StmtBreak | + StmtNone | StmtContinue datatype parseBinopRes = BRbinop of exprPart | BRfinish of int @@ -3046,7 +3047,7 @@ functor Parser(structure Tree: TREE; structure P: PPC; lx end) - | _ => raise Unimplemented + | _ => raise Unreachable end fun printOffsets (LcAux (offset, l)) out = @@ -3467,6 +3468,7 @@ functor Parser(structure Tree: TREE; structure P: PPC; | Tk T.kwBreak => parseJmp StmtBreak | Tk T.kwContinue => parseJmp StmtContinue | Tk T.kwReturn => parseReturn ctx + | Tk T.Semicolon => (StmtNone, #3 $ getTokenCtx ctx) | _ => parseStmtExpr ctx end @@ -3670,8 +3672,12 @@ functor Parser(structure Tree: TREE; structure P: PPC; | _ => let val (stmt, ctx) = parseStmt ctx + val acc = + case stmt of + StmtNone => acc + | _ => stmt :: acc in - collectStmts (stmt :: acc) ctx + collectStmts acc ctx end end @@ -3723,6 +3729,7 @@ functor Parser(structure Tree: TREE; structure P: PPC; Printf out `"return " Popt pea ea `";" % | pstmt' _ StmtBreak out = Printf out `"break;" % | pstmt' _ StmtContinue out = Printf out `"continue;" % + | pstmt' _ StmtNone _ = raise Unreachable and pCompBody off (S as (StmtCompound _)) out = Printf out A2 pstmt' (off - 1) S % |