<?xml version="1.0"?>
<!--
		Bluefish HTML Editor
		php.bflang2 $Revision: 8819 $

		Copyright (C) 2008-2015 Olivier Sessink

	    This program is free software: you can redistribute it and/or modify
		it under the terms of the GNU General Public License as published by
		the Free Software Foundation, either version 3 of the License, or
		(at your option) any later version.

		This program is distributed in the hope that it will be useful,
		but WITHOUT ANY WARRANTY; without even the implied warranty of
		MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
		GNU General Public License for more details.

		You should have received a copy of the GNU General Public License
		along with this program.  If not, see <http://www.gnu.org/licenses/>.
-->
<!DOCTYPE bflang [
	<!ENTITY univ "accesskey,class,contenteditable,contextmenudir,draggable,dropzone,hidden,id,lang,spellcheck,style=c.html.attrib.style,tabindex,title,translate">
	<!ENTITY evnt "onclick,ondblclick,ondrag,ondragend,ondragenter,ondragleave,ondragover,ondragstart,ondrop,onmousedown,onmouseup,onmouseover,onmousemove,onmouseout,onkeypress,onkeydown,onkeyup,onmousewheel,onscroll,onwheel,oncopy,oncut,onpaste">
	<!ENTITY css-selectors SYSTEM "css-selectors.bfinc">
	<!ENTITY css-rules SYSTEM "css-rules.bfinc">
	<!ENTITY all-javascript SYSTEM "all-javascript.bfinc">
	<!ENTITY all-html SYSTEM "all-html.bfinc">
	<!ENTITY all-php SYSTEM "all-php.bfinc">

	<!ENTITY globals "accesskey,class,contenteditable,contextmenu,dir,draggable,dropzone,hidden,id,lang,spellcheck,style,tabindex,title,translate,onabort,onblur,oncancel,oncanplay,oncanplaythrough,onchange,onclick,onclose,oncontextmenu,oncuechange,ondblclick,ondrag,ondragend,ondragenter,ondragleave,ondragover,ondragstart,ondrop,ondurationchange,onemptied,onended,onerror,onfocus,oninput,oninvalid,onkeydown,onkeypress,onkeyup,onload,onloadeddata,onloadedmetadata,onloadstart,onmousedown,onmousemove,onmouseout,onmouseover,onmouseup,onmousewheel,onpause,onplay,onplaying,onprogress,onratechange,onreset,onscroll,onseeked,onseeking,onselect,onshow,onstalled,onsubmit,onsuspend,ontimeupdate,onvolumechange,onwaiting">
	<!ENTITY svguniv "id,xml:base,xml:lang,xml:space">
	<!ENTITY svgevent "onactivate,onclick,onfocusin,onfocusout,onload,onmousedown,onmousemove,onmouseout,onmouseover,onmouseup">
	<!ENTITY svgshapetext "fill,fill-opacity,fill-rule,stroke,stroke-dasharray,stroke-dashoffset,stroke-linecap,stroke-linejoin,stroke-miterlimit,stroke-opacity,stroke-width">
	<!ENTITY svgtext "direction,dominant-baseline,font,font-family,font-size,font-size-adjust,font-stretch,font-style,font-variant,font-weight,glyph-orientation-horizontal,glyph-orientation-vertical,kerning,letter-spacing,text-anchor,text-decoration,unicode-bidi,word-spacing">
	<!ENTITY css-selectors SYSTEM "css-selectors.bfinc">
	<!ENTITY css-rules SYSTEM "css-rules.bfinc">
	<!ENTITY all-javascript SYSTEM "all-javascript.bfinc">
	<!ENTITY svg SYSTEM "svg.bfinc">
	<!ENTITY JQuery SYSTEM "JQuery.bfinc">
]>

