1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-09-11 15:08:33 +01:00
nixpkgs/pkgs/development
aszlig 311aa5d8d9
python-wrapper: Handle strings at the beginning.
This should fix #7366 for now, but using the (IMHO) pragmatic approach
of extending the sed expression to recognize strings.

However, this approach is obviously not parsing the full AST, nor does
it wrap Python itself (as pointed out by @spwhitt in #7366) but tries to
match Python strings as best as possible without getting TOO unreadable.

We also use a little bit of Nix to help generating the SED expression,
because doing the whole quote matching block over and over again would
be quite repetitious and error-prone to change. The reason why I'm using
imap here is that we need to have unique labels to avoid jumping into
the wrong branch.

So the new expression is not only able to match continous regions of
triple-quoted strings, but also regions with only one quote character
(even with escaped inner quotes) and empty strings.

However, what it doesn't correctly recognize is something like this:

"string1" "string2" "multi
line
string"

Which is very unlikely that we'll find something like this in the wild.
Of course, we could handle it as well, but it would mean that we need to
substitute the current line into hold space until we're finished parsing
the strings, branch off to another label where we match multiline
strings of all sorts and swap hold/pattern space and finally print the
result. So to summarize: The SED expression would be 3 to 4 times bigger
than now and we gain very little from that.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
2015-04-14 07:13:15 +02:00
..
arduino
compilers nixpkgs: update oraclejdk8 sha256s 2015-04-12 01:15:52 -05:00
coq-modules bedrock: Don't bulid Cito without the platform 2015-04-10 14:13:54 -05:00
eclipse
go-modules/generic
guile-modules
haskell-modules haskell-ng: patch dyre to check NIX_GHC 2015-04-13 11:08:15 +01:00
interpreters Merge pull request #7267 from couchemar/erlang-r17.5 2015-04-10 11:12:40 +02:00
libraries Merge pull request #7159 from codyopel/libvpx-cleanup 2015-04-13 21:38:07 -07:00
lisp-modules More mysql migrations 2015-04-01 16:50:47 -07:00
lua-modules
misc
mobile
ocaml-modules ocaml-pgocaml: update from 2.1 to 2.2 2015-04-10 17:45:37 +02:00
perl-modules DBD-mysql: 4.023 -> 4.031 2015-04-01 16:41:19 -07:00
pharo
pure-modules/pure-gsl
python-modules python-wrapper: Handle strings at the beginning. 2015-04-14 07:13:15 +02:00
qtcreator
r-modules One more mysql fix 2015-04-01 16:52:38 -07:00
ruby-modules
tools nixpkgs: arcanist 20150318 -> 20150412 2015-04-12 12:16:30 -05:00
web Remove error hiding, comment saying where to call script from. 2015-04-09 17:11:47 +02:00