components/prism-c.js


Log

Author Commit Date CI Message
Golmote 9487b5be 2015-01-09T08:11:21 Removed unneeded escapes in RegExps, added some semicolons
Andreas Rohner 550c81e7 2014-07-11T21:21:27 Fix for some serious bugs in C and C++ highlighter &lt; and &gt; don't seem to work as they used to. So this patch replaces them with the corresponding < or > sign like it was done in the clike base language. The pattern for macro statements was seriously flawed. It didn't allow for macros with no argument like #else or #endif. This patch fixes the problem and additionally adds support for multiline macros, which are fairly common. #define FOO(a, b, c) \ do { \ do_stuff_here \ do_more_stuff \ } while (0) Furthermore the path of the #include macro is highlighted as a string. #include <stdio.h> #include "config.h" C also allows for multiline strings in a similar way as multiline macros. "This is a \ multiline \ string"
augustjd efff6cbc 2014-02-07T12:26:07 Updated prism-c.js for enhanced C macro support Previously, #include <stdio.h> resulted in the < and > being tagged as operators, which is confusing. Also, preprocessor directives are not allowed to have spaces after the # and before the directive (#include, #define, #if, etc.), so I updated the regex to ignore improperly formatted macros. Currently, macro arguments will be highlighted as properties, but you can line 11 to whatever flagging is desired (keyword, for instance) to visually distinguish between the macro and its arguments.
Andreas Rohner 47ffc24c 2013-03-16T18:39:06 Add C/C++ highlighting support