You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
open(my$ofh, ">", $file) ordie"Couldn't open '".$file."' for writing because: ".$!;
286
+
287
+
# go through the file and remove all possible newlines
288
+
# do not remove
289
+
# - newlines in case statements
290
+
# - new lines in here documents
291
+
# replace
292
+
# - new lines in quotes (single or double) with $'\n'
293
+
# remove
294
+
# - \ with newline at the end of the line
295
+
# replace newlines with ; unless
296
+
# - in array declaration
297
+
# - || or && or | or { or ( at the end of the line
298
+
# 'then' or 'do' or 'else' at the end of the line
299
+
newline_process($data,$ofh);
300
+
close$ofh;
301
+
}
252
302
253
-
# aggressive
254
-
if ($aggressive) {
255
-
# say "Aggressive mode";
256
-
my$var = <<EOS;
257
-
1,\${ # from second line to the end
258
-
:loop # label for loop behavior
259
-
N # join next line with current, separating by \\n
260
-
s/[\\]\\n//g
261
-
s/\\(}\\|))\\|esac\\|done\\|fi\\)\\s*\\n/\\1;/g # line break to ';' on lines ending with '}', '))', 'esac','done' or 'fi'
262
-
s/\\(do\\|{\\||\\|then\\|else\\)\\s*\\n/\\1 /g # line break to ' ' on lines ending with 'do', '{', '|', 'then' or 'else'
263
-
s/\\n\\(function\\|while\\)/;\\1/g # line break to ';' on lines starting with 'function' or 'while'
264
-
s/;;;/\\n;;/g # fix ;;; bug
265
-
s/\\(\\([^);]\\);\\?\\n\\(if\\|else\\|done\\|\\[\\)\\)/\\2;\\3/g # lines beginning by if, else, done or [ preceded by line break from lines not ending with ^,;,], should change \\n into ;
266
-
s/\\("[^"]\\+"\\)\\n/\\1;/g # lines ending with open and closed ", change \\n into ;
267
-
s/\\n\\([a-z][a-z0-9]*=.*\\)\\n/;\\1;/g # var definition lines alone e.g. \\nvar=value\\n, change to ;var=value;
268
-
s/expect { /expect {\\n/g
269
-
s/\\(return[ ;0-9]*\\)\\n/\\1;/g # return with or without value and ending with ; or not
270
-
s/\\(local [a-z0-9]+\\|>&[0-9]\\)\\n/\\1;/g # return with or without value and ending with ; or not
0 commit comments