<bflang name="PHP" version="3" contexts="421" matches="9456">
<header>
	<mime type="application/x-php"/>
	<mime type="text/plain?php"/>
	<option name="load_reference" default="1" description="Load reference data"/>
	<option name="load_completion" default="1" description="Load completion data"/>
	<option name="load_php_functions" default="1" description="Load all php functions" />
	<option name="show_in_menu" default="1" />
	<option name="php_short_open_tag" default="1" description="Enable the PHP short open tag"/>
	<option name="Parentheses block_foldable" default="0" description="Allow folding of Parentheses block"/>
	<option name="Square brackets block_foldable" default="0" description="Allow folding of Square brackets block"/>
	<option name="Curly brackets block_foldable" default="1" description="Allow folding of Curly brackets block"/>
	<option name="Javascript Parentheses block_foldable" default="0" description="Allow folding of Javascript Parentheses block"/>
	<option name="Javascript Square brackets block_foldable" default="0" description="Allow folding of Javascript Square brackets block"/>
	<option name="Javascript Curly brackets block_foldable" default="1" description="Allow folding of Javascript Curly brackets block"/>
	<option name="C style comment_foldable" default="1" description="Allow folding of C style comments" />
	<option name="PHP block_foldable" default="1" description="Allow folding of PHP blocks" />
	<option name="autocomplete_PHP_variable" default="1" description="Auto-complete PHP variables" />
	<option name="autocomplete_PHP_function" default="1" description="Auto-complete PHP functions" />
	<option name="html-block_foldable" default="0" />
<!--	<option name="autocomplete_tags" default="1" />-->
	<option name="autocomplete_with_arguments" default="1" />
	<option name="autocomplete_with_parentheses" default="0" />
	<option name="stretch_tag_block" default="1" />
	<option name="attribute_string_is_block" default="0" description="Show tag attributes as block"/>
	<option name="autocomplete_javascript_var" default="1" description="autocomplete javascript variables"/>
	<option name="javascript_object_methods" default="1" description="Autocomplete Javascript object methods" />
	<option name="javascript_css_properties" default="1"  />
	<option name="sql-in-php-string" default="1" description="Scan for sql in strings" />
	<option name="autocomplete-html-entities" default="0" />
	<option name="self_close_singleton_tags" default="0" description="Self-close tags such as br, hr, and img with /&gt;" />
	<option name="JQuery" default="0" description="include JQuery syntax" />
	<highlight name="attribute-string" style="string-no-spell-check" />
	<highlight name="php-block-tag" style="special-value"  />
	<highlight name="php-inner-context" style="none" />
	<highlight name="string" style="string"   />
	<highlight name="php-heredoc-string" style="string"   />
	<highlight name="brackets" style="brackets"  />
	<highlight name="php-keyword" style="keyword"  />
	<highlight name="php-value" style="value" />
	<highlight name="php-function" style="function"  />
	<highlight name="php-comment" style="comment"  />
	<highlight name="php-variable" style="variable"  />
	<highlight name="php-string-sql-keyword" style="special-keyword"  />
	<highlight name="html-not-supported-tag" style="warning" />
	<highlight name="html-tag" style="tag"  />
	<highlight name="html-comment" style="comment"  />
	<highlight name="html-entity" style="value"  />
	<highlight name="html-attribute" style="attribute" />
	<highlight name="html-reference-external-tag" style="special-tag" />
	<highlight name="html-table-tag" style="special-tag2" />
	<highlight name="html-form-tag" style="special-tag3" />
	<highlight name="html-deprecated-tag" style="warning" />

	<highlight name="js-keyword" style="keyword"  />
	<highlight name="js-brackets" style="brackets"  />
	<highlight name="js-type" style="type"  />
	<highlight name="js-comment" style="comment"  />
	<highlight name="js-css-property" style="function"  />
	<highlight name="js-string" style="string"  />
	<highlight name="js-value" style="value"  />
	<highlight name="js-variable" style="variable"  />
	<highlight name="js-function" style="function"  />
	<highlight name="js-property" style="special-function"  />
	<highlight name="css-brackets" style="brackets"  />
	<highlight name="css-comment" style="comment" />
	<highlight name="css-html-tag" style="tag"  />
	<highlight name="css-html-classid" style="tag" />
	<highlight name="css-html-media" style="special-tag" />
	<highlight name="css-keyword" style="keyword"  />
	<highlight name="css-property" style="special-keyword"  />
	<highlight name="css-draft-property" style="special-tag3" />
	<highlight name="css-string" style="string" />
	<highlight name="css-value" style="value"   />
	<highlight name="css-pseudo-element" style="keyword" />
	<highlight name="css-operator" style="operator" />
