From 9f6e54e92820754d4f05e7d6ef556c11c5351411 Mon Sep 17 00:00:00 2001 From: murphy Date: Tue, 20 Oct 2009 11:12:26 +0000 Subject: Updated PHP scanner (#36) * highlighting of class and function definitions * improved HTML/PHP detection * heredocs (simple) * a new test for classes --- lib/coderay/scanners/cpp.rb | 2 +- lib/coderay/scanners/php.rb | 50 +++++++++++++++++++++++++++++++++++++-------- 2 files changed, 43 insertions(+), 9 deletions(-) (limited to 'lib/coderay') diff --git a/lib/coderay/scanners/cpp.rb b/lib/coderay/scanners/cpp.rb index 7ba9ec0..0b92ef9 100644 --- a/lib/coderay/scanners/cpp.rb +++ b/lib/coderay/scanners/cpp.rb @@ -96,7 +96,7 @@ module Scanners kind = :delimiter elsif scan(/#\s*(\w*)/) - kind = :preprocessor # FIXME multiline preprocs + kind = :preprocessor state = :include_expected if self[1] == 'include' elsif scan(/ L?' (?: [^\'\n\\] | \\ #{ESCAPE} )? '? /ox) diff --git a/lib/coderay/scanners/php.rb b/lib/coderay/scanners/php.rb index 700c7cb..bfbc642 100644 --- a/lib/coderay/scanners/php.rb +++ b/lib/coderay/scanners/php.rb @@ -184,7 +184,7 @@ module Scanners HTML_INDICATOR = / ]/i - IDENTIFIER = /[a-z_\x80-\xFF][a-z0-9_\x80-\xFF]*/i + IDENTIFIER = /[a-z_\x7f-\xFF][a-z0-9_\x7f-\xFF]*/i VARIABLE = /\$#{IDENTIFIER}/ OPERATOR = / @@ -205,7 +205,7 @@ module Scanners states = [:initial] if match?(RE::PHP_START) || # starts with