textmate / d.tmbundle

TextMate support for D
13 stars 8 forks source link

Delimited strings are not recognised #17

Open unleashy opened 5 years ago

unleashy commented 5 years ago

See gist:

https://gist.github.com/unleashy/c6a01c0798d99726940aec4ffca7f321

After the (admittedly weird) delimited string, the whole file becomes "string"-highlighted. This is obviously because delimited strings are not recognised, so "(" is recognised as a bog-standard string, and the final " is taken as a bog-standard string again, but it never ends.

I'm ok with making a PR to fix this... as soon as I figure out how textmate grammars work :stuck_out_tongue:

Geod24 commented 4 years ago

@jacob-carlborg : I actually just installed TextMate to test this use case.

void main ()
{
    writeln(q"EOF
        Let's see"
        this is still inside a string"
    EOF");
        string str = "Works?";
}

It's interesting that the last quote after EOF does not result in the result of the file being stringified.

jacob-carlborg commented 4 years ago

It's interesting that the last quote after EOF does not result in the result of the file being stringified.

I think the grammar sees the above code snippet as containing two regular strings. One starting at q"EOF and ending at see". The other one starting at string" and ending at EOF".

The grammar doesn't recognize hex strings, delimited strings or token strings. Much of it is still based on D1.