Skip to content

Commit

Permalink
Remove double quotation from parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
ishaangandhi authored and Yann Regis-Gianas committed May 10, 2023
1 parent 4ba8b68 commit d5edea9
Show file tree
Hide file tree
Showing 7 changed files with 75 additions and 337 deletions.
1 change: 0 additions & 1 deletion src/prelexer.mll
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,6 @@ rule token current = parse
| "}" {
debug ~rule:"parameter-closing-brace" lexbuf current;
if under_braces current then
let current = pop_quotation OpeningBrace current in
let _ = debug ~rule:"parameter-closing-brace-after-pop" lexbuf current in
return lexbuf current []
else
Expand Down
4 changes: 1 addition & 3 deletions src/prelexerState.ml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ type atom =
| QuotingMark of quote_kind
| AssignmentMark

and quote_kind = SingleQuote | DoubleQuote | OpeningBrace
and quote_kind = SingleQuote | DoubleQuote

module AtomBuffer : sig
type t
Expand Down Expand Up @@ -267,13 +267,11 @@ let pop_quotation k b =
match k with
| SingleQuote -> WordSingleQuoted word
| DoubleQuote -> WordDoubleQuoted word
| OpeningBrace -> WordDoubleQuoted word
in
let squote =
match k with
| SingleQuote -> "'" ^ squote ^ "'"
| DoubleQuote -> "\"" ^ squote ^ "\""
| OpeningBrace -> squote
in
let quote = WordComponent (squote, quoted_word) in
let buffer = AtomBuffer.make (quote :: buffer) in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,21 +105,7 @@
[
"Word",
"word",
[
[
"WordDoubleQuoted",
[
"Word",
"word",
[
[
"WordLiteral",
"word"
]
]
]
]
]
[ [ "WordLiteral", "word" ] ]
]
]
]
Expand Down Expand Up @@ -169,21 +155,7 @@
[
"Word",
"word",
[
[
"WordDoubleQuoted",
[
"Word",
"word",
[
[
"WordLiteral",
"word"
]
]
]
]
]
[ [ "WordLiteral", "word" ] ]
]
]
]
Expand Down Expand Up @@ -233,21 +205,7 @@
[
"Word",
"word",
[
[
"WordDoubleQuoted",
[
"Word",
"word",
[
[
"WordLiteral",
"word"
]
]
]
]
]
[ [ "WordLiteral", "word" ] ]
]
]
]
Expand Down Expand Up @@ -297,21 +255,7 @@
[
"Word",
"word",
[
[
"WordDoubleQuoted",
[
"Word",
"word",
[
[
"WordLiteral",
"word"
]
]
]
]
]
[ [ "WordLiteral", "word" ] ]
]
]
]
Expand Down Expand Up @@ -361,21 +305,7 @@
[
"Word",
"word",
[
[
"WordDoubleQuoted",
[
"Word",
"word",
[
[
"WordLiteral",
"word"
]
]
]
]
]
[ [ "WordLiteral", "word" ] ]
]
]
]
Expand Down Expand Up @@ -425,21 +355,7 @@
[
"Word",
"word",
[
[
"WordDoubleQuoted",
[
"Word",
"word",
[
[
"WordLiteral",
"word"
]
]
]
]
]
[ [ "WordLiteral", "word" ] ]
]
]
]
Expand Down Expand Up @@ -489,21 +405,7 @@
[
"Word",
"word",
[
[
"WordDoubleQuoted",
[
"Word",
"word",
[
[
"WordLiteral",
"word"
]
]
]
]
]
[ [ "WordLiteral", "word" ] ]
]
]
]
Expand Down Expand Up @@ -553,21 +455,7 @@
[
"Word",
"word",
[
[
"WordDoubleQuoted",
[
"Word",
"word",
[
[
"WordLiteral",
"word"
]
]
]
]
]
[ [ "WordLiteral", "word" ] ]
]
]
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,21 +46,7 @@
[
"Word",
"<<?",
[
[
"WordDoubleQuoted",
[
"Word",
"<<?",
[
[
"WordLiteral",
"<<?"
]
]
]
]
]
[ [ "WordLiteral", "<<?" ] ]
]
]
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,62 +38,49 @@
"$(echo foo)",
[
[
"WordDoubleQuoted",
"WordSubshell",
[ "SubShellKindParentheses" ],
[
"Word",
"$(echo foo)",
"Program_LineBreak_CompleteCommands_LineBreak",
[ "LineBreak_Empty" ],
[
"CompleteCommands_CompleteCommand",
[
"WordSubshell",
"CompleteCommand_CList",
[
"SubShellKindParentheses"
],
[
"Program_LineBreak_CompleteCommands_LineBreak",
[
"LineBreak_Empty"
],
"CList_AndOr",
[
"CompleteCommands_CompleteCommand",
"AndOr_Pipeline",
[
"CompleteCommand_CList",
"Pipeline_PipeSequence",
[
"CList_AndOr",
"PipeSequence_Command",
[
"AndOr_Pipeline",
"Command_SimpleCommand",
[
"Pipeline_PipeSequence",
"SimpleCommand_CmdName_CmdSuffix",
[
"PipeSequence_Command",
"CmdName_Word",
[
"Command_SimpleCommand",
"Word",
"echo",
[
"SimpleCommand_CmdName_CmdSuffix",
[
"CmdName_Word",
[
"Word",
"echo",
[
[
"WordName",
"echo"
]
]
]
],
"WordName",
"echo"
]
]
]
],
[
"CmdSuffix_Word",
[
"Word",
"foo",
[
[
"CmdSuffix_Word",
[
"Word",
"foo",
[
[
"WordName",
"foo"
]
]
]
"WordName",
"foo"
]
]
]
Expand All @@ -102,13 +89,11 @@
]
]
]
],
[
"LineBreak_Empty"
]
]
]
]
],
[ "LineBreak_Empty" ]
]
]
]
Expand Down
Loading

0 comments on commit d5edea9

Please sign in to comment.