我想知道,如果铛格式可以设置,以减少非compound_statement成{ non-compound_statement; }在iteration_statement.
statement
: labeled_statement
| compound_statement
| expression_statement
| selection_statement
| iteration_statement
| jump_statement
;
iteration_statement
: WHILE '(' expression ')' statement
| DO statement WHILE '(' expression ')' ';'
| FOR '(' expression_statement expression_statement ')' statement
| FOR '(' expression_statement expression_statement expression ')' statement
;
Run Code Online (Sandbox Code Playgroud)
例
输入:
if (exp) foo = 1;
Run Code Online (Sandbox Code Playgroud)
输出:
if (exp) { foo = 1; }
Run Code Online (Sandbox Code Playgroud)
然后美化师会根据需要缩进.
视图没有 rowid,这是预期的吗?例子:
create table t2 (u text);
insert into t2 values ('x');
insert into t2 values ('y');
create table t1 (t text, i integer);
insert into t1 values ('a',1);
insert into t1 values ('b',2);
insert into t1 values ('c',1);
insert into t1 values ('d',2);
create view v as select * from t1 join t2 on t1.i=t2.rowid;
select rowid,* from t1;
ro t i
-- -- --
1 a 1
2 b 2
3 c 1
4 d 2
select rowid,* …Run Code Online (Sandbox Code Playgroud) 我尝试在bash中使用lastpipe选项,当从交互式提示命令行运行时,它似乎无法按预期工作.
phi@phiz:~$ shopt lastpipe
lastpipe on
phi@phiz:~$ echo $BASH_VERSION
4.3.11(1)-release
phi@phiz:~$ echo yo | read a ; echo "a='$a'"
a=''
Run Code Online (Sandbox Code Playgroud)
所以我在$ a中没有得到任何东西,但是如果在子流程中运行它有点工作虽然没用我在顶级交互中需要它
phi@phiz:~$ (echo yo | read a ; echo "a='$a'")
a='yo'
Run Code Online (Sandbox Code Playgroud)
这种行为有望吗?我完成了我的RTFM职责,无法确定这是出于意图还是出乎意料.
我是bash的新手,当来自其他炮弹时,这让人感到困惑
提前感谢任何建议.