diff options
author | John Hodge <tpg@mutabah.net> | 2015-05-20 15:22:00 +0800 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2015-05-20 15:22:00 +0800 |
commit | 71f33986378cbf01ea33490a095244a28a907f15 (patch) | |
tree | 8323d89bcc935dc1bbb68b366f8e9cf66cd261c1 | |
parent | d0e38eff804b9f085bf8a3f0a3db4805fde72e05 (diff) | |
download | mrust-71f33986378cbf01ea33490a095244a28a907f15.tar.gz |
(old) BNF update
-rw-r--r-- | bnf/Makefile | 1 | ||||
-rw-r--r-- | bnf/rust.lex | 1 | ||||
-rw-r--r-- | bnf/rust.y | 7 |
3 files changed, 8 insertions, 1 deletions
diff --git a/bnf/Makefile b/bnf/Makefile index 75465648..1bd962d4 100644 --- a/bnf/Makefile +++ b/bnf/Makefile @@ -5,6 +5,7 @@ all: test.bin test: test.bin ../samples/1.rs ./test.bin < ../samples/1.rs +# ./test.bin < ../../../RustPorts/OS/libcore/lib.rs test.bin: rust.tab.c rust.lex.c gcc rust.tab.c rust.lex.c -o $@ diff --git a/bnf/rust.lex b/bnf/rust.lex index dc06d06a..21de6d92 100644 --- a/bnf/rust.lex +++ b/bnf/rust.lex @@ -38,6 +38,7 @@ ident_c [a-zA-Z_] "pub" { return RWD_pub; } "let" { return RWD_let; } +"ref" { return RWD_ref; } "self" { return RWD_self; } "super" { return RWD_super; } @@ -6,7 +6,7 @@ %token DOUBLEEQUAL EXCLAMEQUAL DOUBLEPIPE DOUBLEAMP %token DOUBLELT DOUBLEGT %token RWD_mod RWD_fn RWD_const RWD_static RWD_use RWD_struct RWD_enum RWD_trait RWD_impl RWD_type -%token RWD_as RWD_mut RWD_pub RWD_where +%token RWD_as RWD_mut RWD_ref RWD_pub RWD_where %token RWD_let %token RWD_self RWD_super %token RWD_match RWD_if RWD_while RWD_loop RWD_for RWD_else @@ -300,7 +300,12 @@ struct_pattern refutable_pattern : IDENT { /* maybe bind */ } | IDENT '@' nonbind_pattern + | RWD_ref IDENT + | RWD_ref IDENT '@' nonbind_pattern + | RWD_ref RWD_mut IDENT + | RWD_ref RWD_mut IDENT '@' nonbind_pattern | '&' refutable_pattern + | '&' RWD_mut refutable_pattern | nonbind_pattern; nonbind_pattern |