[intellij sh] IDEA-243118 Fix substring replacement parsing

GitOrigin-RevId: 704e4c4f4b3d7700ebe11b15146207d21d74e51b
This commit is contained in:
Mikhail Mazurkevich
2020-06-17 18:57:48 +03:00
committed by intellij-monorepo-bot
parent e4f8c77a28
commit 672dc1c890
4 changed files with 629 additions and 612 deletions
File diff suppressed because it is too large Load Diff
+3 -2
View File
@@ -123,6 +123,7 @@ Filedescriptor = "&" {IntegerLiteral} | "&-" //todo:: check the usage
AssigOp = "=" | "+="
ParamExpansionName = ([a-zA-Z0-9_] | {EscapedAnyChar})*
ParameterExpansionExpr = [^}/$`\"]* | {EscapedChar}*
ParamExpansionSeparator = "#""#"? | "!" | ":" | ":"?"=" | ":"?"+" | ":"?"-" | ":"?"?" | "@" | ","","? | "^""^"? | "*"
HeredocMarker = [^\r\n|&\\;()[] \t\"'] | {EscapedChar}
@@ -307,8 +308,8 @@ EvalContent = [^\r\n$\"`'() ;] | {EscapedAnyChar}
}
<PARAMETER_EXPANSION_EXPR> {
[^}/$`\"]* { popState(); return WORD; }
[^] { popState(); yypushback(yylength()); }
{ParameterExpansionExpr} { popState(); return WORD; }
[^] { popState(); yypushback(yylength()); }
}
<CASE_CONDITION> {
@@ -2,5 +2,5 @@
arg="${arg//\\/\\\\}"
printf "%s\n" "${arg}"
arg="${arg//\\/\\\\\}"
printf "%s\n" "${arg} ff}"
#IDEA-243118
"\"${string//\"/\\\"}\""
@@ -27,29 +27,17 @@ word ('arg')
CLOSE_QUOTE ('"')
\n ('\n')
\n ('\n')
word ('arg')
= ('=')
OPEN_QUOTE ('"')
$ ('$')
{ ('{')
word ('arg')
param_separator ('//')
word ('\\')
param_separator ('/')
word ('\\\\\')
} ('}')
CLOSE_QUOTE ('"')
Comment ('#IDEA-243118')
\n ('\n')
word ('printf')
WHITE_SPACE (' ')
OPEN_QUOTE ('"')
STRING_CONTENT ('%s\n')
CLOSE_QUOTE ('"')
WHITE_SPACE (' ')
OPEN_QUOTE ('"')
STRING_CONTENT ('\"')
$ ('$')
{ ('{')
word ('arg')
word ('string')
param_separator ('//')
word ('\"')
param_separator ('/')
word ('\\\"')
} ('}')
STRING_CONTENT (' ff}')
STRING_CONTENT ('\"')
CLOSE_QUOTE ('"')