Update of /cvsroot/geshi/geshi-src/geshi/languages/c
In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv21378
Modified Files:
c.php
Log Message:
Added newline-termination for string literals and character
constants
because:
a) multi-line strings are illegal in C, except when they are
continued -
as with any other part of the syntax - with \. This is
now handled
generically.
b) treating character constants as strings so that
'\xFFF' etc highlight
properly - a change that the previous commit introduced
- requires
that they have some sensible termination within #error
and #pragma
directives - these are the only places where single
quote characters
can appear "unbounded" from GeSHi's
perspective. Likewise
double quotes can legally appear "unbounded"
in these directives,
so the same rationale applies.
GeSHiCCodeParser::parseToken() removes highlighting of
character
constants and string literals in these directives but
they need to
terminate naturally - i.e. without parseToken()
intervention - within the
directives.
Index: c.php
============================================================
=======
RCS file: /cvsroot/geshi/geshi-src/geshi/languages/c/c.php,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** c.php 28 Jul 2006 00:01:31 -0000 1.13
--- c.php 28 Jul 2006 13:59:27 -0000 1.14
***************
*** 110,127 ****
function geshi_c_c_string_literal (&$context)
{
! geshi_c_base_string($context, '"',
'"', false);
}
function geshi_c_c_widestring_literal (&$context)
{
! geshi_c_base_string($context, 'L"',
'"', true);
}
function geshi_c_c_character_constant (&$context)
{
! geshi_c_base_string($context, "'",
"'", false);
}
function geshi_c_c_widecharacter_constant (&$context)
{
! geshi_c_base_string($context, "L'",
"'", true);
}
--- 110,127 ----
function geshi_c_c_string_literal (&$context)
{
! geshi_c_base_string($context, '"',
array('"', 'REGEX#(?=\n)#'), false);
}
function geshi_c_c_widestring_literal (&$context)
{
! geshi_c_base_string($context, 'L"',
array('"', 'REGEX#(?=\n)#'), true);
}
function geshi_c_c_character_constant (&$context)
{
! geshi_c_base_string($context, "'",
array("'", 'REGEX#(?=\n)#'), false);
}
function geshi_c_c_widecharacter_constant (&$context)
{
! geshi_c_base_string($context, "L'",
array("'", 'REGEX#(?=\n)#'), true);
}
------------------------------------------------------------
-------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the
chance to share your
opinions on IT & business topics through brief surveys
-- and earn cash
http://www.techsay.com/default.
php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
geshi-cvs mailing list
geshi-cvs lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geshi-cvs
|