components/prism-c.js


Log

Author Commit Date CI Message
Golmote 12c0b20a 2018-03-08T22:19:01 Decouple minus sign from number pattern in most languages. Close #1110
Golmote ffeb26e9 2017-10-22T14:19:33 C: Regexp optimisation + don't use captures if not needed
Hong Xu 1a4a7c96 2016-10-01T16:22:32 Add more keywords and constants for C.
Chaos Shen ad316a36 2015-10-10T17:51:31 Improve highlight: - add highlight for directives in C/C++ macros and C#/F# preprocessor lines; - add some predefined constants in C; - remove 'true' and 'false' from keyword list in JavaScript, they should be considered as boolean constant.
Golmote 071c3ddf 2015-09-04T00:13:37 Merge branch 'c-fixes' of https://github.com/rygorous/prism into gh-pages Conflicts: components/prism-c.js components/prism-c.min.js components/prism-clike.js components/prism-clike.min.js + added tests
Golmote 4d64d077 2015-09-04T00:11:44 Merge branch 'c-fixes' of https://github.com/rygorous/prism into gh-pages Conflicts: components/prism-c.js components/prism-c.min.js components/prism-clike.js components/prism-clike.min.js + added tests
Golmote 48686353 2015-07-12T08:30:48 C: Used property as an alias for macro statements + added support for \r in macros
Golmote dcce1a78 2015-07-12T08:21:31 C: Removed string pattern (now that C-like supports escaped new lines) + simplified operators regexp
Golmote b1fd5bdc 2015-03-10T08:27:53 Removed unused global flag in all grammars
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.
Fabian Giesen 2aeed5cc 2013-07-25T19:19:15 Refine C number regexp. - Exponent may contain '+', not just '-'. - Numbers may have "float" (f), "unsigned" (u), "long" (l) or "long long" (ll) suffixes. The set of suffixes described by this regexp is somewhat larger than what a real C compiler would accept.
Andreas Rohner 47ffc24c 2013-03-16T18:39:06 Add C/C++ highlighting support