malcolmwallace / cpphs

The C pre-processor, implemented in Haskell.
2 stars 0 forks source link

## concatenation operator isn't supported #20

Closed phadej closed 4 years ago

phadej commented 5 years ago

If this is by design, it should be documented:

% cat foo.h
#define M(x) x##bar

M(foo)
M(quux)
% cpp foo.h 
# 1 "foo.h"
# 1 "<built-in>"
# 1 "<command-line>"
# 31 "<command-line>"
# 1 "/usr/include/stdc-predef.h" 1 3 4
# 32 "<command-line>" 2
# 1 "foo.h"

foobar
quuxbar
% cpphs foo.h 
#line 1 "foo.h"

foo##bar
quux##bar
malcolmwallace commented 4 years ago

$ cpphs --hashes foo.h

line 1 "foo.h"

foobar quuxbar

phadej commented 4 years ago

I'd argue it should be on by default, and one could turn it off. But I see how it could clash with some operator named ## in haskell somewhere