summary refs log tree commit diff stats
path: root/pycompab.py
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2009-06-24 17:13:22 +0200
committerAndreas Rumpf <rumpf_a@web.de>2009-06-24 17:13:22 +0200
commit300430fbba28b408f7ac86ca46b03d9d50839399 (patch)
treeb8a84f8efdccda7bfa909b3db911d9e2b9a4b39b /pycompab.py
parent36818817bd61594ea6d106328bb8df0f5a25cfc4 (diff)
downloadNim-300430fbba28b408f7ac86ca46b03d9d50839399.tar.gz
overload resolution for proc vars
Diffstat (limited to 'pycompab.py')
-rw-r--r--pycompab.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/pycompab.py b/pycompab.py
index 3121856ef..c6752bee3 100644
--- a/pycompab.py
+++ b/pycompab.py
@@ -68,11 +68,16 @@ def Subs(frmt, *args, **substitution):
   a = args

   result = []

   i = 0

+  num = 0

   L = len(frmt)

   while i < L:

     if frmt[i] == '$':

       i = i+1

-      if frmt[i] == '$':

+      if frmt[i] == '#':

+        result.append(a[num])

+        num = num+1

+        i = i+1

+      elif frmt[i] == '$':

         result.append('$')

         i = i+1

       elif frmt[i] == '{':

@@ -91,7 +96,8 @@ def Subs(frmt, *args, **substitution):
         while i < len(frmt) and frmt[i] in chars: i = i + 1

         x = frmt[j:i]

         if x[0] in DIGITS:

-          result.append(str(a[int(x)-1]))

+          num = int(x)

+          result.append(str(a[num-1]))

         else:

           result.append(str(d[x]))

       else: