Update of /cvsroot/geshi/geshi-src/geshi/classes
In directory
sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv29839/geshi/classes
Modified Files:
class.geshicodecontext.php
Log Message:
useStandardDoubles() now takes an array of options to
configure the highlighting of double numbers. +/- signs
before double number are no longer highlighted like the
number.
Index: class.geshicodecontext.php
============================================================
=======
RCS file:
/cvsroot/geshi/geshi-src/geshi/classes/class.geshicodecontex
t.php,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -d -r1.27 -r1.28
*** class.geshicodecontext.php 13 May 2006 06:05:48
-0000 1.27
--- class.geshicodecontext.php 14 May 2006 01:29:54
-0000 1.28
***************
*** 142,170 ****
}
! function useStandardDoubles ($plus_minus_context,
$require_leading_number = false)
{
$banned = '[^a-zA-Z_0-9]';
$plus_minus = '[\-\+]?';
! $leading_number_symbol = ($require_leading_number)
? '+' : '*';
$this->addRegexGroup(array(
// double precision with e, e.g. 3.5e7 or
-.45e2
!
"#(^|$banned)?({$plus_minus})([0-9]$leading_number_sym
bol\.[0-9]+[eE]{$plus_minus}[0-9]+[fl]?)($banned|\$)?#&qu
ot;,
// double precision with e and no decimal
place, e.g. 5e2
!
"#(^|$banned)?({$plus_minus})([0-9]+[eE]{$plus_minus}[
0-9]+[fl]?)($banned|\$)?#",
// double precision (.123 or 34.342 for
example)
// There are some cases where the - sign will
not be highlighted for various reasons,
// but I'm happy that it's done where it can
be. Maybe it might be worth looking at
// later if there are any real problems, else
I'll ignore it
!
"#(^|$banned)?({$plus_minus})([0-9]$leading_number_sym
bol\.[0-9]+[fl]?)($banned|\$)?#"
! ),
! '.', //doubles must have a dot
! array(
1 => true, // as above, catch for normal
stuff
! 2 => array($plus_minus_context, false),
! 3 => array('num/dbl', false), // Don't
attempt to highlight numbers as code
! 4 => true
! )
! );
}
--- 142,173 ----
}
! /**
! * param array $options An array of options to configure
double number
! * highlighting
! */
! function useStandardDoubles ($options = array())
{
$banned = '[^a-zA-Z_0-9]';
$plus_minus = '[\-\+]?';
! $leading_number_symbol =
(isset($options['require_leading_number'])
! &&
$options['require_leading_number']) ? '+' : '*';
! $chars_after_number =
(isset($options['chars_after_number']))
! ? '[' . implode('',
(array)$options['chars_after_number']) . ']?' : '';
$this->addRegexGroup(array(
// double precision with e, e.g. 3.5e7 or
-.45e2
!
"#(^|$banned)?([0-9]$leading_number_symbol\.[0-9]+[eE
]{$plus_minus}[0-9]+$chars_after_number)($banned|\$)?#&quo
t;,
// double precision with e and no decimal
place, e.g. 5e2
!
"#(^|$banned)?([0-9]+[eE]{$plus_minus}[0-9]+$chars_aft
er_number)($banned|\$)?#",
// double precision (.123 or 34.342 for
example)
// There are some cases where the - sign will
not be highlighted for various reasons,
// but I'm happy that it's done where it can
be. Maybe it might be worth looking at
// later if there are any real problems, else
I'll ignore it
!
"#(^|$banned)?([0-9]$leading_number_symbol\.[0-9]+$ch
ars_after_number)($banned|\$)?#"
! ), '.', array(
1 => true, // as above, catch for normal
stuff
! 2 => array('num/dbl', false), // Don't
attempt to highlight numbers as code
! 3 => true
! ));
}
-------------------------------------------------------
Using Tomcat but need to do more? Need to support web
services, security?
Get stuff done quickly with pre-integrated technology to
make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on
Apache Geronimo
http://sel.as-us.falkag.net/
sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
geshi-cvs mailing list
geshi-cvs lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geshi-cvs
|