wrapPythonProgram: fix magical sed expression
* Treat #! as all other comments; * Treat comma at the end as a multi-line marker; * Skip lines with a space at start (they are continuing previous lines); * Don't allow spaces in front of quotes or the first real statement.
This commit is contained in:
parent
4ad459e3e0
commit
adafdb88f5
1 changed files with 5 additions and 5 deletions
|
@ -53,7 +53,7 @@ in modules // {
|
|||
isSingle = elem quote [ "\"" "'\"'\"'" ];
|
||||
endQuote = if isSingle then "[^\\\\]${quote}" else quote;
|
||||
in ''
|
||||
/^ *[a-z]?${quote}/ {
|
||||
/^[a-z]?${quote}/ {
|
||||
/${quote}${quote}|${quote}.*${endQuote}/{n;br}
|
||||
:${label}; n; /^${quote}/{n;br}; /${endQuote}/{n;br}; b${label}
|
||||
}
|
||||
|
@ -73,11 +73,11 @@ in modules // {
|
|||
|
||||
in ''
|
||||
1 {
|
||||
/^#!/!b; :r
|
||||
/\\$/{N;br}
|
||||
/__future__|^ *(#.*)?$/{n;br}
|
||||
:r
|
||||
/\\$|,$/{N;br}
|
||||
/__future__|^ |^ *(#.*)?$/{n;br}
|
||||
${concatImapStrings mkStringSkipper quoteVariants}
|
||||
/^ *[^# ]/i ${replaceStrings ["\n"] [";"] preamble}
|
||||
/^[^# ]/i ${replaceStrings ["\n"] [";"] preamble}
|
||||
}
|
||||
'';
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue