2011-06-15 11:19:50 -07:00
|
|
|
|
2011-05-17 20:41:41 +02:00
|
|
|
import std::vec;
|
|
|
|
import std::str;
|
2011-05-12 17:24:54 +02:00
|
|
|
import std::option;
|
|
|
|
import std::option::some;
|
|
|
|
import std::option::none;
|
|
|
|
import std::map::hashmap;
|
|
|
|
import driver::session;
|
|
|
|
import ast::ident;
|
|
|
|
import front::parser::parser;
|
|
|
|
import front::parser::spanned;
|
|
|
|
import front::parser::new_parser;
|
2011-06-16 14:59:51 -07:00
|
|
|
import front::parser::parse_inner_attributes;
|
2011-05-12 17:24:54 +02:00
|
|
|
import front::parser::parse_mod_items;
|
|
|
|
import util::common;
|
|
|
|
import util::common::filename;
|
|
|
|
import util::common::span;
|
|
|
|
import util::common::new_str_hash;
|
2011-02-24 15:54:55 -08:00
|
|
|
|
|
|
|
|
|
|
|
// Simple dynamic-typed value type for eval_expr.
|
2011-06-15 11:19:50 -07:00
|
|
|
tag val { val_bool(bool); val_int(int); val_str(str); }
|
2011-02-24 15:54:55 -08:00
|
|
|
|
2011-06-15 11:19:50 -07:00
|
|
|
tag eval_mode { mode_depend; mode_parse; }
|
2011-05-03 15:50:56 -07:00
|
|
|
|
2011-02-24 15:54:55 -08:00
|
|
|
type env = vec[tup(ident, val)];
|
|
|
|
|
2011-06-15 11:19:50 -07:00
|
|
|
type ctx =
|
|
|
|
@rec(parser p,
|
|
|
|
eval_mode mode,
|
|
|
|
mutable vec[str] deps,
|
|
|
|
session::session sess,
|
|
|
|
mutable uint chpos,
|
|
|
|
mutable uint next_ann);
|
|
|
|
|
|
|
|
fn mk_env() -> env { ret []; }
|
2011-02-24 15:54:55 -08:00
|
|
|
|
|
|
|
fn val_is_bool(val v) -> bool {
|
2011-06-15 11:19:50 -07:00
|
|
|
alt (v) { case (val_bool(_)) { true } case (_) { false } }
|
2011-02-24 15:54:55 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
fn val_is_int(val v) -> bool {
|
2011-06-15 11:19:50 -07:00
|
|
|
alt (v) { case (val_int(_)) { true } case (_) { false } }
|
2011-02-24 15:54:55 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
fn val_is_str(val v) -> bool {
|
2011-06-15 11:19:50 -07:00
|
|
|
alt (v) { case (val_str(_)) { true } case (_) { false } }
|
2011-02-24 15:54:55 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
fn val_as_bool(val v) -> bool {
|
2011-06-15 11:19:50 -07:00
|
|
|
alt (v) { case (val_bool(?b)) { b } case (_) { fail } }
|
2011-02-24 15:54:55 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
fn val_as_int(val v) -> int {
|
2011-06-15 11:19:50 -07:00
|
|
|
alt (v) { case (val_int(?i)) { i } case (_) { fail } }
|
2011-02-24 15:54:55 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
fn val_as_str(val v) -> str {
|
2011-06-15 11:19:50 -07:00
|
|
|
alt (v) { case (val_str(?s)) { s } case (_) { fail } }
|
2011-02-24 15:54:55 -08:00
|
|
|
}
|
|
|
|
|
2011-05-12 17:24:54 +02:00
|
|
|
fn lookup(session::session sess, env e, span sp, ident i) -> val {
|
2011-02-24 15:54:55 -08:00
|
|
|
for (tup(ident, val) pair in e) {
|
2011-06-15 11:19:50 -07:00
|
|
|
if (str::eq(i, pair._0)) { ret pair._1; }
|
2011-02-24 15:54:55 -08:00
|
|
|
}
|
2011-06-14 14:09:14 -07:00
|
|
|
sess.span_err(sp, "unknown variable: " + i)
|
2011-02-24 15:54:55 -08:00
|
|
|
}
|
|
|
|
|
2011-05-12 17:24:54 +02:00
|
|
|
fn eval_lit(ctx cx, span sp, @ast::lit lit) -> val {
|
2011-02-24 15:54:55 -08:00
|
|
|
alt (lit.node) {
|
2011-06-14 14:09:14 -07:00
|
|
|
case (ast::lit_bool(?b)) { val_bool(b) }
|
|
|
|
case (ast::lit_int(?i)) { val_int(i) }
|
2011-06-15 11:19:50 -07:00
|
|
|
case (ast::lit_str(?s, _)) { val_str(s) }
|
|
|
|
case (_) { cx.sess.span_err(sp, "evaluating unsupported literal") }
|
2011-02-24 15:54:55 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-05-12 17:24:54 +02:00
|
|
|
fn eval_expr(ctx cx, env e, @ast::expr x) -> val {
|
2011-02-24 15:54:55 -08:00
|
|
|
alt (x.node) {
|
2011-05-12 17:24:54 +02:00
|
|
|
case (ast::expr_path(?pth, _)) {
|
2011-05-17 20:41:41 +02:00
|
|
|
if (vec::len[ident](pth.node.idents) == 1u &&
|
2011-06-15 11:19:50 -07:00
|
|
|
vec::len[@ast::ty](pth.node.types) == 0u) {
|
2011-04-08 18:44:20 +02:00
|
|
|
ret lookup(cx.sess, e, x.span, pth.node.idents.(0));
|
2011-02-24 15:54:55 -08:00
|
|
|
}
|
2011-04-08 18:44:20 +02:00
|
|
|
cx.sess.span_err(x.span, "evaluating structured path-name");
|
2011-02-24 15:54:55 -08:00
|
|
|
}
|
2011-06-15 11:19:50 -07:00
|
|
|
case (ast::expr_lit(?lit, _)) { ret eval_lit(cx, x.span, lit); }
|
2011-05-12 17:24:54 +02:00
|
|
|
case (ast::expr_unary(?op, ?a, _)) {
|
2011-04-08 18:44:20 +02:00
|
|
|
auto av = eval_expr(cx, e, a);
|
2011-02-24 15:54:55 -08:00
|
|
|
alt (op) {
|
2011-05-12 17:24:54 +02:00
|
|
|
case (ast::not) {
|
2011-06-15 11:19:50 -07:00
|
|
|
if (val_is_bool(av)) { ret val_bool(!val_as_bool(av)); }
|
2011-04-08 18:44:20 +02:00
|
|
|
cx.sess.span_err(x.span, "bad types in '!' expression");
|
2011-02-24 15:54:55 -08:00
|
|
|
}
|
|
|
|
case (_) {
|
2011-04-08 18:44:20 +02:00
|
|
|
cx.sess.span_err(x.span, "evaluating unsupported unop");
|
2011-02-24 15:54:55 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2011-05-12 17:24:54 +02:00
|
|
|
case (ast::expr_binary(?op, ?a, ?b, _)) {
|
2011-04-08 18:44:20 +02:00
|
|
|
auto av = eval_expr(cx, e, a);
|
|
|
|
auto bv = eval_expr(cx, e, b);
|
2011-02-24 15:54:55 -08:00
|
|
|
alt (op) {
|
2011-05-12 17:24:54 +02:00
|
|
|
case (ast::add) {
|
2011-02-24 15:54:55 -08:00
|
|
|
if (val_is_int(av) && val_is_int(bv)) {
|
|
|
|
ret val_int(val_as_int(av) + val_as_int(bv));
|
|
|
|
}
|
|
|
|
if (val_is_str(av) && val_is_str(bv)) {
|
|
|
|
ret val_str(val_as_str(av) + val_as_str(bv));
|
|
|
|
}
|
2011-04-08 18:44:20 +02:00
|
|
|
cx.sess.span_err(x.span, "bad types in '+' expression");
|
2011-02-24 15:54:55 -08:00
|
|
|
}
|
2011-05-12 17:24:54 +02:00
|
|
|
case (ast::sub) {
|
2011-02-24 15:54:55 -08:00
|
|
|
if (val_is_int(av) && val_is_int(bv)) {
|
|
|
|
ret val_int(val_as_int(av) - val_as_int(bv));
|
|
|
|
}
|
2011-04-08 18:44:20 +02:00
|
|
|
cx.sess.span_err(x.span, "bad types in '-' expression");
|
2011-02-24 15:54:55 -08:00
|
|
|
}
|
2011-05-12 17:24:54 +02:00
|
|
|
case (ast::mul) {
|
2011-02-24 15:54:55 -08:00
|
|
|
if (val_is_int(av) && val_is_int(bv)) {
|
|
|
|
ret val_int(val_as_int(av) * val_as_int(bv));
|
|
|
|
}
|
2011-04-08 18:44:20 +02:00
|
|
|
cx.sess.span_err(x.span, "bad types in '*' expression");
|
2011-02-24 15:54:55 -08:00
|
|
|
}
|
2011-05-12 17:24:54 +02:00
|
|
|
case (ast::div) {
|
2011-02-24 15:54:55 -08:00
|
|
|
if (val_is_int(av) && val_is_int(bv)) {
|
|
|
|
ret val_int(val_as_int(av) / val_as_int(bv));
|
|
|
|
}
|
2011-04-08 18:44:20 +02:00
|
|
|
cx.sess.span_err(x.span, "bad types in '/' expression");
|
2011-02-24 15:54:55 -08:00
|
|
|
}
|
2011-05-12 17:24:54 +02:00
|
|
|
case (ast::rem) {
|
2011-02-24 15:54:55 -08:00
|
|
|
if (val_is_int(av) && val_is_int(bv)) {
|
|
|
|
ret val_int(val_as_int(av) % val_as_int(bv));
|
|
|
|
}
|
2011-04-08 18:44:20 +02:00
|
|
|
cx.sess.span_err(x.span, "bad types in '%' expression");
|
2011-02-24 15:54:55 -08:00
|
|
|
}
|
2011-05-12 17:24:54 +02:00
|
|
|
case (ast::and) {
|
2011-02-24 15:54:55 -08:00
|
|
|
if (val_is_bool(av) && val_is_bool(bv)) {
|
|
|
|
ret val_bool(val_as_bool(av) && val_as_bool(bv));
|
|
|
|
}
|
2011-04-08 18:44:20 +02:00
|
|
|
cx.sess.span_err(x.span, "bad types in '&&' expression");
|
2011-02-24 15:54:55 -08:00
|
|
|
}
|
2011-05-12 17:24:54 +02:00
|
|
|
case (ast::or) {
|
2011-02-24 15:54:55 -08:00
|
|
|
if (val_is_bool(av) && val_is_bool(bv)) {
|
|
|
|
ret val_bool(val_as_bool(av) || val_as_bool(bv));
|
|
|
|
}
|
2011-04-08 18:44:20 +02:00
|
|
|
cx.sess.span_err(x.span, "bad types in '||' expression");
|
2011-02-24 15:54:55 -08:00
|
|
|
}
|
2011-05-12 17:24:54 +02:00
|
|
|
case (ast::eq) {
|
2011-04-08 18:44:20 +02:00
|
|
|
ret val_bool(val_eq(cx.sess, x.span, av, bv));
|
2011-02-24 15:54:55 -08:00
|
|
|
}
|
2011-05-12 17:24:54 +02:00
|
|
|
case (ast::ne) {
|
2011-06-15 11:19:50 -07:00
|
|
|
ret val_bool(!val_eq(cx.sess, x.span, av, bv));
|
2011-02-24 15:54:55 -08:00
|
|
|
}
|
|
|
|
case (_) {
|
2011-04-08 18:44:20 +02:00
|
|
|
cx.sess.span_err(x.span, "evaluating unsupported binop");
|
2011-02-24 15:54:55 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
case (_) {
|
2011-04-08 18:44:20 +02:00
|
|
|
cx.sess.span_err(x.span, "evaluating unsupported expression");
|
2011-02-24 15:54:55 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
fail;
|
|
|
|
}
|
|
|
|
|
2011-05-12 17:24:54 +02:00
|
|
|
fn val_eq(session::session sess, span sp, val av, val bv) -> bool {
|
2011-02-24 15:54:55 -08:00
|
|
|
if (val_is_bool(av) && val_is_bool(bv)) {
|
2011-06-14 14:09:14 -07:00
|
|
|
val_as_bool(av) == val_as_bool(bv)
|
|
|
|
} else if (val_is_int(av) && val_is_int(bv)) {
|
|
|
|
val_as_int(av) == val_as_int(bv)
|
|
|
|
} else if (val_is_str(av) && val_is_str(bv)) {
|
2011-06-15 11:19:50 -07:00
|
|
|
str::eq(val_as_str(av), val_as_str(bv))
|
|
|
|
} else { sess.span_err(sp, "bad types in comparison") }
|
2011-02-24 15:54:55 -08:00
|
|
|
}
|
|
|
|
|
2011-06-15 11:19:50 -07:00
|
|
|
fn eval_crate_directives(ctx cx, env e, vec[@ast::crate_directive] cdirs,
|
|
|
|
str prefix, &mutable vec[@ast::view_item] view_items,
|
|
|
|
&mutable vec[@ast::item] items) {
|
2011-05-12 17:24:54 +02:00
|
|
|
for (@ast::crate_directive sub_cdir in cdirs) {
|
2011-06-15 11:19:50 -07:00
|
|
|
eval_crate_directive(cx, e, sub_cdir, prefix, view_items, items);
|
2011-02-24 15:54:55 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-04-19 13:35:49 -07:00
|
|
|
fn eval_crate_directives_to_mod(ctx cx, env e,
|
2011-06-15 11:19:50 -07:00
|
|
|
vec[@ast::crate_directive] cdirs, str prefix)
|
|
|
|
-> ast::_mod {
|
2011-05-16 18:21:22 -07:00
|
|
|
let vec[@ast::view_item] view_items = [];
|
|
|
|
let vec[@ast::item] items = [];
|
2011-06-15 11:19:50 -07:00
|
|
|
eval_crate_directives(cx, e, cdirs, prefix, view_items, items);
|
2011-05-11 16:30:48 +02:00
|
|
|
ret rec(view_items=view_items, items=items);
|
2011-02-24 15:54:55 -08:00
|
|
|
}
|
|
|
|
|
2011-06-15 11:19:50 -07:00
|
|
|
fn eval_crate_directive_block(ctx cx, env e, &ast::block blk, str prefix,
|
|
|
|
&mutable vec[@ast::view_item] view_items,
|
|
|
|
&mutable vec[@ast::item] items) {
|
2011-05-12 17:24:54 +02:00
|
|
|
for (@ast::stmt s in blk.node.stmts) {
|
2011-02-24 15:54:55 -08:00
|
|
|
alt (s.node) {
|
2011-05-12 17:24:54 +02:00
|
|
|
case (ast::stmt_crate_directive(?cdir)) {
|
2011-06-15 11:19:50 -07:00
|
|
|
eval_crate_directive(cx, e, cdir, prefix, view_items, items);
|
2011-02-24 15:54:55 -08:00
|
|
|
}
|
|
|
|
case (_) {
|
2011-04-08 18:44:20 +02:00
|
|
|
cx.sess.span_err(s.span,
|
|
|
|
"unsupported stmt in crate-directive block");
|
2011-02-24 15:54:55 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-06-15 11:19:50 -07:00
|
|
|
fn eval_crate_directive_expr(ctx cx, env e, @ast::expr x, str prefix,
|
|
|
|
&mutable vec[@ast::view_item] view_items,
|
|
|
|
&mutable vec[@ast::item] items) {
|
2011-02-24 15:54:55 -08:00
|
|
|
alt (x.node) {
|
2011-05-12 17:24:54 +02:00
|
|
|
case (ast::expr_if(?cond, ?thn, ?elopt, _)) {
|
2011-04-08 18:44:20 +02:00
|
|
|
auto cv = eval_expr(cx, e, cond);
|
2011-02-24 15:54:55 -08:00
|
|
|
if (!val_is_bool(cv)) {
|
2011-04-08 18:44:20 +02:00
|
|
|
cx.sess.span_err(x.span, "bad cond type in 'if'");
|
2011-02-24 15:54:55 -08:00
|
|
|
}
|
|
|
|
if (val_as_bool(cv)) {
|
2011-06-15 11:19:50 -07:00
|
|
|
ret eval_crate_directive_block(cx, e, thn, prefix, view_items,
|
|
|
|
items);
|
2011-02-24 15:54:55 -08:00
|
|
|
}
|
|
|
|
alt (elopt) {
|
2011-05-31 00:39:19 -04:00
|
|
|
case (some(?els)) {
|
2011-04-08 18:44:20 +02:00
|
|
|
ret eval_crate_directive_expr(cx, e, els, prefix,
|
2011-05-11 16:30:48 +02:00
|
|
|
view_items, items);
|
2011-02-24 15:54:55 -08:00
|
|
|
}
|
|
|
|
case (_) {
|
|
|
|
// Absent-else is ok.
|
2011-06-15 11:19:50 -07:00
|
|
|
|
2011-02-24 15:54:55 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2011-05-12 17:24:54 +02:00
|
|
|
case (ast::expr_alt(?v, ?arms, _)) {
|
2011-04-08 18:44:20 +02:00
|
|
|
auto vv = eval_expr(cx, e, v);
|
2011-05-12 17:24:54 +02:00
|
|
|
for (ast::arm arm in arms) {
|
2011-02-24 15:54:55 -08:00
|
|
|
alt (arm.pat.node) {
|
2011-05-12 17:24:54 +02:00
|
|
|
case (ast::pat_lit(?lit, _)) {
|
2011-04-08 18:44:20 +02:00
|
|
|
auto pv = eval_lit(cx, arm.pat.span, lit);
|
|
|
|
if (val_eq(cx.sess, arm.pat.span, vv, pv)) {
|
2011-06-15 11:19:50 -07:00
|
|
|
ret eval_crate_directive_block(cx, e, arm.block,
|
|
|
|
prefix, view_items,
|
|
|
|
items);
|
2011-02-24 15:54:55 -08:00
|
|
|
}
|
|
|
|
}
|
2011-05-12 17:24:54 +02:00
|
|
|
case (ast::pat_wild(_)) {
|
2011-06-15 11:19:50 -07:00
|
|
|
ret eval_crate_directive_block(cx, e, arm.block,
|
|
|
|
prefix, view_items,
|
|
|
|
items);
|
2011-02-24 15:54:55 -08:00
|
|
|
}
|
|
|
|
case (_) {
|
2011-04-08 18:44:20 +02:00
|
|
|
cx.sess.span_err(arm.pat.span,
|
|
|
|
"bad pattern type in 'alt'");
|
2011-02-24 15:54:55 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2011-04-08 18:44:20 +02:00
|
|
|
cx.sess.span_err(x.span, "no cases matched in 'alt'");
|
2011-02-24 15:54:55 -08:00
|
|
|
}
|
2011-05-12 17:24:54 +02:00
|
|
|
case (ast::expr_block(?block, _)) {
|
2011-06-15 11:19:50 -07:00
|
|
|
ret eval_crate_directive_block(cx, e, block, prefix, view_items,
|
|
|
|
items);
|
2011-02-24 15:54:55 -08:00
|
|
|
}
|
2011-06-15 11:19:50 -07:00
|
|
|
case (_) { cx.sess.span_err(x.span, "unsupported expr type"); }
|
2011-02-24 15:54:55 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-06-15 11:19:50 -07:00
|
|
|
fn eval_crate_directive(ctx cx, env e, @ast::crate_directive cdir, str prefix,
|
|
|
|
&mutable vec[@ast::view_item] view_items,
|
|
|
|
&mutable vec[@ast::item] items) {
|
2011-02-24 15:54:55 -08:00
|
|
|
alt (cdir.node) {
|
2011-05-12 17:24:54 +02:00
|
|
|
case (ast::cdir_let(?id, ?x, ?cdirs)) {
|
2011-04-08 18:44:20 +02:00
|
|
|
auto v = eval_expr(cx, e, x);
|
2011-05-16 18:21:22 -07:00
|
|
|
auto e0 = [tup(id, v)] + e;
|
2011-06-15 11:19:50 -07:00
|
|
|
eval_crate_directives(cx, e0, cdirs, prefix, view_items, items);
|
2011-02-24 15:54:55 -08:00
|
|
|
}
|
2011-05-12 17:24:54 +02:00
|
|
|
case (ast::cdir_expr(?x)) {
|
2011-06-15 11:19:50 -07:00
|
|
|
eval_crate_directive_expr(cx, e, x, prefix, view_items, items);
|
2011-02-24 15:54:55 -08:00
|
|
|
}
|
2011-05-12 17:24:54 +02:00
|
|
|
case (ast::cdir_src_mod(?id, ?file_opt)) {
|
2011-02-24 15:54:55 -08:00
|
|
|
auto file_path = id + ".rs";
|
|
|
|
alt (file_opt) {
|
2011-06-15 11:19:50 -07:00
|
|
|
case (some(?f)) { file_path = f; }
|
|
|
|
case (none) { }
|
2011-02-24 15:54:55 -08:00
|
|
|
}
|
2011-05-12 17:24:54 +02:00
|
|
|
auto full_path = prefix + std::fs::path_sep() + file_path;
|
2011-06-15 11:19:50 -07:00
|
|
|
if (cx.mode == mode_depend) { cx.deps += [full_path]; ret; }
|
2011-04-08 18:44:20 +02:00
|
|
|
auto start_id = cx.p.next_def_id();
|
2011-06-15 11:19:50 -07:00
|
|
|
auto p0 =
|
|
|
|
new_parser(cx.sess, e, start_id, full_path, cx.chpos,
|
|
|
|
cx.next_ann);
|
2011-06-16 14:59:51 -07:00
|
|
|
auto inner_attrs = parse_inner_attributes(p0);
|
|
|
|
auto first_item_outer_attrs = inner_attrs._1;
|
|
|
|
auto m0 = parse_mod_items(p0, token::EOF,
|
|
|
|
first_item_outer_attrs);
|
2011-03-10 17:34:58 -05:00
|
|
|
auto next_id = p0.next_def_id();
|
2011-04-08 18:44:20 +02:00
|
|
|
// Thread defids and chpos through the parsers
|
2011-06-15 11:19:50 -07:00
|
|
|
|
2011-04-08 18:44:20 +02:00
|
|
|
cx.p.set_def(next_id._1);
|
|
|
|
cx.chpos = p0.get_chpos();
|
2011-05-12 13:25:18 +02:00
|
|
|
cx.next_ann = p0.next_ann_num();
|
2011-06-16 14:59:51 -07:00
|
|
|
auto i = front::parser::mk_item(cx.p, cdir.span.lo, cdir.span.hi,
|
|
|
|
id, ast::item_mod(m0),
|
|
|
|
inner_attrs._0);
|
2011-05-17 20:41:41 +02:00
|
|
|
vec::push[@ast::item](items, i);
|
2011-02-24 15:54:55 -08:00
|
|
|
}
|
2011-05-12 17:24:54 +02:00
|
|
|
case (ast::cdir_dir_mod(?id, ?dir_opt, ?cdirs)) {
|
2011-02-24 15:54:55 -08:00
|
|
|
auto path = id;
|
2011-06-15 11:19:50 -07:00
|
|
|
alt (dir_opt) { case (some(?d)) { path = d; } case (none) { } }
|
2011-05-12 17:24:54 +02:00
|
|
|
auto full_path = prefix + std::fs::path_sep() + path;
|
2011-04-08 18:44:20 +02:00
|
|
|
auto m0 = eval_crate_directives_to_mod(cx, e, cdirs, full_path);
|
2011-06-16 16:55:46 -07:00
|
|
|
auto i =
|
|
|
|
front::parser::mk_item(cx.p, cdir.span.lo, cdir.span.hi, id,
|
|
|
|
ast::item_mod(m0), []);
|
2011-05-17 20:41:41 +02:00
|
|
|
vec::push[@ast::item](items, i);
|
2011-02-24 15:54:55 -08:00
|
|
|
}
|
2011-05-12 17:24:54 +02:00
|
|
|
case (ast::cdir_view_item(?vi)) {
|
2011-05-17 20:41:41 +02:00
|
|
|
vec::push[@ast::view_item](view_items, vi);
|
2011-02-24 15:54:55 -08:00
|
|
|
}
|
2011-06-07 17:54:22 -07:00
|
|
|
case (ast::cdir_meta(?vi, ?mi)) {
|
2011-06-15 11:19:50 -07:00
|
|
|
if (vi == ast::export_meta) { cx.sess.add_metadata(mi); }
|
2011-04-18 09:22:23 +02:00
|
|
|
}
|
2011-06-15 11:19:50 -07:00
|
|
|
case (ast::cdir_syntax(?pth)) { }
|
|
|
|
case (ast::cdir_auth(?pth, ?eff)) { }
|
2011-02-24 15:54:55 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
//
|
|
|
|
// Local Variables:
|
|
|
|
// mode: rust
|
|
|
|
// fill-column: 78;
|
|
|
|
// indent-tabs-mode: nil
|
|
|
|
// c-basic-offset: 4
|
|
|
|
// buffer-file-coding-system: utf-8-unix
|
2011-03-25 15:07:27 -07:00
|
|
|
// compile-command: "make -k -C $RBUILD 2>&1 | sed -e 's/\\/x\\//x:\\//g'";
|
2011-02-24 15:54:55 -08:00
|
|
|
// End:
|
|
|
|
//
|