Additional ; to , changes, disable "tag" and ";" in parser. Close #1430. Close #1428.

This commit is contained in:
Graydon Hoare 2012-01-19 19:29:21 -08:00
parent a23f188bdb
commit 7b1a8f0a91
14 changed files with 23 additions and 23 deletions

View File

@ -20,8 +20,8 @@ import trans_common::*;
// range)
enum opt {
lit(@ast::expr),
var(/* disr val */int, /* variant dids */{tg: def_id, var: def_id});
range(@ast::expr, @ast::expr);
var(/* disr val */int, /* variant dids */{tg: def_id, var: def_id}),
range(@ast::expr, @ast::expr)
}
fn opt_eq(a: opt, b: opt) -> bool {
alt (a, b) {

View File

@ -338,21 +338,21 @@ enum block_kind {
// in the source language. Since these blocks create variable scope, any
// variables created in them that are still live at the end of the block
// must be dropped and cleaned up when the block ends.
SCOPE_BLOCK;
SCOPE_BLOCK,
// A basic block created from the body of a loop. Contains pointers to
// which block to jump to in the case of "continue" or "break", with the
// "continue" block optional, because "while" and "do while" don't support
// "continue" (TODO: is this intentional?)
LOOP_SCOPE_BLOCK(option::t<@block_ctxt>, @block_ctxt);
LOOP_SCOPE_BLOCK(option::t<@block_ctxt>, @block_ctxt),
// A non-scope block is a basic block created as a translation artifact
// from translating code that expresses conditional logic rather than by
// explicit { ... } block structure in the source language. It's called a
// non-scope block because it doesn't introduce a new variable scope.
NON_SCOPE_BLOCK;
NON_SCOPE_BLOCK
}

View File

@ -2074,7 +2074,7 @@ fn parse_item_tag(p: parser, attrs: [ast::attribute]) -> @ast::item {
}
alt p.token {
token::SEMI | token::COMMA {
token::COMMA {
p.bump();
if p.token == token::RBRACE { done = true; }
}

View File

@ -65,7 +65,7 @@ type port_id = int;
over other channels."
)]
enum chan<T: send> {
chan_t(task::task, port_id);
chan_t(task::task, port_id)
}
resource port_ptr<T: send>(po: *rustrt::rust_port) {
@ -89,7 +89,7 @@ resource port_ptr<T: send>(po: *rustrt::rust_port) {
copied, both copies refer to the same port. \
Ports may be associated with multiple <chan>s."
)]
enum port<T: send> { port_t(@port_ptr<T>); }
enum port<T: send> { port_t(@port_ptr<T>) }
#[doc(
brief = "Sends data over a channel. The sent data is moved \

View File

@ -14,7 +14,7 @@ enum t<T, U> {
/* Variant: left */
left(T),
/* Variant: right */
right(U),
right(U)
}
/* Section: Operations */

View File

@ -23,7 +23,7 @@ enum t<T, U> {
Contains the error value
*/
err(U),
err(U)
}
/* Section: Operations */

View File

@ -43,7 +43,7 @@ export ptr;
*/
enum t<T> {
t({ base: *mutable T, len: uint, rsrc: @dtor_res});
t({ base: *mutable T, len: uint, rsrc: @dtor_res})
}
resource dtor_res(dtor: option::t<fn@()>) {

View File

@ -39,8 +39,8 @@ import option::{some, none};
// Functions used by the fmt extension at compile time
mod ct {
enum signedness { signed, unsigned, }
enum caseness { case_upper, case_lower, }
enum signedness { signed, unsigned }
enum caseness { case_upper, case_lower }
enum ty {
ty_bool,
ty_str,

View File

@ -33,7 +33,7 @@ Tag: tree_node
*/
enum tree_node<K, V> {
empty,
node(@K, @V, @tree_node<K, V>, @tree_node<K, V>),
node(@K, @V, @tree_node<K, V>, @tree_node<K, V>)
}
/* Section: Operations */

View File

@ -114,7 +114,7 @@ mod chained {
enum chain<K, V> {
present(@entry<K, V>),
absent,
absent
}
type t<K, V> = {
@ -127,7 +127,7 @@ mod chained {
enum search_result<K, V> {
not_found,
found_first(uint, @entry<K,V>),
found_after(@entry<K,V>, @entry<K,V>),
found_after(@entry<K,V>, @entry<K,V>)
}
fn search_rem<K: copy, V: copy>(

View File

@ -28,7 +28,7 @@ type treemap<K, V> = @mutable tree_node<K, V>;
/*
Tag: tree_node
*/
enum tree_node<K, V> { empty, node(@K, @V, treemap<K, V>, treemap<K, V>), }
enum tree_node<K, V> { empty, node(@K, @V, treemap<K, V>, treemap<K, V>) }
/* Section: Operations */

View File

@ -33,9 +33,9 @@ fn write_markdown(
}
enum hlvl {
h1 = 1;
h2 = 2;
h3 = 3;
h1 = 1,
h2 = 2,
h3 = 3
}
fn write_header(ctxt: ctxt, lvl: hlvl, title: str) {

View File

@ -1,6 +1,6 @@
// error-pattern:invalidate reference i
enum foo { left({mutable x: int}); right(bool); }
enum foo { left({mutable x: int}), right(bool) }
fn main() {
let x = left({mutable x: 10});

View File

@ -1,6 +1,6 @@
enum maybe_ordered_pair {
yes({low: int, high: int} : less_than(*.low, *.high));
no;
yes({low: int, high: int} : less_than(*.low, *.high)),
no
}
pure fn less_than(x: int, y: int) -> bool { ret x < y; }
fn main() { }