Skip to content

Commit b690f35

Browse files
committed
---
yaml --- r: 2309 b: refs/heads/master c: d08b443 h: refs/heads/master i: 2307: 9d60e70 v: v3
1 parent 36465fc commit b690f35

File tree

183 files changed

+1240
-1257
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

183 files changed

+1240
-1257
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 764de078e7c4baaf0a1f426e7ac4d834c2ea8797
2+
refs/heads/master: d08b443fffb1181d8d45ae5d061412f202dd4118

trunk/src/boot/fe/item.ml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -199,14 +199,6 @@ and parse_stmts_including_none (ps:pstate) : Ast.stmt array =
199199
bump ps;
200200
expect ps SEMI;
201201
[| span ps apos (lexpos ps) Ast.STMT_cont |]
202-
| ASSERT ->
203-
bump ps;
204-
let (stmts, expr) =
205-
ctxt "stmts: check value" parse_expr ps
206-
in
207-
expect ps SEMI;
208-
spans ps stmts apos (Ast.STMT_check_expr expr)
209-
(* leaving check as it is; adding assert as a synonym for the "old" check *)
210202
| CHECK ->
211203
bump ps;
212204
begin

trunk/src/boot/fe/lexer.mll

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@
9292

9393
("type", TYPE);
9494
("check", CHECK);
95-
("assert", ASSERT);
9695
("claim", CLAIM);
9796
("prove", PROVE);
9897

trunk/src/boot/fe/token.ml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ type token =
7777
(* Type and type-state keywords *)
7878
| TYPE
7979
| CHECK
80-
| ASSERT
8180
| CLAIM
8281
| PROVE
8382

@@ -238,7 +237,6 @@ let rec string_of_tok t =
238237
(* Type and type-state keywords *)
239238
| TYPE -> "type"
240239
| CHECK -> "check"
241-
| ASSERT -> "assert"
242240
| CLAIM -> "claim"
243241
| PROVE -> "prove"
244242

trunk/src/comp/front/ast.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -283,10 +283,7 @@ tag expr_ {
283283
expr_put(option.t[@expr], ann);
284284
expr_be(@expr, ann);
285285
expr_log(int, @expr, ann);
286-
/* just an assert, no significance to typestate */
287-
expr_assert(@expr, ann);
288-
/* preds that typestate is aware of */
289-
expr_check(@expr, ann);
286+
expr_check_expr(@expr, ann);
290287
expr_port(ann);
291288
expr_chan(@expr, ann);
292289
}

