From d5edea9b672286e15a4e3506ca9824aeff0ae027 Mon Sep 17 00:00:00 2001 From: ishaangandhi Date: Fri, 9 Oct 2020 11:45:51 -0400 Subject: [PATCH] Remove double quotation from parameter --- src/prelexer.mll | 1 - src/prelexerState.ml | 4 +- .../basic.t/expected.json | 128 +----------- .../operator-in-parameter.t/expected.json | 16 +- .../recursive.t/expected.json | 77 +++----- .../vicious.t/expected.json | 184 ++++-------------- .../expected.json | 2 +- 7 files changed, 75 insertions(+), 337 deletions(-) diff --git a/src/prelexer.mll b/src/prelexer.mll index d6589b9b..594eab7d 100644 --- a/src/prelexer.mll +++ b/src/prelexer.mll @@ -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 diff --git a/src/prelexerState.ml b/src/prelexerState.ml index 60b1032e..76fe63e8 100644 --- a/src/prelexerState.ml +++ b/src/prelexerState.ml @@ -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 @@ -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 diff --git a/tests/golden/good/2.6-word-expansions/2.6.2-parameter-expansion/basic.t/expected.json b/tests/golden/good/2.6-word-expansions/2.6.2-parameter-expansion/basic.t/expected.json index 536f9414..5a739b3f 100644 --- a/tests/golden/good/2.6-word-expansions/2.6.2-parameter-expansion/basic.t/expected.json +++ b/tests/golden/good/2.6-word-expansions/2.6.2-parameter-expansion/basic.t/expected.json @@ -105,21 +105,7 @@ [ "Word", "word", - [ - [ - "WordDoubleQuoted", - [ - "Word", - "word", - [ - [ - "WordLiteral", - "word" - ] - ] - ] - ] - ] + [ [ "WordLiteral", "word" ] ] ] ] ] @@ -169,21 +155,7 @@ [ "Word", "word", - [ - [ - "WordDoubleQuoted", - [ - "Word", - "word", - [ - [ - "WordLiteral", - "word" - ] - ] - ] - ] - ] + [ [ "WordLiteral", "word" ] ] ] ] ] @@ -233,21 +205,7 @@ [ "Word", "word", - [ - [ - "WordDoubleQuoted", - [ - "Word", - "word", - [ - [ - "WordLiteral", - "word" - ] - ] - ] - ] - ] + [ [ "WordLiteral", "word" ] ] ] ] ] @@ -297,21 +255,7 @@ [ "Word", "word", - [ - [ - "WordDoubleQuoted", - [ - "Word", - "word", - [ - [ - "WordLiteral", - "word" - ] - ] - ] - ] - ] + [ [ "WordLiteral", "word" ] ] ] ] ] @@ -361,21 +305,7 @@ [ "Word", "word", - [ - [ - "WordDoubleQuoted", - [ - "Word", - "word", - [ - [ - "WordLiteral", - "word" - ] - ] - ] - ] - ] + [ [ "WordLiteral", "word" ] ] ] ] ] @@ -425,21 +355,7 @@ [ "Word", "word", - [ - [ - "WordDoubleQuoted", - [ - "Word", - "word", - [ - [ - "WordLiteral", - "word" - ] - ] - ] - ] - ] + [ [ "WordLiteral", "word" ] ] ] ] ] @@ -489,21 +405,7 @@ [ "Word", "word", - [ - [ - "WordDoubleQuoted", - [ - "Word", - "word", - [ - [ - "WordLiteral", - "word" - ] - ] - ] - ] - ] + [ [ "WordLiteral", "word" ] ] ] ] ] @@ -553,21 +455,7 @@ [ "Word", "word", - [ - [ - "WordDoubleQuoted", - [ - "Word", - "word", - [ - [ - "WordLiteral", - "word" - ] - ] - ] - ] - ] + [ [ "WordLiteral", "word" ] ] ] ] ] diff --git a/tests/golden/good/2.6-word-expansions/2.6.2-parameter-expansion/operator-in-parameter.t/expected.json b/tests/golden/good/2.6-word-expansions/2.6.2-parameter-expansion/operator-in-parameter.t/expected.json index 1e6a1adc..1415da1c 100644 --- a/tests/golden/good/2.6-word-expansions/2.6.2-parameter-expansion/operator-in-parameter.t/expected.json +++ b/tests/golden/good/2.6-word-expansions/2.6.2-parameter-expansion/operator-in-parameter.t/expected.json @@ -46,21 +46,7 @@ [ "Word", "<