Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
fa5ba17c
R
Rust
项目概览
int
/
Rust
接近 1 年 前同步成功
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
Rust
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
fa5ba17c
编写于
3月 29, 2013
作者:
J
John Clements
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
parser comments
parser comments
上级
1b4ced8b
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
20 addition
and
6 deletion
+20
-6
src/libsyntax/parse/attr.rs
src/libsyntax/parse/attr.rs
+7
-0
src/libsyntax/parse/parser.rs
src/libsyntax/parse/parser.rs
+8
-6
src/libsyntax/syntax.rc
src/libsyntax/syntax.rc
+5
-0
未找到文件。
src/libsyntax/parse/attr.rs
浏览文件 @
fa5ba17c
...
...
@@ -62,12 +62,14 @@ fn parse_outer_attributes(&self) -> ~[ast::attribute] {
return
attrs
;
}
// matches attribute = # attribute_naked
fn
parse_attribute
(
&
self
,
style
:
ast
::
attr_style
)
->
ast
::
attribute
{
let
lo
=
self
.span.lo
;
self
.expect
(
&
token
::
POUND
);
return
self
.parse_attribute_naked
(
style
,
lo
);
}
// matches attribute_naked = [ meta_item ]
fn
parse_attribute_naked
(
&
self
,
style
:
ast
::
attr_style
,
lo
:
BytePos
)
->
ast
::
attribute
{
self
.expect
(
&
token
::
LBRACKET
);
...
...
@@ -86,6 +88,7 @@ fn parse_attribute_naked(&self, style: ast::attr_style, lo: BytePos) ->
// is an inner attribute of the containing item or an outer attribute of
// the first contained item until we see the semi).
// matches inner_attrs* outer_attr?
// you can make the 'next' field an Option, but the result is going to be
// more useful as a vector.
fn
parse_inner_attrs_and_next
(
&
self
)
->
...
...
@@ -134,6 +137,9 @@ fn parse_inner_attrs_and_next(&self) ->
(
inner_attrs
,
next_outer_attrs
)
}
// matches meta_item = IDENT
// | IDENT = lit
// | IDENT meta_seq
fn
parse_meta_item
(
&
self
)
->
@
ast
::
meta_item
{
let
lo
=
self
.span.lo
;
let
name
=
self
.id_to_str
(
self
.parse_ident
());
...
...
@@ -156,6 +162,7 @@ fn parse_meta_item(&self) -> @ast::meta_item {
}
}
// matches meta_seq = ( COMMASEP(meta_item) )
fn
parse_meta_seq
(
&
self
)
->
~
[
@
ast
::
meta_item
]
{
copy
self
.parse_seq
(
&
token
::
LPAREN
,
...
...
src/libsyntax/parse/parser.rs
浏览文件 @
fa5ba17c
...
...
@@ -870,6 +870,7 @@ fn maybe_parse_fixed_vstore(&self) -> Option<@ast::expr> {
}
}
// matches token_lit = LIT_INT | ...
fn
lit_from_token
(
&
self
,
tok
:
&
token
::
Token
)
->
lit_
{
match
*
tok
{
token
::
LIT_INT
(
i
,
it
)
=>
lit_int
(
i
,
it
),
...
...
@@ -884,6 +885,7 @@ fn lit_from_token(&self, tok: &token::Token) -> lit_ {
}
}
// matches lit = true | false | token_lit
fn
parse_lit
(
&
self
)
->
lit
{
let
lo
=
self
.span.lo
;
let
lit
=
if
self
.eat_keyword
(
&~
"true"
)
{
...
...
@@ -2762,8 +2764,6 @@ fn parse_optional_onceness(&self) -> ast::Onceness {
// matches optbounds = ( ( : ( boundseq )? )? )
// where boundseq = ( bound + boundseq ) | bound
// and bound = ( 'static ) | ty
// you might want to insist on the boundseq having seen the colon, but
// that's not currently in place.
fn
parse_optional_ty_param_bounds
(
&
self
)
->
@
OptVec
<
TyParamBound
>
{
if
!
self
.eat
(
&
token
::
COLON
)
{
return
@
opt_vec
::
Empty
;
...
...
@@ -3085,6 +3085,7 @@ fn parse_fn_block_decl(&self) -> fn_decl {
}
}
// matches fn_header = IDENT generics
// parse the name and optional generic types of a function header.
fn
parse_fn_header
(
&
self
)
->
(
ident
,
ast
::
Generics
)
{
let
id
=
self
.parse_ident
();
...
...
@@ -3436,7 +3437,7 @@ fn parse_mod_items(&self, term: token::Token,
let
attrs_remaining_len
=
attrs_remaining
.len
();
// looks like this code depends on the invariant that
// outer attributes can't occur on view items (or macro
s
// outer attributes can't occur on view items (or macro
// invocations?)
let
mut
first
=
true
;
while
*
self
.token
!=
term
{
...
...
@@ -3449,9 +3450,9 @@ fn parse_mod_items(&self, term: token::Token,
attrs
);
match
self
.parse_item_or_view_item
(
/*bad*/
copy
attrs
,
true
,
false
,
true
true
,
// items allowed
false
,
// foreign items allowed
true
// macros allowed
)
{
iovi_item
(
item
)
=>
items
.push
(
item
),
iovi_view_item
(
view_item
)
=>
{
...
...
@@ -3706,6 +3707,7 @@ fn parse_foreign_mod_items(&self, sort: ast::foreign_mod_sort,
}
}
// parse extern mod foo { ... } or extern { ... }
fn
parse_item_foreign_mod
(
&
self
,
lo
:
BytePos
,
opt_abis
:
Option
<
AbiSet
>
,
...
...
src/libsyntax/syntax.rc
浏览文件 @
fa5ba17c
...
...
@@ -8,6 +8,11 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
/*! This module contains the Rust parser. It maps source text
* to token trees and to ASTs. It contains code for expanding
* macros.
*/
#[link(name = "syntax",
vers = "0.7-pre",
uuid = "9311401b-d6ea-4cd9-a1d9-61f89499c645")];
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录