</header>
<properties>
	<comment id="cm.cblockcomment" type="block" start="/*" end="*/" />
	<comment id="cm.htmlcomment" type="block" start="&lt;!--" end="--&gt;" />
	<comment id="cm.cpplinecomment" type="line" start="//" />
	<comment id="cm.scriptcomment" type="line" start="#" />
	<smartindent characters="{" />
	<smartoutdent characters="}" />
	<smartselection characters="$_" />
	<default_spellcheck enabled="1" spell_decode_entities="1" />
	<auto_re_use_attributes enabled="1" />
</properties>
<definition>
<context symbols="&gt;&lt;&amp;; &#9;&#10;&#13;-/" commentid_block="cm.htmlcomment" commentid_line="none">

<group class="php_short_open_tag">
<element id="e.php.short.open" pattern="&lt;(\?|\?php)" is_regex="1" starts_block="1" block_name="PHP block" highlight="php-block-tag">
<context symbols="'&#34;(){}[];#:.,/?!$^*-+=&gt;&lt;&amp; &#9;&#10;&#13;" commentid_block="cm.cblockcomment" commentid_line="cm.cpplinecomment" default_spellcheck="0" highlight="php-inner-context">
&all-php;
<element id="e.php.short.lbrace" pattern="{" starts_block="1" highlight="brackets" block_name="Curly brackets block" />
<element pattern="}" ends_block="1" blockstartelement="e.php.short.lbrace" highlight="brackets" />
<element id="e.php.short.lbracket" pattern="[" starts_block="1" highlight="brackets" block_name="Square brackets block" />
<element pattern="]" ends_block="1" blockstartelement="e.php.short.lbracket" highlight="brackets" />
<element id="e.php.short.lparen" pattern="(" starts_block="1" highlight="brackets" block_name="Parentheses block" />
<element pattern=")" ends_block="1" blockstartelement="e.php.short.lparen" highlight="brackets" />
<element id="e.php.short.lcomment" pattern="/*" starts_block="1" block_name="C style comment" highlight="php-comment">
	<context symbols="*/&#9;&#10;&#13;" highlight="php-comment">
		<element pattern="*/" ends_block="1" blockstartelement="e.php.short.lcomment" highlight="php-comment" ends_context="1" />
	</context>
</element>

<element id="e.php.short.heredoc_string" pattern="&lt;&lt;&lt;EOF" starts_block="1" highlight="brackets" >
<reference><b>heredoc string</b>
<span color="red">Warning</span>: only <b>&lt;&lt;&lt;EOF</b> (without space) is correctly highligted.</reference>
	<autocomplete enable="1" />
	<context symbols="&#13;&#10;EF$ " highlight="php-heredoc-string">
		<element pattern="$[a-zA-Z_][a-zA-Z0-9_]*" is_regex="1" case_insens="1" highlight="php-variable" />
		<element pattern="(&#10;|&#13;|&#13;&#10;)EOF"  is_regex="1" ends_block="1" ends_context="1" blockstartelement="e.php.short.heredoc_string" highlight="brackets" />
	</context>
</element>
<element id="e.php.short.nowdoc_string" pattern="&lt;&lt;&lt;'EOF'" starts_block="1" highlight="brackets" >
<reference><b>nowdoc string</b>
<span color="red">Warning</span>: only <b>&lt;&lt;&lt;'EOF'</b> (without space) is correctly highligted</reference>
	<autocomplete enable="1" />
	<context symbols="&#13;&#10;EF" highlight="php-heredoc-string">
		<element pattern="(&#10;|&#13;|&#13;&#10;)EOF"  is_regex="1" ends_block="1" ends_context="1" blockstartelement="e.php.short.nowdoc_string" highlight="brackets" />
	</context>
</element>
<element id="e.php.short.variable" pattern="$[a-zA-Z_][a-zA-Z0-9_]*" is_regex="1" case_insens="1" highlight="php-variable" identifier_mode="2" identifier_autocomp="option:autocomplete_PHP_variable" />
<element id="e.php.short.doublequotedstring" pattern="&#34;" highlight="string" starts_block="1">
	<context symbols="\&#34;$ &#9;&#10;&#13;' -&lt;&gt;{}[]" highlight="string">
		<element pattern="\\." highlight="string" is_regex="1" />
