Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Annlix
ShellCheck
提交
5b14dba4
S
ShellCheck
项目概览
Annlix
/
ShellCheck
与 Fork 源项目一致
Fork自
镜像 / koalaman / ShellCheck
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
ShellCheck
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
5b14dba4
编写于
1月 13, 2018
作者:
V
Vidar Holen
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Parse 'else if' correctly, and not like elif. Fixes #1088.
上级
ee997fde
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
10 addition
and
9 deletion
+10
-9
CHANGELOG.md
CHANGELOG.md
+3
-0
ShellCheck/Parser.hs
ShellCheck/Parser.hs
+7
-9
未找到文件。
CHANGELOG.md
浏览文件 @
5b14dba4
...
...
@@ -2,6 +2,9 @@
### Added
-
SC2223: Quote warning specific to
`: ${var=value}`
### Changed
-
SC1073: 'else if' is now parsed correctly and not like 'elif'
## v0.4.7 - 2017-12-08
### Added
-
Statically linked binaries for Linux and Windows (see README.md)!
...
...
ShellCheck/Parser.hs
浏览文件 @
5b14dba4
...
...
@@ -2035,7 +2035,7 @@ skipAnnotationAndWarn = optional $ do
prop_readIfClause
=
isOk
readIfClause
"if false; then foo; elif true; then stuff; more stuff; else cows; fi"
prop_readIfClause2
=
isWarning
readIfClause
"if false; then; echo oo; fi"
prop_readIfClause3
=
isWarning
readIfClause
"if false; then true; else; echo lol; fi"
prop_readIfClause4
=
isWarning
readIfClause
"if false; then true; else if true; then echo lol; fi"
prop_readIfClause4
=
isWarning
readIfClause
"if false; then true; else if true; then echo lol; fi
; fi
"
prop_readIfClause5
=
isOk
readIfClause
"if false; then true; else
\n
if true; then echo lol; fi; fi"
readIfClause
=
called
"if expression"
$
do
id
<-
getNextId
...
...
@@ -2080,12 +2080,9 @@ readIfPart = do
readElifPart
=
called
"elif clause"
$
do
pos
<-
getPosition
correctElif
<-
elif
unless
correctElif
$
parseProblemAt
pos
ErrorC
1075
"Use 'elif' instead of 'else if' (or put 'if' on new line if nesting)."
g_Elif
allspacing
condition
<-
readTerm
ifNextToken
(
g_Fi
<|>
g_Elif
<|>
g_Else
)
$
parseProblemAt
pos
ErrorC
1049
"Did you forget the 'then' for this 'elif'?"
...
...
@@ -2095,13 +2092,14 @@ readElifPart = called "elif clause" $ do
verifyNotEmptyIf
"then"
action
<-
readTerm
return
(
condition
,
action
)
where
elif
=
(
g_Elif
>>
return
True
)
<|>
try
(
g_Else
>>
g_If
>>
return
False
)
readElsePart
=
called
"else clause"
$
do
pos
<-
getPosition
g_Else
optional
$
do
try
.
lookAhead
$
g_If
parseProblemAt
pos
ErrorC
1075
"Use 'elif' instead of 'else if' (or put 'if' on new line if nesting)."
acceptButWarn
g_Semi
ErrorC
1053
"Semicolons directly after 'else' are not allowed. Just remove it."
allspacing
verifyNotEmptyIf
"else"
...
...
@@ -2917,7 +2915,7 @@ parseShell env name contents = do
isName
_
=
False
notesForContext
list
=
zipWith
(
$
)
[
first
,
second
]
$
filter
isName
list
first
(
ContextName
pos
str
)
=
ParseNote
pos
pos
ErrorC
1073
$
"Couldn't parse this "
++
str
++
"."
"Couldn't parse this "
++
str
++
".
Fix to allow more checks.
"
second
(
ContextName
pos
str
)
=
ParseNote
pos
pos
InfoC
1009
$
"The mentioned parser error was in this "
++
str
++
"."
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录