diff options
author | redmatrix <git@macgirvin.com> | 2016-06-15 19:44:15 -0700 |
---|---|---|
committer | redmatrix <git@macgirvin.com> | 2016-06-15 19:44:15 -0700 |
commit | fa48de33c2f6cefbac8bfec7cde75b75390d5f39 (patch) | |
tree | 63440977ec1d802850c7b8c21496f01c9a44e7fd /library/Text_Highlighter/php.xml | |
parent | 476116a972c0f8b8ade495de557b8fc8d3097964 (diff) | |
download | volse-hubzilla-fa48de33c2f6cefbac8bfec7cde75b75390d5f39.tar.gz volse-hubzilla-fa48de33c2f6cefbac8bfec7cde75b75390d5f39.tar.bz2 volse-hubzilla-fa48de33c2f6cefbac8bfec7cde75b75390d5f39.zip |
provide syntax based [colour] highlighting on code blocks for popular languages. I'm not happy with the line height on the list elements but couldn't see where this was defaulted. This uses the syntax [code=xxx]some code snippet[/code], where xxx represents a code/language style - with about 18 builtins.
Diffstat (limited to 'library/Text_Highlighter/php.xml')
-rw-r--r-- | library/Text_Highlighter/php.xml | 194 |
1 files changed, 194 insertions, 0 deletions
diff --git a/library/Text_Highlighter/php.xml b/library/Text_Highlighter/php.xml new file mode 100644 index 000000000..1b08ea203 --- /dev/null +++ b/library/Text_Highlighter/php.xml @@ -0,0 +1,194 @@ +<?xml version="1.0"?> +<!-- $Id: php.xml,v 1.1 2007-06-03 02:35:28 ssttoo Exp $ --> + +<highlight lang="php"> + + <authors> + <author name="Andrey Demenev" email ="demenev@gmail.com"/> + </authors> + + + <default innerClass="code" /> + + <region name="phpCode" delimClass="inlinetags" innerClass="code" + start="\<\?(php|=)?" end="\?\>" never-contained="yes"> + <contains all="yes"/> + </region> + + <region name="block" delimClass="brackets" innerClass="code" start="\{" end="\}" contained="yes"> + <contains all="yes"/> + </region> + + <region name="brackets" delimClass="brackets" innerClass="code" start="\(" end="\)" contained="yes" > + <contains all="yes"/> + </region> + + <region name="sqbrackets" delimClass="brackets" innerClass="code" start="\[" end="\]" contained="yes"> + <contains all="yes"/> + </region> + + + <region name="mlcomment" innerClass="comment" start="\/\*" end="\*\/" contained="yes"> + <contains block="phpdoc"/> + <contains block="cvstag"/> + </region> + + <region name="strdouble" delimClass="quotes" innerClass="string" start=""" end=""" contained="yes"> + <contains block="var"/> + </region> + + <region name="exec" delimClass="quotes" innerClass="string" start="`" end="`" contained="yes"> + <contains block="var"/> + </region> + + <region name="heredoc" delimClass="quotes" innerClass="string" start="/\<\<\<[\x20\x09]*(\w+)$/m" end="/^%1%;?$/m" contained="yes" remember="yes"> + <contains block="var"/> + </region> + + <region name="strsingle" delimClass="quotes" innerClass="string" start="'" end="'" contained="yes"/> + + <block name="escaped" match="\\\\|\\"|\\'|\\`" innerClass="special" contained="yes"> + <onlyin region="strsingle"/> + <onlyin region="exec"/> + </block> + + <block name="descaped" match="\\[\\"'`tnr\$\{]" innerClass="special" contained="yes"> + <onlyin region="strdouble"/> + <onlyin region="heredoc"/> + </block> + + + <region name="comment" start="(#|\/\/)" end="/$|(?=\?\>)/m" innerClass="comment" contained="yes"> + <contains block="cvstag"/> + </region> + + + <block name="identifier" match="[a-z_]\w*" innerClass="identifier" contained="yes"/> + + <block name="typecast" match="\((array|int|integer|string|bool|boolean|object|float|double)\)" innerClass="reserved" contained="yes"/> + + <block name="curlyvar" match="\{\$[a-z_].*\}" innerClass="var" contained="yes"> + <onlyin region="strdouble"/> + <onlyin region="heredoc"/> + <onlyin region="exec"/> + </block> + + <region name="codeescape" delimClass="inlinetags" innerClass="default" end="\<\?(php|=)?" start="\?\>" contained="yes"> + <onlyin region="block"/> + </region> + + <block name="hexinteger" match="0[xX][\da-f]+" innerClass="number" contained="yes"/> + <block name="var" match="\$[a-z_]\w*" innerClass="var" contained="yes"/> + + <block name="integer" match="\d\d*|\b0\b" innerClass="number" contained="yes"/> + + + <block name="octinteger" match="0[0-7]+" innerClass="number" contained="yes"/> + + <block name="float" match="(\d*\.\d+)|(\d+\.\d*)" innerClass="number" contained="yes"/> + + <block name="exponent" + match="((\d+|((\d*\.\d+)|(\d+\.\d*)))[eE][+-]?\d+)" + innerClass="number" contained="yes"/> + + <block name="phpdoc" match="\s@\w+\s" innerClass="inlinedoc" contained="yes"> + <onlyin region="mlcomment"/> + <onlyin region="comment"/> + </block> + + <block name="url" match="((https?|ftp):\/\/[\w\?\.\-\&=\/%+]+)|(^|[\s,!?])www\.\w+\.\w+[\w\?\.\&=\/%+]*" innerClass="url" contained="yes"> + <onlyin region="mlcomment"/> + <onlyin region="comment"/> + </block> + + <block name="email" match="\w+[\.\w\-]+@(\w+[\.\w\-])+" innerClass="url" contained="yes"> + <onlyin region="mlcomment"/> + <onlyin region="comment"/> + </block> + + <block name="note" match="\bnote:" innerClass="inlinedoc" contained="yes"> + <onlyin region="mlcomment"/> + <onlyin region="comment"/> + </block> + + + <block name="cvstag" match="\$\w+\s*:.*\$" innerClass="inlinedoc" contained="yes"> + <onlyin region="mlcomment"/> + <onlyin region="comment"/> + </block> + + <keywords name="constants" inherits="identifier" innerClass="reserved" case = "yes"> + <keyword match="DIRECTORY_SEPARATOR"/> + <keyword match="PATH_SEPARATOR"/> + </keywords> + + <keywords name="reserved" inherits="identifier" innerClass="reserved"> + <keyword match="echo"/> + <keyword match="foreach"/> + <keyword match="else"/> + <keyword match="if"/> + <keyword match="elseif"/> + <keyword match="for"/> + <keyword match="as"/> + <keyword match="while"/> + <keyword match="foreach"/> + <keyword match="break"/> + <keyword match="continue"/> + <keyword match="class"/> + <keyword match="const"/> + <keyword match="declare"/> + <keyword match="switch"/> + <keyword match="case"/> + <keyword match="endfor"/> + <keyword match="endswitch"/> + <keyword match="endforeach"/> + <keyword match="endswitch"/> + <keyword match="endif"/> + <keyword match="array"/> + <keyword match="default"/> + <keyword match="do"/> + <keyword match="enddeclare"/> + <keyword match="eval"/> + <keyword match="exit"/> + <keyword match="die"/> + <keyword match="extends"/> + <keyword match="function"/> + <keyword match="global"/> + <keyword match="include"/> + <keyword match="include_once"/> + <keyword match="require"/> + <keyword match="require_once"/> + <keyword match="isset"/> + <keyword match="empty"/> + <keyword match="list"/> + <keyword match="new"/> + <keyword match="static"/> + <keyword match="unset"/> + <keyword match="var"/> + <keyword match="return"/> + <keyword match="try"/> + <keyword match="catch"/> + <keyword match="final"/> + <keyword match="throw"/> + <keyword match="public"/> + <keyword match="private"/> + <keyword match="protected"/> + <keyword match="abstract"/> + <keyword match="interface"/> + <keyword match="implements"/> + <keyword match="const"/> + <keyword match="define"/> + <keyword match="__FILE__"/> + <keyword match="__LINE__"/> + <keyword match="__CLASS__"/> + <keyword match="__METHOD__"/> + <keyword match="__FUNCTION__"/> + <keyword match="NULL"/> + <keyword match="true"/> + <keyword match="false"/> + <keyword match="and"/> + <keyword match="or"/> + <keyword match="xor"/> + </keywords> + +</highlight> |