Open GoogleCodeExporter opened 8 years ago
How does the C preprocessor lexer distinguish a '#' that starts a preprocessor
directive from one that does not?
Original comment by mikesamuel@gmail.com
on 3 Jun 2011 at 11:42
Just ran into this as well.
I don't know how it works in C, but in C++ `#` is a preprocessor directive
exactly when it is either the first nonwhitespace character in the source file
or is preceded by whitespace containing a newline.
Reference: C++ working draft N3242, "Preprocessing Directives"
[http://www.open-std.org/jtc1/sc22/wg21/]
Original comment by matthew....@gmail.com
on 7 Apr 2012 at 11:37
Related to this issue, I don't know why #include/define/etc are marked as
comments. I think that C-like languages should have hashComments=false. You can
fix this issue modifying prettify.js source code. Search for:
registerLangHandler(sourceDecorator({
'keywords': CPP_KEYWORDS,
'hashComments': false, // This is true in the official release
'cStyleComments': true,
'types': C_TYPES
}), ['c', 'cc', 'cpp', 'cxx', 'cyc', 'm']);
I've attached a patch to fix this issue.
Original comment by davidcapello
on 13 Dec 2013 at 7:42
Attachments:
Original issue reported on code.google.com by
stu...@testtrack4.com
on 3 Jun 2011 at 6:34