JGCSCS 4 PHP Hypertext Preprocessor *.php;*.php3 JGsoft support@editpadpro.com http://www.editpadpro.com http://www.php.net TRUE # 1 HTML files with embedded PHP scripts. 6 PHP Example 0 TRUE 9 PHP Opening 1 PHP-style opening tag <\?(php)? TRUE FALSE 2 0 6 FALSE PHP Opening 2 TRUE FALSE 2 0 2 FALSE Bracket [{}]+ FALSE FALSE 17 0 0 FALSE Reserved words \b(?:__(?:CLASS|FILE|FUNCTION|LINE|METHOD)__|abstract|and|array|as|break|case|catch|cfunction|class|clone|const|continue|declare|default|die|do|echo|else(?:if)?|empty|enddeclare|endfor(?:each)?|endif|endswitch|endwhile|eval|exception|exit|extends|final|for(?:each)?|function|global|if|implements|include(?:_once)?|interface|isset|list|new|old_function|or|php_user_filter|print|private|protected|public|require(?:_once)?|return|static|switch|throw|try|unset|use|var|while|xor)\b TRUE FALSE 7 0 0 FALSE Single-line comment Note that the PHP closing tag is also considered end-of-line and will stop the comment and the PHP section. We use zero-width positive lookahead (?=...) for the ?> as it is not part of the comment (//|#).*?((?=)|$) TRUE FALSE 5 0 0 TRUE Multi-line comment /\* FALSE TRUE 5 0 11 FALSE Number hexadecimal | integer, decimal part, exponent \b0[xX][A-Fa-f0-9]++|\b[0-9]++(?:\.[0-9]++)?+(?:[eE][+-]?+[0-9]++)?+ FALSE FALSE 10 0 0 FALSE Variable \$[A-Za-z_][A-Za-z0-9_]*(?:->[A-Za-z_][A-Za-z0-9_]*)? FALSE FALSE 16 0 0 FALSE Single-quoted string '[^'\\\r\n]*+(\\(?:.|$)[^'\\\r\n]*+)*+'? FALSE FALSE 9 0 0 TRUE Double-quoted string " FALSE TRUE 9 0 9 FALSE Here document Properly finished here document. A here document is started by an identifier preceded by << and terminated by the same identifier at the beginning of a line. <<<([A-Za-z0-9_]++)\b.*?^\1\b FALSE TRUE 0 0 0 TRUE Open here document Here document with missing terminator <<<(?:[A-Za-z0-9_]++)\b.*+ FALSE TRUE 0 0 0 TRUE Operator [-.[\]()=+*/<>|&!~]++ FALSE FALSE 13 0 0 FALSE PHP 3 1 0 FALSE 12 Closing PHP-style closing tag. Use toggle-back because this subscheme is references to in several places. %> FALSE FALSE 2 0 1 FALSE Bracket [{}]+ FALSE FALSE 17 0 0 FALSE Reserved words \b(?:__(?:CLASS|FILE|FUNCTION|LINE|METHOD)__|abstract|and|array|as|break|case|catch|cfunction|class|clone|const|continue|declare|default|die|do|echo|else(?:if)?|empty|enddeclare|endfor(?:each)?|endif|endswitch|endwhile|eval|exception|exit|extends|final|for(?:each)?|function|global|if|implements|include(?:_once)?|interface|isset|list|new|old_function|or|php_user_filter|print|private|protected|public|require(?:_once)?|return|static|switch|throw|try|unset|use|var|while|xor)\b TRUE FALSE 7 0 0 FALSE Single-line comment Note that the PHP closing tag is also considered end-of-line and will stop the comment and the PHP section. We use zero-width positive lookahead (?=...) for the ?> as it is not part of the comment (//|#).*?((?=%>)|$) FALSE FALSE 5 0 0 TRUE Mutli-line comment /\* FALSE TRUE 5 0 11 FALSE Number hexadecimal | integer, decimal part, exponent \b0[xX][A-Fa-f0-9]++|\b[0-9]++(?:\.[0-9]++)?+(?:[eE][+-]?+[0-9]++)?+ FALSE FALSE 10 0 0 FALSE Variable \$[A-Za-z_][A-Za-z0-9_]*(?:->[A-Za-z_][A-Za-z0-9_]*)? FALSE FALSE 16 0 0 FALSE Single-quoted string '[^'\\\r\n]*+(\\.[^'\\\r\n]*+)*+'? FALSE FALSE 9 0 0 TRUE Double-quoted string " FALSE TRUE 9 0 9 FALSE Here document Properly finished here document. A here document is started by an identifier preceded by << and terminated by the same identifier at the beginning of a line. <<<([A-Za-z0-9_]++)\b.*?^\1\b FALSE TRUE 0 0 0 TRUE Open here document Here document with missing terminator <<<(?:[A-Za-z0-9_]++)\b.*+ FALSE TRUE 0 0 0 TRUE Operator [-.[\]()=+*/<>|&!~]++ FALSE FALSE 13 0 0 FALSE Interpolated String 1 9 TRUE 3 Escaped character This element makes sure escaped " and $ characters are skipped. Using lookbehind won't work, since (? bracket, assume the HTML tag ends here > FALSE FALSE 2 0 2 FALSE PHP Opening 1 PHP-style opening tag <\?(php)? FALSE FALSE 2 0 6 FALSE PHP Opening 3 ASP-style opening tag <% FALSE FALSE 2 0 8 FALSE URL \b(?:https?|ftp|file)://[-A-Z0-9+&@#/%?=~_|!:,.]*[-A-Z0-9+&@#/%=~_|] TRUE FALSE 1 1 0 FALSE email address \b(?:mailto:)?[A-Z0-9._%-]++@[A-Z0-9._%-]+\.[A-Z]{2,4}\b TRUE FALSE 1 3 0 FALSE Another tag Though not valid in HTML, we permit < tags to keep syntax coloring consistent while the file is being edited (?=<) FALSE FALSE 2 0 2 FALSE PHP Comment 1 5 TRUE 1 Closing */ \*/ FALSE FALSE 5 0 1 FALSE