<?php /*------------------------------------------------------------------------------ Entities ------------------------------------------------------------------------------*/ Bitter::rule(Bitter::id('xml-entity'), Bitter::capture('&(#|#x)?([a-z0-9]+)?;?'), Bitter::rule(Bitter::id('xml-entity-valid'), Bitter::tag('entity'), Bitter::capture('^&([a-z]+|#[0-9]+|#x[0-9a-f]+);', 'i')), Bitter::rule(Bitter::id('xml-entity-error'), Bitter::tag('error'), Bitter::capture('.+'))); /*------------------------------------------------------------------------------ Attributes ------------------------------------------------------------------------------*/ Bitter::rule(Bitter::id('xml-attribute'), Bitter::capture('([a-z][a-z0-9_\\-\\:]*)(\\s*=\\s*)?(".*?"|\'.*?\')?', 'i'), Bitter::rule(Bitter::id('xml-attribute-key'), Bitter::tag('attribute'), Bitter::capture('^[^="\']+=\\s*(?=["\'])')), Bitter::rule(Bitter::id('xml-attribute-value-single'), Bitter::tag('value'), Bitter::capture("'.*?'\$"), Bitter::id('xml-entity')), Bitter::rule(Bitter::id('xml-attribute-value-double'), Bitter::tag('value'), Bitter::capture('".*?"$'), Bitter::id('xml-entity')), Bitter::rule(Bitter::id('xml-attribute-error'), Bitter::tag('error'), Bitter::capture('.+'))); /*------------------------------------------------------------------------------ Comments ------------------------------------------------------------------------------*/ Bitter::rule(Bitter::id('xml-doctype'), Bitter::tag('doctype'), Bitter::capture('<!DOCTYPE(.*?)>')); Bitter::rule(Bitter::id('xml-comment'), Bitter::tag('comment'), Bitter::start('<!--'), Bitter::stop('-->?'), Bitter::rule(Bitter::id('xml-comment-error'), Bitter::tag('error'), Bitter::capture('--'))); Bitter::rule(Bitter::id('xml-cdata'), Bitter::tag('cdata'), Bitter::start('<!\\[CDATA\\['), Bitter::stop('\\]\\]>')); /*------------------------------------------------------------------------------ Declarations ------------------------------------------------------------------------------*/ Bitter::rule(Bitter::id('xml-declaration'), Bitter::tag('declaration open close'), Bitter::capture('<\\?xml.*?(\\??)>', 'i'), Bitter::rule(Bitter::id('xml-declaration-begin'), Bitter::tag('begin'), Bitter::capture('^<\\?xml', 'i')), Bitter::rule(Bitter::id('xml-declaration-end'), Bitter::tag('end'), Bitter::capture('[\\?]>$')), Bitter::id('xml-attribute')); /*------------------------------------------------------------------------------ Tags ------------------------------------------------------------------------------*/ Bitter::rule(Bitter::id('xml-tag-open'), Bitter::capture('<[a-z][a-z0-9_\\-\\:]*(([^>]+)?)>', 'i'), Bitter::tag('tag open'), Bitter::rule(Bitter::id('xml-tag-open-begin'), Bitter::capture('^<[a-z][a-z0-9_\\-\\:]*', 'i'), Bitter::tag('begin')), Bitter::rule(Bitter::id('xml-tag-open-end'), Bitter::capture('/>|>$'), Bitter::tag('end')), Bitter::id('xml-attribute')); Bitter::rule(Bitter::id('xml-tag-close'), Bitter::capture('</[^>]+>?'), Bitter::rule(Bitter::id('xml-tag-close-valid'), Bitter::tag('tag close'), Bitter::capture('</[a-z][a-z0-9_\\-\\:]*>')), Bitter::rule(Bitter::id('xml-declaration-error'), Bitter::tag('error'), Bitter::capture('.+')), Bitter::id('xml-attribute')); /*------------------------------------------------------------------------------ Main ------------------------------------------------------------------------------*/ Bitter::rule(Bitter::id('xml-include'), Bitter::tag('context-markup xml'), Bitter::capture('.+', 's'), Bitter::id('xml-entity'), Bitter::id('xml-doctype'), Bitter::id('xml-comment'), Bitter::id('xml-cdata'), Bitter::id('xml-declaration'), Bitter::id('xml-tag-close'), Bitter::id('xml-tag-open')); Bitter::rule(Bitter::id('xml'), Bitter::id('xml-include')); /*----------------------------------------------------------------------------*/
/*------------------------------------------------------------------------------ Comments ------------------------------------------------------------------------------*/ Bitter::rule(Bitter::id('php-comment-block'), Bitter::capture('/\\*.*?\\*/', 's'), Bitter::rule(Bitter::id('php-comment-block-doc'), Bitter::capture('/\\*\\*.*%', 's'), Bitter::tag('comment block doc'), Bitter::rule(Bitter::id('php-comment-docword'), Bitter::capture('@[a-z][a-z_\\-]+', 'i'), Bitter::tag('docword'))), Bitter::rule(Bitter::id('php-comment-block-normal'), Bitter::capture('.*', 's'), Bitter::tag('comment block'))); Bitter::rule(Bitter::id('php-comment-line'), Bitter::capture('(#|//).*', 'm'), Bitter::tag('comment line')); /*------------------------------------------------------------------------------ Keywords ------------------------------------------------------------------------------*/ Bitter::rule(Bitter::id('php-keyword'), Bitter::capture('\\b(__NAMESPACE__|__METHOD__|__FUNCTION__|__FILE__|__DIR__|__CLASS__|xor|while|var|use|unset|try|true|throw|switch|string|str|stdClass|static|self|return|require_once|require|public|protected|private|print|php_user_filter|parent|or|old_function|object|null|new|namespace|list|isset|interface|integer|int|instanceof|include_once|include|implements|if|goto|global|function|foreach|for|float|final|false|extends|exit|Exception|eval|endwhile|endswitch|endif|endforeach|endfor|enddeclare|empty|elseif|else|echo|do|Directory|die|default|declare|continue|const|Closure|clone|class|cfunction|catch|case|break|boolean|bool|as|array|and|abstract)\\b', 'i'), Bitter::tag('keyword')); Bitter::rule(Bitter::id('php-keyword-class'), Bitter::capture('\\b(class|new|extends|implements|instanceof)\\s+[a-z_][a-z0-9_]+', 'i'), Bitter::rule(Bitter::id('php-define-class-name'), Bitter::capture('[a-z_][a-z0-9_]+$', 'i'), Bitter::tag('class defined')), Bitter::id('php-keyword')); Bitter::rule(Bitter::id('php-keyword-function'), Bitter::capture('\\b(function)\\s+[a-z_][a-z0-9_]+', 'i'), Bitter::rule(Bitter::id('php-keyword-function-name'), Bitter::capture('[a-z_][a-z0-9_]+$', 'i'), Bitter::tag('function defined')), Bitter::id('php-keyword')); Bitter::rule(Bitter::id('php-keyword-class-access'), Bitter::capture('[a-z_][a-z0-9_]+::\\$*[a-z_][a-z0-9_]*\\(?', 'i'), Bitter::rule(Bitter::id('php-keyword-class-access-name'), Bitter::capture('^.+?(?=::)', 'i'), Bitter::tag('keyword class')), Bitter::rule(Bitter::id('php-keyword-class-access-variable'), Bitter::capture('::\\$+[a-z_][a-z0-9_]*', 'i'), Bitter::tag('variable')), Bitter::rule(Bitter::id('php-keyword-class-access-function'), Bitter::capture('::[a-z_][a-z0-9_]*\\(', 'i'), Bitter::rule(Bitter::id('php-keyword-class-access-function-call'), Bitter::capture('[^\\(]+', 'i'), Bitter::tag('function'))), Bitter::rule(Bitter::id('php-keyword-class-access-constant'), Bitter::capture('::[a-z_][a-z0-9_]*\\b', 'i'), Bitter::tag('constant'))); /*------------------------------------------------------------------------------ Variables ------------------------------------------------------------------------------*/ Bitter::rule(Bitter::id('php-variable-normal'), Bitter::capture('(->\\$*|(::)?\\$+)[a-z_][a-z0-9_]*(->\\$*[a-z_][a-z0-9_]*)*', 'i'), Bitter::tag('variable')); Bitter::rule(Bitter::id('php-variable-function'), Bitter::capture('(->\\$*|(::)?\\$+)[a-z_][a-z0-9_]*(->\\$*[a-z_][a-z0-9_]*)*(?=[a-z0-9_]*\\s*\\()', 'i'), Bitter::tag('variable'), Bitter::rule(Bitter::id('php-variable-function-call'), Bitter::capture('(\\$+|->\\$*)[a-z_][a-z0-9_]*$', 'i'), Bitter::tag('function called'))); /*------------------------------------------------------------------------------ Functions ------------------------------------------------------------------------------*/ Bitter::rule(Bitter::id('php-function'), Bitter::capture('\\b[a-z_][a-z0-9_]*\\(', 'i'), Bitter::rule(Bitter::id('php-function-call'), Bitter::capture('[^\\(]+', 'i'), Bitter::tag('function called'))); /*------------------------------------------------------------------------------ Constants ------------------------------------------------------------------------------*/ Bitter::rule(Bitter::id('php-constant'), Bitter::capture('\\b[a-z_][a-z0-9_]*\\b', 'i'), Bitter::tag('constant')); /*------------------------------------------------------------------------------ Main ------------------------------------------------------------------------------*/ Bitter::rule(Bitter::id('php-include'), Bitter::tag('context-source php'), Bitter::start('<\\?(php|=)?'), Bitter::stop('\\?>'), Bitter::id('php-string-single'), Bitter::id('php-string-double'), Bitter::id('php-number-float'), Bitter::id('php-number-integer-decimal'), Bitter::id('php-number-integer-octal'), Bitter::id('php-number-integer-hexadecimal'), Bitter::id('php-comment-block'), Bitter::id('php-comment-line'), Bitter::id('php-variable-function'), Bitter::id('php-variable-normal'), Bitter::id('php-keyword-class'), Bitter::id('php-keyword-class-access'), Bitter::id('php-keyword-function'), Bitter::id('php-keyword'), Bitter::id('php-function'), Bitter::id('php-constant')); Bitter::rule(Bitter::id('php'), Bitter::id('php-include')); /*----------------------------------------------------------------------------*/
Comments ------------------------------------------------------------------------------*/ Bitter::rule(Bitter::id('css-comment'), Bitter::tag('comment block'), Bitter::start('/\\*'), Bitter::stop('\\*/')); /*------------------------------------------------------------------------------ Properties ------------------------------------------------------------------------------*/ Bitter::rule(Bitter::id('css-block'), Bitter::start('\\{'), Bitter::stop('\\}'), Bitter::rule(Bitter::id('css-property'), Bitter::tag('property'), Bitter::capture('[a-z\\-]+(?=:)', 's')), Bitter::rule(Bitter::id('css-value'), Bitter::tag('value'), Bitter::capture('(?<=:)[^;]+', 's'), Bitter::id('css-string-single'), Bitter::id('css-string-double'), Bitter::id('css-number'), Bitter::id('css-color'), Bitter::id('css-keyword')), Bitter::id('css-comment')); /*------------------------------------------------------------------------------ Keywords ------------------------------------------------------------------------------*/ Bitter::rule(Bitter::id('css-keyword'), Bitter::tag('keyword'), Bitter::capture('(!important|\\b(xx-small|xx-large|xor|x-small|x-large|wider|wait|w-resize|visual|visible|url|uppercase|upper-roman|upper-latin|upper-alpha|underline|ultra-expanded|ultra-condensed|transparent|top|thin|thick|textfield|textarea|text-top|text-bottom|text|table-row-group|table-row|table-header-group|table-footer-group|table-column-group|table-column|table-cell|table-caption|table|sw-resize|super|sub|status-bar|static|square-button|square|space|source-over|source-out|source-in|source-atop|solid|smaller|small-caption|small-caps|small|sliderthumb-vertical|sliderthumb-horizontal|slider-vertical|slider-horizontal|show|serif|separate|semi-expanded|semi-condensed|searchfield-results-decoration|searchfield-results-button|searchfield-decoration|searchfield-cancel-button|searchfield|se-resize|scrollbartrack-vertical|scrollbartrack-horizontal|scrollbarthumb-vertical|scrollbarthumb-horizontal|scrollbargripper-vertical|scrollbargripper-horizontal|scrollbarbutton-up|scrollbarbutton-right|scrollbarbutton-left|scrollbarbutton-down|scroll|sans-serif|s-resize|run-in|rtl|right|ridge|rgba|rgb|repeat-y|repeat-x|repeat|relative|rect|read-write-plaintext-only|read-write|read-only|radio|push-button|progress|pre|pointer|plus-lighter|plus-darker|overline|outside|outset|open-quote|oblique|nw-resize|nowrap|normal|none|no-repeat|no-open-quote|no-close-quote|ne-resize|narrower|n-resize|move|middle|message-box|menulist-textfield|menulist-text|menulist-button|menulist|menu|medium|ltr|lowercase|lower-roman|lower-latin|lower-greek|lower-alpha|logical|listitem|listbox|list-item|lines|line-through|lighter|left|larger|large|justify|italic|invert|inside|inset|inline-table|inline-block|inline|inherit|ignore|icon|hsla|hsl|highlight|hide|hidden|help|groove|georgian|fixed|extra-expanded|extra-condensed|expanded|embed|element|e-resize|double|dotted|discard|disc|destination-over|destination-out|destination-in|destination-atop|default|decimal-leading-zero|decimal|dashed|crosshair|counters|counter|copy|condensed|collapse|close-quote|clear|circle|checkbox|center|caret|caption|capitalize|button-bevel|button|bottom|both|bolder|bold|block|blink|bidi-override|baseline|auto|attr|armenian|after-white-space|absolute))\\b')); /*------------------------------------------------------------------------------ Strings ------------------------------------------------------------------------------*/ Bitter::rule(Bitter::id('css-string-escape'), Bitter::tag('escape'), Bitter::capture('\\\\(\'|"|[a-f0-9]{1,6})')); Bitter::rule(Bitter::id('css-string-single'), Bitter::tag('string single'), Bitter::start("'"), Bitter::stop("'"), Bitter::id('css-string-escape')); Bitter::rule(Bitter::id('css-string-double'), Bitter::tag('string double'), Bitter::start('"'), Bitter::stop('"'), Bitter::id('css-string-escape')); /*------------------------------------------------------------------------------ Numbers ------------------------------------------------------------------------------*/ Bitter::rule(Bitter::id('css-number'), Bitter::tag('number'), Bitter::capture('(-|\\b)([0-9]*\\.[0-9]+|[0-9]+)(%|(px|pt|em|en|ex|in)\\b)?', 'i')); /*------------------------------------------------------------------------------ Colours ------------------------------------------------------------------------------*/ Bitter::rule(Bitter::id('css-color'), Bitter::tag('color'), Bitter::capture('(#([a-f0-9]{3}|[a-f0-9]{6})|\\b(yellowgreen|yellow|whitesmoke|white|wheat|violet|turquoise|tomato|thistle|teal|tan|steelblue|springgreen|snow|slategrey|slategray|slateblue|skyblue|silver|sienna|seashell|seagreen|sandybrown|salmon|saddlebrown|royalblue|rosybrown|red|purple|powderblue|plum|pink|peru|peachpuff|papayawhip|palevioletred|paleturquoise|palegreen|palegoldenrod|orchid|orangered|orange|olivedrab|olive|oldlace|navy|navajowhite|moccasin|mistyrose|mintcream|midnightblue|mediumvioletred|mediumturquoise|mediumspringgreen|mediumslateblue|mediumseagreen|mediumpurple|mediumorchid|mediumblue|mediumaquamarine|maroon|magenta|linen|limegreen|lime|lightyellow|lightsteelblue|lightslategrey|lightslategray|lightskyblue|lightseagreen|lightsalmon|lightpink|lightgrey|lightgreen|lightgray|lightgoldenrodyellow|lightcyan|lightcoral|lightblue|lemonchiffon|lawngreen|lavenderblush|lavender|khaki|ivory|indigo|indianred|hotpink|honeydew|grey|greenyellow|green|gray|goldenrod|gold|ghostwhite|gainsboro|fuchsia|forestgreen|floralwhite|firebrick|dodgerblue|dimgrey|dimgray|deepskyblue|deeppink|darkviolet|darkturquoise|darkslategrey|darkslategray|darkslateblue|darkseagreen|darksalmon|darkred|darkorchid|darkorange|darkolivegreen|darkmagenta|darkkhaki|darkgrey|darkgreen|darkgray|darkgoldenrod|darkcyan|darkblue|cyan|crimson|cornsilk|cornflowerblue|coral|chocolate|chartreuse|cadetblue|burlywood|brown|blueviolet|blue|blanchedalmond|black|bisque|beige|azure|aquamarine|aqua|antiquewhite|aliceblue))\\b', 'i')); /*------------------------------------------------------------------------------ Main ------------------------------------------------------------------------------*/ Bitter::rule(Bitter::id('css-include'), Bitter::tag('context-source css'), Bitter::capture('.+', 's'), Bitter::id('css-comment'), Bitter::id('css-selector'), Bitter::id('css-block')); Bitter::rule(Bitter::id('css'), Bitter::id('css-include')); /*----------------------------------------------------------------------------*/
Bitter::rule(Bitter::id('js-string-single'), Bitter::tag('string single'), Bitter::start("'"), Bitter::stop("'"), Bitter::id('js-string-escape')); Bitter::rule(Bitter::id('js-string-double'), Bitter::tag('string double'), Bitter::start('"'), Bitter::stop('"'), Bitter::id('js-string-escape')); /*------------------------------------------------------------------------------ Regexp ------------------------------------------------------------------------------*/ Bitter::rule(Bitter::id('js-regexp-escape'), Bitter::tag('escape'), Bitter::capture('\\\\([bBdDfnrsStvwW0/]|c[A-Z]|x[a-fA-F0-9]{2}|h[a-fA-F0-9]{4}|[0-7]{1,3})')); Bitter::rule(Bitter::id('js-regexp'), Bitter::tag('regexp'), Bitter::start("/"), Bitter::stop("/[gim]*"), Bitter::id('js-regexp-escape')); /*------------------------------------------------------------------------------ Numbers ------------------------------------------------------------------------------*/ Bitter::rule(Bitter::id('js-number-float'), Bitter::capture("\\b[0-9]*\\.[0-9]+\\b"), Bitter::tag('number float')); Bitter::rule(Bitter::id('js-number-integer'), Bitter::capture("\\b[0-9]+\\b"), Bitter::tag('number integer')); /*------------------------------------------------------------------------------ Comments ------------------------------------------------------------------------------*/ Bitter::rule(Bitter::id('js-comment-block'), Bitter::tag('comment block'), Bitter::start('/\\*'), Bitter::stop('\\*/')); Bitter::rule(Bitter::id('js-comment-line'), Bitter::tag('comment line'), Bitter::capture("//.*", 'm')); /*------------------------------------------------------------------------------ Keywords ------------------------------------------------------------------------------*/ Bitter::rule(Bitter::id('js-keyword'), Bitter::tag('keyword'), Bitter::capture('\\b(with|while|volatile|void|var|typeof|try|true|transient|throws|throw|this|synchronized|switch|super|static|short|return|public|protected|private|package|null|new|native|long|interface|int|instanceof|in|import|implements|if|goto|function|for|float|finally|final|false|extends|export|enum|else|double|do|delete|default|debugger|continue|const|class|char|catch|case|byte|break|boolean|abstract)\\b', 'i')); /*------------------------------------------------------------------------------ Variables ------------------------------------------------------------------------------*/ Bitter::rule(Bitter::id('js-variable-normal'), Bitter::tag('variable'), Bitter::capture('[$a-z_][$a-z0-0_]*(\\.[$a-z_][$a-z0-0_]*)*', 'i')); Bitter::rule(Bitter::id('js-variable-function'), Bitter::tag('variable'), Bitter::capture('[$a-z_][$a-z0-0_]*(\\.[$a-z_][$a-z0-0_]*)*(?=[$a-z0-9_]*\\s*\\()', 'i'), Bitter::rule(Bitter::id('js-variable-function-call'), Bitter::tag('function'), Bitter::capture('(\\.)?[$a-z_][$a-z0-0_]*$', 'i'))); /*------------------------------------------------------------------------------ Objects ------------------------------------------------------------------------------*/ Bitter::rule(Bitter::id('js-object-key'), Bitter::tag('object-key'), Bitter::capture('[$a-z_][$a-z0-0_]*(\\.[$a-z_][$a-z0-0_]*)*(?=:)', 'i')); /*------------------------------------------------------------------------------