Bflang: Difference between revisions

From Bluefish Wiki
Jump to navigation Jump to search
Fal7i (talk | contribs)
m Created page with '__NOTOC__ __NOEDITSECTION__ {{Man2top |lang=en |rev=2.0.0 |st=d |Title=6. File reference |prev=Man 2 ch12s05 |Subtitle=Chapter XII. Development guidelines |next=Ma…'
 
Fal7i (talk | contribs)
m escape & in <pre>
 
(5 intermediate revisions by the same user not shown)
Line 3: Line 3:
{{Man2top
{{Man2top
|lang=en
|lang=en
|rev=2.0.0
|rev=2.0.4
|st=d
|st=u
|Title=6.&nbsp;File reference
|Title=6. Bflang
|prev=Man 2 ch12s05
|prev=Man 2 ch12s05
|Subtitle=Chapter&nbsp;XII.&nbsp;Development guidelines
|Subtitle=Chapter XII. Development guidelines
|next=Man 2 ch12s07
|next=Man 2 ch12s07
}}
}}
== 6. File reference ==
== regex ==
References
php.bflang2
<pre>
<element pattern="//" highlight="php-comment">
<context id="c.php.short.linecomment" symbols="?&amp;gt;&amp;#10;&amp;#13;" highlight="php-comment">
<!-- dos has \r\n -> we should never end a pattern between these two chars  -->
<element pattern="(&amp;#10;|&amp;#13;|&amp;#13;&amp;#10;)" is_regex="1" ends_context="1" />
<element pattern="?&amp;gt;" ends_context="2" ends_block="1" blockstartelement="e.php.short.open" highlight="php-block-tag" mayfold="1" />
</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>
</pre>


question:
a pattern like: <tt>-?[0-9]+ </tt> fails, and <tt>[0-9]+(\.[0-9]+)? </tt> fails too.<br />
we need:
* <tt>[0-9]+\.[0-9]+</tt>
* <tt>-[0-9]+\.[0-9]+</tt>
* <tt>[0-9]+</tt>
* <tt>-[0-9]+</tt>




Line 19: Line 42:
|up=Man 2 ch12
|up=Man 2 ch12
|next=Man 2 ch12s07
|next=Man 2 ch12s07
|prevname= 5.&nbsp;New files
|prevname= 5. New files
|nextname=7.&nbsp;Patches
|nextname=7. Patches
}}
}}

Latest revision as of 11:22, 28 June 2011


regex

php.bflang2

<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" mayfold="1" />
	</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>

question:

a pattern like: -?[0-9]+ fails, and [0-9]+(\.[0-9]+)? fails too.
we need:

  • [0-9]+\.[0-9]+
  • -[0-9]+\.[0-9]+
  • [0-9]+
  • -[0-9]+