1.1 --- a/encoders.py Sun Jun 24 18:47:03 2018 +0200
1.2 +++ b/encoders.py Mon Jun 25 14:27:00 2018 +0200
1.3 @@ -3,7 +3,7 @@
1.4 """
1.5 Encoder functions, producing representations of program objects.
1.6
1.7 -Copyright (C) 2016, 2017 Paul Boddie <paul@boddie.org.uk>
1.8 +Copyright (C) 2016, 2017, 2018 Paul Boddie <paul@boddie.org.uk>
1.9
1.10 This program is free software; you can redistribute it and/or modify it under
1.11 the terms of the GNU General Public License as published by the Free Software
1.12 @@ -87,6 +87,26 @@
1.13 t.access_number is not None and ":#%d" % t.access_number or "",
1.14 invocation and "!" or "")
1.15
1.16 +def decode_alias_location(s):
1.17 +
1.18 + "Decode the alias location 's'."
1.19 +
1.20 + path, name, rest = s.split(":", 2)
1.21 + attrnames = version = access_number = None
1.22 + invocation = rest.endswith("!")
1.23 +
1.24 + t = rest.rstrip("!").split(":#")
1.25 + if len(t) > 1:
1.26 + rest = t[0]; access_number = int(t[1])
1.27 +
1.28 + t = rest.split(":=")
1.29 + if len(t) > 1:
1.30 + attrnames = t[0]; version = int(t[1])
1.31 + else:
1.32 + attrnames = rest
1.33 +
1.34 + return path, name, attrnames, version, access_number, invocation
1.35 +
1.36 def encode_location(t):
1.37
1.38 "Encode the general location 't' in a concise form."