Skip to content

Commit deffa5e

Browse files
brsongraydon
authored andcommitted
---
yaml --- r: 1635 b: refs/heads/master c: 80e0eba h: refs/heads/master i: 1633: 62acb17 1631: b4f155c v: v3
1 parent bad4cef commit deffa5e

File tree

3 files changed

+45
-1
lines changed

3 files changed

+45
-1
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: 45f79552614e135821f1c64ff9f9b4a303d4aab6
2+
refs/heads/master: 80e0ebaa86869b6c7063dde8316f98aa5f365316

trunk/src/comp/front/ast.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,9 @@ tag expr_ {
242242
expr_be(@expr);
243243
expr_log(@expr);
244244
expr_check_expr(@expr);
245+
expr_port(ann);
246+
expr_chan(@expr, ann);
247+
expr_send(@expr /* TODO: @expr|is_lval */, @expr, ann);
245248
}
246249

247250
type lit = spanned[lit_];
@@ -278,6 +281,8 @@ tag ty_ {
278281
ty_rec(vec[ty_field]);
279282
ty_fn(proto, vec[ty_arg], @ty); // TODO: effect
280283
ty_obj(vec[ty_method]);
284+
ty_chan(@ty);
285+
ty_port(@ty);
281286
ty_path(path, option.t[def]);
282287
ty_mutable(@ty);
283288
ty_type;

trunk/src/comp/front/parser.rs

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,22 @@ impure fn parse_ty(parser p) -> @ast.ty {
429429
t = parse_ty_obj(p, hi);
430430
}
431431

432+
case (token.PORT) {
433+
p.bump();
434+
expect(p, token.LBRACKET);
435+
t = ast.ty_port(parse_ty(p));
436+
hi = p.get_span();
437+
expect(p, token.RBRACKET);
438+
}
439+
440+
case (token.CHAN) {
441+
p.bump();
442+
expect(p, token.LBRACKET);
443+
t = ast.ty_chan(parse_ty(p));
444+
hi = p.get_span();
445+
expect(p, token.RBRACKET);
446+
}
447+
432448
case (token.IDENT(_)) {
433449
t = ast.ty_path(parse_path(p, GREEDY), none[ast.def]);
434450
}
@@ -799,6 +815,23 @@ impure fn parse_bottom_expr(parser p) -> @ast.expr {
799815
}
800816
}
801817

818+
case (token.PORT) {
819+
p.bump();
820+
expect(p, token.LPAREN);
821+
expect(p, token.RPAREN);
822+
hi = p.get_span();
823+
ex = ast.expr_port(ast.ann_none);
824+
}
825+
826+
case (token.CHAN) {
827+
p.bump();
828+
expect(p, token.LPAREN);
829+
auto e = parse_expr(p);
830+
hi = e.span;
831+
expect(p, token.RPAREN);
832+
ex = ast.expr_chan(e, ast.ann_none);
833+
}
834+
802835
case (_) {
803836
auto lit = parse_lit(p);
804837
hi = lit.span;
@@ -1080,6 +1113,12 @@ impure fn parse_assign_expr(parser p) -> @ast.expr {
10801113
ret @spanned(lo, rhs.span,
10811114
ast.expr_assign_op(aop, lhs, rhs, ast.ann_none));
10821115
}
1116+
case (token.SEND) {
1117+
p.bump();
1118+
auto rhs = parse_expr(p);
1119+
ret @spanned(lo, rhs.span,
1120+
ast.expr_send(lhs, rhs, ast.ann_none));
1121+
}
10831122
case (_) { /* fall through */ }
10841123
}
10851124
ret lhs;

0 commit comments

Comments
 (0)