patrickt / pony

A source-to-source transformer for C99, written in Haskell.
Other
5 stars 0 forks source link

Create a distinct AST node for C strings #53

Closed cbarrett closed 13 years ago

cbarrett commented 13 years ago

There are lots of places in the AST where a string literal can go, but since it's a leaf node of CExpr, it looks like other junk can go in there.

cbarrett commented 13 years ago

Hm. Not sure I grok this. Thinking out loud.

Currently, a string literal CExpr node would be constructed with:

Constant (CString "foobar")

Which has a type CExpr

So our newtype could be:

newtype StringLiteral = StringLiteral CExpr {
        getExpr :: CExpr
    }

and then you would make one of these with:

StringLiteral (Constant (CString "foobar"))

Does that make sense?

patrickt commented 13 years ago

Colin and I have discussed this, and we think the best solution is to create a distinct StringLiteral node that holds C strings.

patrickt commented 13 years ago

Fixed in a7c03bc1fdf4eb18d17d23e78a6b5626fcc102a3.