<!--		<element pattern="\$" highlight="string" />-->
		<element idref="e.php.short.variable" />
		<group class="sql-in-php-string" highlight="php-string-sql-keyword" case_insens="1">
			<element pattern="AND" />
			<element pattern="AS" />
			<element pattern="ASC" />
			<element pattern="BY" />
			<element pattern="COUNT" />
			<element pattern="DATE" />
			<element pattern="DATE_FORMAT" />
			<element pattern="DELETE" />
			<element pattern="DESC" />
			<element pattern="DISTINCT" />
			<element pattern="FROM" />
			<element pattern="GROUP" />
			<element pattern="IN" />
			<element pattern="INNER" />
			<element pattern="INSERT" />
			<element pattern="INTO" />
			<element pattern="JOIN" />
			<element pattern="LEFT" />
			<element pattern="LIMIT" />
			<element pattern="NOT" />
			<element pattern="ON" />
			<element pattern="OR" />
			<element pattern="ORDER" />
			<element pattern="REGEXP" />
			<element pattern="SELECT" />
			<element pattern="SET" />
			<element pattern="UPDATE" />
			<element pattern="VALUES" />
			<element pattern="WHERE" />
		</group>
		<element pattern="&#34;" highlight="string" ends_context="1" ends_block="1" blockstartelement="e.php.short.doublequotedstring" />
	</context>
</element>
<element pattern="//" highlight="php-comment">
	<context id="c.php.short.linecomment" symbols="?&gt;&#10;&#13;" highlight="php-comment">
<!-- dos has \r\n -> we should never end a pattern between these two chars  -->
		<element pattern="(&#10;|&#13;|&#13;&#10;)" is_regex="1" ends_context="1" />
		<element pattern="?&gt;" ends_context="2" ends_block="1" blockstartelement="e.php.short.open" highlight="php-block-tag" />
	</context>
