Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Macros have a freeform syntax, with the only restriction being that delimiters within have to be balanced. I don't see how an IDE could provide general syntax highlighting for them.


The IDE could parse the macro definition and highlight accordingly. (It would know where to expect an identifier and where to expect an expression etc.)


> (It would know where to expect an identifier and where to expect an expression etc.)

But that doesn't mean that what's in the macro should be highlighted like Rust:

    sql!("SELECT * FROM users WHERE name = $1");
is a macro provided by https://github.com/sfackler/rust-postgres-macros , and should be highlighted like SQL, not like a Rust string.

    sql!("SELECT * FORM users WHERE name = $1");
throws an error, because it's malformed.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: