]> thyrsus.com Git - mad.git/commitdiff
Handle function pointer arguments in expressions.
authorEric S. Raymond <esr@thyrsus,com>
Sat, 14 Feb 2004 16:47:13 +0000 (16:47 +0000)
committerEric S. Raymond <esr@thyrsus,com>
Sat, 14 Feb 2004 16:47:13 +0000 (16:47 +0000)
mad

diff --git a/mad b/mad
index c0ab70dc258b6d200c7c96efab430a50c841a5fb..a9481c5d278ff3ea4654eda2f8a84b38d7af0ce0 100755 (executable)
--- a/mad
+++ b/mad
@@ -56,6 +56,7 @@ for r in reserved:
 def t_STRING(t):
     r'\$[^$]*\$'
     t.value = t.value[1:-1]
+    t.value = re.sub("\n\s*", "", t.value)
     return t
 
 def t_FUNCALL(t):
@@ -695,6 +696,8 @@ def prinC1(t):
             for dim in t[2]:
                 res += '[' + print_C_expr(dim) + ']'
         return res
+    elif t[0] == 'funptr':
+        return t[1]
     elif t[0] == 'apply':
         madfunc = t[1][:-1]
         return madfunc_map.get(madfunc, madfunc) + '(' + ', '.join(map(prinC1, t[2])) + ')'
@@ -1073,7 +1076,7 @@ if __name__ == '__main__':
         # Put them after every newline, then remove if they're followed
         # by whitespace and a continuation digit
         source = source.replace("\n", " eos\n")
-        source = re.sub('eos\n(\s*)[0-9]+', '\n\\1', source)
+        source = re.sub('eos\n(\s*)[0-9]+\s*', '\n\\1', source)
         # Transform some adjacent groups of keywords into
         # agglomerates. This lets us get away with stuff like SET LIST
         # TO LIST that the parser would otherwise choke on, because