Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OP-TEE
busybox
提交
717200eb
B
busybox
项目概览
OP-TEE
/
busybox
通知
0
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
B
busybox
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
717200eb
编写于
7月 03, 2021
作者:
D
Denys Vlasenko
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
awk: rename GRPSTART/END to L/RBRACE, no code changes
Signed-off-by:
N
Denys Vlasenko
<
vda.linux@googlemail.com
>
上级
b705bf55
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
33 addition
and
27 deletion
+33
-27
editors/awk.c
editors/awk.c
+33
-27
未找到文件。
editors/awk.c
浏览文件 @
717200eb
...
...
@@ -211,8 +211,8 @@ typedef struct tsplitter_s {
#define TC_PIPE (1 << 9)
/* input redirection pipe | */
#define TC_UOPPRE2 (1 << 10)
/* unary prefix operator + - ! */
#define TC_ARRTERM (1 << 11)
/* ] */
#define TC_
GRPSTART
(1 << 12)
/* { */
#define TC_
GRPTERM
(1 << 13)
/* } */
#define TC_
LBRACE
(1 << 12)
/* { */
#define TC_
RBRACE
(1 << 13)
/* } */
#define TC_SEMICOL (1 << 14)
/* ; */
#define TC_NEWLINE (1 << 15)
#define TC_STATX (1 << 16)
/* ctl statement (for, next...) */
...
...
@@ -250,8 +250,8 @@ if ((n) & TC_COMMA ) debug_printf_parse(" COMMA" ); \
if ((n) & TC_PIPE ) debug_printf_parse(" PIPE" ); \
if ((n) & TC_UOPPRE2 ) debug_printf_parse(" UOPPRE2" ); \
if ((n) & TC_ARRTERM ) debug_printf_parse(" ARRTERM" ); \
if ((n) & TC_
GRPSTART) debug_printf_parse(" GRPSTART"
); \
if ((n) & TC_
GRPTERM ) debug_printf_parse(" GRPTERM"
); \
if ((n) & TC_
LBRACE ) debug_printf_parse(" LBRACE"
); \
if ((n) & TC_
RBRACE ) debug_printf_parse(" RBRACE"
); \
if ((n) & TC_SEMICOL ) debug_printf_parse(" SEMICOL" ); \
if ((n) & TC_NEWLINE ) debug_printf_parse(" NEWLINE" ); \
if ((n) & TC_STATX ) debug_printf_parse(" STATX" ); \
...
...
@@ -291,13 +291,13 @@ if ((n) & TC_NUMBER ) debug_printf_parse(" NUMBER" ); \
| TC_FUNCDECL | TC_BEGIN | TC_END)
/* discard newlines after these */
#define TS_NOTERM (TC_COMMA | TC_
GRPSTART | TC_GRPTERM
\
#define TS_NOTERM (TC_COMMA | TC_
LBRACE | TC_RBRACE
\
| TS_BINOP | TS_OPTERM)
/* what can expression begin with */
#define TS_OPSEQ (TS_OPERAND | TS_UOPPRE | TC_REGEXP)
/* what can group begin with */
#define TS_GRPSEQ (TS_OPSEQ | TS_OPTERM | TS_STATEMNT | TC_
GRPSTART
)
#define TS_GRPSEQ (TS_OPSEQ | TS_OPTERM | TS_STATEMNT | TC_
LBRACE
)
/* if previous token class is CONCAT_L and next is CONCAT_R, concatenation */
/* operator is inserted between them */
...
...
@@ -402,8 +402,8 @@ static const char tokenlist[] ALIGN1 =
"
\1
|"
NTC
/* TC_PIPE */
"
\1
+"
"
\1
-"
"
\1
!"
NTC
/* TC_UOPPRE2 */
"
\1
]"
NTC
/* TC_ARRTERM */
"
\1
{"
NTC
/* TC_
GRPSTART
*/
"
\1
}"
NTC
/* TC_
GRPTERM
*/
"
\1
{"
NTC
/* TC_
LBRACE
*/
"
\1
}"
NTC
/* TC_
RBRACE
*/
"
\1
;"
NTC
/* TC_SEMICOL */
"
\1\n
"
NTC
/* TC_NEWLINE */
"
\2
if"
"
\2
do"
"
\3
for"
"
\5
break"
/* TC_STATX */
...
...
@@ -1471,7 +1471,7 @@ static node *parse_expr(uint32_t term_tc)
debug_printf_parse
(
"%s: TC_LENGTH
\n
"
,
__func__
);
tc
=
next_token
(
TC_LPAREN
/* length(...) */
|
TS_OPTERM
/* length; (or newline)*/
|
TC_
GRPTERM
/* length } */
|
TC_
RBRACE
/* length } */
|
TC_BINOPX
/* length <op> NUM */
|
TC_COMMA
/* print length, 1 */
);
...
...
@@ -1516,11 +1516,11 @@ static void chain_expr(uint32_t info)
n
=
chain_node
(
info
);
n
->
l
.
n
=
parse_expr
(
TS_OPTERM
|
TC_
GRPTERM
);
n
->
l
.
n
=
parse_expr
(
TS_OPTERM
|
TC_
RBRACE
);
if
((
info
&
OF_REQUIRED
)
&&
!
n
->
l
.
n
)
syntax_error
(
EMSG_TOO_FEW_ARGS
);
if
(
t_tclass
&
TC_
GRPTERM
)
if
(
t_tclass
&
TC_
RBRACE
)
rollback_token
();
}
...
...
@@ -1559,16 +1559,16 @@ static void chain_group(void)
c
=
next_token
(
TS_GRPSEQ
);
}
while
(
c
&
TC_NEWLINE
);
if
(
c
&
TC_
GRPSTART
)
{
debug_printf_parse
(
"%s: TC_
GRPSTART
\n
"
,
__func__
);
while
((
c
=
next_token
(
TS_GRPSEQ
|
TC_
GRPTERM
))
!=
TC_GRPTERM
)
{
debug_printf_parse
(
"%s: !TC_
GRPTERM
\n
"
,
__func__
);
if
(
c
&
TC_
LBRACE
)
{
debug_printf_parse
(
"%s: TC_
LBRACE
\n
"
,
__func__
);
while
((
c
=
next_token
(
TS_GRPSEQ
|
TC_
RBRACE
))
!=
TC_RBRACE
)
{
debug_printf_parse
(
"%s: !TC_
RBRACE
\n
"
,
__func__
);
if
(
c
&
TC_NEWLINE
)
continue
;
rollback_token
();
chain_group
();
}
debug_printf_parse
(
"%s: TC_
GRPTERM
\n
"
,
__func__
);
debug_printf_parse
(
"%s: TC_
RBRACE
\n
"
,
__func__
);
return
;
}
if
(
c
&
(
TS_OPSEQ
|
TS_OPTERM
))
{
...
...
@@ -1588,7 +1588,7 @@ static void chain_group(void)
chain_group
();
n2
=
chain_node
(
OC_EXEC
);
n
->
r
.
n
=
seq
->
last
;
if
(
next_token
(
TS_GRPSEQ
|
TC_
GRPTERM
|
TC_ELSE
)
==
TC_ELSE
)
{
if
(
next_token
(
TS_GRPSEQ
|
TC_
RBRACE
|
TC_ELSE
)
==
TC_ELSE
)
{
chain_group
();
n2
->
a
.
n
=
seq
->
last
;
}
else
{
...
...
@@ -1641,12 +1641,12 @@ static void chain_group(void)
case
OC_PRINTF
:
debug_printf_parse
(
"%s: OC_PRINT[F]
\n
"
,
__func__
);
n
=
chain_node
(
t_info
);
n
->
l
.
n
=
parse_expr
(
TS_OPTERM
|
TC_OUTRDR
|
TC_
GRPTERM
);
n
->
l
.
n
=
parse_expr
(
TS_OPTERM
|
TC_OUTRDR
|
TC_
RBRACE
);
if
(
t_tclass
&
TC_OUTRDR
)
{
n
->
info
|=
t_info
;
n
->
r
.
n
=
parse_expr
(
TS_OPTERM
|
TC_
GRPTERM
);
n
->
r
.
n
=
parse_expr
(
TS_OPTERM
|
TC_
RBRACE
);
}
if
(
t_tclass
&
TC_
GRPTERM
)
if
(
t_tclass
&
TC_
RBRACE
)
rollback_token
();
break
;
...
...
@@ -1684,7 +1684,7 @@ static void parse_program(char *p)
g_pos
=
p
;
t_lineno
=
1
;
while
((
tclass
=
next_token
(
TC_EOF
|
TS_OPSEQ
|
TC_
GRPSTART
|
while
((
tclass
=
next_token
(
TC_EOF
|
TS_OPSEQ
|
TC_
LBRACE
|
TS_OPTERM
|
TC_BEGIN
|
TC_END
|
TC_FUNCDECL
))
!=
TC_EOF
)
{
if
(
tclass
&
TS_OPTERM
)
{
...
...
@@ -1696,10 +1696,14 @@ static void parse_program(char *p)
if
(
tclass
&
TC_BEGIN
)
{
debug_printf_parse
(
"%s: TC_BEGIN
\n
"
,
__func__
);
seq
=
&
beginseq
;
//TODO: ensure there is no newline between BEGIN and {
//next_token(TC_LBRACE); rollback_token();
chain_group
();
}
else
if
(
tclass
&
TC_END
)
{
debug_printf_parse
(
"%s: TC_END
\n
"
,
__func__
);
seq
=
&
endseq
;
//TODO: ensure there is no newline between END and {
//next_token(TC_LBRACE); rollback_token();
chain_group
();
}
else
if
(
tclass
&
TC_FUNCDECL
)
{
debug_printf_parse
(
"%s: TC_FUNCDECL
\n
"
,
__func__
);
...
...
@@ -1726,24 +1730,26 @@ static void parse_program(char *p)
/* it was a comma, we ate it */
}
seq
=
&
f
->
body
;
//TODO: ensure there is { after "func F(...)" - but newlines are allowed
//while (next_token(TC_LBRACE | TC_NEWLINE) == TC_NEWLINE) continue; rollback_token();
chain_group
();
hash_clear
(
ahash
);
}
else
if
(
tclass
&
TS_OPSEQ
)
{
debug_printf_parse
(
"%s: TS_OPSEQ
\n
"
,
__func__
);
rollback_token
();
cn
=
chain_node
(
OC_TEST
);
cn
->
l
.
n
=
parse_expr
(
TS_OPTERM
|
TC_EOF
|
TC_
GRPSTART
);
if
(
t_tclass
&
TC_
GRPSTART
)
{
debug_printf_parse
(
"%s: TC_
GRPSTART
\n
"
,
__func__
);
cn
->
l
.
n
=
parse_expr
(
TS_OPTERM
|
TC_EOF
|
TC_
LBRACE
);
if
(
t_tclass
&
TC_
LBRACE
)
{
debug_printf_parse
(
"%s: TC_
LBRACE
\n
"
,
__func__
);
rollback_token
();
chain_group
();
}
else
{
debug_printf_parse
(
"%s: !TC_
GRPSTART
\n
"
,
__func__
);
debug_printf_parse
(
"%s: !TC_
LBRACE
\n
"
,
__func__
);
chain_node
(
OC_PRINT
);
}
cn
->
r
.
n
=
mainseq
.
last
;
}
else
/* if (tclass & TC_
GRPSTART
) */
{
debug_printf_parse
(
"%s: TC_
GRPSTART
(?)
\n
"
,
__func__
);
}
else
/* if (tclass & TC_
LBRACE
) */
{
debug_printf_parse
(
"%s: TC_
LBRACE
(?)
\n
"
,
__func__
);
rollback_token
();
chain_group
();
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录