Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Annlix
ShellCheck
提交
5794f3d3
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,发现更多精彩内容 >>
提交
5794f3d3
编写于
6月 21, 2013
作者:
V
Vidar Holen
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fixed parsing of "test$"
上级
092073d0
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
11 addition
and
9 deletion
+11
-9
ShellCheck/Parser.hs
ShellCheck/Parser.hs
+11
-9
未找到文件。
ShellCheck/Parser.hs
浏览文件 @
5794f3d3
...
@@ -325,7 +325,7 @@ readConditionContents single = do
...
@@ -325,7 +325,7 @@ readConditionContents single = do
-- Currently a bit of a hack since parsing rules are obscure
-- Currently a bit of a hack since parsing rules are obscure
regexOperatorAhead
=
(
lookAhead
$
do
regexOperatorAhead
=
(
lookAhead
$
do
try
(
string
"=~"
)
<|>
try
(
string
"~="
)
try
(
string
"=~"
)
<|>
try
(
string
"~="
)
return
True
)
return
True
)
<|>
return
False
<|>
return
False
readRegex
=
called
"regex"
$
do
readRegex
=
called
"regex"
$
do
id
<-
getNextId
id
<-
getNextId
...
@@ -407,7 +407,7 @@ readArithmeticContents =
...
@@ -407,7 +407,7 @@ readArithmeticContents =
readExpansion
=
do
readExpansion
=
do
id
<-
getNextId
id
<-
getNextId
x
<-
readDollar
x
<-
read
Normal
Dollar
spacing
spacing
return
$
TA_Expansion
id
x
return
$
TA_Expansion
id
x
...
@@ -587,7 +587,7 @@ checkPossibleTermination _ _ = return ()
...
@@ -587,7 +587,7 @@ checkPossibleTermination _ _ = return ()
readNormalWordPart
end
=
do
readNormalWordPart
end
=
do
checkForParenthesis
checkForParenthesis
readSingleQuoted
<|>
readDoubleQuoted
<|>
readGlob
<|>
readDollar
<|>
readBraced
<|>
readBackTicked
<|>
readProcSub
<|>
(
readNormalLiteral
end
)
readSingleQuoted
<|>
readDoubleQuoted
<|>
readGlob
<|>
read
Normal
Dollar
<|>
readBraced
<|>
readBackTicked
<|>
readProcSub
<|>
(
readNormalLiteral
end
)
where
where
checkForParenthesis
=
do
checkForParenthesis
=
do
return
()
`
attempting
`
do
return
()
`
attempting
`
do
...
@@ -606,7 +606,7 @@ readDollarBracedWord = do
...
@@ -606,7 +606,7 @@ readDollarBracedWord = do
list
<-
many
readDollarBracedPart
list
<-
many
readDollarBracedPart
return
$
T_NormalWord
id
list
return
$
T_NormalWord
id
list
readDollarBracedPart
=
readSingleQuoted
<|>
readDoubleQuoted
<|>
readExtglob
<|>
readDollar
<|>
readBackTicked
<|>
readDollarBracedLiteral
readDollarBracedPart
=
readSingleQuoted
<|>
readDoubleQuoted
<|>
readExtglob
<|>
read
Normal
Dollar
<|>
readBackTicked
<|>
readDollarBracedLiteral
readDollarBracedLiteral
=
do
readDollarBracedLiteral
=
do
id
<-
getNextId
id
<-
getNextId
...
@@ -670,7 +670,7 @@ readDoubleQuoted = called "double quoted string" $ do
...
@@ -670,7 +670,7 @@ readDoubleQuoted = called "double quoted string" $ do
doubleQuote
<?>
"end of double quoted string"
doubleQuote
<?>
"end of double quoted string"
return
$
T_DoubleQuoted
id
x
return
$
T_DoubleQuoted
id
x
doubleQuotedPart
=
readDoubleLiteral
<|>
readDollar
<|>
readBackTicked
doubleQuotedPart
=
readDoubleLiteral
<|>
readDo
ubleQuotedDo
llar
<|>
readBackTicked
readDoubleQuotedLiteral
=
do
readDoubleQuotedLiteral
=
do
doubleQuote
doubleQuote
...
@@ -817,8 +817,9 @@ readBraced = try $ do
...
@@ -817,8 +817,9 @@ readBraced = try $ do
char
'}'
char
'}'
return
$
T_BraceExpansion
id
$
concat
str
return
$
T_BraceExpansion
id
$
concat
str
readDollar
=
readDollarExpression
<|>
readDollarLonely
readNormalDollar
=
readDollarExpression
<|>
readDollarLonely
<|>
readDollarDoubleQuote
readDollarExpression
=
readDollarArithmetic
<|>
readDollarBraced
<|>
readDollarExpansion
<|>
readDollarVariable
<|>
readDollarSingleQuote
<|>
readDollarDoubleQuote
readDoubleQuotedDollar
=
readDollarExpression
<|>
readDollarLonely
readDollarExpression
=
readDollarArithmetic
<|>
readDollarBraced
<|>
readDollarExpansion
<|>
readDollarVariable
<|>
readDollarSingleQuote
prop_readDollarSingleQuote
=
isOk
readDollarSingleQuote
"$'foo
\\\'
lol'"
prop_readDollarSingleQuote
=
isOk
readDollarSingleQuote
"$'foo
\\\'
lol'"
readDollarSingleQuote
=
called
"$'..' expression"
$
do
readDollarSingleQuote
=
called
"$'..' expression"
$
do
...
@@ -908,9 +909,10 @@ readVariableName = do
...
@@ -908,9 +909,10 @@ readVariableName = do
readDollarLonely
=
do
readDollarLonely
=
do
id
<-
getNextId
id
<-
getNextId
pos
<-
getPosition
char
'$'
char
'$'
n
<-
lookAhead
(
anyChar
<|>
(
eof
>>
return
'_'
))
n
<-
lookAhead
(
anyChar
<|>
(
eof
>>
return
'_'
))
when
(
n
/=
'
\'
'
)
$
parseNote
StyleC
"$ is not used specially and should therefore be escaped."
when
(
n
/=
'
\'
'
)
$
parseNote
At
pos
StyleC
"$ is not used specially and should therefore be escaped."
return
$
T_Literal
id
"$"
return
$
T_Literal
id
"$"
prop_readHereDoc
=
isOk
readHereDoc
"<< foo
\n
lol
\n
cow
\n
foo"
prop_readHereDoc
=
isOk
readHereDoc
"<< foo
\n
lol
\n
cow
\n
foo"
...
@@ -1399,7 +1401,7 @@ readAssignmentWord = try $ do
...
@@ -1399,7 +1401,7 @@ readAssignmentWord = try $ do
pos
<-
getPosition
pos
<-
getPosition
optional
(
char
'$'
>>
parseNote
ErrorC
"Don't use $ on the left side of assignments."
)
optional
(
char
'$'
>>
parseNote
ErrorC
"Don't use $ on the left side of assignments."
)
variable
<-
readVariableName
variable
<-
readVariableName
optional
(
read
Dollar
>>
parseNoteAt
pos
ErrorC
optional
(
read
NormalDollar
>>
parseNoteAt
pos
ErrorC
"For indirection, use (associative) arrays or 'read
\"
var$n
\"
<<<
\"
value
\"
'"
)
"For indirection, use (associative) arrays or 'read
\"
var$n
\"
<<<
\"
value
\"
'"
)
optional
readArrayIndex
-- Throws away the index. Fixme?
optional
readArrayIndex
-- Throws away the index. Fixme?
space
<-
spacing
space
<-
spacing
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录