Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
18115135
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,发现更多精彩内容 >>
提交
18115135
编写于
5月 31, 2011
作者:
G
Graydon Hoare
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix long lines
上级
371c2568
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
16 addition
and
8 deletion
+16
-8
src/comp/pretty/pp.rs
src/comp/pretty/pp.rs
+6
-4
src/comp/pretty/pprust.rs
src/comp/pretty/pprust.rs
+10
-4
未找到文件。
src/comp/pretty/pp.rs
浏览文件 @
18115135
...
...
@@ -443,13 +443,15 @@ fn indent(int amount) {
}
fn
print
(
token
x
,
int
L
)
{
log
#
fmt
(
"print %s %d (remaining line space=%d)"
,
tok_str
(
x
),
L
,
space
);
log
#
fmt
(
"print %s %d (remaining line space=%d)"
,
tok_str
(
x
),
L
,
space
);
log
buf_str
(
token
,
size
,
left
,
right
,
6u
);
alt
(
x
)
{
case
(
BEGIN
(
?
b
))
{
if
(
L
>
space
)
{
auto
col
=
(
margin
-
space
)
+
b
.offset
;
log
#
fmt
(
"print BEGIN -> push broken block at col %d"
,
col
);
log
#
fmt
(
"print BEGIN -> push broken block at col %d"
,
col
);
vec
::
push
(
print_stack
,
rec
(
offset
=
col
,
pbreak
=
broken
(
b
.breaks
)));
...
...
@@ -491,11 +493,11 @@ fn print(token x, int L) {
case
(
broken
(
inconsistent
))
{
if
(
L
>
space
)
{
log
"print BREAK w/ newline in inconsistent
block
"
;
log
"print BREAK w/ newline in inconsistent"
;
self
.print_newline
(
top
.offset
+
b
.offset
);
space
=
margin
-
(
top
.offset
+
b
.offset
);
}
else
{
log
"print BREAK w/o newline in inconsistent
block
"
;
log
"print BREAK w/o newline in inconsistent"
;
self
.indent
(
b
.blank_space
);
space
-=
b
.blank_space
;
}
...
...
src/comp/pretty/pprust.rs
浏览文件 @
18115135
...
...
@@ -72,8 +72,11 @@ fn block_to_str(&ast::block blk) -> str {
comments
=
option
::
none
[
vec
[
lexer
::
cmnt
]],
mutable
cur_cmnt
=
0u
,
mode
=
mo_untyped
);
cbox
(
s
.s
,
indent_unit
);
// containing cbox, will be closed by print-block at }
ibox
(
s
.s
,
0u
);
// head-ibox, will be closed by print-block after {
// containing cbox, will be closed by print-block at }
cbox
(
s
.s
,
indent_unit
);
// head-ibox, will be closed by print-block after {
ibox
(
s
.s
,
0u
);
print_block
(
s
,
blk
);
eof
(
s
.s
);
ret
writer
.get_str
();
...
...
@@ -657,8 +660,11 @@ fn print_opt(ps s, &option::t[@ast::expr] expr) {
bclose
(
s
,
expr
.span
);
}
case
(
ast
::
expr_block
(
?
block
,
_
))
{
cbox
(
s
.s
,
indent_unit
);
// containing cbox, will be closed by print-block at }
ibox
(
s
.s
,
0u
);
// head-box, will be closed by print-block after {
// containing cbox, will be closed by print-block at }
cbox
(
s
.s
,
indent_unit
);
// head-box, will be closed by print-block after {
ibox
(
s
.s
,
0u
);
print_block
(
s
,
block
);
}
case
(
ast
::
expr_assign
(
?
lhs
,
?
rhs
,
_
))
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录