63 |
%defs ( |
%defs ( |
64 |
structure PT = ParseTree |
structure PT = ParseTree |
65 |
structure L = Literal |
structure L = Literal |
66 |
structure Op = Operators |
structure B = BasisNames |
67 |
|
|
68 |
(* apply a mark constructor to a span and a tree *) |
(* apply a mark constructor to a span and a tree *) |
69 |
fun mark cons (span : AntlrStreamPos.span, tr) = cons{span = span, tree = tr} |
fun mark cons (span : AntlrStreamPos.span, tr) = cons{span = span, tree = tr} |
77 |
fun markExpr (_, e as PT.E_Mark _) = e |
fun markExpr (_, e as PT.E_Mark _) = e |
78 |
| markExpr (sp, tr) = mark PT.E_Mark (sp, tr) |
| markExpr (sp, tr) = mark PT.E_Mark (sp, tr) |
79 |
|
|
80 |
|
fun mkCondExp cons (e, []) = e |
81 |
|
| mkCondExp cons (e, [e']) = cons(e, e') |
82 |
|
| mkCondExp (e, e'::r) = cons(e, mkCondExp(e', r)) |
83 |
|
|
84 |
(* build an application for an infix binary operator *) |
(* build an application for an infix binary operator *) |
85 |
fun mkBinApp (e1, rator, e2) = PT.E_BinOp(e1, rator, e2) |
fun mkBinApp (e1, rator, e2) = PT.E_BinOp(e1, rator, e2) |
86 |
|
|
270 |
(***** Expressions *****) |
(***** Expressions *****) |
271 |
|
|
272 |
Expr |
Expr |
273 |
: AndExpr ( "||" AndExpr => (Op.orElse, AndExpr) )* |
: AndExpr ("||" AndExpr)* |
274 |
=> (mkLBinExp (AndExpr, SR)) |
=> (List.foldr PT.AndAlso |
275 |
; |
; |
276 |
|
|
277 |
AndExpr |
AndExpr |