trunk/src/comp/front/creader.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ fn parse_ty(@pstate st, str_def sd) -> ty.t {
9393
case ('c') { ret ty.mk_char(st.tcx); }
9494
case ('s') { ret ty.mk_str(st.tcx); }
9595
case ('t') {
96-
assert (next(st) as char == '[');
96+
check(next(st) as char == '[');
9797
auto def = parse_def(st, sd);
9898
let vec[ty.t] params = vec();
9999
while (peek(st) as char != ']') {
@@ -108,7 +108,7 @@ fn parse_ty(@pstate st, str_def sd) -> ty.t {
108108
case ('P') { ret ty.mk_port(st.tcx, parse_ty(st, sd)); }
109109
case ('C') { ret ty.mk_chan(st.tcx, parse_ty(st, sd)); }
110110
case ('T') {
111-
assert (next(st) as char == '[');
111+
check(next(st) as char == '[');
112112
let vec[ty.mt] params = vec();
113113
while (peek(st) as char != ']') {
114114
params += vec(parse_mt(st, sd));
@@ -117,7 +117,7 @@ fn parse_ty(@pstate st, str_def sd) -> ty.t {
117117
ret ty.mk_tup(st.tcx, params);
118118
}
119119
case ('R') {
120-
assert (next(st) as char == '[');
120+
check(next(st) as char == '[');
121121
let vec[ty.field] fields = vec();
122122
while (peek(st) as char != ']') {
123123
auto name = "";
@@ -149,7 +149,7 @@ fn parse_ty(@pstate st, str_def sd) -> ty.t {
149149
ret ty.mk_native_fn(st.tcx,abi,func._0,func._1);
150150
}
151151
case ('O') {
152-
assert (next(st) as char == '[');
152+
check(next(st) as char == '[');
153153
let vec[ty.method] methods = vec();
154154
while (peek(st) as char != ']') {
155155
auto proto;
@@ -175,9 +175,9 @@ fn parse_ty(@pstate st, str_def sd) -> ty.t {
175175
case ('Y') { ret ty.mk_type(st.tcx); }
176176
case ('#') {
177177
auto pos = parse_hex(st);
178-
assert (next(st) as char == ':');
178+
check (next(st) as char == ':');
179179
auto len = parse_hex(st);
180-
assert (next(st) as char == '#');
180+
check (next(st) as char == '#');
181181
alt (st.tcx.rcache.find(tup(st.crate,pos,len))) {
182182
case (some[ty.t](?tt)) { ret tt; }
183183
case (none[ty.t]) {
@@ -245,7 +245,7 @@ fn parse_hex(@pstate st) -> uint {
245245
}
246246

247247
fn parse_ty_fn(@pstate st, str_def sd) -> tup(vec[ty.arg], ty.t) {
248-
assert (next(st) as char == '[');
248+
check(next(st) as char == '[');
249249
let vec[ty.arg] inputs = vec();
250250
while (peek(st) as char != ']') {
251251
auto mode = ast.val;

trunk/src/comp/front/lexer.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,6 @@ fn keyword_table() -> std.map.hashmap[str, token.token] {
127127

128128
keywords.insert("type", token.TYPE);
129129
keywords.insert("check", token.CHECK);
130-
keywords.insert("assert", token.ASSERT);
131130
keywords.insert("claim", token.CLAIM);
132131
keywords.insert("prove", token.PROVE);
133132

@@ -529,7 +528,7 @@ fn scan_numeric_escape(reader rdr) -> char {
529528

530529
auto n_hex_digits = 0;
531530

532-
assert (rdr.curr() == '\\');
531+
check (rdr.curr() == '\\');
533532

534533
alt (rdr.next()) {
535534
case ('x') { n_hex_digits = 2; }

trunk/src/comp/front/parser.rs

Lines changed: 19 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -621,7 +621,7 @@ fn parse_path(parser p, greed g) -> ast.path {
621621
if (p.peek() == token.DOT) {
622622
if (g == GREEDY) {
623623
p.bump();
624-
assert (is_ident(p.peek()));
624+
check (is_ident(p.peek()));
625625
} else {
626626
more = false;
627627
}
@@ -816,22 +816,19 @@ fn parse_bottom_expr(parser p) -> @ast.expr {
816816
ex = ast.expr_log(0, e, ast.ann_none);
817817
}
818818

819-
case (token.ASSERT) {
820-
p.bump();
821-
auto e = parse_expr(p);
822-
auto hi = e.span.hi;
823-
ex = ast.expr_assert(e, ast.ann_none);
824-
}
825-
826819
case (token.CHECK) {
827820
p.bump();
828-
/* Should be a predicate (pure boolean function) applied to
829-
arguments that are all either slot variables or literals.
830-
but the typechecker enforces that. */
831-
auto e = parse_expr(p);
832-
auto hi = e.span.hi;
833-
ex = ast.expr_check(e, ast.ann_none);
834-
}
821+
alt (p.peek()) {
822+
case (token.LPAREN) {
823+
auto e = parse_expr(p);
824+
auto hi = e.span.hi;
825+
ex = ast.expr_check_expr(e, ast.ann_none);
826+
}
827+
case (_) {
828+
p.get_session().unimpl("constraint-check stmt");
829+
}
830+
}
831+
}
835832

836833
case (token.RET) {
837834
p.bump();
@@ -940,7 +937,7 @@ fn expand_syntax_ext(parser p, ast.span sp,
940937
&ast.path path, vec[@ast.expr] args,
941938
option.t[str] body) -> ast.expr_ {
942939

943-
assert (_vec.len[ast.ident](path.node.idents) > 0u);
940+
check (_vec.len[ast.ident](path.node.idents) > 0u);
944941
auto extname = path.node.idents.(0);
945942
if (_str.eq(extname, "fmt")) {
946943
auto expanded = extfmt.expand_syntax_ext(args, body);
@@ -1676,8 +1673,7 @@ fn stmt_ends_with_semi(@ast.stmt stmt) -> bool {
16761673
case (ast.expr_put(_,_)) { ret true; }
16771674
case (ast.expr_be(_,_)) { ret true; }
16781675
case (ast.expr_log(_,_,_)) { ret true; }
1679-
case (ast.expr_check(_,_)) { ret true; }
1680-
case (ast.expr_assert(_,_)) { ret true; }
1676+
case (ast.expr_check_expr(_,_)) { ret true; }
16811677
}
16821678
}
16831679
// We should not be calling this on a cdir.
@@ -2161,24 +2157,24 @@ fn parse_item(parser p) -> @ast.item {
21612157

21622158
alt (p.peek()) {
21632159
case (token.CONST) {
2164-
assert (lyr == ast.layer_value);
2160+
check (lyr == ast.layer_value);
21652161
ret parse_item_const(p);
21662162
}
21672163

21682164
case (token.FN) {
2169-
assert (lyr == ast.layer_value);
2165+
check (lyr == ast.layer_value);
21702166
ret parse_item_fn_or_iter(p);
21712167
}
21722168
case (token.ITER) {
2173-
assert (lyr == ast.layer_value);
2169+
check (lyr == ast.layer_value);
21742170
ret parse_item_fn_or_iter(p);
21752171
}
21762172
case (token.MOD) {
2177-
assert (lyr == ast.layer_value);
2173+
check (lyr == ast.layer_value);
21782174
ret parse_item_mod(p);
21792175
}
21802176
case (token.NATIVE) {
2181-
assert (lyr == ast.layer_value);
2177+
check (lyr == ast.layer_value);
21822178
ret parse_item_native_mod(p);
21832179
}
21842180
case (token.TYPE) {

trunk/src/comp/front/token.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ tag token {
8989

9090
/* Type and type-state keywords */
9191
TYPE;
92-
ASSERT;
9392
CHECK;
9493
CLAIM;
9594
PROVE;
@@ -259,7 +258,6 @@ fn to_str(token t) -> str {
259258

260259
/* Type and type-state keywords */
261260
case (TYPE) { ret "type"; }
262-
case (ASSERT) { ret "assert"; }
263261
case (CHECK) { ret "check"; }
264262
case (CLAIM) { ret "claim"; }
265263
case (PROVE) { ret "prove"; }

0 commit comments

Comments
 (0)