hsc2hs icon indicating copy to clipboard operation
hsc2hs copied to clipboard

Partial fix for #14

Open flip111 opened this issue 6 years ago • 3 comments

Before the line pragma of Special token was dependent on the creation of empty Text tokens (not to be confused with Data.Text). The empty Text tokens create empty sections in the generated .hs file and in generally it's better to let the Special tokens be responsible for it's own line pragma's.

I added state for starttype / stoptype so the line numbers get tracked. The thing was that the C macro for hsc_starttype and the hsc_field to not generated any hs code. All the code is only generated at the hsc_stoptype macro. But the offset in the original hsc file is counted from the line number of the hsc_starttype not hsc_stoptype. This is the main fix for #14

flip111 avatar Dec 26 '18 14:12 flip111

By the way, as i was diving into the bindings.dsl.h code and also the code of hsc2hs i was wondering why this was written in C. Maybe it makes more sense there to skip the C step and write out the HS file straight from haskell.

flip111 avatar Dec 26 '18 15:12 flip111

The situation with the line numbers seem to be better than as it was. However need support from bindings.dsl.h for printing correct line pragma's see https://github.com/jwiegley/bindings-dsl/issues/33

flip111 avatar Dec 26 '18 15:12 flip111

Why wasn't this PR merged? Can i help it somehow?

l29ah avatar Jun 05 '20 20:06 l29ah