</element>
<!-- there is a bug in the scanning engine such that a regex style pattern like (#|//) won't work. The reason is that
there is special code if a pattern ends on a symbol. That code fails on the above pattern because both # and / are ends
for this pattern and both of them are a symbol. That's why we have a separate entry for # and for // -->
<element pattern="#" highlight="php-comment">
	<context idref="c.php.short.linecomment"/>
</element>
<element pattern="?&gt;" ends_block="1" blockstartelement="e.php.short.open" highlight="php-block-tag" ends_context="1" />
</context></element>
</group>
<group notclass="php_short_open_tag">
<element id="e.php.open" pattern="&lt;?php" starts_block="1" highlight="php-block-tag" block_name="PHP block">
<context symbols="'&#34;(){}[];#:.,/?!$^*-+=&gt;&lt;&amp; &#9;&#10;&#13;" commentid_block="cm.cblockcomment" highlight="php-inner-context" commentid_line="cm.cpplinecomment" default_spellcheck="0">
<!-- unfortunately we cannot refer the context as previously used, because if option php_short_open_tag
was disabled, this whole section is not parsed by the language manager, so the context does not yet exist..  -->
&all-php;
<element id="e.php.lbrace" pattern="{" starts_block="1" highlight="brackets" block_name="Curly brackets block"/>
<element pattern="}" ends_block="1" blockstartelement="e.php.lbrace" highlight="brackets" />
<element id="e.php.lbracket" pattern="[" starts_block="1" highlight="brackets" />
<element pattern="]" ends_block="1" blockstartelement="e.php.lbracket" highlight="brackets" />
<element id="e.php.lparen" pattern="(" starts_block="1" highlight="brackets" block_name="Parentheses block" />
<element pattern=")" ends_block="1" blockstartelement="e.php.lparen" highlight="brackets" />
<element id="e.php.lcomment" pattern="/*" starts_block="1" block_name="C style comment" highlight="php-comment">
	<context symbols="*/&#9;&#10;&#13;" highlight="php-comment">
		<element pattern="*/" ends_block="1" blockstartelement="e.php.lcomment" highlight="php-comment" ends_context="1" />
	</context>
</element>

<element id="e.php.heredoc_string" pattern="&lt;&lt;&lt;EOF" starts_block="1" highlight="brackets" >
<reference><b>heredoc string</b>
<span color="red">Warning</span>: only <b>&lt;&lt;&lt;EOF</b> (without space) is correctly highligted.</reference>
	<autocomplete enable="1" />
	<context symbols="&#13;&#10;EF$ " highlight="php-heredoc-string">
		<element pattern="$[a-zA-Z_][a-zA-Z0-9_]*" is_regex="1" case_insens="1" highlight="php-variable" />
		<element pattern="(&#10;|&#13;|&#13;&#10;)EOF"  is_regex="1" ends_block="1" ends_context="1" blockstartelement="e.php.heredoc_string" highlight="brackets" />
	</context>
</element>
<element id="e.php.nowdoc_string" pattern="&lt;&lt;&lt;'EOF'" starts_block="1" highlight="brackets" >
<reference><b>nowdoc string</b>
<span color="red">Warning</span>: only <b>&lt;&lt;&lt;'EOF'</b> (without space) is correctly highligted</reference>
	<autocomplete enable="1" />
	<context symbols="&#13;&#10;EF" highlight="php-heredoc-string">
		<element pattern="(&#10;|&#13;|&#13;&#10;)EOF"  is_regex="1" ends_block="1" ends_context="1" blockstartelement="e.php.nowdoc_string" highlight="brackets" />
	</context>
</element>

<element id="e.php.variable" pattern="$[a-zA-Z_][a-zA-Z0-9_]*" is_regex="1" case_insens="1" highlight="php-variable" identifier_mode="2" identifier_autocomp="option:autocomplete_PHP_variable"/>
<element pattern="&#34;" highlight="string" id="e.php.doublequotedstring">
	<context symbols="\&#34;$ &#9;&#10;&#13;' -&lt;&gt;{}[]" highlight="string">
		<element pattern="\\." highlight="string" is_regex="1" />
<!--		<element pattern="\$" highlight="string" />-->
		<element idref="e.php.variable" />
		<group class="sql-in-php-string" highlight="php-string-sql-keyword" case_insens="1">
			<element pattern="AND" />
			<element pattern="AS" />
			<element pattern="ASC" />
			<element pattern="BY" />
			<element pattern="COUNT" />
			<element pattern="DATE" />
			<element pattern="DATE_FORMAT" />
			<element pattern="DELETE" />
			<element pattern="DESC" />
			<element pattern="DISTINCT" />
			<element pattern="FROM" />
			<element pattern="GROUP" />
			<element pattern="IN" />
			<element pattern="INNER" />
			<element pattern="INSERT" />
			<element pattern="INTO" />
			<element pattern="JOIN" />
			<element pattern="LEFT" />
			<element pattern="LIMIT" />
			<element pattern="NOT" />
			<element pattern="ON" />
			<element pattern="OR" />
			<element pattern="ORDER" />
			<element pattern="REGEXP" />
			<element pattern="SELECT" />
			<element pattern="SET" />
			<element pattern="UPDATE" />
			<element pattern="VALUES" />
			<element pattern="WHERE" />
		</group>
		<element pattern="&#34;" highlight="string" ends_context="1" ends_block="1" blockstartelement="e.php.doublequotedstring"/>
	</context>
</element>
<element pattern="//" highlight="php-comment">
	<context id="c.php.linecomment" symbols="?&gt;&#10;&#13;" highlight="php-comment">
		<element pattern="(&#10;|&#13;|&#13;&#10;)" is_regex="1" ends_context="1" />
		<element pattern="?&gt;" ends_context="2" ends_block="1" blockstartelement="e.php.open" highlight="php-block-tag" />
	</context>
</element>
<!-- there is a bug in the scanning engine such that a regex style pattern like (#|//) won't work. The reason is that
there is special code if a pattern ends on a symbol. That code fails on the above pattern because both # and / are ends
for this pattern and both of them are a symbol. That's why we have a separate entry for # and for // -->
<element pattern="#" highlight="php-comment">
	<context idref="c.php.linecomment"/>
</element>
<element pattern="?&gt;" ends_block="1" blockstartelement="e.php.open" highlight="php-block-tag" ends_context="1" />
</context></element>
</group>

&all-html;

</context>
</definition>
</bflang>
