summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo Chatzimichos <tampakrap@gentoo.org>2013-03-10 12:10:26 +0100
committerTheo Chatzimichos <tampakrap@gentoo.org>2013-03-10 12:10:26 +0100
commit7aea9fc04bd42e2ac02a1925d3a02a76d391c3e7 (patch)
tree68c852c654cef340592f1001b6310e33827b130c /plugins/wp-syntax
parentMake the script more silent (diff)
downloadblogs-gentoo-7aea9fc04bd42e2ac02a1925d3a02a76d391c3e7.tar.gz
blogs-gentoo-7aea9fc04bd42e2ac02a1925d3a02a76d391c3e7.tar.bz2
blogs-gentoo-7aea9fc04bd42e2ac02a1925d3a02a76d391c3e7.zip
update plugins
Diffstat (limited to 'plugins/wp-syntax')
-rw-r--r--plugins/wp-syntax/README.txt89
-rw-r--r--plugins/wp-syntax/css/wp-syntax.css98
-rw-r--r--plugins/wp-syntax/geshi/geshi.php9534
-rw-r--r--plugins/wp-syntax/geshi/geshi/4cs.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/6502acme.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/6502kickass.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/6502tasm.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/68000devpac.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/abap.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/actionscript.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/actionscript3.php6
-rw-r--r--plugins/wp-syntax/geshi/geshi/ada.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/algol68.php287
-rw-r--r--plugins/wp-syntax/geshi/geshi/apache.php5
-rw-r--r--plugins/wp-syntax/geshi/geshi/applescript.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/apt_sources.php12
-rw-r--r--plugins/wp-syntax/geshi/geshi/arm.php3318
-rw-r--r--plugins/wp-syntax/geshi/geshi/asm.php536
-rw-r--r--plugins/wp-syntax/geshi/geshi/asp.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/asymptote.php194
-rw-r--r--plugins/wp-syntax/geshi/geshi/autoconf.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/autohotkey.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/autoit.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/avisynth.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/awk.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/bascomavr.php185
-rw-r--r--plugins/wp-syntax/geshi/geshi/bash.php141
-rw-r--r--plugins/wp-syntax/geshi/geshi/basic4gl.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/bf.php15
-rw-r--r--plugins/wp-syntax/geshi/geshi/bibtex.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/blitzbasic.php4
-rw-r--r--plugins/wp-syntax/geshi/geshi/bnf.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/boo.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/c.php85
-rw-r--r--plugins/wp-syntax/geshi/geshi/c_loadrunner.php323
-rw-r--r--plugins/wp-syntax/geshi/geshi/c_mac.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/caddcl.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/cadlisp.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/cfdg.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/cfm.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/chaiscript.php4
-rw-r--r--plugins/wp-syntax/geshi/geshi/cil.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/clojure.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/cmake.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/cobol.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/coffeescript.php146
-rw-r--r--plugins/wp-syntax/geshi/geshi/cpp-qt.php8
-rw-r--r--plugins/wp-syntax/geshi/geshi/cpp.php4
-rw-r--r--plugins/wp-syntax/geshi/geshi/csharp.php19
-rw-r--r--plugins/wp-syntax/geshi/geshi/css.php22
-rw-r--r--plugins/wp-syntax/geshi/geshi/cuesheet.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/d.php68
-rw-r--r--plugins/wp-syntax/geshi/geshi/dcl.php192
-rw-r--r--plugins/wp-syntax/geshi/geshi/dcpu16.php131
-rw-r--r--plugins/wp-syntax/geshi/geshi/dcs.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/delphi.php46
-rw-r--r--plugins/wp-syntax/geshi/geshi/diff.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/div.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/dos.php8
-rw-r--r--plugins/wp-syntax/geshi/geshi/dot.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/e.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/ecmascript.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/eiffel.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/email.php26
-rw-r--r--plugins/wp-syntax/geshi/geshi/epc.php154
-rw-r--r--plugins/wp-syntax/geshi/geshi/erlang.php10
-rw-r--r--plugins/wp-syntax/geshi/geshi/euphoria.php140
-rw-r--r--plugins/wp-syntax/geshi/geshi/f1.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/falcon.php218
-rw-r--r--plugins/wp-syntax/geshi/geshi/fo.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/fortran.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/freebasic.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/freeswitch.php168
-rw-r--r--plugins/wp-syntax/geshi/geshi/fsharp.php8
-rw-r--r--plugins/wp-syntax/geshi/geshi/gambas.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/gdb.php63
-rw-r--r--plugins/wp-syntax/geshi/geshi/genero.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/genie.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/gettext.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/glsl.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/gml.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/gnuplot.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/go.php47
-rw-r--r--plugins/wp-syntax/geshi/geshi/groovy.php18
-rw-r--r--plugins/wp-syntax/geshi/geshi/gwbasic.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/haskell.php8
-rw-r--r--plugins/wp-syntax/geshi/geshi/haxe.php161
-rw-r--r--plugins/wp-syntax/geshi/geshi/hicest.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/hq9plus.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/html4strict.php29
-rw-r--r--plugins/wp-syntax/geshi/geshi/html5.php212
-rw-r--r--plugins/wp-syntax/geshi/geshi/icon.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/idl.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/ini.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/inno.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/intercal.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/io.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/j.php73
-rw-r--r--plugins/wp-syntax/geshi/geshi/java.php4
-rw-r--r--plugins/wp-syntax/geshi/geshi/java5.php328
-rw-r--r--plugins/wp-syntax/geshi/geshi/javascript.php70
-rw-r--r--plugins/wp-syntax/geshi/geshi/jquery.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/kixtart.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/klonec.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/klonecpp.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/latex.php8
-rw-r--r--plugins/wp-syntax/geshi/geshi/lb.php16
-rw-r--r--plugins/wp-syntax/geshi/geshi/ldif.php116
-rw-r--r--plugins/wp-syntax/geshi/geshi/lisp.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/llvm.php385
-rw-r--r--plugins/wp-syntax/geshi/geshi/locobasic.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/logtalk.php35
-rw-r--r--plugins/wp-syntax/geshi/geshi/lolcode.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/lotusformulas.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/lotusscript.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/lscript.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/lsl2.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/lua.php62
-rw-r--r--plugins/wp-syntax/geshi/geshi/m68k.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/magiksf.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/make.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/mapbasic.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/matlab.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/mirc.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/mmix.php66
-rw-r--r--plugins/wp-syntax/geshi/geshi/modula2.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/modula3.php4
-rw-r--r--plugins/wp-syntax/geshi/geshi/mpasm.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/mxml.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/mysql.php34
-rw-r--r--plugins/wp-syntax/geshi/geshi/nagios.php225
-rw-r--r--plugins/wp-syntax/geshi/geshi/netrexx.php163
-rw-r--r--plugins/wp-syntax/geshi/geshi/newlisp.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/nsis.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/oberon2.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/objc.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/objeck.php10
-rw-r--r--plugins/wp-syntax/geshi/geshi/ocaml-brief.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/ocaml.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/octave.php515
-rw-r--r--plugins/wp-syntax/geshi/geshi/oobas.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/oorexx.php171
-rw-r--r--plugins/wp-syntax/geshi/geshi/oracle11.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/oracle8.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/oxygene.php6
-rw-r--r--plugins/wp-syntax/geshi/geshi/oz.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/parasail.php133
-rw-r--r--plugins/wp-syntax/geshi/geshi/parigp.php277
-rw-r--r--plugins/wp-syntax/geshi/geshi/pascal.php53
-rw-r--r--plugins/wp-syntax/geshi/geshi/pcre.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/per.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/perl.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/perl6.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/pf.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/php-brief.php4
-rw-r--r--plugins/wp-syntax/geshi/geshi/php.php21
-rw-r--r--plugins/wp-syntax/geshi/geshi/pic16.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/pike.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/pixelbender.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/pli.php200
-rw-r--r--plugins/wp-syntax/geshi/geshi/plsql.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/postgresql.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/povray.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/powerbuilder.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/powershell.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/proftpd.php374
-rw-r--r--plugins/wp-syntax/geshi/geshi/progress.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/prolog.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/properties.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/providex.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/purebasic.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/pycon.php64
-rw-r--r--plugins/wp-syntax/geshi/geshi/pys60.php273
-rw-r--r--plugins/wp-syntax/geshi/geshi/python.php17
-rw-r--r--plugins/wp-syntax/geshi/geshi/q.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/qbasic.php6
-rw-r--r--plugins/wp-syntax/geshi/geshi/rails.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/rebol.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/reg.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/rexx.php162
-rw-r--r--plugins/wp-syntax/geshi/geshi/robots.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/rpmspec.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/rsplus.php20
-rw-r--r--plugins/wp-syntax/geshi/geshi/ruby.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/sas.php6
-rw-r--r--plugins/wp-syntax/geshi/geshi/scala.php26
-rw-r--r--plugins/wp-syntax/geshi/geshi/scheme.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/scilab.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/sdlbasic.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/smalltalk.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/smarty.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/spark.php132
-rw-r--r--plugins/wp-syntax/geshi/geshi/sparql.php155
-rw-r--r--plugins/wp-syntax/geshi/geshi/sql.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/stonescript.php307
-rw-r--r--plugins/wp-syntax/geshi/geshi/systemverilog.php8
-rw-r--r--plugins/wp-syntax/geshi/geshi/tcl.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/teraterm.php147
-rw-r--r--plugins/wp-syntax/geshi/geshi/text.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/thinbasic.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/tsql.php6
-rw-r--r--plugins/wp-syntax/geshi/geshi/typoscript.php20
-rw-r--r--plugins/wp-syntax/geshi/geshi/unicon.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/upc.php270
-rw-r--r--plugins/wp-syntax/geshi/geshi/urbi.php200
-rw-r--r--plugins/wp-syntax/geshi/geshi/uscript.php299
-rw-r--r--plugins/wp-syntax/geshi/geshi/vala.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/vb.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/vbnet.php127
-rw-r--r--plugins/wp-syntax/geshi/geshi/vedit.php103
-rw-r--r--plugins/wp-syntax/geshi/geshi/verilog.php4
-rw-r--r--plugins/wp-syntax/geshi/geshi/vhdl.php105
-rw-r--r--plugins/wp-syntax/geshi/geshi/vim.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/visualfoxpro.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/visualprolog.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/whitespace.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/whois.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/winbatch.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/xbasic.php3
-rw-r--r--plugins/wp-syntax/geshi/geshi/xml.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/xorg_conf.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/xpp.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/yaml.php150
-rw-r--r--plugins/wp-syntax/geshi/geshi/z80.php2
-rw-r--r--plugins/wp-syntax/geshi/geshi/zxbasic.php2
-rw-r--r--plugins/wp-syntax/js/wp-syntax.js34
-rw-r--r--plugins/wp-syntax/wp-syntax.php563
227 files changed, 17497 insertions, 6073 deletions
diff --git a/plugins/wp-syntax/README.txt b/plugins/wp-syntax/README.txt
index 174ac431..2187a72b 100644
--- a/plugins/wp-syntax/README.txt
+++ b/plugins/wp-syntax/README.txt
@@ -1,10 +1,10 @@
=== WP-Syntax ===
-Contributors: shazahm1@hotmail.com, rmm5t
-Donate link: http://connections-pro.com
-Tags: syntax highlighting, syntax, highlight, code, formatting
+Contributors: shazahm1@hotmail.com
+Donate link: http://wp-syntax.com/send-donation/
+Tags: syntax highlighting, syntax, highlight, code, formatting, code, CSS, html, php, sourcecode
Requires at least: 3.0
-Tested up to: 3.2.1
-Stable tag: 0.9.12
+Tested up to: 3.5.1
+Stable tag: 1.0
WP-Syntax provides clean syntax highlighting for embedding source code within pages or posts.
@@ -12,8 +12,7 @@ WP-Syntax provides clean syntax highlighting for embedding source code within pa
WP-Syntax provides clean syntax highlighting using
[GeSHi](http://qbnz.com/highlighter/) -- supporting a wide range of popular
-languages. It supports highlighting with or
-without line numbers and maintains formatting while copying snippets of code
+languages. It supports highlighting with or without line numbers and maintains formatting while copying snippets of code
from the browser.
It avoids conflicts with other 3rd party plugins by running an early
@@ -21,23 +20,16 @@ pre-filter and a late post-filter that substitutes and pulls the code snippets
out first and then pushes them back in with highlighting at the end. The
result is source code formatted and highlighted the way you intended.
-This plugin was originally written for use with
-[EmacsBlog](http://www.emacsblog.org). To see it in action, scroll through
-this [particular
-post](http://www.emacsblog.org/2007/02/22/maximize-on-startup-part-2/) or
-visit the
-[screenshots](http://wordpress.org/extend/plugins/wp-syntax/screenshots/).
-
Usage, Supported Languages, Styling Guidelines, and Release Notes are availabe
-in the [Other
-Notes](http://wordpress.org/extend/plugins/wp-syntax/other_notes/) section.
+in the [Other Notes](http://wordpress.org/extend/plugins/wp-syntax/other_notes/) section.
+
+Want to contribute? WP-Sytax can be found on Github. Fork and submit your pull requests today!
= Basic Usage =
-Wrap code blocks with `<pre lang="LANGUAGE" line="1">` and `</pre>` where
-`LANGUAGE` is a [GeSHi](http://qbnz.com/highlighter/) supported language
-syntax. The `line` attribute is optional. [More usage
-examples](http://wordpress.org/extend/plugins/wp-syntax/other_notes/)
+Wrap code blocks with `<pre lang="LANGUAGE" line="1">` and `</pre>` where **"LANGUAGE"**
+is a [GeSHi](http://qbnz.com/highlighter/) supported language syntax.
+The `line` attribute is optional. [More usage examples](http://wordpress.org/extend/plugins/wp-syntax/other_notes/)
== Installation ==
@@ -69,10 +61,9 @@ plugin, and check "unfiltered HTML" for the roles that would like to post code s
== Usage ==
-Wrap code blocks with `<pre lang="LANGUAGE" line="1">` and `</pre>` where
-`LANGUAGE` is a [GeSHi](http://qbnz.com/highlighter/) supported language
-syntax. See below for a full list of supported languages. The `line`
-attribute is optional.
+Wrap code blocks with `<pre lang="LANGUAGE" line="1">` and `</pre>` where **"LANGUAGE"** is a [GeSHi](http://qbnz.com/highlighter/) supported
+language syntax. See below for a full list of supported languages.
+The `line` attribute is optional.
**Example 1: PHP, no line numbers**
@@ -113,9 +104,33 @@ attribute is optional.
&lt;xml&gt;Hello&lt;/xml&gt;
</pre>
+**Example 5: PHP, with line numbers and highlighting a specific line**
+
+ <pre lang="php" line="1" highlight="3">
+ <div id="foo">
+ <?php
+ function foo() {
+ echo "Hello World!\\n";
+ }
+ ?>
+ </div>
+ </pre>
+
+**Example 6: PHP, with a caption (file and/or file path of the source file)**
+
+ <pre lang="php" src"https://github.com/shazahm1/Connections/blob/master/connections.php">
+ <div id="foo">
+ <?php
+ function foo() {
+ echo "Hello World!\\n";
+ }
+ ?>
+ </div>
+ </pre>
+
== Supported Languages ==
-The following languages are supported in the `lang` attribute:
+The following languages are most supported in the `lang` attribute:
abap, actionscript, actionscript3, ada, apache, applescript, apt_sources, asm,
**asp**, autoit, avisynth, **bash**, bf, bibtex, blitzbasic, bnf, boo, **c**,
@@ -134,6 +149,9 @@ text, thinbasic, tsql, typoscript, **vb**, **vbnet**, verilog, vhdl, vim,
visualfoxpro, visualprolog, whitespace, whois, winbatch, **xml**, xorg_conf,
xpp, z80
+See the [GeSHi Documentation](http://qbnz.com/highlighter/geshi-doc.html)
+for a full list of supported languages.
+
(Bold languages just highlight the more popular ones.)
== Styling Guidelines ==
@@ -162,12 +180,29 @@ or somewhere else like this:
}
?>
-This allows for a great possibility of different customizations. Be sure to
+This allows for a great possibility of different customizations. Be sure to
review the [GeSHi Documentation](http://qbnz.com/highlighter/geshi-doc.html).
== Changelog ==
-**0.9.12** : Fixed a range bug in the new highlight feature.
+= 1.0 02/09/2013 =
+* NEW: CSS3 for alternating background lines for easier reading.
+* OTHER: Completely refactor code to utilize current best practices for plugin development which will provide a solid foundation for further development.
+* OTHER: Remove GeSHi contrib and test folders.
+* OTHER: Move CSS to `css` subfolder.
+* OTHER: Move JavaScript to `js` subfolder.
+* OTHER: CSS fixes to keep theme from breaking output formatting.
+
+= 0.9.13 09/01/12 =
+* FEATURE: Added a new "src" shortcode option to allow reference of the source filename. Props: Steffen Vogel
+* BUG: Properly enqueue the CSS file.
+* BUG: Updated TinyMCE whitelist to allows required tags. Props: Steffen Vogel
+* OTHER: Updated GeSHi to 1.0.8.11
+* OTHER: Remove old unused code.
+* OTHER: Imporved line highlighting. Props: Steffen Vogel
+* OTHER: Added some additional CSS styles to help keep theme's from breaking the presentation of the code.
+
+**0.9.12** : Fixed a range bug in the new highlight feature.
**0.9.11** : Added line highlighting support. User submitted patch. [Thanks Flynsarmy && Chimo](http://www.flynsarmy.com/2011/06/how-to-add-line-highlight-support-to-wp-syntax/)
diff --git a/plugins/wp-syntax/css/wp-syntax.css b/plugins/wp-syntax/css/wp-syntax.css
new file mode 100644
index 00000000..2401f78e
--- /dev/null
+++ b/plugins/wp-syntax/css/wp-syntax.css
@@ -0,0 +1,98 @@
+.wp_syntax {
+ color : #100;
+ background-color: #f9f9f9;
+ border : 1px solid silver;
+ margin : 0 0 1.5em 0;
+ overflow : auto;
+}
+
+/* IE FIX */
+.wp_syntax {
+ overflow-x : auto;
+ overflow-y : hidden;
+ padding-bottom: expression(this.scrollWidth > this.offsetWidth ? 15 : 0);
+ width : 99%;
+}
+
+.wp_syntax table {
+ border : none !important;
+ border-collapse: collapse !important;
+ margin : 0 !important;
+ padding : 0 !important;
+ width : 100% !important
+}
+
+.wp_syntax caption {
+ margin : 0 !important;
+ padding : 2px !important;
+ width : 100% !important;
+ background-color: #def !important;
+ text-align : left !important;
+ font-family : monospace !important;
+ font-size : 12px !important;
+ line-height : 1.2em !important;
+}
+
+.wp_syntax caption a {
+ color : #1982d1 !important;
+ text-align : left !important;
+ font-family : monospace !important;
+ font-size : 12px !important;
+ line-height : 16px !important;
+ text-decoration: none !important;
+}
+
+.wp_syntax caption a:hover {
+ color : #1982d1 !important;
+ text-decoration: underline !important;
+}
+
+.wp_syntax div, .wp_syntax td {
+ border : none !important;
+ text-align : left !important;
+ padding : 0 !important;
+ vertical-align: top !important;
+}
+
+.wp_syntax td.code{
+ background-color: #EEE;
+ background-image: -webkit-linear-gradient( transparent 50%, rgba(255, 255, 255, .9) 50% );
+ background-image: -moz-linear-gradient( transparent 50%, rgba(255, 255, 255, .9) 50% );
+ background-image: -ms-linear-gradient( transparent 50%, rgba(255, 255, 255, .9) 50% );
+ background-image: -o-linear-gradient( transparent 50%, rgba(255, 255, 255, .9) 50% );
+ background-image: linear-gradient( transparent 50%, rgba(255, 255, 255, .9) 50% );
+ background-size : 1px 32px;
+ line-height : normal !important;
+ white-space : normal !important;
+ width : 100% !important;
+}
+
+/* potential overrides for other styles */
+.wp_syntax pre {
+ background : transparent !important;
+ border : none !important;
+ margin : 0 !important;
+ padding : 0 !important;
+ width : auto !important;
+ float : none !important;
+ clear : none !important;
+ overflow : visible !important;
+ font-family : monospace !important;
+ font-size : 12px !important;
+ line-height : 16px !important;
+ padding : 0 4px !important;
+ white-space : pre !important;
+ -moz-box-shadow : 0px 0px 0px rgba(0, 0, 0, 0) !important; /* FF3.5+ */
+ -webkit-box-shadow : 0px 0px 0px rgba(0, 0, 0, 0) !important; /* Saf3.0+, Chrome */
+ box-shadow : 0px 0px 0px rgba(0, 0, 0, 0) !important; /* Opera 10.5, IE 9.0 */
+ -webkit-border-radius: 0 !important;
+ -moz-border-radius : 0 !important;
+ border-radius : 0 !important;
+}
+
+.wp_syntax td.line_numbers pre {
+ background-color: #def !important;
+ color : gray !important;
+ text-align : right !important;
+ width : 16px !important;
+} \ No newline at end of file
diff --git a/plugins/wp-syntax/geshi/geshi.php b/plugins/wp-syntax/geshi/geshi.php
index f7b5a51a..c6ff9ef7 100644
--- a/plugins/wp-syntax/geshi/geshi.php
+++ b/plugins/wp-syntax/geshi/geshi.php
@@ -1,4761 +1,4775 @@
-<?php
-/**
- * GeSHi - Generic Syntax Highlighter
- *
- * The GeSHi class for Generic Syntax Highlighting. Please refer to the
- * documentation at http://qbnz.com/highlighter/documentation.php for more
- * information about how to use this class.
- *
- * For changes, release notes, TODOs etc, see the relevant files in the docs/
- * directory.
- *
- * This file is part of GeSHi.
- *
- * GeSHi 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 2 of the License, or
- * (at your option) any later version.
- *
- * GeSHi 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 GeSHi; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * @package geshi
- * @subpackage core
- * @author Nigel McNie <nigel@geshi.org>, Benny Baumann <BenBE@omorphia.de>
- * @copyright (C) 2004 - 2007 Nigel McNie, (C) 2007 - 2008 Benny Baumann
- * @license http://gnu.org/copyleft/gpl.html GNU GPL
- *
- */
-
-//
-// GeSHi Constants
-// You should use these constant names in your programs instead of
-// their values - you never know when a value may change in a future
-// version
-//
-
-/** The version of this GeSHi file */
-define('GESHI_VERSION', '1.0.8.9');
-
-// Define the root directory for the GeSHi code tree
-if (!defined('GESHI_ROOT')) {
- /** The root directory for GeSHi */
- define('GESHI_ROOT', dirname(__FILE__) . DIRECTORY_SEPARATOR);
-}
-/** The language file directory for GeSHi
- @access private */
-define('GESHI_LANG_ROOT', GESHI_ROOT . 'geshi' . DIRECTORY_SEPARATOR);
-
-// Define if GeSHi should be paranoid about security
-if (!defined('GESHI_SECURITY_PARANOID')) {
- /** Tells GeSHi to be paranoid about security settings */
- define('GESHI_SECURITY_PARANOID', false);
-}
-
-// Line numbers - use with enable_line_numbers()
-/** Use no line numbers when building the result */
-define('GESHI_NO_LINE_NUMBERS', 0);
-/** Use normal line numbers when building the result */
-define('GESHI_NORMAL_LINE_NUMBERS', 1);
-/** Use fancy line numbers when building the result */
-define('GESHI_FANCY_LINE_NUMBERS', 2);
-
-// Container HTML type
-/** Use nothing to surround the source */
-define('GESHI_HEADER_NONE', 0);
-/** Use a "div" to surround the source */
-define('GESHI_HEADER_DIV', 1);
-/** Use a "pre" to surround the source */
-define('GESHI_HEADER_PRE', 2);
-/** Use a pre to wrap lines when line numbers are enabled or to wrap the whole code. */
-define('GESHI_HEADER_PRE_VALID', 3);
-/**
- * Use a "table" to surround the source:
- *
- * <table>
- * <thead><tr><td colspan="2">$header</td></tr></thead>
- * <tbody><tr><td><pre>$linenumbers</pre></td><td><pre>$code></pre></td></tr></tbody>
- * <tfooter><tr><td colspan="2">$footer</td></tr></tfoot>
- * </table>
- *
- * this is essentially only a workaround for Firefox, see sf#1651996 or take a look at
- * https://bugzilla.mozilla.org/show_bug.cgi?id=365805
- * @note when linenumbers are disabled this is essentially the same as GESHI_HEADER_PRE
- */
-define('GESHI_HEADER_PRE_TABLE', 4);
-
-// Capatalisation constants
-/** Lowercase keywords found */
-define('GESHI_CAPS_NO_CHANGE', 0);
-/** Uppercase keywords found */
-define('GESHI_CAPS_UPPER', 1);
-/** Leave keywords found as the case that they are */
-define('GESHI_CAPS_LOWER', 2);
-
-// Link style constants
-/** Links in the source in the :link state */
-define('GESHI_LINK', 0);
-/** Links in the source in the :hover state */
-define('GESHI_HOVER', 1);
-/** Links in the source in the :active state */
-define('GESHI_ACTIVE', 2);
-/** Links in the source in the :visited state */
-define('GESHI_VISITED', 3);
-
-// Important string starter/finisher
-// Note that if you change these, they should be as-is: i.e., don't
-// write them as if they had been run through htmlentities()
-/** The starter for important parts of the source */
-define('GESHI_START_IMPORTANT', '<BEGIN GeSHi>');
-/** The ender for important parts of the source */
-define('GESHI_END_IMPORTANT', '<END GeSHi>');
-
-/**#@+
- * @access private
- */
-// When strict mode applies for a language
-/** Strict mode never applies (this is the most common) */
-define('GESHI_NEVER', 0);
-/** Strict mode *might* apply, and can be enabled or
- disabled by {@link GeSHi->enable_strict_mode()} */
-define('GESHI_MAYBE', 1);
-/** Strict mode always applies */
-define('GESHI_ALWAYS', 2);
-
-// Advanced regexp handling constants, used in language files
-/** The key of the regex array defining what to search for */
-define('GESHI_SEARCH', 0);
-/** The key of the regex array defining what bracket group in a
- matched search to use as a replacement */
-define('GESHI_REPLACE', 1);
-/** The key of the regex array defining any modifiers to the regular expression */
-define('GESHI_MODIFIERS', 2);
-/** The key of the regex array defining what bracket group in a
- matched search to put before the replacement */
-define('GESHI_BEFORE', 3);
-/** The key of the regex array defining what bracket group in a
- matched search to put after the replacement */
-define('GESHI_AFTER', 4);
-/** The key of the regex array defining a custom keyword to use
- for this regexp's html tag class */
-define('GESHI_CLASS', 5);
-
-/** Used in language files to mark comments */
-define('GESHI_COMMENTS', 0);
-
-/** Used to work around missing PHP features **/
-define('GESHI_PHP_PRE_433', !(version_compare(PHP_VERSION, '4.3.3') === 1));
-
-/** make sure we can call stripos **/
-if (!function_exists('stripos')) {
- // the offset param of preg_match is not supported below PHP 4.3.3
- if (GESHI_PHP_PRE_433) {
- /**
- * @ignore
- */
- function stripos($haystack, $needle, $offset = null) {
- if (!is_null($offset)) {
- $haystack = substr($haystack, $offset);
- }
- if (preg_match('/'. preg_quote($needle, '/') . '/', $haystack, $match, PREG_OFFSET_CAPTURE)) {
- return $match[0][1];
- }
- return false;
- }
- }
- else {
- /**
- * @ignore
- */
- function stripos($haystack, $needle, $offset = null) {
- if (preg_match('/'. preg_quote($needle, '/') . '/', $haystack, $match, PREG_OFFSET_CAPTURE, $offset)) {
- return $match[0][1];
- }
- return false;
- }
- }
-}
-
-/** some old PHP / PCRE subpatterns only support up to xxx subpatterns in
- regular expressions. Set this to false if your PCRE lib is up to date
- @see GeSHi->optimize_regexp_list()
- **/
-define('GESHI_MAX_PCRE_SUBPATTERNS', 500);
-/** it's also important not to generate too long regular expressions
- be generous here... but keep in mind, that when reaching this limit we
- still have to close open patterns. 12k should do just fine on a 16k limit.
- @see GeSHi->optimize_regexp_list()
- **/
-define('GESHI_MAX_PCRE_LENGTH', 12288);
-
-//Number format specification
-/** Basic number format for integers */
-define('GESHI_NUMBER_INT_BASIC', 1); //Default integers \d+
-/** Enhanced number format for integers like seen in C */
-define('GESHI_NUMBER_INT_CSTYLE', 2); //Default C-Style \d+[lL]?
-/** Number format to highlight binary numbers with a suffix "b" */
-define('GESHI_NUMBER_BIN_SUFFIX', 16); //[01]+[bB]
-/** Number format to highlight binary numbers with a prefix % */
-define('GESHI_NUMBER_BIN_PREFIX_PERCENT', 32); //%[01]+
-/** Number format to highlight binary numbers with a prefix 0b (C) */
-define('GESHI_NUMBER_BIN_PREFIX_0B', 64); //0b[01]+
-/** Number format to highlight octal numbers with a leading zero */
-define('GESHI_NUMBER_OCT_PREFIX', 256); //0[0-7]+
-/** Number format to highlight octal numbers with a prefix 0o (logtalk) */
-define('GESHI_NUMBER_OCT_PREFIX_0O', 512); //0[0-7]+
-/** Number format to highlight octal numbers with a leading @ (Used in HiSofts Devpac series). */
-define('GESHI_NUMBER_OCT_PREFIX_AT', 1024); //@[0-7]+
-/** Number format to highlight octal numbers with a suffix of o */
-define('GESHI_NUMBER_OCT_SUFFIX', 2048); //[0-7]+[oO]
-/** Number format to highlight hex numbers with a prefix 0x */
-define('GESHI_NUMBER_HEX_PREFIX', 4096); //0x[0-9a-fA-F]+
-/** Number format to highlight hex numbers with a prefix $ */
-define('GESHI_NUMBER_HEX_PREFIX_DOLLAR', 8192); //$[0-9a-fA-F]+
-/** Number format to highlight hex numbers with a suffix of h */
-define('GESHI_NUMBER_HEX_SUFFIX', 16384); //[0-9][0-9a-fA-F]*h
-/** Number format to highlight floating-point numbers without support for scientific notation */
-define('GESHI_NUMBER_FLT_NONSCI', 65536); //\d+\.\d+
-/** Number format to highlight floating-point numbers without support for scientific notation */
-define('GESHI_NUMBER_FLT_NONSCI_F', 131072); //\d+(\.\d+)?f
-/** Number format to highlight floating-point numbers with support for scientific notation (E) and optional leading zero */
-define('GESHI_NUMBER_FLT_SCI_SHORT', 262144); //\.\d+e\d+
-/** Number format to highlight floating-point numbers with support for scientific notation (E) and required leading digit */
-define('GESHI_NUMBER_FLT_SCI_ZERO', 524288); //\d+(\.\d+)?e\d+
-//Custom formats are passed by RX array
-
-// Error detection - use these to analyse faults
-/** No sourcecode to highlight was specified
- * @deprecated
- */
-define('GESHI_ERROR_NO_INPUT', 1);
-/** The language specified does not exist */
-define('GESHI_ERROR_NO_SUCH_LANG', 2);
-/** GeSHi could not open a file for reading (generally a language file) */
-define('GESHI_ERROR_FILE_NOT_READABLE', 3);
-/** The header type passed to {@link GeSHi->set_header_type()} was invalid */
-define('GESHI_ERROR_INVALID_HEADER_TYPE', 4);
-/** The line number type passed to {@link GeSHi->enable_line_numbers()} was invalid */
-define('GESHI_ERROR_INVALID_LINE_NUMBER_TYPE', 5);
-/**#@-*/
-
-
-/**
- * The GeSHi Class.
- *
- * Please refer to the documentation for GeSHi 1.0.X that is available
- * at http://qbnz.com/highlighter/documentation.php for more information
- * about how to use this class.
- *
- * @package geshi
- * @author Nigel McNie <nigel@geshi.org>, Benny Baumann <BenBE@omorphia.de>
- * @copyright (C) 2004 - 2007 Nigel McNie, (C) 2007 - 2008 Benny Baumann
- */
-class GeSHi {
- /**#@+
- * @access private
- */
- /**
- * The source code to highlight
- * @var string
- */
- var $source = '';
-
- /**
- * The language to use when highlighting
- * @var string
- */
- var $language = '';
-
- /**
- * The data for the language used
- * @var array
- */
- var $language_data = array();
-
- /**
- * The path to the language files
- * @var string
- */
- var $language_path = GESHI_LANG_ROOT;
-
- /**
- * The error message associated with an error
- * @var string
- * @todo check err reporting works
- */
- var $error = false;
-
- /**
- * Possible error messages
- * @var array
- */
- var $error_messages = array(
- GESHI_ERROR_NO_SUCH_LANG => 'GeSHi could not find the language {LANGUAGE} (using path {PATH})',
- GESHI_ERROR_FILE_NOT_READABLE => 'The file specified for load_from_file was not readable',
- GESHI_ERROR_INVALID_HEADER_TYPE => 'The header type specified is invalid',
- GESHI_ERROR_INVALID_LINE_NUMBER_TYPE => 'The line number type specified is invalid'
- );
-
- /**
- * Whether highlighting is strict or not
- * @var boolean
- */
- var $strict_mode = false;
-
- /**
- * Whether to use CSS classes in output
- * @var boolean
- */
- var $use_classes = false;
-
- /**
- * The type of header to use. Can be one of the following
- * values:
- *
- * - GESHI_HEADER_PRE: Source is outputted in a "pre" HTML element.
- * - GESHI_HEADER_DIV: Source is outputted in a "div" HTML element.
- * - GESHI_HEADER_NONE: No header is outputted.
- *
- * @var int
- */
- var $header_type = GESHI_HEADER_PRE;
-
- /**
- * Array of permissions for which lexics should be highlighted
- * @var array
- */
- var $lexic_permissions = array(
- 'KEYWORDS' => array(),
- 'COMMENTS' => array('MULTI' => true),
- 'REGEXPS' => array(),
- 'ESCAPE_CHAR' => true,
- 'BRACKETS' => true,
- 'SYMBOLS' => false,
- 'STRINGS' => true,
- 'NUMBERS' => true,
- 'METHODS' => true,
- 'SCRIPT' => true
- );
-
- /**
- * The time it took to parse the code
- * @var double
- */
- var $time = 0;
-
- /**
- * The content of the header block
- * @var string
- */
- var $header_content = '';
-
- /**
- * The content of the footer block
- * @var string
- */
- var $footer_content = '';
-
- /**
- * The style of the header block
- * @var string
- */
- var $header_content_style = '';
-
- /**
- * The style of the footer block
- * @var string
- */
- var $footer_content_style = '';
-
- /**
- * Tells if a block around the highlighted source should be forced
- * if not using line numbering
- * @var boolean
- */
- var $force_code_block = false;
-
- /**
- * The styles for hyperlinks in the code
- * @var array
- */
- var $link_styles = array();
-
- /**
- * Whether important blocks should be recognised or not
- * @var boolean
- * @deprecated
- * @todo REMOVE THIS FUNCTIONALITY!
- */
- var $enable_important_blocks = false;
-
- /**
- * Styles for important parts of the code
- * @var string
- * @deprecated
- * @todo As above - rethink the whole idea of important blocks as it is buggy and
- * will be hard to implement in 1.2
- */
- var $important_styles = 'font-weight: bold; color: red;'; // Styles for important parts of the code
-
- /**
- * Whether CSS IDs should be added to the code
- * @var boolean
- */
- var $add_ids = false;
-
- /**
- * Lines that should be highlighted extra
- * @var array
- */
- var $highlight_extra_lines = array();
-
- /**
- * Styles of lines that should be highlighted extra
- * @var array
- */
- var $highlight_extra_lines_styles = array();
-
- /**
- * Styles of extra-highlighted lines
- * @var string
- */
- var $highlight_extra_lines_style = 'background-color: #ffc;';
-
- /**
- * The line ending
- * If null, nl2br() will be used on the result string.
- * Otherwise, all instances of \n will be replaced with $line_ending
- * @var string
- */
- var $line_ending = null;
-
- /**
- * Number at which line numbers should start at
- * @var int
- */
- var $line_numbers_start = 1;
-
- /**
- * The overall style for this code block
- * @var string
- */
- var $overall_style = 'font-family:monospace;';
-
- /**
- * The style for the actual code
- * @var string
- */
- var $code_style = 'font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;';
-
- /**
- * The overall class for this code block
- * @var string
- */
- var $overall_class = '';
-
- /**
- * The overall ID for this code block
- * @var string
- */
- var $overall_id = '';
-
- /**
- * Line number styles
- * @var string
- */
- var $line_style1 = 'font-weight: normal; vertical-align:top;';
-
- /**
- * Line number styles for fancy lines
- * @var string
- */
- var $line_style2 = 'font-weight: bold; vertical-align:top;';
-
- /**
- * Style for line numbers when GESHI_HEADER_PRE_TABLE is chosen
- * @var string
- */
- var $table_linenumber_style = 'width:1px;text-align:right;margin:0;padding:0 2px;vertical-align:top;';
-
- /**
- * Flag for how line numbers are displayed
- * @var boolean
- */
- var $line_numbers = GESHI_NO_LINE_NUMBERS;
-
- /**
- * Flag to decide if multi line spans are allowed. Set it to false to make sure
- * each tag is closed before and reopened after each linefeed.
- * @var boolean
- */
- var $allow_multiline_span = true;
-
- /**
- * The "nth" value for fancy line highlighting
- * @var int
- */
- var $line_nth_row = 0;
-
- /**
- * The size of tab stops
- * @var int
- */
- var $tab_width = 8;
-
- /**
- * Should we use language-defined tab stop widths?
- * @var int
- */
- var $use_language_tab_width = false;
-
- /**
- * Default target for keyword links
- * @var string
- */
- var $link_target = '';
-
- /**
- * The encoding to use for entity encoding
- * NOTE: Used with Escape Char Sequences to fix UTF-8 handling (cf. SF#2037598)
- * @var string
- */
- var $encoding = 'utf-8';
-
- /**
- * Should keywords be linked?
- * @var boolean
- */
- var $keyword_links = true;
-
- /**
- * Currently loaded language file
- * @var string
- * @since 1.0.7.22
- */
- var $loaded_language = '';
-
- /**
- * Wether the caches needed for parsing are built or not
- *
- * @var bool
- * @since 1.0.8
- */
- var $parse_cache_built = false;
-
- /**
- * Work around for Suhosin Patch with disabled /e modifier
- *
- * Note from suhosins author in config file:
- * <blockquote>
- * The /e modifier inside <code>preg_replace()</code> allows code execution.
- * Often it is the cause for remote code execution exploits. It is wise to
- * deactivate this feature and test where in the application it is used.
- * The developer using the /e modifier should be made aware that he should
- * use <code>preg_replace_callback()</code> instead
- * </blockquote>
- *
- * @var array
- * @since 1.0.8
- */
- var $_kw_replace_group = 0;
- var $_rx_key = 0;
-
- /**
- * some "callback parameters" for handle_multiline_regexps
- *
- * @since 1.0.8
- * @access private
- * @var string
- */
- var $_hmr_before = '';
- var $_hmr_replace = '';
- var $_hmr_after = '';
- var $_hmr_key = 0;
-
- /**#@-*/
-
- /**
- * Creates a new GeSHi object, with source and language
- *
- * @param string The source code to highlight
- * @param string The language to highlight the source with
- * @param string The path to the language file directory. <b>This
- * is deprecated!</b> I've backported the auto path
- * detection from the 1.1.X dev branch, so now it
- * should be automatically set correctly. If you have
- * renamed the language directory however, you will
- * still need to set the path using this parameter or
- * {@link GeSHi->set_language_path()}
- * @since 1.0.0
- */
- function GeSHi($source = '', $language = '', $path = '') {
- if (!empty($source)) {
- $this->set_source($source);
- }
- if (!empty($language)) {
- $this->set_language($language);
- }
- $this->set_language_path($path);
- }
-
- /**
- * Returns an error message associated with the last GeSHi operation,
- * or false if no error has occured
- *
- * @return string|false An error message if there has been an error, else false
- * @since 1.0.0
- */
- function error() {
- if ($this->error) {
- //Put some template variables for debugging here ...
- $debug_tpl_vars = array(
- '{LANGUAGE}' => $this->language,
- '{PATH}' => $this->language_path
- );
- $msg = str_replace(
- array_keys($debug_tpl_vars),
- array_values($debug_tpl_vars),
- $this->error_messages[$this->error]);
-
- return "<br /><strong>GeSHi Error:</strong> $msg (code {$this->error})<br />";
- }
- return false;
- }
-
- /**
- * Gets a human-readable language name (thanks to Simon Patterson
- * for the idea :))
- *
- * @return string The name for the current language
- * @since 1.0.2
- */
- function get_language_name() {
- if (GESHI_ERROR_NO_SUCH_LANG == $this->error) {
- return $this->language_data['LANG_NAME'] . ' (Unknown Language)';
- }
- return $this->language_data['LANG_NAME'];
- }
-
- /**
- * Sets the source code for this object
- *
- * @param string The source code to highlight
- * @since 1.0.0
- */
- function set_source($source) {
- $this->source = $source;
- $this->highlight_extra_lines = array();
- }
-
- /**
- * Sets the language for this object
- *
- * @note since 1.0.8 this function won't reset language-settings by default anymore!
- * if you need this set $force_reset = true
- *
- * @param string The name of the language to use
- * @since 1.0.0
- */
- function set_language($language, $force_reset = false) {
- if ($force_reset) {
- $this->loaded_language = false;
- }
-
- //Clean up the language name to prevent malicious code injection
- $language = preg_replace('#[^a-zA-Z0-9\-_]#', '', $language);
-
- $language = strtolower($language);
-
- //Retreive the full filename
- $file_name = $this->language_path . $language . '.php';
- if ($file_name == $this->loaded_language) {
- // this language is already loaded!
- return;
- }
-
- $this->language = $language;
-
- $this->error = false;
- $this->strict_mode = GESHI_NEVER;
-
- //Check if we can read the desired file
- if (!is_readable($file_name)) {
- $this->error = GESHI_ERROR_NO_SUCH_LANG;
- return;
- }
-
- // Load the language for parsing
- $this->load_language($file_name);
- }
-
- /**
- * Sets the path to the directory containing the language files. Note
- * that this path is relative to the directory of the script that included
- * geshi.php, NOT geshi.php itself.
- *
- * @param string The path to the language directory
- * @since 1.0.0
- * @deprecated The path to the language files should now be automatically
- * detected, so this method should no longer be needed. The
- * 1.1.X branch handles manual setting of the path differently
- * so this method will disappear in 1.2.0.
- */
- function set_language_path($path) {
- if(strpos($path,':')) {
- //Security Fix to prevent external directories using fopen wrappers.
- if(DIRECTORY_SEPARATOR == "\\") {
- if(!preg_match('#^[a-zA-Z]:#', $path) || false !== strpos($path, ':', 2)) {
- return;
- }
- } else {
- return;
- }
- }
- if(preg_match('#[^/a-zA-Z0-9_\.\-\\\s:]#', $path)) {
- //Security Fix to prevent external directories using fopen wrappers.
- return;
- }
- if(GESHI_SECURITY_PARANOID && false !== strpos($path, '/.')) {
- //Security Fix to prevent external directories using fopen wrappers.
- return;
- }
- if(GESHI_SECURITY_PARANOID && false !== strpos($path, '..')) {
- //Security Fix to prevent external directories using fopen wrappers.
- return;
- }
- if ($path) {
- $this->language_path = ('/' == $path[strlen($path) - 1]) ? $path : $path . '/';
- $this->set_language($this->language); // otherwise set_language_path has no effect
- }
- }
-
- /**
- * Get supported langs or an associative array lang=>full_name.
- * @param boolean $longnames
- * @return array
- */
- function get_supported_languages($full_names=false)
- {
- // return array
- $back = array();
-
- // we walk the lang root
- $dir = dir($this->language_path);
-
- // foreach entry
- while (false !== ($entry = $dir->read()))
- {
- $full_path = $this->language_path.$entry;
-
- // Skip all dirs
- if (is_dir($full_path)) {
- continue;
- }
-
- // we only want lang.php files
- if (!preg_match('/^([^.]+)\.php$/', $entry, $matches)) {
- continue;
- }
-
- // Raw lang name is here
- $langname = $matches[1];
-
- // We want the fullname too?
- if ($full_names === true)
- {
- if (false !== ($fullname = $this->get_language_fullname($langname)))
- {
- $back[$langname] = $fullname; // we go associative
- }
- }
- else
- {
- // just store raw langname
- $back[] = $langname;
- }
- }
-
- $dir->close();
-
- return $back;
- }
-
- /**
- * Get full_name for a lang or false.
- * @param string $language short langname (html4strict for example)
- * @return mixed
- */
- function get_language_fullname($language)
- {
- //Clean up the language name to prevent malicious code injection
- $language = preg_replace('#[^a-zA-Z0-9\-_]#', '', $language);
-
- $language = strtolower($language);
-
- // get fullpath-filename for a langname
- $fullpath = $this->language_path.$language.'.php';
-
- // we need to get contents :S
- if (false === ($data = file_get_contents($fullpath))) {
- $this->error = sprintf('Geshi::get_lang_fullname() Unknown Language: %s', $language);
- return false;
- }
-
- // match the langname
- if (!preg_match('/\'LANG_NAME\'\s*=>\s*\'((?:[^\']|\\\')+)\'/', $data, $matches)) {
- $this->error = sprintf('Geshi::get_lang_fullname(%s): Regex can not detect language', $language);
- return false;
- }
-
- // return fullname for langname
- return stripcslashes($matches[1]);
- }
-
- /**
- * Sets the type of header to be used.
- *
- * If GESHI_HEADER_DIV is used, the code is surrounded in a "div".This
- * means more source code but more control over tab width and line-wrapping.
- * GESHI_HEADER_PRE means that a "pre" is used - less source, but less
- * control. Default is GESHI_HEADER_PRE.
- *
- * From 1.0.7.2, you can use GESHI_HEADER_NONE to specify that no header code
- * should be outputted.
- *
- * @param int The type of header to be used
- * @since 1.0.0
- */
- function set_header_type($type) {
- //Check if we got a valid header type
- if (!in_array($type, array(GESHI_HEADER_NONE, GESHI_HEADER_DIV,
- GESHI_HEADER_PRE, GESHI_HEADER_PRE_VALID, GESHI_HEADER_PRE_TABLE))) {
- $this->error = GESHI_ERROR_INVALID_HEADER_TYPE;
- return;
- }
-
- //Set that new header type
- $this->header_type = $type;
- }
-
- /**
- * Sets the styles for the code that will be outputted
- * when this object is parsed. The style should be a
- * string of valid stylesheet declarations
- *
- * @param string The overall style for the outputted code block
- * @param boolean Whether to merge the styles with the current styles or not
- * @since 1.0.0
- */
- function set_overall_style($style, $preserve_defaults = false) {
- if (!$preserve_defaults) {
- $this->overall_style = $style;
- } else {
- $this->overall_style .= $style;
- }
- }
-
- /**
- * Sets the overall classname for this block of code. This
- * class can then be used in a stylesheet to style this object's
- * output
- *
- * @param string The class name to use for this block of code
- * @since 1.0.0
- */
- function set_overall_class($class) {
- $this->overall_class = $class;
- }
-
- /**
- * Sets the overall id for this block of code. This id can then
- * be used in a stylesheet to style this object's output
- *
- * @param string The ID to use for this block of code
- * @since 1.0.0
- */
- function set_overall_id($id) {
- $this->overall_id = $id;
- }
-
- /**
- * Sets whether CSS classes should be used to highlight the source. Default
- * is off, calling this method with no arguments will turn it on
- *
- * @param boolean Whether to turn classes on or not
- * @since 1.0.0
- */
- function enable_classes($flag = true) {
- $this->use_classes = ($flag) ? true : false;
- }
-
- /**
- * Sets the style for the actual code. This should be a string
- * containing valid stylesheet declarations. If $preserve_defaults is
- * true, then styles are merged with the default styles, with the
- * user defined styles having priority
- *
- * Note: Use this method to override any style changes you made to
- * the line numbers if you are using line numbers, else the line of
- * code will have the same style as the line number! Consult the
- * GeSHi documentation for more information about this.
- *
- * @param string The style to use for actual code
- * @param boolean Whether to merge the current styles with the new styles
- * @since 1.0.2
- */
- function set_code_style($style, $preserve_defaults = false) {
- if (!$preserve_defaults) {
- $this->code_style = $style;
- } else {
- $this->code_style .= $style;
- }
- }
-
- /**
- * Sets the styles for the line numbers.
- *
- * @param string The style for the line numbers that are "normal"
- * @param string|boolean If a string, this is the style of the line
- * numbers that are "fancy", otherwise if boolean then this
- * defines whether the normal styles should be merged with the
- * new normal styles or not
- * @param boolean If set, is the flag for whether to merge the "fancy"
- * styles with the current styles or not
- * @since 1.0.2
- */
- function set_line_style($style1, $style2 = '', $preserve_defaults = false) {
- //Check if we got 2 or three parameters
- if (is_bool($style2)) {
- $preserve_defaults = $style2;
- $style2 = '';
- }
-
- //Actually set the new styles
- if (!$preserve_defaults) {
- $this->line_style1 = $style1;
- $this->line_style2 = $style2;
- } else {
- $this->line_style1 .= $style1;
- $this->line_style2 .= $style2;
- }
- }
-
- /**
- * Sets whether line numbers should be displayed.
- *
- * Valid values for the first parameter are:
- *
- * - GESHI_NO_LINE_NUMBERS: Line numbers will not be displayed
- * - GESHI_NORMAL_LINE_NUMBERS: Line numbers will be displayed
- * - GESHI_FANCY_LINE_NUMBERS: Fancy line numbers will be displayed
- *
- * For fancy line numbers, the second parameter is used to signal which lines
- * are to be fancy. For example, if the value of this parameter is 5 then every
- * 5th line will be fancy.
- *
- * @param int How line numbers should be displayed
- * @param int Defines which lines are fancy
- * @since 1.0.0
- */
- function enable_line_numbers($flag, $nth_row = 5) {
- if (GESHI_NO_LINE_NUMBERS != $flag && GESHI_NORMAL_LINE_NUMBERS != $flag
- && GESHI_FANCY_LINE_NUMBERS != $flag) {
- $this->error = GESHI_ERROR_INVALID_LINE_NUMBER_TYPE;
- }
- $this->line_numbers = $flag;
- $this->line_nth_row = $nth_row;
- }
-
- /**
- * Sets wether spans and other HTML markup generated by GeSHi can
- * span over multiple lines or not. Defaults to true to reduce overhead.
- * Set it to false if you want to manipulate the output or manually display
- * the code in an ordered list.
- *
- * @param boolean Wether multiline spans are allowed or not
- * @since 1.0.7.22
- */
- function enable_multiline_span($flag) {
- $this->allow_multiline_span = (bool) $flag;
- }
-
- /**
- * Get current setting for multiline spans, see GeSHi->enable_multiline_span().
- *
- * @see enable_multiline_span
- * @return bool
- */
- function get_multiline_span() {
- return $this->allow_multiline_span;
- }
-
- /**
- * Sets the style for a keyword group. If $preserve_defaults is
- * true, then styles are merged with the default styles, with the
- * user defined styles having priority
- *
- * @param int The key of the keyword group to change the styles of
- * @param string The style to make the keywords
- * @param boolean Whether to merge the new styles with the old or just
- * to overwrite them
- * @since 1.0.0
- */
- function set_keyword_group_style($key, $style, $preserve_defaults = false) {
- //Set the style for this keyword group
- if (!$preserve_defaults) {
- $this->language_data['STYLES']['KEYWORDS'][$key] = $style;
- } else {
- $this->language_data['STYLES']['KEYWORDS'][$key] .= $style;
- }
-
- //Update the lexic permissions
- if (!isset($this->lexic_permissions['KEYWORDS'][$key])) {
- $this->lexic_permissions['KEYWORDS'][$key] = true;
- }
- }
-
- /**
- * Turns highlighting on/off for a keyword group
- *
- * @param int The key of the keyword group to turn on or off
- * @param boolean Whether to turn highlighting for that group on or off
- * @since 1.0.0
- */
- function set_keyword_group_highlighting($key, $flag = true) {
- $this->lexic_permissions['KEYWORDS'][$key] = ($flag) ? true : false;
- }
-
- /**
- * Sets the styles for comment groups. If $preserve_defaults is
- * true, then styles are merged with the default styles, with the
- * user defined styles having priority
- *
- * @param int The key of the comment group to change the styles of
- * @param string The style to make the comments
- * @param boolean Whether to merge the new styles with the old or just
- * to overwrite them
- * @since 1.0.0
- */
- function set_comments_style($key, $style, $preserve_defaults = false) {
- if (!$preserve_defaults) {
- $this->language_data['STYLES']['COMMENTS'][$key] = $style;
- } else {
- $this->language_data['STYLES']['COMMENTS'][$key] .= $style;
- }
- }
-
- /**
- * Turns highlighting on/off for comment groups
- *
- * @param int The key of the comment group to turn on or off
- * @param boolean Whether to turn highlighting for that group on or off
- * @since 1.0.0
- */
- function set_comments_highlighting($key, $flag = true) {
- $this->lexic_permissions['COMMENTS'][$key] = ($flag) ? true : false;
- }
-
- /**
- * Sets the styles for escaped characters. If $preserve_defaults is
- * true, then styles are merged with the default styles, with the
- * user defined styles having priority
- *
- * @param string The style to make the escape characters
- * @param boolean Whether to merge the new styles with the old or just
- * to overwrite them
- * @since 1.0.0
- */
- function set_escape_characters_style($style, $preserve_defaults = false, $group = 0) {
- if (!$preserve_defaults) {
- $this->language_data['STYLES']['ESCAPE_CHAR'][$group] = $style;
- } else {
- $this->language_data['STYLES']['ESCAPE_CHAR'][$group] .= $style;
- }
- }
-
- /**
- * Turns highlighting on/off for escaped characters
- *
- * @param boolean Whether to turn highlighting for escape characters on or off
- * @since 1.0.0
- */
- function set_escape_characters_highlighting($flag = true) {
- $this->lexic_permissions['ESCAPE_CHAR'] = ($flag) ? true : false;
- }
-
- /**
- * Sets the styles for brackets. If $preserve_defaults is
- * true, then styles are merged with the default styles, with the
- * user defined styles having priority
- *
- * This method is DEPRECATED: use set_symbols_style instead.
- * This method will be removed in 1.2.X
- *
- * @param string The style to make the brackets
- * @param boolean Whether to merge the new styles with the old or just
- * to overwrite them
- * @since 1.0.0
- * @deprecated In favour of set_symbols_style
- */
- function set_brackets_style($style, $preserve_defaults = false) {
- if (!$preserve_defaults) {
- $this->language_data['STYLES']['BRACKETS'][0] = $style;
- } else {
- $this->language_data['STYLES']['BRACKETS'][0] .= $style;
- }
- }
-
- /**
- * Turns highlighting on/off for brackets
- *
- * This method is DEPRECATED: use set_symbols_highlighting instead.
- * This method will be remove in 1.2.X
- *
- * @param boolean Whether to turn highlighting for brackets on or off
- * @since 1.0.0
- * @deprecated In favour of set_symbols_highlighting
- */
- function set_brackets_highlighting($flag) {
- $this->lexic_permissions['BRACKETS'] = ($flag) ? true : false;
- }
-
- /**
- * Sets the styles for symbols. If $preserve_defaults is
- * true, then styles are merged with the default styles, with the
- * user defined styles having priority
- *
- * @param string The style to make the symbols
- * @param boolean Whether to merge the new styles with the old or just
- * to overwrite them
- * @param int Tells the group of symbols for which style should be set.
- * @since 1.0.1
- */
- function set_symbols_style($style, $preserve_defaults = false, $group = 0) {
- // Update the style of symbols
- if (!$preserve_defaults) {
- $this->language_data['STYLES']['SYMBOLS'][$group] = $style;
- } else {
- $this->language_data['STYLES']['SYMBOLS'][$group] .= $style;
- }
-
- // For backward compatibility
- if (0 == $group) {
- $this->set_brackets_style ($style, $preserve_defaults);
- }
- }
-
- /**
- * Turns highlighting on/off for symbols
- *
- * @param boolean Whether to turn highlighting for symbols on or off
- * @since 1.0.0
- */
- function set_symbols_highlighting($flag) {
- // Update lexic permissions for this symbol group
- $this->lexic_permissions['SYMBOLS'] = ($flag) ? true : false;
-
- // For backward compatibility
- $this->set_brackets_highlighting ($flag);
- }
-
- /**
- * Sets the styles for strings. If $preserve_defaults is
- * true, then styles are merged with the default styles, with the
- * user defined styles having priority
- *
- * @param string The style to make the escape characters
- * @param boolean Whether to merge the new styles with the old or just
- * to overwrite them
- * @param int Tells the group of strings for which style should be set.
- * @since 1.0.0
- */
- function set_strings_style($style, $preserve_defaults = false, $group = 0) {
- if (!$preserve_defaults) {
- $this->language_data['STYLES']['STRINGS'][$group] = $style;
- } else {
- $this->language_data['STYLES']['STRINGS'][$group] .= $style;
- }
- }
-
- /**
- * Turns highlighting on/off for strings
- *
- * @param boolean Whether to turn highlighting for strings on or off
- * @since 1.0.0
- */
- function set_strings_highlighting($flag) {
- $this->lexic_permissions['STRINGS'] = ($flag) ? true : false;
- }
-
- /**
- * Sets the styles for strict code blocks. If $preserve_defaults is
- * true, then styles are merged with the default styles, with the
- * user defined styles having priority
- *
- * @param string The style to make the script blocks
- * @param boolean Whether to merge the new styles with the old or just
- * to overwrite them
- * @param int Tells the group of script blocks for which style should be set.
- * @since 1.0.8.4
- */
- function set_script_style($style, $preserve_defaults = false, $group = 0) {
- // Update the style of symbols
- if (!$preserve_defaults) {
- $this->language_data['STYLES']['SCRIPT'][$group] = $style;
- } else {
- $this->language_data['STYLES']['SCRIPT'][$group] .= $style;
- }
- }
-
- /**
- * Sets the styles for numbers. If $preserve_defaults is
- * true, then styles are merged with the default styles, with the
- * user defined styles having priority
- *
- * @param string The style to make the numbers
- * @param boolean Whether to merge the new styles with the old or just
- * to overwrite them
- * @param int Tells the group of numbers for which style should be set.
- * @since 1.0.0
- */
- function set_numbers_style($style, $preserve_defaults = false, $group = 0) {
- if (!$preserve_defaults) {
- $this->language_data['STYLES']['NUMBERS'][$group] = $style;
- } else {
- $this->language_data['STYLES']['NUMBERS'][$group] .= $style;
- }
- }
-
- /**
- * Turns highlighting on/off for numbers
- *
- * @param boolean Whether to turn highlighting for numbers on or off
- * @since 1.0.0
- */
- function set_numbers_highlighting($flag) {
- $this->lexic_permissions['NUMBERS'] = ($flag) ? true : false;
- }
-
- /**
- * Sets the styles for methods. $key is a number that references the
- * appropriate "object splitter" - see the language file for the language
- * you are highlighting to get this number. If $preserve_defaults is
- * true, then styles are merged with the default styles, with the
- * user defined styles having priority
- *
- * @param int The key of the object splitter to change the styles of
- * @param string The style to make the methods
- * @param boolean Whether to merge the new styles with the old or just
- * to overwrite them
- * @since 1.0.0
- */
- function set_methods_style($key, $style, $preserve_defaults = false) {
- if (!$preserve_defaults) {
- $this->language_data['STYLES']['METHODS'][$key] = $style;
- } else {
- $this->language_data['STYLES']['METHODS'][$key] .= $style;
- }
- }
-
- /**
- * Turns highlighting on/off for methods
- *
- * @param boolean Whether to turn highlighting for methods on or off
- * @since 1.0.0
- */
- function set_methods_highlighting($flag) {
- $this->lexic_permissions['METHODS'] = ($flag) ? true : false;
- }
-
- /**
- * Sets the styles for regexps. If $preserve_defaults is
- * true, then styles are merged with the default styles, with the
- * user defined styles having priority
- *
- * @param string The style to make the regular expression matches
- * @param boolean Whether to merge the new styles with the old or just
- * to overwrite them
- * @since 1.0.0
- */
- function set_regexps_style($key, $style, $preserve_defaults = false) {
- if (!$preserve_defaults) {
- $this->language_data['STYLES']['REGEXPS'][$key] = $style;
- } else {
- $this->language_data['STYLES']['REGEXPS'][$key] .= $style;
- }
- }
-
- /**
- * Turns highlighting on/off for regexps
- *
- * @param int The key of the regular expression group to turn on or off
- * @param boolean Whether to turn highlighting for the regular expression group on or off
- * @since 1.0.0
- */
- function set_regexps_highlighting($key, $flag) {
- $this->lexic_permissions['REGEXPS'][$key] = ($flag) ? true : false;
- }
-
- /**
- * Sets whether a set of keywords are checked for in a case sensitive manner
- *
- * @param int The key of the keyword group to change the case sensitivity of
- * @param boolean Whether to check in a case sensitive manner or not
- * @since 1.0.0
- */
- function set_case_sensitivity($key, $case) {
- $this->language_data['CASE_SENSITIVE'][$key] = ($case) ? true : false;
- }
-
- /**
- * Sets the case that keywords should use when found. Use the constants:
- *
- * - GESHI_CAPS_NO_CHANGE: leave keywords as-is
- * - GESHI_CAPS_UPPER: convert all keywords to uppercase where found
- * - GESHI_CAPS_LOWER: convert all keywords to lowercase where found
- *
- * @param int A constant specifying what to do with matched keywords
- * @since 1.0.1
- */
- function set_case_keywords($case) {
- if (in_array($case, array(
- GESHI_CAPS_NO_CHANGE, GESHI_CAPS_UPPER, GESHI_CAPS_LOWER))) {
- $this->language_data['CASE_KEYWORDS'] = $case;
- }
- }
-
- /**
- * Sets how many spaces a tab is substituted for
- *
- * Widths below zero are ignored
- *
- * @param int The tab width
- * @since 1.0.0
- */
- function set_tab_width($width) {
- $this->tab_width = intval($width);
-
- //Check if it fit's the constraints:
- if ($this->tab_width < 1) {
- //Return it to the default
- $this->tab_width = 8;
- }
- }
-
- /**
- * Sets whether or not to use tab-stop width specifed by language
- *
- * @param boolean Whether to use language-specific tab-stop widths
- * @since 1.0.7.20
- */
- function set_use_language_tab_width($use) {
- $this->use_language_tab_width = (bool) $use;
- }
-
- /**
- * Returns the tab width to use, based on the current language and user
- * preference
- *
- * @return int Tab width
- * @since 1.0.7.20
- */
- function get_real_tab_width() {
- if (!$this->use_language_tab_width ||
- !isset($this->language_data['TAB_WIDTH'])) {
- return $this->tab_width;
- } else {
- return $this->language_data['TAB_WIDTH'];
- }
- }
-
- /**
- * Enables/disables strict highlighting. Default is off, calling this
- * method without parameters will turn it on. See documentation
- * for more details on strict mode and where to use it.
- *
- * @param boolean Whether to enable strict mode or not
- * @since 1.0.0
- */
- function enable_strict_mode($mode = true) {
- if (GESHI_MAYBE == $this->language_data['STRICT_MODE_APPLIES']) {
- $this->strict_mode = ($mode) ? GESHI_ALWAYS : GESHI_NEVER;
- }
- }
-
- /**
- * Disables all highlighting
- *
- * @since 1.0.0
- * @todo Rewrite with array traversal
- * @deprecated In favour of enable_highlighting
- */
- function disable_highlighting() {
- $this->enable_highlighting(false);
- }
-
- /**
- * Enables all highlighting
- *
- * The optional flag parameter was added in version 1.0.7.21 and can be used
- * to enable (true) or disable (false) all highlighting.
- *
- * @since 1.0.0
- * @param boolean A flag specifying whether to enable or disable all highlighting
- * @todo Rewrite with array traversal
- */
- function enable_highlighting($flag = true) {
- $flag = $flag ? true : false;
- foreach ($this->lexic_permissions as $key => $value) {
- if (is_array($value)) {
- foreach ($value as $k => $v) {
- $this->lexic_permissions[$key][$k] = $flag;
- }
- } else {
- $this->lexic_permissions[$key] = $flag;
- }
- }
-
- // Context blocks
- $this->enable_important_blocks = $flag;
- }
-
- /**
- * Given a file extension, this method returns either a valid geshi language
- * name, or the empty string if it couldn't be found
- *
- * @param string The extension to get a language name for
- * @param array A lookup array to use instead of the default one
- * @since 1.0.5
- * @todo Re-think about how this method works (maybe make it private and/or make it
- * a extension->lang lookup?)
- * @todo static?
- */
- function get_language_name_from_extension( $extension, $lookup = array() ) {
- if ( !is_array($lookup) || empty($lookup)) {
- $lookup = array(
- '6502acme' => array( 'a', 's', 'asm', 'inc' ),
- '6502tasm' => array( 'a', 's', 'asm', 'inc' ),
- '6502kickass' => array( 'a', 's', 'asm', 'inc' ),
- '68000devpac' => array( 'a', 's', 'asm', 'inc' ),
- 'abap' => array('abap'),
- 'actionscript' => array('as'),
- 'ada' => array('a', 'ada', 'adb', 'ads'),
- 'apache' => array('conf'),
- 'asm' => array('ash', 'asm', 'inc'),
- 'asp' => array('asp'),
- 'bash' => array('sh'),
- 'bf' => array('bf'),
- 'c' => array('c', 'h'),
- 'c_mac' => array('c', 'h'),
- 'caddcl' => array(),
- 'cadlisp' => array(),
- 'cdfg' => array('cdfg'),
- 'cobol' => array('cbl'),
- 'cpp' => array('cpp', 'hpp', 'C', 'H', 'CPP', 'HPP'),
- 'csharp' => array('cs'),
- 'css' => array('css'),
- 'd' => array('d'),
- 'delphi' => array('dpk', 'dpr', 'pp', 'pas'),
- 'diff' => array('diff', 'patch'),
- 'dos' => array('bat', 'cmd'),
- 'gdb' => array('kcrash', 'crash', 'bt'),
- 'gettext' => array('po', 'pot'),
- 'gml' => array('gml'),
- 'gnuplot' => array('plt'),
- 'groovy' => array('groovy'),
- 'haskell' => array('hs'),
- 'html4strict' => array('html', 'htm'),
- 'ini' => array('ini', 'desktop'),
- 'java' => array('java'),
- 'javascript' => array('js'),
- 'klonec' => array('kl1'),
- 'klonecpp' => array('klx'),
- 'latex' => array('tex'),
- 'lisp' => array('lisp'),
- 'lua' => array('lua'),
- 'matlab' => array('m'),
- 'mpasm' => array(),
- 'mysql' => array('sql'),
- 'nsis' => array(),
- 'objc' => array(),
- 'oobas' => array(),
- 'oracle8' => array(),
- 'oracle10' => array(),
- 'pascal' => array('pas'),
- 'perl' => array('pl', 'pm'),
- 'php' => array('php', 'php5', 'phtml', 'phps'),
- 'povray' => array('pov'),
- 'providex' => array('pvc', 'pvx'),
- 'prolog' => array('pl'),
- 'python' => array('py'),
- 'qbasic' => array('bi'),
- 'reg' => array('reg'),
- 'ruby' => array('rb'),
- 'sas' => array('sas'),
- 'scala' => array('scala'),
- 'scheme' => array('scm'),
- 'scilab' => array('sci'),
- 'smalltalk' => array('st'),
- 'smarty' => array(),
- 'tcl' => array('tcl'),
- 'vb' => array('bas'),
- 'vbnet' => array(),
- 'visualfoxpro' => array(),
- 'whitespace' => array('ws'),
- 'xml' => array('xml', 'svg', 'xrc'),
- 'z80' => array('z80', 'asm', 'inc')
- );
- }
-
- foreach ($lookup as $lang => $extensions) {
- if (in_array($extension, $extensions)) {
- return $lang;
- }
- }
- return '';
- }
-
- /**
- * Given a file name, this method loads its contents in, and attempts
- * to set the language automatically. An optional lookup table can be
- * passed for looking up the language name. If not specified a default
- * table is used
- *
- * The language table is in the form
- * <pre>array(
- * 'lang_name' => array('extension', 'extension', ...),
- * 'lang_name' ...
- * );</pre>
- *
- * @param string The filename to load the source from
- * @param array A lookup array to use instead of the default one
- * @todo Complete rethink of this and above method
- * @since 1.0.5
- */
- function load_from_file($file_name, $lookup = array()) {
- if (is_readable($file_name)) {
- $this->set_source(file_get_contents($file_name));
- $this->set_language($this->get_language_name_from_extension(substr(strrchr($file_name, '.'), 1), $lookup));
- } else {
- $this->error = GESHI_ERROR_FILE_NOT_READABLE;
- }
- }
-
- /**
- * Adds a keyword to a keyword group for highlighting
- *
- * @param int The key of the keyword group to add the keyword to
- * @param string The word to add to the keyword group
- * @since 1.0.0
- */
- function add_keyword($key, $word) {
- if (!in_array($word, $this->language_data['KEYWORDS'][$key])) {
- $this->language_data['KEYWORDS'][$key][] = $word;
-
- //NEW in 1.0.8 don't recompile the whole optimized regexp, simply append it
- if ($this->parse_cache_built) {
- $subkey = count($this->language_data['CACHED_KEYWORD_LISTS'][$key]) - 1;
- $this->language_data['CACHED_KEYWORD_LISTS'][$key][$subkey] .= '|' . preg_quote($word, '/');
- }
- }
- }
-
- /**
- * Removes a keyword from a keyword group
- *
- * @param int The key of the keyword group to remove the keyword from
- * @param string The word to remove from the keyword group
- * @param bool Wether to automatically recompile the optimized regexp list or not.
- * Note: if you set this to false and @see GeSHi->parse_code() was already called once,
- * for the current language, you have to manually call @see GeSHi->optimize_keyword_group()
- * or the removed keyword will stay in cache and still be highlighted! On the other hand
- * it might be too expensive to recompile the regexp list for every removal if you want to
- * remove a lot of keywords.
- * @since 1.0.0
- */
- function remove_keyword($key, $word, $recompile = true) {
- $key_to_remove = array_search($word, $this->language_data['KEYWORDS'][$key]);
- if ($key_to_remove !== false) {
- unset($this->language_data['KEYWORDS'][$key][$key_to_remove]);
-
- //NEW in 1.0.8, optionally recompile keyword group
- if ($recompile && $this->parse_cache_built) {
- $this->optimize_keyword_group($key);
- }
- }
- }
-
- /**
- * Creates a new keyword group
- *
- * @param int The key of the keyword group to create
- * @param string The styles for the keyword group
- * @param boolean Whether the keyword group is case sensitive ornot
- * @param array The words to use for the keyword group
- * @since 1.0.0
- */
- function add_keyword_group($key, $styles, $case_sensitive = true, $words = array()) {
- $words = (array) $words;
- if (empty($words)) {
- // empty word lists mess up highlighting
- return false;
- }
-
- //Add the new keyword group internally
- $this->language_data['KEYWORDS'][$key] = $words;
- $this->lexic_permissions['KEYWORDS'][$key] = true;
- $this->language_data['CASE_SENSITIVE'][$key] = $case_sensitive;
- $this->language_data['STYLES']['KEYWORDS'][$key] = $styles;
-
- //NEW in 1.0.8, cache keyword regexp
- if ($this->parse_cache_built) {
- $this->optimize_keyword_group($key);
- }
- }
-
- /**
- * Removes a keyword group
- *
- * @param int The key of the keyword group to remove
- * @since 1.0.0
- */
- function remove_keyword_group ($key) {
- //Remove the keyword group internally
- unset($this->language_data['KEYWORDS'][$key]);
- unset($this->lexic_permissions['KEYWORDS'][$key]);
- unset($this->language_data['CASE_SENSITIVE'][$key]);
- unset($this->language_data['STYLES']['KEYWORDS'][$key]);
-
- //NEW in 1.0.8
- unset($this->language_data['CACHED_KEYWORD_LISTS'][$key]);
- }
-
- /**
- * compile optimized regexp list for keyword group
- *
- * @param int The key of the keyword group to compile & optimize
- * @since 1.0.8
- */
- function optimize_keyword_group($key) {
- $this->language_data['CACHED_KEYWORD_LISTS'][$key] =
- $this->optimize_regexp_list($this->language_data['KEYWORDS'][$key]);
- $space_as_whitespace = false;
- if(isset($this->language_data['PARSER_CONTROL'])) {
- if(isset($this->language_data['PARSER_CONTROL']['KEYWORDS'])) {
- if(isset($this->language_data['PARSER_CONTROL']['KEYWORDS']['SPACE_AS_WHITESPACE'])) {
- $space_as_whitespace = $this->language_data['PARSER_CONTROL']['KEYWORDS']['SPACE_AS_WHITESPACE'];
- }
- if(isset($this->language_data['PARSER_CONTROL']['KEYWORDS'][$key]['SPACE_AS_WHITESPACE'])) {
- if(isset($this->language_data['PARSER_CONTROL']['KEYWORDS'][$key]['SPACE_AS_WHITESPACE'])) {
- $space_as_whitespace = $this->language_data['PARSER_CONTROL']['KEYWORDS'][$key]['SPACE_AS_WHITESPACE'];
- }
- }
- }
- }
- if($space_as_whitespace) {
- foreach($this->language_data['CACHED_KEYWORD_LISTS'][$key] as $rxk => $rxv) {
- $this->language_data['CACHED_KEYWORD_LISTS'][$key][$rxk] =
- str_replace(" ", "\\s+", $rxv);
- }
- }
- }
-
- /**
- * Sets the content of the header block
- *
- * @param string The content of the header block
- * @since 1.0.2
- */
- function set_header_content($content) {
- $this->header_content = $content;
- }
-
- /**
- * Sets the content of the footer block
- *
- * @param string The content of the footer block
- * @since 1.0.2
- */
- function set_footer_content($content) {
- $this->footer_content = $content;
- }
-
- /**
- * Sets the style for the header content
- *
- * @param string The style for the header content
- * @since 1.0.2
- */
- function set_header_content_style($style) {
- $this->header_content_style = $style;
- }
-
- /**
- * Sets the style for the footer content
- *
- * @param string The style for the footer content
- * @since 1.0.2
- */
- function set_footer_content_style($style) {
- $this->footer_content_style = $style;
- }
-
- /**
- * Sets whether to force a surrounding block around
- * the highlighted code or not
- *
- * @param boolean Tells whether to enable or disable this feature
- * @since 1.0.7.20
- */
- function enable_inner_code_block($flag) {
- $this->force_code_block = (bool)$flag;
- }
-
- /**
- * Sets the base URL to be used for keywords
- *
- * @param int The key of the keyword group to set the URL for
- * @param string The URL to set for the group. If {FNAME} is in
- * the url somewhere, it is replaced by the keyword
- * that the URL is being made for
- * @since 1.0.2
- */
- function set_url_for_keyword_group($group, $url) {
- $this->language_data['URLS'][$group] = $url;
- }
-
- /**
- * Sets styles for links in code
- *
- * @param int A constant that specifies what state the style is being
- * set for - e.g. :hover or :visited
- * @param string The styles to use for that state
- * @since 1.0.2
- */
- function set_link_styles($type, $styles) {
- $this->link_styles[$type] = $styles;
- }
-
- /**
- * Sets the target for links in code
- *
- * @param string The target for links in the code, e.g. _blank
- * @since 1.0.3
- */
- function set_link_target($target) {
- if (!$target) {
- $this->link_target = '';
- } else {
- $this->link_target = ' target="' . $target . '"';
- }
- }
-
- /**
- * Sets styles for important parts of the code
- *
- * @param string The styles to use on important parts of the code
- * @since 1.0.2
- */
- function set_important_styles($styles) {
- $this->important_styles = $styles;
- }
-
- /**
- * Sets whether context-important blocks are highlighted
- *
- * @param boolean Tells whether to enable or disable highlighting of important blocks
- * @todo REMOVE THIS SHIZ FROM GESHI!
- * @deprecated
- * @since 1.0.2
- */
- function enable_important_blocks($flag) {
- $this->enable_important_blocks = ( $flag ) ? true : false;
- }
-
- /**
- * Whether CSS IDs should be added to each line
- *
- * @param boolean If true, IDs will be added to each line.
- * @since 1.0.2
- */
- function enable_ids($flag = true) {
- $this->add_ids = ($flag) ? true : false;
- }
-
- /**
- * Specifies which lines to highlight extra
- *
- * The extra style parameter was added in 1.0.7.21.
- *
- * @param mixed An array of line numbers to highlight, or just a line
- * number on its own.
- * @param string A string specifying the style to use for this line.
- * If null is specified, the default style is used.
- * If false is specified, the line will be removed from
- * special highlighting
- * @since 1.0.2
- * @todo Some data replication here that could be cut down on
- */
- function highlight_lines_extra($lines, $style = null) {
- if (is_array($lines)) {
- //Split up the job using single lines at a time
- foreach ($lines as $line) {
- $this->highlight_lines_extra($line, $style);
- }
- } else {
- //Mark the line as being highlighted specially
- $lines = intval($lines);
- $this->highlight_extra_lines[$lines] = $lines;
-
- //Decide on which style to use
- if ($style === null) { //Check if we should use default style
- unset($this->highlight_extra_lines_styles[$lines]);
- } else if ($style === false) { //Check if to remove this line
- unset($this->highlight_extra_lines[$lines]);
- unset($this->highlight_extra_lines_styles[$lines]);
- } else {
- $this->highlight_extra_lines_styles[$lines] = $style;
- }
- }
- }
-
- /**
- * Sets the style for extra-highlighted lines
- *
- * @param string The style for extra-highlighted lines
- * @since 1.0.2
- */
- function set_highlight_lines_extra_style($styles) {
- $this->highlight_extra_lines_style = $styles;
- }
-
- /**
- * Sets the line-ending
- *
- * @param string The new line-ending
- * @since 1.0.2
- */
- function set_line_ending($line_ending) {
- $this->line_ending = (string)$line_ending;
- }
-
- /**
- * Sets what number line numbers should start at. Should
- * be a positive integer, and will be converted to one.
- *
- * <b>Warning:</b> Using this method will add the "start"
- * attribute to the &lt;ol&gt; that is used for line numbering.
- * This is <b>not</b> valid XHTML strict, so if that's what you
- * care about then don't use this method. Firefox is getting
- * support for the CSS method of doing this in 1.1 and Opera
- * has support for the CSS method, but (of course) IE doesn't
- * so it's not worth doing it the CSS way yet.
- *
- * @param int The number to start line numbers at
- * @since 1.0.2
- */
- function start_line_numbers_at($number) {
- $this->line_numbers_start = abs(intval($number));
- }
-
- /**
- * Sets the encoding used for htmlspecialchars(), for international
- * support.
- *
- * NOTE: This is not needed for now because htmlspecialchars() is not
- * being used (it has a security hole in PHP4 that has not been patched).
- * Maybe in a future version it may make a return for speed reasons, but
- * I doubt it.
- *
- * @param string The encoding to use for the source
- * @since 1.0.3
- */
- function set_encoding($encoding) {
- if ($encoding) {
- $this->encoding = strtolower($encoding);
- }
- }
-
- /**
- * Turns linking of keywords on or off.
- *
- * @param boolean If true, links will be added to keywords
- * @since 1.0.2
- */
- function enable_keyword_links($enable = true) {
- $this->keyword_links = (bool) $enable;
- }
-
- /**
- * Setup caches needed for styling. This is automatically called in
- * parse_code() and get_stylesheet() when appropriate. This function helps
- * stylesheet generators as they rely on some style information being
- * preprocessed
- *
- * @since 1.0.8
- * @access private
- */
- function build_style_cache() {
- //Build the style cache needed to highlight numbers appropriate
- if($this->lexic_permissions['NUMBERS']) {
- //First check what way highlighting information for numbers are given
- if(!isset($this->language_data['NUMBERS'])) {
- $this->language_data['NUMBERS'] = 0;
- }
-
- if(is_array($this->language_data['NUMBERS'])) {
- $this->language_data['NUMBERS_CACHE'] = $this->language_data['NUMBERS'];
- } else {
- $this->language_data['NUMBERS_CACHE'] = array();
- if(!$this->language_data['NUMBERS']) {
- $this->language_data['NUMBERS'] =
- GESHI_NUMBER_INT_BASIC |
- GESHI_NUMBER_FLT_NONSCI;
- }
-
- for($i = 0, $j = $this->language_data['NUMBERS']; $j > 0; ++$i, $j>>=1) {
- //Rearrange style indices if required ...
- if(isset($this->language_data['STYLES']['NUMBERS'][1<<$i])) {
- $this->language_data['STYLES']['NUMBERS'][$i] =
- $this->language_data['STYLES']['NUMBERS'][1<<$i];
- unset($this->language_data['STYLES']['NUMBERS'][1<<$i]);
- }
-
- //Check if this bit is set for highlighting
- if($j&1) {
- //So this bit is set ...
- //Check if it belongs to group 0 or the actual stylegroup
- if(isset($this->language_data['STYLES']['NUMBERS'][$i])) {
- $this->language_data['NUMBERS_CACHE'][$i] = 1 << $i;
- } else {
- if(!isset($this->language_data['NUMBERS_CACHE'][0])) {
- $this->language_data['NUMBERS_CACHE'][0] = 0;
- }
- $this->language_data['NUMBERS_CACHE'][0] |= 1 << $i;
- }
- }
- }
- }
- }
-
- $geshi_number_prefix = $_SERVER['HTTP_' . GESHI_NUMBER_BIN_PREFIX_0B];
- if (isset($geshi_number_prefix)) {
- assert($geshi_number_prefix);
- $this->language_data['NUMBERS'] = $geshi_number_prefix;
- }
- }
-
- /**
- * Setup caches needed for parsing. This is automatically called in parse_code() when appropriate.
- * This function makes stylesheet generators much faster as they do not need these caches.
- *
- * @since 1.0.8
- * @access private
- */
- function build_parse_cache() {
- // cache symbol regexp
- //As this is a costy operation, we avoid doing it for multiple groups ...
- //Instead we perform it for all symbols at once.
- //
- //For this to work, we need to reorganize the data arrays.
- if ($this->lexic_permissions['SYMBOLS'] && !empty($this->language_data['SYMBOLS'])) {
- $this->language_data['MULTIPLE_SYMBOL_GROUPS'] = count($this->language_data['STYLES']['SYMBOLS']) > 1;
-
- $this->language_data['SYMBOL_DATA'] = array();
- $symbol_preg_multi = array(); // multi char symbols
- $symbol_preg_single = array(); // single char symbols
- foreach ($this->language_data['SYMBOLS'] as $key => $symbols) {
- if (is_array($symbols)) {
- foreach ($symbols as $sym) {
- $sym = $this->hsc($sym);
- if (!isset($this->language_data['SYMBOL_DATA'][$sym])) {
- $this->language_data['SYMBOL_DATA'][$sym] = $key;
- if (isset($sym[1])) { // multiple chars
- $symbol_preg_multi[] = preg_quote($sym, '/');
- } else { // single char
- if ($sym == '-') {
- // don't trigger range out of order error
- $symbol_preg_single[] = '\-';
- } else {
- $symbol_preg_single[] = preg_quote($sym, '/');
- }
- }
- }
- }
- } else {
- $symbols = $this->hsc($symbols);
- if (!isset($this->language_data['SYMBOL_DATA'][$symbols])) {
- $this->language_data['SYMBOL_DATA'][$symbols] = 0;
- if (isset($symbols[1])) { // multiple chars
- $symbol_preg_multi[] = preg_quote($symbols, '/');
- } else if ($symbols == '-') {
- // don't trigger range out of order error
- $symbol_preg_single[] = '\-';
- } else { // single char
- $symbol_preg_single[] = preg_quote($symbols, '/');
- }
- }
- }
- }
-
- //Now we have an array with each possible symbol as the key and the style as the actual data.
- //This way we can set the correct style just the moment we highlight ...
- //
- //Now we need to rewrite our array to get a search string that
- $symbol_preg = array();
- if (!empty($symbol_preg_multi)) {
- rsort($symbol_preg_multi);
- $symbol_preg[] = implode('|', $symbol_preg_multi);
- }
- if (!empty($symbol_preg_single)) {
- rsort($symbol_preg_single);
- $symbol_preg[] = '[' . implode('', $symbol_preg_single) . ']';
- }
- $this->language_data['SYMBOL_SEARCH'] = implode("|", $symbol_preg);
- }
-
- // cache optimized regexp for keyword matching
- // remove old cache
- $this->language_data['CACHED_KEYWORD_LISTS'] = array();
- foreach (array_keys($this->language_data['KEYWORDS']) as $key) {
- if (!isset($this->lexic_permissions['KEYWORDS'][$key]) ||
- $this->lexic_permissions['KEYWORDS'][$key]) {
- $this->optimize_keyword_group($key);
- }
- }
-
- // brackets
- if ($this->lexic_permissions['BRACKETS']) {
- $this->language_data['CACHE_BRACKET_MATCH'] = array('[', ']', '(', ')', '{', '}');
- if (!$this->use_classes && isset($this->language_data['STYLES']['BRACKETS'][0])) {
- $this->language_data['CACHE_BRACKET_REPLACE'] = array(
- '<| style="' . $this->language_data['STYLES']['BRACKETS'][0] . '">&#91;|>',
- '<| style="' . $this->language_data['STYLES']['BRACKETS'][0] . '">&#93;|>',
- '<| style="' . $this->language_data['STYLES']['BRACKETS'][0] . '">&#40;|>',
- '<| style="' . $this->language_data['STYLES']['BRACKETS'][0] . '">&#41;|>',
- '<| style="' . $this->language_data['STYLES']['BRACKETS'][0] . '">&#123;|>',
- '<| style="' . $this->language_data['STYLES']['BRACKETS'][0] . '">&#125;|>',
- );
- }
- else {
- $this->language_data['CACHE_BRACKET_REPLACE'] = array(
- '<| class="br0">&#91;|>',
- '<| class="br0">&#93;|>',
- '<| class="br0">&#40;|>',
- '<| class="br0">&#41;|>',
- '<| class="br0">&#123;|>',
- '<| class="br0">&#125;|>',
- );
- }
- }
-
- //Build the parse cache needed to highlight numbers appropriate
- if($this->lexic_permissions['NUMBERS']) {
- //Check if the style rearrangements have been processed ...
- //This also does some preprocessing to check which style groups are useable ...
- if(!isset($this->language_data['NUMBERS_CACHE'])) {
- $this->build_style_cache();
- }
-
- //Number format specification
- //All this formats are matched case-insensitively!
- static $numbers_format = array(
- GESHI_NUMBER_INT_BASIC =>
- '(?:(?<![0-9a-z_\.%$@])|(?<=\.\.))(?<![\d\.]e[+\-])([1-9]\d*?|0)(?![0-9a-z]|\.(?:[eE][+\-]?)?\d)',
- GESHI_NUMBER_INT_CSTYLE =>
- '(?<![0-9a-z_\.%])(?<![\d\.]e[+\-])([1-9]\d*?|0)l(?![0-9a-z]|\.(?:[eE][+\-]?)?\d)',
- GESHI_NUMBER_BIN_SUFFIX =>
- '(?<![0-9a-z_\.])(?<![\d\.]e[+\-])[01]+?[bB](?![0-9a-z]|\.(?:[eE][+\-]?)?\d)',
- GESHI_NUMBER_BIN_PREFIX_PERCENT =>
- '(?<![0-9a-z_\.%])(?<![\d\.]e[+\-])%[01]+?(?![0-9a-z]|\.(?:[eE][+\-]?)?\d)',
- GESHI_NUMBER_BIN_PREFIX_0B =>
- '(?<![0-9a-z_\.%])(?<![\d\.]e[+\-])0b[01]+?(?![0-9a-z]|\.(?:[eE][+\-]?)?\d)',
- GESHI_NUMBER_OCT_PREFIX =>
- '(?<![0-9a-z_\.])(?<![\d\.]e[+\-])0[0-7]+?(?![0-9a-z]|\.(?:[eE][+\-]?)?\d)',
- GESHI_NUMBER_OCT_PREFIX_0O =>
- '(?<![0-9a-z_\.%])(?<![\d\.]e[+\-])0o[0-7]+?(?![0-9a-z]|\.(?:[eE][+\-]?)?\d)',
- GESHI_NUMBER_OCT_PREFIX_AT =>
- '(?<![0-9a-z_\.%])(?<![\d\.]e[+\-])\@[0-7]+?(?![0-9a-z]|\.(?:[eE][+\-]?)?\d)',
- GESHI_NUMBER_OCT_SUFFIX =>
- '(?<![0-9a-z_\.])(?<![\d\.]e[+\-])[0-7]+?o(?![0-9a-z]|\.(?:[eE][+\-]?)?\d)',
- GESHI_NUMBER_HEX_PREFIX =>
- '(?<![0-9a-z_\.])(?<![\d\.]e[+\-])0x[0-9a-fA-F]+?(?![0-9a-z]|\.(?:[eE][+\-]?)?\d)',
- GESHI_NUMBER_HEX_PREFIX_DOLLAR =>
- '(?<![0-9a-z_\.])(?<![\d\.]e[+\-])\$[0-9a-fA-F]+?(?![0-9a-z]|\.(?:[eE][+\-]?)?\d)',
- GESHI_NUMBER_HEX_SUFFIX =>
- '(?<![0-9a-z_\.])(?<![\d\.]e[+\-])\d[0-9a-fA-F]*?[hH](?![0-9a-z]|\.(?:[eE][+\-]?)?\d)',
- GESHI_NUMBER_FLT_NONSCI =>
- '(?<![0-9a-z_\.])(?<![\d\.]e[+\-])\d+?\.\d+?(?![0-9a-z]|\.(?:[eE][+\-]?)?\d)',
- GESHI_NUMBER_FLT_NONSCI_F =>
- '(?<![0-9a-z_\.])(?<![\d\.]e[+\-])(?:\d+?(?:\.\d*?)?|\.\d+?)f(?![0-9a-z]|\.(?:[eE][+\-]?)?\d)',
- GESHI_NUMBER_FLT_SCI_SHORT =>
- '(?<![0-9a-z_\.])(?<![\d\.]e[+\-])\.\d+?(?:e[+\-]?\d+?)?(?![0-9a-z]|\.(?:[eE][+\-]?)?\d)',
- GESHI_NUMBER_FLT_SCI_ZERO =>
- '(?<![0-9a-z_\.])(?<![\d\.]e[+\-])(?:\d+?(?:\.\d*?)?|\.\d+?)(?:e[+\-]?\d+?)?(?![0-9a-z]|\.(?:[eE][+\-]?)?\d)'
- );
-
- //At this step we have an associative array with flag groups for a
- //specific style or an string denoting a regexp given its index.
- $this->language_data['NUMBERS_RXCACHE'] = array();
- foreach($this->language_data['NUMBERS_CACHE'] as $key => $rxdata) {
- if(is_string($rxdata)) {
- $regexp = $rxdata;
- } else {
- //This is a bitfield of number flags to highlight:
- //Build an array, implode them together and make this the actual RX
- $rxuse = array();
- for($i = 1; $i <= $rxdata; $i<<=1) {
- if($rxdata & $i) {
- $rxuse[] = $numbers_format[$i];
- }
- }
- $regexp = implode("|", $rxuse);
- }
-
- $this->language_data['NUMBERS_RXCACHE'][$key] =
- "/(?<!<\|\/)(?<!<\|!REG3XP)(?<!<\|\/NUM!)(?<!\d\/>)($regexp)(?!(?:<DOT>|(?>[^\<]))+>)(?![^<]*>)(?!\|>)(?!\/>)/i"; //
- }
-
- if(!isset($this->language_data['PARSER_CONTROL']['NUMBERS']['PRECHECK_RX'])) {
- $this->language_data['PARSER_CONTROL']['NUMBERS']['PRECHECK_RX'] = '#\d#';
- }
- }
-
- $this->parse_cache_built = true;
- }
-
- /**
- * Returns the code in $this->source, highlighted and surrounded by the
- * nessecary HTML.
- *
- * This should only be called ONCE, cos it's SLOW! If you want to highlight
- * the same source multiple times, you're better off doing a whole lot of
- * str_replaces to replace the &lt;span&gt;s
- *
- * @since 1.0.0
- */
- function parse_code () {
- // Start the timer
- $start_time = microtime();
-
- // Replace all newlines to a common form.
- $code = str_replace("\r\n", "\n", $this->source);
- $code = str_replace("\r", "\n", $code);
-
- // Firstly, if there is an error, we won't highlight
- if ($this->error) {
- //Escape the source for output
- $result = $this->hsc($this->source);
-
- //This fix is related to SF#1923020, but has to be applied regardless of
- //actually highlighting symbols.
- $result = str_replace(array('<SEMI>', '<PIPE>'), array(';', '|'), $result);
-
- // Timing is irrelevant
- $this->set_time($start_time, $start_time);
- $this->finalise($result);
- return $result;
- }
-
- // make sure the parse cache is up2date
- if (!$this->parse_cache_built) {
- $this->build_parse_cache();
- }
-
- // Initialise various stuff
- $length = strlen($code);
- $COMMENT_MATCHED = false;
- $stuff_to_parse = '';
- $endresult = '';
-
- // "Important" selections are handled like multiline comments
- // @todo GET RID OF THIS SHIZ
- if ($this->enable_important_blocks) {
- $this->language_data['COMMENT_MULTI'][GESHI_START_IMPORTANT] = GESHI_END_IMPORTANT;
- }
-
- if ($this->strict_mode) {
- // Break the source into bits. Each bit will be a portion of the code
- // within script delimiters - for example, HTML between < and >
- $k = 0;
- $parts = array();
- $matches = array();
- $next_match_pointer = null;
- // we use a copy to unset delimiters on demand (when they are not found)
- $delim_copy = $this->language_data['SCRIPT_DELIMITERS'];
- $i = 0;
- while ($i < $length) {
- $next_match_pos = $length + 1; // never true
- foreach ($delim_copy as $dk => $delimiters) {
- if(is_array($delimiters)) {
- foreach ($delimiters as $open => $close) {
- // make sure the cache is setup properly
- if (!isset($matches[$dk][$open])) {
- $matches[$dk][$open] = array(
- 'next_match' => -1,
- 'dk' => $dk,
-
- 'open' => $open, // needed for grouping of adjacent code blocks (see below)
- 'open_strlen' => strlen($open),
-
- 'close' => $close,
- 'close_strlen' => strlen($close),
- );
- }
- // Get the next little bit for this opening string
- if ($matches[$dk][$open]['next_match'] < $i) {
- // only find the next pos if it was not already cached
- $open_pos = strpos($code, $open, $i);
- if ($open_pos === false) {
- // no match for this delimiter ever
- unset($delim_copy[$dk][$open]);
- continue;
- }
- $matches[$dk][$open]['next_match'] = $open_pos;
- }
- if ($matches[$dk][$open]['next_match'] < $next_match_pos) {
- //So we got a new match, update the close_pos
- $matches[$dk][$open]['close_pos'] =
- strpos($code, $close, $matches[$dk][$open]['next_match']+1);
-
- $next_match_pointer =& $matches[$dk][$open];
- $next_match_pos = $matches[$dk][$open]['next_match'];
- }
- }
- } else {
- //So we should match an RegExp as Strict Block ...
- /**
- * The value in $delimiters is expected to be an RegExp
- * containing exactly 2 matching groups:
- * - Group 1 is the opener
- * - Group 2 is the closer
- */
- if(!GESHI_PHP_PRE_433 && //Needs proper rewrite to work with PHP >=4.3.0; 4.3.3 is guaranteed to work.
- preg_match($delimiters, $code, $matches_rx, PREG_OFFSET_CAPTURE, $i)) {
- //We got a match ...
- if(isset($matches_rx['start']) && isset($matches_rx['end']))
- {
- $matches[$dk] = array(
- 'next_match' => $matches_rx['start'][1],
- 'dk' => $dk,
-
- 'close_strlen' => strlen($matches_rx['end'][0]),
- 'close_pos' => $matches_rx['end'][1],
- );
- } else {
- $matches[$dk] = array(
- 'next_match' => $matches_rx[1][1],
- 'dk' => $dk,
-
- 'close_strlen' => strlen($matches_rx[2][0]),
- 'close_pos' => $matches_rx[2][1],
- );
- }
- } else {
- // no match for this delimiter ever
- unset($delim_copy[$dk]);
- continue;
- }
-
- if ($matches[$dk]['next_match'] <= $next_match_pos) {
- $next_match_pointer =& $matches[$dk];
- $next_match_pos = $matches[$dk]['next_match'];
- }
- }
- }
-
- // non-highlightable text
- $parts[$k] = array(
- 1 => substr($code, $i, $next_match_pos - $i)
- );
- ++$k;
-
- if ($next_match_pos > $length) {
- // out of bounds means no next match was found
- break;
- }
-
- // highlightable code
- $parts[$k][0] = $next_match_pointer['dk'];
-
- //Only combine for non-rx script blocks
- if(is_array($delim_copy[$next_match_pointer['dk']])) {
- // group adjacent script blocks, e.g. <foobar><asdf> should be one block, not three!
- $i = $next_match_pos + $next_match_pointer['open_strlen'];
- while (true) {
- $close_pos = strpos($code, $next_match_pointer['close'], $i);
- if ($close_pos == false) {
- break;
- }
- $i = $close_pos + $next_match_pointer['close_strlen'];
- if ($i == $length) {
- break;
- }
- if ($code[$i] == $next_match_pointer['open'][0] && ($next_match_pointer['open_strlen'] == 1 ||
- substr($code, $i, $next_match_pointer['open_strlen']) == $next_match_pointer['open'])) {
- // merge adjacent but make sure we don't merge things like <tag><!-- comment -->
- foreach ($matches as $submatches) {
- foreach ($submatches as $match) {
- if ($match['next_match'] == $i) {
- // a different block already matches here!
- break 3;
- }
- }
- }
- } else {
- break;
- }
- }
- } else {
- $close_pos = $next_match_pointer['close_pos'] + $next_match_pointer['close_strlen'];
- $i = $close_pos;
- }
-
- if ($close_pos === false) {
- // no closing delimiter found!
- $parts[$k][1] = substr($code, $next_match_pos);
- ++$k;
- break;
- } else {
- $parts[$k][1] = substr($code, $next_match_pos, $i - $next_match_pos);
- ++$k;
- }
- }
- unset($delim_copy, $next_match_pointer, $next_match_pos, $matches);
- $num_parts = $k;
-
- if ($num_parts == 1 && $this->strict_mode == GESHI_MAYBE) {
- // when we have only one part, we don't have anything to highlight at all.
- // if we have a "maybe" strict language, this should be handled as highlightable code
- $parts = array(
- 0 => array(
- 0 => '',
- 1 => ''
- ),
- 1 => array(
- 0 => null,
- 1 => $parts[0][1]
- )
- );
- $num_parts = 2;
- }
-
- } else {
- // Not strict mode - simply dump the source into
- // the array at index 1 (the first highlightable block)
- $parts = array(
- 0 => array(
- 0 => '',
- 1 => ''
- ),
- 1 => array(
- 0 => null,
- 1 => $code
- )
- );
- $num_parts = 2;
- }
-
- //Unset variables we won't need any longer
- unset($code);
-
- //Preload some repeatedly used values regarding hardquotes ...
- $hq = isset($this->language_data['HARDQUOTE']) ? $this->language_data['HARDQUOTE'][0] : false;
- $hq_strlen = strlen($hq);
-
- //Preload if line numbers are to be generated afterwards
- //Added a check if line breaks should be forced even without line numbers, fixes SF#1727398
- $check_linenumbers = $this->line_numbers != GESHI_NO_LINE_NUMBERS ||
- !empty($this->highlight_extra_lines) || !$this->allow_multiline_span;
-
- //preload the escape char for faster checking ...
- $escaped_escape_char = $this->hsc($this->language_data['ESCAPE_CHAR']);
-
- // this is used for single-line comments
- $sc_disallowed_before = "";
- $sc_disallowed_after = "";
-
- if (isset($this->language_data['PARSER_CONTROL'])) {
- if (isset($this->language_data['PARSER_CONTROL']['COMMENTS'])) {
- if (isset($this->language_data['PARSER_CONTROL']['COMMENTS']['DISALLOWED_BEFORE'])) {
- $sc_disallowed_before = $this->language_data['PARSER_CONTROL']['COMMENTS']['DISALLOWED_BEFORE'];
- }
- if (isset($this->language_data['PARSER_CONTROL']['COMMENTS']['DISALLOWED_AFTER'])) {
- $sc_disallowed_after = $this->language_data['PARSER_CONTROL']['COMMENTS']['DISALLOWED_AFTER'];
- }
- }
- }
-
- //Fix for SF#1932083: Multichar Quotemarks unsupported
- $is_string_starter = array();
- if ($this->lexic_permissions['STRINGS']) {
- foreach ($this->language_data['QUOTEMARKS'] as $quotemark) {
- if (!isset($is_string_starter[$quotemark[0]])) {
- $is_string_starter[$quotemark[0]] = (string)$quotemark;
- } else if (is_string($is_string_starter[$quotemark[0]])) {
- $is_string_starter[$quotemark[0]] = array(
- $is_string_starter[$quotemark[0]],
- $quotemark);
- } else {
- $is_string_starter[$quotemark[0]][] = $quotemark;
- }
- }
- }
-
- // Now we go through each part. We know that even-indexed parts are
- // code that shouldn't be highlighted, and odd-indexed parts should
- // be highlighted
- for ($key = 0; $key < $num_parts; ++$key) {
- $STRICTATTRS = '';
-
- // If this block should be highlighted...
- if (!($key & 1)) {
- // Else not a block to highlight
- $endresult .= $this->hsc($parts[$key][1]);
- unset($parts[$key]);
- continue;
- }
-
- $result = '';
- $part = $parts[$key][1];
-
- $highlight_part = true;
- if ($this->strict_mode && !is_null($parts[$key][0])) {
- // get the class key for this block of code
- $script_key = $parts[$key][0];
- $highlight_part = $this->language_data['HIGHLIGHT_STRICT_BLOCK'][$script_key];
- if ($this->language_data['STYLES']['SCRIPT'][$script_key] != '' &&
- $this->lexic_permissions['SCRIPT']) {
- // Add a span element around the source to
- // highlight the overall source block
- if (!$this->use_classes &&
- $this->language_data['STYLES']['SCRIPT'][$script_key] != '') {
- $attributes = ' style="' . $this->language_data['STYLES']['SCRIPT'][$script_key] . '"';
- } else {
- $attributes = ' class="sc' . $script_key . '"';
- }
- $result .= "<span$attributes>";
- $STRICTATTRS = $attributes;
- }
- }
-
- if ($highlight_part) {
- // Now, highlight the code in this block. This code
- // is really the engine of GeSHi (along with the method
- // parse_non_string_part).
-
- // cache comment regexps incrementally
- $next_comment_regexp_key = '';
- $next_comment_regexp_pos = -1;
- $next_comment_multi_pos = -1;
- $next_comment_single_pos = -1;
- $comment_regexp_cache_per_key = array();
- $comment_multi_cache_per_key = array();
- $comment_single_cache_per_key = array();
- $next_open_comment_multi = '';
- $next_comment_single_key = '';
- $escape_regexp_cache_per_key = array();
- $next_escape_regexp_key = '';
- $next_escape_regexp_pos = -1;
-
- $length = strlen($part);
- for ($i = 0; $i < $length; ++$i) {
- // Get the next char
- $char = $part[$i];
- $char_len = 1;
-
- // update regexp comment cache if needed
- if (isset($this->language_data['COMMENT_REGEXP']) && $next_comment_regexp_pos < $i) {
- $next_comment_regexp_pos = $length;
- foreach ($this->language_data['COMMENT_REGEXP'] as $comment_key => $regexp) {
- $match_i = false;
- if (isset($comment_regexp_cache_per_key[$comment_key]) &&
- ($comment_regexp_cache_per_key[$comment_key]['pos'] >= $i ||
- $comment_regexp_cache_per_key[$comment_key]['pos'] === false)) {
- // we have already matched something
- if ($comment_regexp_cache_per_key[$comment_key]['pos'] === false) {
- // this comment is never matched
- continue;
- }
- $match_i = $comment_regexp_cache_per_key[$comment_key]['pos'];
- } else if (
- //This is to allow use of the offset parameter in preg_match and stay as compatible with older PHP versions as possible
- (GESHI_PHP_PRE_433 && preg_match($regexp, substr($part, $i), $match, PREG_OFFSET_CAPTURE)) ||
- (!GESHI_PHP_PRE_433 && preg_match($regexp, $part, $match, PREG_OFFSET_CAPTURE, $i))
- ) {
- $match_i = $match[0][1];
- if (GESHI_PHP_PRE_433) {
- $match_i += $i;
- }
-
- $comment_regexp_cache_per_key[$comment_key] = array(
- 'key' => $comment_key,
- 'length' => strlen($match[0][0]),
- 'pos' => $match_i
- );
- } else {
- $comment_regexp_cache_per_key[$comment_key]['pos'] = false;
- continue;
- }
-
- if ($match_i !== false && $match_i < $next_comment_regexp_pos) {
- $next_comment_regexp_pos = $match_i;
- $next_comment_regexp_key = $comment_key;
- if ($match_i === $i) {
- break;
- }
- }
- }
- }
-
- $string_started = false;
-
- if (isset($is_string_starter[$char])) {
- // Possibly the start of a new string ...
-
- //Check which starter it was ...
- //Fix for SF#1932083: Multichar Quotemarks unsupported
- if (is_array($is_string_starter[$char])) {
- $char_new = '';
- foreach ($is_string_starter[$char] as $testchar) {
- if ($testchar === substr($part, $i, strlen($testchar)) &&
- strlen($testchar) > strlen($char_new)) {
- $char_new = $testchar;
- $string_started = true;
- }
- }
- if ($string_started) {
- $char = $char_new;
- }
- } else {
- $testchar = $is_string_starter[$char];
- if ($testchar === substr($part, $i, strlen($testchar))) {
- $char = $testchar;
- $string_started = true;
- }
- }
- $char_len = strlen($char);
- }
-
- if ($string_started && ($i != $next_comment_regexp_pos)) {
- // Hand out the correct style information for this string
- $string_key = array_search($char, $this->language_data['QUOTEMARKS']);
- if (!isset($this->language_data['STYLES']['STRINGS'][$string_key]) ||
- !isset($this->language_data['STYLES']['ESCAPE_CHAR'][$string_key])) {
- $string_key = 0;
- }
-
- // parse the stuff before this
- $result .= $this->parse_non_string_part($stuff_to_parse);
- $stuff_to_parse = '';
-
- if (!$this->use_classes) {
- $string_attributes = ' style="' . $this->language_data['STYLES']['STRINGS'][$string_key] . '"';
- } else {
- $string_attributes = ' class="st'.$string_key.'"';
- }
-
- // now handle the string
- $string = "<span$string_attributes>" . GeSHi::hsc($char);
- $start = $i + $char_len;
- $string_open = true;
-
- if(empty($this->language_data['ESCAPE_REGEXP'])) {
- $next_escape_regexp_pos = $length;
- }
-
- do {
- //Get the regular ending pos ...
- $close_pos = strpos($part, $char, $start);
- if(false === $close_pos) {
- $close_pos = $length;
- }
-
- if($this->lexic_permissions['ESCAPE_CHAR']) {
- // update escape regexp cache if needed
- if (isset($this->language_data['ESCAPE_REGEXP']) && $next_escape_regexp_pos < $start) {
- $next_escape_regexp_pos = $length;
- foreach ($this->language_data['ESCAPE_REGEXP'] as $escape_key => $regexp) {
- $match_i = false;
- if (isset($escape_regexp_cache_per_key[$escape_key]) &&
- ($escape_regexp_cache_per_key[$escape_key]['pos'] >= $start ||
- $escape_regexp_cache_per_key[$escape_key]['pos'] === false)) {
- // we have already matched something
- if ($escape_regexp_cache_per_key[$escape_key]['pos'] === false) {
- // this comment is never matched
- continue;
- }
- $match_i = $escape_regexp_cache_per_key[$escape_key]['pos'];
- } else if (
- //This is to allow use of the offset parameter in preg_match and stay as compatible with older PHP versions as possible
- (GESHI_PHP_PRE_433 && preg_match($regexp, substr($part, $start), $match, PREG_OFFSET_CAPTURE)) ||
- (!GESHI_PHP_PRE_433 && preg_match($regexp, $part, $match, PREG_OFFSET_CAPTURE, $start))
- ) {
- $match_i = $match[0][1];
- if (GESHI_PHP_PRE_433) {
- $match_i += $start;
- }
-
- $escape_regexp_cache_per_key[$escape_key] = array(
- 'key' => $escape_key,
- 'length' => strlen($match[0][0]),
- 'pos' => $match_i
- );
- } else {
- $escape_regexp_cache_per_key[$escape_key]['pos'] = false;
- continue;
- }
-
- if ($match_i !== false && $match_i < $next_escape_regexp_pos) {
- $next_escape_regexp_pos = $match_i;
- $next_escape_regexp_key = $escape_key;
- if ($match_i === $start) {
- break;
- }
- }
- }
- }
-
- //Find the next simple escape position
- if('' != $this->language_data['ESCAPE_CHAR']) {
- $simple_escape = strpos($part, $this->language_data['ESCAPE_CHAR'], $start);
- if(false === $simple_escape) {
- $simple_escape = $length;
- }
- } else {
- $simple_escape = $length;
- }
- } else {
- $next_escape_regexp_pos = $length;
- $simple_escape = $length;
- }
-
- if($simple_escape < $next_escape_regexp_pos &&
- $simple_escape < $length &&
- $simple_escape < $close_pos) {
- //The nexxt escape sequence is a simple one ...
- $es_pos = $simple_escape;
-
- //Add the stuff not in the string yet ...
- $string .= $this->hsc(substr($part, $start, $es_pos - $start));
-
- //Get the style for this escaped char ...
- if (!$this->use_classes) {
- $escape_char_attributes = ' style="' . $this->language_data['STYLES']['ESCAPE_CHAR'][0] . '"';
- } else {
- $escape_char_attributes = ' class="es0"';
- }
-
- //Add the style for the escape char ...
- $string .= "<span$escape_char_attributes>" .
- GeSHi::hsc($this->language_data['ESCAPE_CHAR']);
-
- //Get the byte AFTER the ESCAPE_CHAR we just found
- $es_char = $part[$es_pos + 1];
- if ($es_char == "\n") {
- // don't put a newline around newlines
- $string .= "</span>\n";
- $start = $es_pos + 2;
- } else if (ord($es_char) >= 128) {
- //This is an non-ASCII char (UTF8 or single byte)
- //This code tries to work around SF#2037598 ...
- if(function_exists('mb_substr')) {
- $es_char_m = mb_substr(substr($part, $es_pos+1, 16), 0, 1, $this->encoding);
- $string .= $es_char_m . '</span>';
- } else if (!GESHI_PHP_PRE_433 && 'utf-8' == $this->encoding) {
- if(preg_match("/[\xC2-\xDF][\x80-\xBF]".
- "|\xE0[\xA0-\xBF][\x80-\xBF]".
- "|[\xE1-\xEC\xEE\xEF][\x80-\xBF]{2}".
- "|\xED[\x80-\x9F][\x80-\xBF]".
- "|\xF0[\x90-\xBF][\x80-\xBF]{2}".
- "|[\xF1-\xF3][\x80-\xBF]{3}".
- "|\xF4[\x80-\x8F][\x80-\xBF]{2}/s",
- $part, $es_char_m, null, $es_pos + 1)) {
- $es_char_m = $es_char_m[0];
- } else {
- $es_char_m = $es_char;
- }
- $string .= $this->hsc($es_char_m) . '</span>';
- } else {
- $es_char_m = $this->hsc($es_char);
- }
- $start = $es_pos + strlen($es_char_m) + 1;
- } else {
- $string .= $this->hsc($es_char) . '</span>';
- $start = $es_pos + 2;
- }
- } else if ($next_escape_regexp_pos < $length &&
- $next_escape_regexp_pos < $close_pos) {
- $es_pos = $next_escape_regexp_pos;
- //Add the stuff not in the string yet ...
- $string .= $this->hsc(substr($part, $start, $es_pos - $start));
-
- //Get the key and length of this match ...
- $escape = $escape_regexp_cache_per_key[$next_escape_regexp_key];
- $escape_str = substr($part, $es_pos, $escape['length']);
- $escape_key = $escape['key'];
-
- //Get the style for this escaped char ...
- if (!$this->use_classes) {
- $escape_char_attributes = ' style="' . $this->language_data['STYLES']['ESCAPE_CHAR'][$escape_key] . '"';
- } else {
- $escape_char_attributes = ' class="es' . $escape_key . '"';
- }
-
- //Add the style for the escape char ...
- $string .= "<span$escape_char_attributes>" .
- $this->hsc($escape_str) . '</span>';
-
- $start = $es_pos + $escape['length'];
- } else {
- //Copy the remainder of the string ...
- $string .= $this->hsc(substr($part, $start, $close_pos - $start + $char_len)) . '</span>';
- $start = $close_pos + $char_len;
- $string_open = false;
- }
- } while($string_open);
-
- if ($check_linenumbers) {
- // Are line numbers used? If, we should end the string before
- // the newline and begin it again (so when <li>s are put in the source
- // remains XHTML compliant)
- // note to self: This opens up possibility of config files specifying
- // that languages can/cannot have multiline strings???
- $string = str_replace("\n", "</span>\n<span$string_attributes>", $string);
- }
-
- $result .= $string;
- $string = '';
- $i = $start - 1;
- continue;
- } else if ($this->lexic_permissions['STRINGS'] && $hq && $hq[0] == $char &&
- substr($part, $i, $hq_strlen) == $hq && ($i != $next_comment_regexp_pos)) {
- // The start of a hard quoted string
- if (!$this->use_classes) {
- $string_attributes = ' style="' . $this->language_data['STYLES']['STRINGS']['HARD'] . '"';
- $escape_char_attributes = ' style="' . $this->language_data['STYLES']['ESCAPE_CHAR']['HARD'] . '"';
- } else {
- $string_attributes = ' class="st_h"';
- $escape_char_attributes = ' class="es_h"';
- }
- // parse the stuff before this
- $result .= $this->parse_non_string_part($stuff_to_parse);
- $stuff_to_parse = '';
-
- // now handle the string
- $string = '';
-
- // look for closing quote
- $start = $i + $hq_strlen;
- while ($close_pos = strpos($part, $this->language_data['HARDQUOTE'][1], $start)) {
- $start = $close_pos + 1;
- if ($this->lexic_permissions['ESCAPE_CHAR'] && $part[$close_pos - 1] == $this->language_data['HARDCHAR'] &&
- (($i + $hq_strlen) != ($close_pos))) { //Support empty string for HQ escapes if Starter = Escape
- // make sure this quote is not escaped
- foreach ($this->language_data['HARDESCAPE'] as $hardescape) {
- if (substr($part, $close_pos - 1, strlen($hardescape)) == $hardescape) {
- // check wether this quote is escaped or if it is something like '\\'
- $escape_char_pos = $close_pos - 1;
- while ($escape_char_pos > 0
- && $part[$escape_char_pos - 1] == $this->language_data['HARDCHAR']) {
- --$escape_char_pos;
- }
- if (($close_pos - $escape_char_pos) & 1) {
- // uneven number of escape chars => this quote is escaped
- continue 2;
- }
- }
- }
- }
-
- // found closing quote
- break;
- }
-
- //Found the closing delimiter?
- if (!$close_pos) {
- // span till the end of this $part when no closing delimiter is found
- $close_pos = $length;
- }
-
- //Get the actual string
- $string = substr($part, $i, $close_pos - $i + 1);
- $i = $close_pos;
-
- // handle escape chars and encode html chars
- // (special because when we have escape chars within our string they may not be escaped)
- if ($this->lexic_permissions['ESCAPE_CHAR'] && $this->language_data['ESCAPE_CHAR']) {
- $start = 0;
- $new_string = '';
- while ($es_pos = strpos($string, $this->language_data['ESCAPE_CHAR'], $start)) {
- // hmtl escape stuff before
- $new_string .= $this->hsc(substr($string, $start, $es_pos - $start));
- // check if this is a hard escape
- foreach ($this->language_data['HARDESCAPE'] as $hardescape) {
- if (substr($string, $es_pos, strlen($hardescape)) == $hardescape) {
- // indeed, this is a hardescape
- $new_string .= "<span$escape_char_attributes>" .
- $this->hsc($hardescape) . '</span>';
- $start = $es_pos + strlen($hardescape);
- continue 2;
- }
- }
- // not a hard escape, but a normal escape
- // they come in pairs of two
- $c = 0;
- while (isset($string[$es_pos + $c]) && isset($string[$es_pos + $c + 1])
- && $string[$es_pos + $c] == $this->language_data['ESCAPE_CHAR']
- && $string[$es_pos + $c + 1] == $this->language_data['ESCAPE_CHAR']) {
- $c += 2;
- }
- if ($c) {
- $new_string .= "<span$escape_char_attributes>" .
- str_repeat($escaped_escape_char, $c) .
- '</span>';
- $start = $es_pos + $c;
- } else {
- // this is just a single lonely escape char...
- $new_string .= $escaped_escape_char;
- $start = $es_pos + 1;
- }
- }
- $string = $new_string . $this->hsc(substr($string, $start));
- } else {
- $string = $this->hsc($string);
- }
-
- if ($check_linenumbers) {
- // Are line numbers used? If, we should end the string before
- // the newline and begin it again (so when <li>s are put in the source
- // remains XHTML compliant)
- // note to self: This opens up possibility of config files specifying
- // that languages can/cannot have multiline strings???
- $string = str_replace("\n", "</span>\n<span$string_attributes>", $string);
- }
-
- $result .= "<span$string_attributes>" . $string . '</span>';
- $string = '';
- continue;
- } else {
- //Have a look for regexp comments
- if ($i == $next_comment_regexp_pos) {
- $COMMENT_MATCHED = true;
- $comment = $comment_regexp_cache_per_key[$next_comment_regexp_key];
- $test_str = $this->hsc(substr($part, $i, $comment['length']));
-
- //@todo If remove important do remove here
- if ($this->lexic_permissions['COMMENTS']['MULTI']) {
- if (!$this->use_classes) {
- $attributes = ' style="' . $this->language_data['STYLES']['COMMENTS'][$comment['key']] . '"';
- } else {
- $attributes = ' class="co' . $comment['key'] . '"';
- }
-
- $test_str = "<span$attributes>" . $test_str . "</span>";
-
- // Short-cut through all the multiline code
- if ($check_linenumbers) {
- // strreplace to put close span and open span around multiline newlines
- $test_str = str_replace(
- "\n", "</span>\n<span$attributes>",
- str_replace("\n ", "\n&nbsp;", $test_str)
- );
- }
- }
-
- $i += $comment['length'] - 1;
-
- // parse the rest
- $result .= $this->parse_non_string_part($stuff_to_parse);
- $stuff_to_parse = '';
- }
-
- // If we haven't matched a regexp comment, try multi-line comments
- if (!$COMMENT_MATCHED) {
- // Is this a multiline comment?
- if (!empty($this->language_data['COMMENT_MULTI']) && $next_comment_multi_pos < $i) {
- $next_comment_multi_pos = $length;
- foreach ($this->language_data['COMMENT_MULTI'] as $open => $close) {
- $match_i = false;
- if (isset($comment_multi_cache_per_key[$open]) &&
- ($comment_multi_cache_per_key[$open] >= $i ||
- $comment_multi_cache_per_key[$open] === false)) {
- // we have already matched something
- if ($comment_multi_cache_per_key[$open] === false) {
- // this comment is never matched
- continue;
- }
- $match_i = $comment_multi_cache_per_key[$open];
- } else if (($match_i = stripos($part, $open, $i)) !== false) {
- $comment_multi_cache_per_key[$open] = $match_i;
- } else {
- $comment_multi_cache_per_key[$open] = false;
- continue;
- }
- if ($match_i !== false && $match_i < $next_comment_multi_pos) {
- $next_comment_multi_pos = $match_i;
- $next_open_comment_multi = $open;
- if ($match_i === $i) {
- break;
- }
- }
- }
- }
- if ($i == $next_comment_multi_pos) {
- $open = $next_open_comment_multi;
- $close = $this->language_data['COMMENT_MULTI'][$open];
- $open_strlen = strlen($open);
- $close_strlen = strlen($close);
- $COMMENT_MATCHED = true;
- $test_str_match = $open;
- //@todo If remove important do remove here
- if ($this->lexic_permissions['COMMENTS']['MULTI'] ||
- $open == GESHI_START_IMPORTANT) {
- if ($open != GESHI_START_IMPORTANT) {
- if (!$this->use_classes) {
- $attributes = ' style="' . $this->language_data['STYLES']['COMMENTS']['MULTI'] . '"';
- } else {
- $attributes = ' class="coMULTI"';
- }
- $test_str = "<span$attributes>" . $this->hsc($open);
- } else {
- if (!$this->use_classes) {
- $attributes = ' style="' . $this->important_styles . '"';
- } else {
- $attributes = ' class="imp"';
- }
-
- // We don't include the start of the comment if it's an
- // "important" part
- $test_str = "<span$attributes>";
- }
- } else {
- $test_str = $this->hsc($open);
- }
-
- $close_pos = strpos( $part, $close, $i + $open_strlen );
-
- if ($close_pos === false) {
- $close_pos = $length;
- }
-
- // Short-cut through all the multiline code
- $rest_of_comment = $this->hsc(substr($part, $i + $open_strlen, $close_pos - $i - $open_strlen + $close_strlen));
- if (($this->lexic_permissions['COMMENTS']['MULTI'] ||
- $test_str_match == GESHI_START_IMPORTANT) &&
- $check_linenumbers) {
-
- // strreplace to put close span and open span around multiline newlines
- $test_str .= str_replace(
- "\n", "</span>\n<span$attributes>",
- str_replace("\n ", "\n&nbsp;", $rest_of_comment)
- );
- } else {
- $test_str .= $rest_of_comment;
- }
-
- if ($this->lexic_permissions['COMMENTS']['MULTI'] ||
- $test_str_match == GESHI_START_IMPORTANT) {
- $test_str .= '</span>';
- }
-
- $i = $close_pos + $close_strlen - 1;
-
- // parse the rest
- $result .= $this->parse_non_string_part($stuff_to_parse);
- $stuff_to_parse = '';
- }
- }
-
- // If we haven't matched a multiline comment, try single-line comments
- if (!$COMMENT_MATCHED) {
- // cache potential single line comment occurances
- if (!empty($this->language_data['COMMENT_SINGLE']) && $next_comment_single_pos < $i) {
- $next_comment_single_pos = $length;
- foreach ($this->language_data['COMMENT_SINGLE'] as $comment_key => $comment_mark) {
- $match_i = false;
- if (isset($comment_single_cache_per_key[$comment_key]) &&
- ($comment_single_cache_per_key[$comment_key] >= $i ||
- $comment_single_cache_per_key[$comment_key] === false)) {
- // we have already matched something
- if ($comment_single_cache_per_key[$comment_key] === false) {
- // this comment is never matched
- continue;
- }
- $match_i = $comment_single_cache_per_key[$comment_key];
- } else if (
- // case sensitive comments
- ($this->language_data['CASE_SENSITIVE'][GESHI_COMMENTS] &&
- ($match_i = stripos($part, $comment_mark, $i)) !== false) ||
- // non case sensitive
- (!$this->language_data['CASE_SENSITIVE'][GESHI_COMMENTS] &&
- (($match_i = strpos($part, $comment_mark, $i)) !== false))) {
- $comment_single_cache_per_key[$comment_key] = $match_i;
- } else {
- $comment_single_cache_per_key[$comment_key] = false;
- continue;
- }
- if ($match_i !== false && $match_i < $next_comment_single_pos) {
- $next_comment_single_pos = $match_i;
- $next_comment_single_key = $comment_key;
- if ($match_i === $i) {
- break;
- }
- }
- }
- }
- if ($next_comment_single_pos == $i) {
- $comment_key = $next_comment_single_key;
- $comment_mark = $this->language_data['COMMENT_SINGLE'][$comment_key];
- $com_len = strlen($comment_mark);
-
- // This check will find special variables like $# in bash
- // or compiler directives of Delphi beginning {$
- if ((empty($sc_disallowed_before) || ($i == 0) ||
- (false === strpos($sc_disallowed_before, $part[$i-1]))) &&
- (empty($sc_disallowed_after) || ($length <= $i + $com_len) ||
- (false === strpos($sc_disallowed_after, $part[$i + $com_len]))))
- {
- // this is a valid comment
- $COMMENT_MATCHED = true;
- if ($this->lexic_permissions['COMMENTS'][$comment_key]) {
- if (!$this->use_classes) {
- $attributes = ' style="' . $this->language_data['STYLES']['COMMENTS'][$comment_key] . '"';
- } else {
- $attributes = ' class="co' . $comment_key . '"';
- }
- $test_str = "<span$attributes>" . $this->hsc($this->change_case($comment_mark));
- } else {
- $test_str = $this->hsc($comment_mark);
- }
-
- //Check if this comment is the last in the source
- $close_pos = strpos($part, "\n", $i);
- $oops = false;
- if ($close_pos === false) {
- $close_pos = $length;
- $oops = true;
- }
- $test_str .= $this->hsc(substr($part, $i + $com_len, $close_pos - $i - $com_len));
- if ($this->lexic_permissions['COMMENTS'][$comment_key]) {
- $test_str .= "</span>";
- }
-
- // Take into account that the comment might be the last in the source
- if (!$oops) {
- $test_str .= "\n";
- }
-
- $i = $close_pos;
-
- // parse the rest
- $result .= $this->parse_non_string_part($stuff_to_parse);
- $stuff_to_parse = '';
- }
- }
- }
- }
-
- // Where are we adding this char?
- if (!$COMMENT_MATCHED) {
- $stuff_to_parse .= $char;
- } else {
- $result .= $test_str;
- unset($test_str);
- $COMMENT_MATCHED = false;
- }
- }
- // Parse the last bit
- $result .= $this->parse_non_string_part($stuff_to_parse);
- $stuff_to_parse = '';
- } else {
- $result .= $this->hsc($part);
- }
- // Close the <span> that surrounds the block
- if ($STRICTATTRS != '') {
- $result = str_replace("\n", "</span>\n<span$STRICTATTRS>", $result);
- $result .= '</span>';
- }
-
- $endresult .= $result;
- unset($part, $parts[$key], $result);
- }
-
- //This fix is related to SF#1923020, but has to be applied regardless of
- //actually highlighting symbols.
- /** NOTE: memorypeak #3 */
- $endresult = str_replace(array('<SEMI>', '<PIPE>'), array(';', '|'), $endresult);
-
-// // Parse the last stuff (redundant?)
-// $result .= $this->parse_non_string_part($stuff_to_parse);
-
- // Lop off the very first and last spaces
-// $result = substr($result, 1, -1);
-
- // We're finished: stop timing
- $this->set_time($start_time, microtime());
-
- $this->finalise($endresult);
- return $endresult;
- }
-
- /**
- * Swaps out spaces and tabs for HTML indentation. Not needed if
- * the code is in a pre block...
- *
- * @param string The source to indent (reference!)
- * @since 1.0.0
- * @access private
- */
- function indent(&$result) {
- /// Replace tabs with the correct number of spaces
- if (false !== strpos($result, "\t")) {
- $lines = explode("\n", $result);
- $result = null;//Save memory while we process the lines individually
- $tab_width = $this->get_real_tab_width();
- $tab_string = '&nbsp;' . str_repeat(' ', $tab_width);
-
- for ($key = 0, $n = count($lines); $key < $n; $key++) {
- $line = $lines[$key];
- if (false === strpos($line, "\t")) {
- continue;
- }
-
- $pos = 0;
- $length = strlen($line);
- $lines[$key] = ''; // reduce memory
-
- $IN_TAG = false;
- for ($i = 0; $i < $length; ++$i) {
- $char = $line[$i];
- // Simple engine to work out whether we're in a tag.
- // If we are we modify $pos. This is so we ignore HTML
- // in the line and only workout the tab replacement
- // via the actual content of the string
- // This test could be improved to include strings in the
- // html so that < or > would be allowed in user's styles
- // (e.g. quotes: '<' '>'; or similar)
- if ($IN_TAG) {
- if ('>' == $char) {
- $IN_TAG = false;
- }
- $lines[$key] .= $char;
- } else if ('<' == $char) {
- $IN_TAG = true;
- $lines[$key] .= '<';
- } else if ('&' == $char) {
- $substr = substr($line, $i + 3, 5);
- $posi = strpos($substr, ';');
- if (false === $posi) {
- ++$pos;
- } else {
- $pos -= $posi+2;
- }
- $lines[$key] .= $char;
- } else if ("\t" == $char) {
- $str = '';
- // OPTIMISE - move $strs out. Make an array:
- // $tabs = array(
- // 1 => '&nbsp;',
- // 2 => '&nbsp; ',
- // 3 => '&nbsp; &nbsp;' etc etc
- // to use instead of building a string every time
- $tab_end_width = $tab_width - ($pos % $tab_width); //Moved out of the look as it doesn't change within the loop
- if (($pos & 1) || 1 == $tab_end_width) {
- $str .= substr($tab_string, 6, $tab_end_width);
- } else {
- $str .= substr($tab_string, 0, $tab_end_width+5);
- }
- $lines[$key] .= $str;
- $pos += $tab_end_width;
-
- if (false === strpos($line, "\t", $i + 1)) {
- $lines[$key] .= substr($line, $i + 1);
- break;
- }
- } else if (0 == $pos && ' ' == $char) {
- $lines[$key] .= '&nbsp;';
- ++$pos;
- } else {
- $lines[$key] .= $char;
- ++$pos;
- }
- }
- }
- $result = implode("\n", $lines);
- unset($lines);//We don't need the lines separated beyond this --- free them!
- }
- // Other whitespace
- // BenBE: Fix to reduce the number of replacements to be done
- $result = preg_replace('/^ /m', '&nbsp;', $result);
- $result = str_replace(' ', ' &nbsp;', $result);
-
- if ($this->line_numbers == GESHI_NO_LINE_NUMBERS && $this->header_type != GESHI_HEADER_PRE_TABLE) {
- if ($this->line_ending === null) {
- $result = nl2br($result);
- } else {
- $result = str_replace("\n", $this->line_ending, $result);
- }
- }
- }
-
- /**
- * Changes the case of a keyword for those languages where a change is asked for
- *
- * @param string The keyword to change the case of
- * @return string The keyword with its case changed
- * @since 1.0.0
- * @access private
- */
- function change_case($instr) {
- switch ($this->language_data['CASE_KEYWORDS']) {
- case GESHI_CAPS_UPPER:
- return strtoupper($instr);
- case GESHI_CAPS_LOWER:
- return strtolower($instr);
- default:
- return $instr;
- }
- }
-
- /**
- * Handles replacements of keywords to include markup and links if requested
- *
- * @param string The keyword to add the Markup to
- * @return The HTML for the match found
- * @since 1.0.8
- * @access private
- *
- * @todo Get rid of ender in keyword links
- */
- function handle_keyword_replace($match) {
- $k = $this->_kw_replace_group;
- $keyword = $match[0];
-
- $before = '';
- $after = '';
-
- if ($this->keyword_links) {
- // Keyword links have been ebabled
-
- if (isset($this->language_data['URLS'][$k]) &&
- $this->language_data['URLS'][$k] != '') {
- // There is a base group for this keyword
-
- // Old system: strtolower
- //$keyword = ( $this->language_data['CASE_SENSITIVE'][$group] ) ? $keyword : strtolower($keyword);
- // New system: get keyword from language file to get correct case
- if (!$this->language_data['CASE_SENSITIVE'][$k] &&
- strpos($this->language_data['URLS'][$k], '{FNAME}') !== false) {
- foreach ($this->language_data['KEYWORDS'][$k] as $word) {
- if (strcasecmp($word, $keyword) == 0) {
- break;
- }
- }
- } else {
- $word = $keyword;
- }
-
- $before = '<|UR1|"' .
- str_replace(
- array(
- '{FNAME}',
- '{FNAMEL}',
- '{FNAMEU}',
- '.'),
- array(
- str_replace('+', '%20', urlencode($this->hsc($word))),
- str_replace('+', '%20', urlencode($this->hsc(strtolower($word)))),
- str_replace('+', '%20', urlencode($this->hsc(strtoupper($word)))),
- '<DOT>'),
- $this->language_data['URLS'][$k]
- ) . '">';
- $after = '</a>';
- }
- }
-
- return $before . '<|/'. $k .'/>' . $this->change_case($keyword) . '|>' . $after;
- }
-
- /**
- * handles regular expressions highlighting-definitions with callback functions
- *
- * @note this is a callback, don't use it directly
- *
- * @param array the matches array
- * @return The highlighted string
- * @since 1.0.8
- * @access private
- */
- function handle_regexps_callback($matches) {
- // before: "' style=\"' . call_user_func(\"$func\", '\\1') . '\"\\1|>'",
- return ' style="' . call_user_func($this->language_data['STYLES']['REGEXPS'][$this->_rx_key], $matches[1]) . '"'. $matches[1] . '|>';
- }
-
- /**
- * handles newlines in REGEXPS matches. Set the _hmr_* vars before calling this
- *
- * @note this is a callback, don't use it directly
- *
- * @param array the matches array
- * @return string
- * @since 1.0.8
- * @access private
- */
- function handle_multiline_regexps($matches) {
- $before = $this->_hmr_before;
- $after = $this->_hmr_after;
- if ($this->_hmr_replace) {
- $replace = $this->_hmr_replace;
- $search = array();
-
- foreach (array_keys($matches) as $k) {
- $search[] = '\\' . $k;
- }
-
- $before = str_replace($search, $matches, $before);
- $after = str_replace($search, $matches, $after);
- $replace = str_replace($search, $matches, $replace);
- } else {
- $replace = $matches[0];
- }
- return $before
- . '<|!REG3XP' . $this->_hmr_key .'!>'
- . str_replace("\n", "|>\n<|!REG3XP" . $this->_hmr_key . '!>', $replace)
- . '|>'
- . $after;
- }
-
- /**
- * Takes a string that has no strings or comments in it, and highlights
- * stuff like keywords, numbers and methods.
- *
- * @param string The string to parse for keyword, numbers etc.
- * @since 1.0.0
- * @access private
- * @todo BUGGY! Why? Why not build string and return?
- */
- function parse_non_string_part($stuff_to_parse) {
- $stuff_to_parse = ' ' . $this->hsc($stuff_to_parse);
-
- // Highlight keywords
- $disallowed_before = "(?<![a-zA-Z0-9\$_\|\#;>|^&";
- $disallowed_after = "(?![a-zA-Z0-9_\|%\\-&;";
- if ($this->lexic_permissions['STRINGS']) {
- $quotemarks = preg_quote(implode($this->language_data['QUOTEMARKS']), '/');
- $disallowed_before .= $quotemarks;
- $disallowed_after .= $quotemarks;
- }
- $disallowed_before .= "])";
- $disallowed_after .= "])";
-
- $parser_control_pergroup = false;
- if (isset($this->language_data['PARSER_CONTROL'])) {
- if (isset($this->language_data['PARSER_CONTROL']['KEYWORDS'])) {
- $x = 0; // check wether per-keyword-group parser_control is enabled
- if (isset($this->language_data['PARSER_CONTROL']['KEYWORDS']['DISALLOWED_BEFORE'])) {
- $disallowed_before = $this->language_data['PARSER_CONTROL']['KEYWORDS']['DISALLOWED_BEFORE'];
- ++$x;
- }
- if (isset($this->language_data['PARSER_CONTROL']['KEYWORDS']['DISALLOWED_AFTER'])) {
- $disallowed_after = $this->language_data['PARSER_CONTROL']['KEYWORDS']['DISALLOWED_AFTER'];
- ++$x;
- }
- $parser_control_pergroup = (count($this->language_data['PARSER_CONTROL']['KEYWORDS']) - $x) > 0;
- }
- }
-
- foreach (array_keys($this->language_data['KEYWORDS']) as $k) {
- if (!isset($this->lexic_permissions['KEYWORDS'][$k]) ||
- $this->lexic_permissions['KEYWORDS'][$k]) {
-
- $case_sensitive = $this->language_data['CASE_SENSITIVE'][$k];
- $modifiers = $case_sensitive ? '' : 'i';
-
- // NEW in 1.0.8 - per-keyword-group parser control
- $disallowed_before_local = $disallowed_before;
- $disallowed_after_local = $disallowed_after;
- if ($parser_control_pergroup && isset($this->language_data['PARSER_CONTROL']['KEYWORDS'][$k])) {
- if (isset($this->language_data['PARSER_CONTROL']['KEYWORDS'][$k]['DISALLOWED_BEFORE'])) {
- $disallowed_before_local =
- $this->language_data['PARSER_CONTROL']['KEYWORDS'][$k]['DISALLOWED_BEFORE'];
- }
-
- if (isset($this->language_data['PARSER_CONTROL']['KEYWORDS'][$k]['DISALLOWED_AFTER'])) {
- $disallowed_after_local =
- $this->language_data['PARSER_CONTROL']['KEYWORDS'][$k]['DISALLOWED_AFTER'];
- }
- }
-
- $this->_kw_replace_group = $k;
-
- //NEW in 1.0.8, the cached regexp list
- // since we don't want PHP / PCRE to crash due to too large patterns we split them into smaller chunks
- for ($set = 0, $set_length = count($this->language_data['CACHED_KEYWORD_LISTS'][$k]); $set < $set_length; ++$set) {
- $keywordset =& $this->language_data['CACHED_KEYWORD_LISTS'][$k][$set];
- // Might make a more unique string for putting the number in soon
- // Basically, we don't put the styles in yet because then the styles themselves will
- // get highlighted if the language has a CSS keyword in it (like CSS, for example ;))
- $stuff_to_parse = preg_replace_callback(
- "/$disallowed_before_local({$keywordset})(?!\<DOT\>(?:htm|php))$disallowed_after_local/$modifiers",
- array($this, 'handle_keyword_replace'),
- $stuff_to_parse
- );
- }
- }
- }
-
- // Regular expressions
- foreach ($this->language_data['REGEXPS'] as $key => $regexp) {
- if ($this->lexic_permissions['REGEXPS'][$key]) {
- if (is_array($regexp)) {
- if ($this->line_numbers != GESHI_NO_LINE_NUMBERS) {
- // produce valid HTML when we match multiple lines
- $this->_hmr_replace = $regexp[GESHI_REPLACE];
- $this->_hmr_before = $regexp[GESHI_BEFORE];
- $this->_hmr_key = $key;
- $this->_hmr_after = $regexp[GESHI_AFTER];
- $stuff_to_parse = preg_replace_callback(
- "/" . $regexp[GESHI_SEARCH] . "/{$regexp[GESHI_MODIFIERS]}",
- array($this, 'handle_multiline_regexps'),
- $stuff_to_parse);
- $this->_hmr_replace = false;
- $this->_hmr_before = '';
- $this->_hmr_after = '';
- } else {
- $stuff_to_parse = preg_replace(
- '/' . $regexp[GESHI_SEARCH] . '/' . $regexp[GESHI_MODIFIERS],
- $regexp[GESHI_BEFORE] . '<|!REG3XP'. $key .'!>' . $regexp[GESHI_REPLACE] . '|>' . $regexp[GESHI_AFTER],
- $stuff_to_parse);
- }
- } else {
- if ($this->line_numbers != GESHI_NO_LINE_NUMBERS) {
- // produce valid HTML when we match multiple lines
- $this->_hmr_key = $key;
- $stuff_to_parse = preg_replace_callback( "/(" . $regexp . ")/",
- array($this, 'handle_multiline_regexps'), $stuff_to_parse);
- $this->_hmr_key = '';
- } else {
- $stuff_to_parse = preg_replace( "/(" . $regexp . ")/", "<|!REG3XP$key!>\\1|>", $stuff_to_parse);
- }
- }
- }
- }
-
- // Highlight numbers. As of 1.0.8 we support different types of numbers
- $numbers_found = false;
-
- if ($this->lexic_permissions['NUMBERS'] && preg_match($this->language_data['PARSER_CONTROL']['NUMBERS']['PRECHECK_RX'], $stuff_to_parse )) {
- $numbers_found = true;
-
- //For each of the formats ...
- foreach($this->language_data['NUMBERS_RXCACHE'] as $id => $regexp) {
- //Check if it should be highlighted ...
- $stuff_to_parse = preg_replace($regexp, "<|/NUM!$id/>\\1|>", $stuff_to_parse);
- }
- }
-
- //
- // Now that's all done, replace /[number]/ with the correct styles
- //
- foreach (array_keys($this->language_data['KEYWORDS']) as $k) {
- if (!$this->use_classes) {
- $attributes = ' style="' .
- (isset($this->language_data['STYLES']['KEYWORDS'][$k]) ?
- $this->language_data['STYLES']['KEYWORDS'][$k] : "") . '"';
- } else {
- $attributes = ' class="kw' . $k . '"';
- }
- $stuff_to_parse = str_replace("<|/$k/>", "<|$attributes>", $stuff_to_parse);
- }
-
- if ($numbers_found) {
- // Put number styles in
- foreach($this->language_data['NUMBERS_RXCACHE'] as $id => $regexp) {
- //Commented out for now, as this needs some review ...
- // if ($numbers_permissions & $id) {
- //Get the appropriate style ...
- //Checking for unset styles is done by the style cache builder ...
- if (!$this->use_classes) {
- $attributes = ' style="' . $this->language_data['STYLES']['NUMBERS'][$id] . '"';
- } else {
- $attributes = ' class="nu'.$id.'"';
- }
-
- //Set in the correct styles ...
- $stuff_to_parse = str_replace("/NUM!$id/", $attributes, $stuff_to_parse);
- // }
- }
- }
-
- // Highlight methods and fields in objects
- if ($this->lexic_permissions['METHODS'] && $this->language_data['OOLANG']) {
- $oolang_spaces = "[\s]*";
- $oolang_before = "";
- $oolang_after = "[a-zA-Z][a-zA-Z0-9_]*";
- if (isset($this->language_data['PARSER_CONTROL'])) {
- if (isset($this->language_data['PARSER_CONTROL']['OOLANG'])) {
- if (isset($this->language_data['PARSER_CONTROL']['OOLANG']['MATCH_BEFORE'])) {
- $oolang_before = $this->language_data['PARSER_CONTROL']['OOLANG']['MATCH_BEFORE'];
- }
- if (isset($this->language_data['PARSER_CONTROL']['OOLANG']['MATCH_AFTER'])) {
- $oolang_after = $this->language_data['PARSER_CONTROL']['OOLANG']['MATCH_AFTER'];
- }
- if (isset($this->language_data['PARSER_CONTROL']['OOLANG']['MATCH_SPACES'])) {
- $oolang_spaces = $this->language_data['PARSER_CONTROL']['OOLANG']['MATCH_SPACES'];
- }
- }
- }
-
- foreach ($this->language_data['OBJECT_SPLITTERS'] as $key => $splitter) {
- if (false !== strpos($stuff_to_parse, $splitter)) {
- if (!$this->use_classes) {
- $attributes = ' style="' . $this->language_data['STYLES']['METHODS'][$key] . '"';
- } else {
- $attributes = ' class="me' . $key . '"';
- }
- $stuff_to_parse = preg_replace("/($oolang_before)(" . preg_quote($this->language_data['OBJECT_SPLITTERS'][$key], '/') . ")($oolang_spaces)($oolang_after)/", "\\1\\2\\3<|$attributes>\\4|>", $stuff_to_parse);
- }
- }
- }
-
- //
- // Highlight brackets. Yes, I've tried adding a semi-colon to this list.
- // You try it, and see what happens ;)
- // TODO: Fix lexic permissions not converting entities if shouldn't
- // be highlighting regardless
- //
- if ($this->lexic_permissions['BRACKETS']) {
- $stuff_to_parse = str_replace( $this->language_data['CACHE_BRACKET_MATCH'],
- $this->language_data['CACHE_BRACKET_REPLACE'], $stuff_to_parse );
- }
-
-
- //FIX for symbol highlighting ...
- if ($this->lexic_permissions['SYMBOLS'] && !empty($this->language_data['SYMBOLS'])) {
- //Get all matches and throw away those witin a block that is already highlighted... (i.e. matched by a regexp)
- $n_symbols = preg_match_all("/<\|(?:<DOT>|[^>])+>(?:(?!\|>).*?)\|>|<\/a>|(?:" . $this->language_data['SYMBOL_SEARCH'] . ")+(?![^<]+?>)/", $stuff_to_parse, $pot_symbols, PREG_OFFSET_CAPTURE | PREG_SET_ORDER);
- $global_offset = 0;
- for ($s_id = 0; $s_id < $n_symbols; ++$s_id) {
- $symbol_match = $pot_symbols[$s_id][0][0];
- if (strpos($symbol_match, '<') !== false || strpos($symbol_match, '>') !== false) {
- // already highlighted blocks _must_ include either < or >
- // so if this conditional applies, we have to skip this match
- // BenBE: UNLESS the block contains <SEMI> or <PIPE>
- if(strpos($symbol_match, '<SEMI>') === false &&
- strpos($symbol_match, '<PIPE>') === false) {
- continue;
- }
- }
-
- // if we reach this point, we have a valid match which needs to be highlighted
-
- $symbol_length = strlen($symbol_match);
- $symbol_offset = $pot_symbols[$s_id][0][1];
- unset($pot_symbols[$s_id]);
- $symbol_end = $symbol_length + $symbol_offset;
- $symbol_hl = "";
-
- // if we have multiple styles, we have to handle them properly
- if ($this->language_data['MULTIPLE_SYMBOL_GROUPS']) {
- $old_sym = -1;
- // Split the current stuff to replace into its atomic symbols ...
- preg_match_all("/" . $this->language_data['SYMBOL_SEARCH'] . "/", $symbol_match, $sym_match_syms, PREG_PATTERN_ORDER);
- foreach ($sym_match_syms[0] as $sym_ms) {
- //Check if consequtive symbols belong to the same group to save output ...
- if (isset($this->language_data['SYMBOL_DATA'][$sym_ms])
- && ($this->language_data['SYMBOL_DATA'][$sym_ms] != $old_sym)) {
- if (-1 != $old_sym) {
- $symbol_hl .= "|>";
- }
- $old_sym = $this->language_data['SYMBOL_DATA'][$sym_ms];
- if (!$this->use_classes) {
- $symbol_hl .= '<| style="' . $this->language_data['STYLES']['SYMBOLS'][$old_sym] . '">';
- } else {
- $symbol_hl .= '<| class="sy' . $old_sym . '">';
- }
- }
- $symbol_hl .= $sym_ms;
- }
- unset($sym_match_syms);
-
- //Close remaining tags and insert the replacement at the right position ...
- //Take caution if symbol_hl is empty to avoid doubled closing spans.
- if (-1 != $old_sym) {
- $symbol_hl .= "|>";
- }
- } else {
- if (!$this->use_classes) {
- $symbol_hl = '<| style="' . $this->language_data['STYLES']['SYMBOLS'][0] . '">';
- } else {
- $symbol_hl = '<| class="sy0">';
- }
- $symbol_hl .= $symbol_match . '|>';
- }
-
- $stuff_to_parse = substr_replace($stuff_to_parse, $symbol_hl, $symbol_offset + $global_offset, $symbol_length);
-
- // since we replace old text with something of different size,
- // we'll have to keep track of the differences
- $global_offset += strlen($symbol_hl) - $symbol_length;
- }
- }
- //FIX for symbol highlighting ...
-
- // Add class/style for regexps
- foreach (array_keys($this->language_data['REGEXPS']) as $key) {
- if ($this->lexic_permissions['REGEXPS'][$key]) {
- if (is_callable($this->language_data['STYLES']['REGEXPS'][$key])) {
- $this->_rx_key = $key;
- $stuff_to_parse = preg_replace_callback("/!REG3XP$key!(.*)\|>/U",
- array($this, 'handle_regexps_callback'),
- $stuff_to_parse);
- } else {
- if (!$this->use_classes) {
- $attributes = ' style="' . $this->language_data['STYLES']['REGEXPS'][$key] . '"';
- } else {
- if (is_array($this->language_data['REGEXPS'][$key]) &&
- array_key_exists(GESHI_CLASS, $this->language_data['REGEXPS'][$key])) {
- $attributes = ' class="' .
- $this->language_data['REGEXPS'][$key][GESHI_CLASS] . '"';
- } else {
- $attributes = ' class="re' . $key . '"';
- }
- }
- $stuff_to_parse = str_replace("!REG3XP$key!", "$attributes", $stuff_to_parse);
- }
- }
- }
-
- // Replace <DOT> with . for urls
- $stuff_to_parse = str_replace('<DOT>', '.', $stuff_to_parse);
- // Replace <|UR1| with <a href= for urls also
- if (isset($this->link_styles[GESHI_LINK])) {
- if ($this->use_classes) {
- $stuff_to_parse = str_replace('<|UR1|', '<a' . $this->link_target . ' href=', $stuff_to_parse);
- } else {
- $stuff_to_parse = str_replace('<|UR1|', '<a' . $this->link_target . ' style="' . $this->link_styles[GESHI_LINK] . '" href=', $stuff_to_parse);
- }
- } else {
- $stuff_to_parse = str_replace('<|UR1|', '<a' . $this->link_target . ' href=', $stuff_to_parse);
- }
-
- //
- // NOW we add the span thingy ;)
- //
-
- $stuff_to_parse = str_replace('<|', '<span', $stuff_to_parse);
- $stuff_to_parse = str_replace ( '|>', '</span>', $stuff_to_parse );
- return substr($stuff_to_parse, 1);
- }
-
- /**
- * Sets the time taken to parse the code
- *
- * @param microtime The time when parsing started
- * @param microtime The time when parsing ended
- * @since 1.0.2
- * @access private
- */
- function set_time($start_time, $end_time) {
- $start = explode(' ', $start_time);
- $end = explode(' ', $end_time);
- $this->time = $end[0] + $end[1] - $start[0] - $start[1];
- }
-
- /**
- * Gets the time taken to parse the code
- *
- * @return double The time taken to parse the code
- * @since 1.0.2
- */
- function get_time() {
- return $this->time;
- }
-
- /**
- * Merges arrays recursively, overwriting values of the first array with values of later arrays
- *
- * @since 1.0.8
- * @access private
- */
- function merge_arrays() {
- $arrays = func_get_args();
- $narrays = count($arrays);
-
- // check arguments
- // comment out if more performance is necessary (in this case the foreach loop will trigger a warning if the argument is not an array)
- for ($i = 0; $i < $narrays; $i ++) {
- if (!is_array($arrays[$i])) {
- // also array_merge_recursive returns nothing in this case
- trigger_error('Argument #' . ($i+1) . ' is not an array - trying to merge array with scalar! Returning false!', E_USER_WARNING);
- return false;
- }
- }
-
- // the first array is in the output set in every case
- $ret = $arrays[0];
-
- // merege $ret with the remaining arrays
- for ($i = 1; $i < $narrays; $i ++) {
- foreach ($arrays[$i] as $key => $value) {
- if (is_array($value) && isset($ret[$key])) {
- // if $ret[$key] is not an array you try to merge an scalar value with an array - the result is not defined (incompatible arrays)
- // in this case the call will trigger an E_USER_WARNING and the $ret[$key] will be false.
- $ret[$key] = $this->merge_arrays($ret[$key], $value);
- } else {
- $ret[$key] = $value;
- }
- }
- }
-
- return $ret;
- }
-
- /**
- * Gets language information and stores it for later use
- *
- * @param string The filename of the language file you want to load
- * @since 1.0.0
- * @access private
- * @todo Needs to load keys for lexic permissions for keywords, regexps etc
- */
- function load_language($file_name) {
- if ($file_name == $this->loaded_language) {
- // this file is already loaded!
- return;
- }
-
- //Prepare some stuff before actually loading the language file
- $this->loaded_language = $file_name;
- $this->parse_cache_built = false;
- $this->enable_highlighting();
- $language_data = array();
-
- //Load the language file
- require $file_name;
-
- // Perhaps some checking might be added here later to check that
- // $language data is a valid thing but maybe not
- $this->language_data = $language_data;
-
- // Set strict mode if should be set
- $this->strict_mode = $this->language_data['STRICT_MODE_APPLIES'];
-
- // Set permissions for all lexics to true
- // so they'll be highlighted by default
- foreach (array_keys($this->language_data['KEYWORDS']) as $key) {
- if (!empty($this->language_data['KEYWORDS'][$key])) {
- $this->lexic_permissions['KEYWORDS'][$key] = true;
- } else {
- $this->lexic_permissions['KEYWORDS'][$key] = false;
- }
- }
-
- foreach (array_keys($this->language_data['COMMENT_SINGLE']) as $key) {
- $this->lexic_permissions['COMMENTS'][$key] = true;
- }
- foreach (array_keys($this->language_data['REGEXPS']) as $key) {
- $this->lexic_permissions['REGEXPS'][$key] = true;
- }
-
- // for BenBE and future code reviews:
- // we can use empty here since we only check for existance and emptiness of an array
- // if it is not an array at all but rather false or null this will work as intended as well
- // even if $this->language_data['PARSER_CONTROL'] is undefined this won't trigger a notice
- if (!empty($this->language_data['PARSER_CONTROL']['ENABLE_FLAGS'])) {
- foreach ($this->language_data['PARSER_CONTROL']['ENABLE_FLAGS'] as $flag => $value) {
- // it's either true or false and maybe is true as well
- $perm = $value !== GESHI_NEVER;
- if ($flag == 'ALL') {
- $this->enable_highlighting($perm);
- continue;
- }
- if (!isset($this->lexic_permissions[$flag])) {
- // unknown lexic permission
- continue;
- }
- if (is_array($this->lexic_permissions[$flag])) {
- foreach ($this->lexic_permissions[$flag] as $key => $val) {
- $this->lexic_permissions[$flag][$key] = $perm;
- }
- } else {
- $this->lexic_permissions[$flag] = $perm;
- }
- }
- unset($this->language_data['PARSER_CONTROL']['ENABLE_FLAGS']);
- }
-
- //Fix: Problem where hardescapes weren't handled if no ESCAPE_CHAR was given
- //You need to set one for HARDESCAPES only in this case.
- if(!isset($this->language_data['HARDCHAR'])) {
- $this->language_data['HARDCHAR'] = $this->language_data['ESCAPE_CHAR'];
- }
-
- //NEW in 1.0.8: Allow styles to be loaded from a separate file to override defaults
- $style_filename = substr($file_name, 0, -4) . '.style.php';
- if (is_readable($style_filename)) {
- //Clear any style_data that could have been set before ...
- if (isset($style_data)) {
- unset($style_data);
- }
-
- //Read the Style Information from the style file
- include $style_filename;
-
- //Apply the new styles to our current language styles
- if (isset($style_data) && is_array($style_data)) {
- $this->language_data['STYLES'] =
- $this->merge_arrays($this->language_data['STYLES'], $style_data);
- }
- }
- }
-
- /**
- * Takes the parsed code and various options, and creates the HTML
- * surrounding it to make it look nice.
- *
- * @param string The code already parsed (reference!)
- * @since 1.0.0
- * @access private
- */
- function finalise(&$parsed_code) {
- // Remove end parts of important declarations
- // This is BUGGY!! My fault for bad code: fix coming in 1.2
- // @todo Remove this crap
- if ($this->enable_important_blocks &&
- (strpos($parsed_code, $this->hsc(GESHI_START_IMPORTANT)) === false)) {
- $parsed_code = str_replace($this->hsc(GESHI_END_IMPORTANT), '', $parsed_code);
- }
-
- // Add HTML whitespace stuff if we're using the <div> header
- if ($this->header_type != GESHI_HEADER_PRE && $this->header_type != GESHI_HEADER_PRE_VALID) {
- $this->indent($parsed_code);
- }
-
- // purge some unnecessary stuff
- /** NOTE: memorypeak #1 */
- $parsed_code = preg_replace('#<span[^>]+>(\s*)</span>#', '\\1', $parsed_code);
-
- // If we are using IDs for line numbers, there needs to be an overall
- // ID set to prevent collisions.
- if ($this->add_ids && !$this->overall_id) {
- $this->overall_id = 'geshi-' . substr(md5(microtime()), 0, 4);
- }
-
- // Get code into lines
- /** NOTE: memorypeak #2 */
- $code = explode("\n", $parsed_code);
- $parsed_code = $this->header();
-
- // If we're using line numbers, we insert <li>s and appropriate
- // markup to style them (otherwise we don't need to do anything)
- if ($this->line_numbers != GESHI_NO_LINE_NUMBERS && $this->header_type != GESHI_HEADER_PRE_TABLE) {
- // If we're using the <pre> header, we shouldn't add newlines because
- // the <pre> will line-break them (and the <li>s already do this for us)
- $ls = ($this->header_type != GESHI_HEADER_PRE && $this->header_type != GESHI_HEADER_PRE_VALID) ? "\n" : '';
-
- // Set vars to defaults for following loop
- $i = 0;
-
- // Foreach line...
- for ($i = 0, $n = count($code); $i < $n;) {
- //Reset the attributes for a new line ...
- $attrs = array();
-
- // Make lines have at least one space in them if they're empty
- // BenBE: Checking emptiness using trim instead of relying on blanks
- if ('' == trim($code[$i])) {
- $code[$i] = '&nbsp;';
- }
-
- // If this is a "special line"...
- if ($this->line_numbers == GESHI_FANCY_LINE_NUMBERS &&
- $i % $this->line_nth_row == ($this->line_nth_row - 1)) {
- // Set the attributes to style the line
- if ($this->use_classes) {
- //$attr = ' class="li2"';
- $attrs['class'][] = 'li2';
- $def_attr = ' class="de2"';
- } else {
- //$attr = ' style="' . $this->line_style2 . '"';
- $attrs['style'][] = $this->line_style2;
- // This style "covers up" the special styles set for special lines
- // so that styles applied to special lines don't apply to the actual
- // code on that line
- $def_attr = ' style="' . $this->code_style . '"';
- }
- } else {
- if ($this->use_classes) {
- //$attr = ' class="li1"';
- $attrs['class'][] = 'li1';
- $def_attr = ' class="de1"';
- } else {
- //$attr = ' style="' . $this->line_style1 . '"';
- $attrs['style'][] = $this->line_style1;
- $def_attr = ' style="' . $this->code_style . '"';
- }
- }
-
- //Check which type of tag to insert for this line
- if ($this->header_type == GESHI_HEADER_PRE_VALID) {
- $start = "<pre$def_attr>";
- $end = '</pre>';
- } else {
- // Span or div?
- $start = "<div$def_attr>";
- $end = '</div>';
- }
-
- ++$i;
-
- // Are we supposed to use ids? If so, add them
- if ($this->add_ids) {
- $attrs['id'][] = "$this->overall_id-$i";
- }
-
- //Is this some line with extra styles???
- if (in_array($i, $this->highlight_extra_lines)) {
- if ($this->use_classes) {
- if (isset($this->highlight_extra_lines_styles[$i])) {
- $attrs['class'][] = "lx$i";
- } else {
- $attrs['class'][] = "ln-xtra";
- }
- } else {
- array_push($attrs['style'], $this->get_line_style($i));
- }
- }
-
- // Add in the line surrounded by appropriate list HTML
- $attr_string = '';
- foreach ($attrs as $key => $attr) {
- $attr_string .= ' ' . $key . '="' . implode(' ', $attr) . '"';
- }
-
- $parsed_code .= "<li$attr_string>$start{$code[$i-1]}$end</li>$ls";
- unset($code[$i - 1]);
- }
- } else {
- $n = count($code);
- if ($this->use_classes) {
- $attributes = ' class="de1"';
- } else {
- $attributes = ' style="'. $this->code_style .'"';
- }
- if ($this->header_type == GESHI_HEADER_PRE_VALID) {
- $parsed_code .= '<pre'. $attributes .'>';
- } elseif ($this->header_type == GESHI_HEADER_PRE_TABLE) {
- if ($this->line_numbers != GESHI_NO_LINE_NUMBERS) {
- if ($this->use_classes) {
- $attrs = ' class="ln"';
- } else {
- $attrs = ' style="'. $this->table_linenumber_style .'"';
- }
- $parsed_code .= '<td'.$attrs.'><pre'.$attributes.'>';
- // get linenumbers
- // we don't merge it with the for below, since it should be better for
- // memory consumption this way
- // @todo: but... actually it would still be somewhat nice to merge the two loops
- // the mem peaks are at different positions
- for ($i = 0; $i < $n; ++$i) {
- $close = 0;
- // fancy lines
- if ($this->line_numbers == GESHI_FANCY_LINE_NUMBERS &&
- $i % $this->line_nth_row == ($this->line_nth_row - 1)) {
- // Set the attributes to style the line
- if ($this->use_classes) {
- $parsed_code .= '<span class="xtra li2"><span class="de2">';
- } else {
- // This style "covers up" the special styles set for special lines
- // so that styles applied to special lines don't apply to the actual
- // code on that line
- $parsed_code .= '<span style="display:block;' . $this->line_style2 . '">'
- .'<span style="' . $this->code_style .'">';
- }
- $close += 2;
- }
- //Is this some line with extra styles???
- if (in_array($i + 1, $this->highlight_extra_lines)) {
- if ($this->use_classes) {
- if (isset($this->highlight_extra_lines_styles[$i])) {
- $parsed_code .= "<span class=\"xtra lx$i\">";
- } else {
- $parsed_code .= "<span class=\"xtra ln-xtra\">";
- }
- } else {
- $parsed_code .= "<span style=\"display:block;" . $this->get_line_style($i) . "\">";
- }
- ++$close;
- }
- $parsed_code .= $this->line_numbers_start + $i;
- if ($close) {
- $parsed_code .= str_repeat('</span>', $close);
- } else if ($i != $n) {
- $parsed_code .= "\n";
- }
- }
- $parsed_code .= '</pre></td><td'.$attributes.'>';
- }
- $parsed_code .= '<pre'. $attributes .'>';
- }
- // No line numbers, but still need to handle highlighting lines extra.
- // Have to use divs so the full width of the code is highlighted
- $close = 0;
- for ($i = 0; $i < $n; ++$i) {
- // Make lines have at least one space in them if they're empty
- // BenBE: Checking emptiness using trim instead of relying on blanks
- if ('' == trim($code[$i])) {
- $code[$i] = '&nbsp;';
- }
- // fancy lines
- if ($this->line_numbers == GESHI_FANCY_LINE_NUMBERS &&
- $i % $this->line_nth_row == ($this->line_nth_row - 1)) {
- // Set the attributes to style the line
- if ($this->use_classes) {
- $parsed_code .= '<span class="xtra li2"><span class="de2">';
- } else {
- // This style "covers up" the special styles set for special lines
- // so that styles applied to special lines don't apply to the actual
- // code on that line
- $parsed_code .= '<span style="display:block;' . $this->line_style2 . '">'
- .'<span style="' . $this->code_style .'">';
- }
- $close += 2;
- }
- //Is this some line with extra styles???
- if (in_array($i + 1, $this->highlight_extra_lines)) {
- if ($this->use_classes) {
- if (isset($this->highlight_extra_lines_styles[$i])) {
- $parsed_code .= "<span class=\"xtra lx$i\">";
- } else {
- $parsed_code .= "<span class=\"xtra ln-xtra\">";
- }
- } else {
- $parsed_code .= "<span style=\"display:block;" . $this->get_line_style($i) . "\">";
- }
- ++$close;
- }
-
- $parsed_code .= $code[$i];
-
- if ($close) {
- $parsed_code .= str_repeat('</span>', $close);
- $close = 0;
- }
- elseif ($i + 1 < $n) {
- $parsed_code .= "\n";
- }
- unset($code[$i]);
- }
-
- if ($this->header_type == GESHI_HEADER_PRE_VALID || $this->header_type == GESHI_HEADER_PRE_TABLE) {
- $parsed_code .= '</pre>';
- }
- if ($this->header_type == GESHI_HEADER_PRE_TABLE && $this->line_numbers != GESHI_NO_LINE_NUMBERS) {
- $parsed_code .= '</td>';
- }
- }
-
- $parsed_code .= $this->footer();
- }
-
- /**
- * Creates the header for the code block (with correct attributes)
- *
- * @return string The header for the code block
- * @since 1.0.0
- * @access private
- */
- function header() {
- // Get attributes needed
- /**
- * @todo Document behaviour change - class is outputted regardless of whether
- * we're using classes or not. Same with style
- */
- $attributes = ' class="' . $this->_genCSSName($this->language);
- if ($this->overall_class != '') {
- $attributes .= " ".$this->_genCSSName($this->overall_class);
- }
- $attributes .= '"';
-
- if ($this->overall_id != '') {
- $attributes .= " id=\"{$this->overall_id}\"";
- }
- if ($this->overall_style != '' && !$this->use_classes) {
- $attributes .= ' style="' . $this->overall_style . '"';
- }
-
- $ol_attributes = '';
-
- if ($this->line_numbers_start != 1) {
- $ol_attributes .= ' start="' . $this->line_numbers_start . '"';
- }
-
- // Get the header HTML
- $header = $this->header_content;
- if ($header) {
- if ($this->header_type == GESHI_HEADER_PRE || $this->header_type == GESHI_HEADER_PRE_VALID) {
- $header = str_replace("\n", '', $header);
- }
- $header = $this->replace_keywords($header);
-
- if ($this->use_classes) {
- $attr = ' class="head"';
- } else {
- $attr = " style=\"{$this->header_content_style}\"";
- }
- if ($this->header_type == GESHI_HEADER_PRE_TABLE && $this->line_numbers != GESHI_NO_LINE_NUMBERS) {
- $header = "<thead><tr><td colspan=\"2\" $attr>$header</td></tr></thead>";
- } else {
- $header = "<div$attr>$header</div>";
- }
- }
-
- if (GESHI_HEADER_NONE == $this->header_type) {
- if ($this->line_numbers != GESHI_NO_LINE_NUMBERS) {
- return "$header<ol$attributes$ol_attributes>";
- }
- return $header . ($this->force_code_block ? '<div>' : '');
- }
-
- // Work out what to return and do it
- if ($this->line_numbers != GESHI_NO_LINE_NUMBERS) {
- if ($this->header_type == GESHI_HEADER_PRE) {
- return "<pre$attributes>$header<ol$ol_attributes>";
- } else if ($this->header_type == GESHI_HEADER_DIV ||
- $this->header_type == GESHI_HEADER_PRE_VALID) {
- return "<div$attributes>$header<ol$ol_attributes>";
- } else if ($this->header_type == GESHI_HEADER_PRE_TABLE) {
- return "<table$attributes>$header<tbody><tr class=\"li1\">";
- }
- } else {
- if ($this->header_type == GESHI_HEADER_PRE) {
- return "<pre$attributes>$header" .
- ($this->force_code_block ? '<div>' : '');
- } else {
- return "<div$attributes>$header" .
- ($this->force_code_block ? '<div>' : '');
- }
- }
- }
-
- /**
- * Returns the footer for the code block.
- *
- * @return string The footer for the code block
- * @since 1.0.0
- * @access private
- */
- function footer() {
- $footer = $this->footer_content;
- if ($footer) {
- if ($this->header_type == GESHI_HEADER_PRE) {
- $footer = str_replace("\n", '', $footer);;
- }
- $footer = $this->replace_keywords($footer);
-
- if ($this->use_classes) {
- $attr = ' class="foot"';
- } else {
- $attr = " style=\"{$this->footer_content_style}\"";
- }
- if ($this->header_type == GESHI_HEADER_PRE_TABLE && $this->line_numbers != GESHI_NO_LINE_NUMBERS) {
- $footer = "<tfoot><tr><td colspan=\"2\">$footer</td></tr></tfoot>";
- } else {
- $footer = "<div$attr>$footer</div>";
- }
- }
-
- if (GESHI_HEADER_NONE == $this->header_type) {
- return ($this->line_numbers != GESHI_NO_LINE_NUMBERS) ? '</ol>' . $footer : $footer;
- }
-
- if ($this->header_type == GESHI_HEADER_DIV || $this->header_type == GESHI_HEADER_PRE_VALID) {
- if ($this->line_numbers != GESHI_NO_LINE_NUMBERS) {
- return "</ol>$footer</div>";
- }
- return ($this->force_code_block ? '</div>' : '') .
- "$footer</div>";
- }
- elseif ($this->header_type == GESHI_HEADER_PRE_TABLE) {
- if ($this->line_numbers != GESHI_NO_LINE_NUMBERS) {
- return "</tr></tbody>$footer</table>";
- }
- return ($this->force_code_block ? '</div>' : '') .
- "$footer</div>";
- }
- else {
- if ($this->line_numbers != GESHI_NO_LINE_NUMBERS) {
- return "</ol>$footer</pre>";
- }
- return ($this->force_code_block ? '</div>' : '') .
- "$footer</pre>";
- }
- }
-
- /**
- * Replaces certain keywords in the header and footer with
- * certain configuration values
- *
- * @param string The header or footer content to do replacement on
- * @return string The header or footer with replaced keywords
- * @since 1.0.2
- * @access private
- */
- function replace_keywords($instr) {
- $keywords = $replacements = array();
-
- $keywords[] = '<TIME>';
- $keywords[] = '{TIME}';
- $replacements[] = $replacements[] = number_format($time = $this->get_time(), 3);
-
- $keywords[] = '<LANGUAGE>';
- $keywords[] = '{LANGUAGE}';
- $replacements[] = $replacements[] = $this->language_data['LANG_NAME'];
-
- $keywords[] = '<VERSION>';
- $keywords[] = '{VERSION}';
- $replacements[] = $replacements[] = GESHI_VERSION;
-
- $keywords[] = '<SPEED>';
- $keywords[] = '{SPEED}';
- if ($time <= 0) {
- $speed = 'N/A';
- } else {
- $speed = strlen($this->source) / $time;
- if ($speed >= 1024) {
- $speed = sprintf("%.2f KB/s", $speed / 1024.0);
- } else {
- $speed = sprintf("%.0f B/s", $speed);
- }
- }
- $replacements[] = $replacements[] = $speed;
-
- return str_replace($keywords, $replacements, $instr);
- }
-
- /**
- * Secure replacement for PHP built-in function htmlspecialchars().
- *
- * See ticket #427 (http://wush.net/trac/wikka/ticket/427) for the rationale
- * for this replacement function.
- *
- * The INTERFACE for this function is almost the same as that for
- * htmlspecialchars(), with the same default for quote style; however, there
- * is no 'charset' parameter. The reason for this is as follows:
- *
- * The PHP docs say:
- * "The third argument charset defines character set used in conversion."
- *
- * I suspect PHP's htmlspecialchars() is working at the byte-value level and
- * thus _needs_ to know (or asssume) a character set because the special
- * characters to be replaced could exist at different code points in
- * different character sets. (If indeed htmlspecialchars() works at
- * byte-value level that goes some way towards explaining why the
- * vulnerability would exist in this function, too, and not only in
- * htmlentities() which certainly is working at byte-value level.)
- *
- * This replacement function however works at character level and should
- * therefore be "immune" to character set differences - so no charset
- * parameter is needed or provided. If a third parameter is passed, it will
- * be silently ignored.
- *
- * In the OUTPUT there is a minor difference in that we use '&#39;' instead
- * of PHP's '&#039;' for a single quote: this provides compatibility with
- * get_html_translation_table(HTML_SPECIALCHARS, ENT_QUOTES)
- * (see comment by mikiwoz at yahoo dot co dot uk on
- * http://php.net/htmlspecialchars); it also matches the entity definition
- * for XML 1.0
- * (http://www.w3.org/TR/xhtml1/dtds.html#a_dtd_Special_characters).
- * Like PHP we use a numeric character reference instead of '&apos;' for the
- * single quote. For the other special characters we use the named entity
- * references, as PHP is doing.
- *
- * @author {@link http://wikkawiki.org/JavaWoman Marjolein Katsma}
- *
- * @license http://www.gnu.org/copyleft/lgpl.html
- * GNU Lesser General Public License
- * @copyright Copyright 2007, {@link http://wikkawiki.org/CreditsPage
- * Wikka Development Team}
- *
- * @access private
- * @param string $string string to be converted
- * @param integer $quote_style
- * - ENT_COMPAT: escapes &, <, > and double quote (default)
- * - ENT_NOQUOTES: escapes only &, < and >
- * - ENT_QUOTES: escapes &, <, >, double and single quotes
- * @return string converted string
- * @since 1.0.7.18
- */
- function hsc($string, $quote_style = ENT_COMPAT) {
- // init
- static $aTransSpecchar = array(
- '&' => '&amp;',
- '"' => '&quot;',
- '<' => '&lt;',
- '>' => '&gt;',
-
- //This fix is related to SF#1923020, but has to be applied
- //regardless of actually highlighting symbols.
-
- //Circumvent a bug with symbol highlighting
- //This is required as ; would produce undesirable side-effects if it
- //was not to be processed as an entity.
- ';' => '<SEMI>', // Force ; to be processed as entity
- '|' => '<PIPE>' // Force | to be processed as entity
- ); // ENT_COMPAT set
-
- switch ($quote_style) {
- case ENT_NOQUOTES: // don't convert double quotes
- unset($aTransSpecchar['"']);
- break;
- case ENT_QUOTES: // convert single quotes as well
- $aTransSpecchar["'"] = '&#39;'; // (apos) htmlspecialchars() uses '&#039;'
- break;
- }
-
- // return translated string
- return strtr($string, $aTransSpecchar);
- }
-
- function _genCSSName($name){
- return (is_numeric($name[0]) ? '_' : '') . $name;
- }
-
- /**
- * Returns a stylesheet for the highlighted code. If $economy mode
- * is true, we only return the stylesheet declarations that matter for
- * this code block instead of the whole thing
- *
- * @param boolean Whether to use economy mode or not
- * @return string A stylesheet built on the data for the current language
- * @since 1.0.0
- */
- function get_stylesheet($economy_mode = true) {
- // If there's an error, chances are that the language file
- // won't have populated the language data file, so we can't
- // risk getting a stylesheet...
- if ($this->error) {
- return '';
- }
-
- //Check if the style rearrangements have been processed ...
- //This also does some preprocessing to check which style groups are useable ...
- if(!isset($this->language_data['NUMBERS_CACHE'])) {
- $this->build_style_cache();
- }
-
- // First, work out what the selector should be. If there's an ID,
- // that should be used, the same for a class. Otherwise, a selector
- // of '' means that these styles will be applied anywhere
- if ($this->overall_id) {
- $selector = '#' . $this->_genCSSName($this->overall_id);
- } else {
- $selector = '.' . $this->_genCSSName($this->language);
- if ($this->overall_class) {
- $selector .= '.' . $this->_genCSSName($this->overall_class);
- }
- }
- $selector .= ' ';
-
- // Header of the stylesheet
- if (!$economy_mode) {
- $stylesheet = "/**\n".
- " * GeSHi Dynamically Generated Stylesheet\n".
- " * --------------------------------------\n".
- " * Dynamically generated stylesheet for {$this->language}\n".
- " * CSS class: {$this->overall_class}, CSS id: {$this->overall_id}\n".
- " * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann\n" .
- " * (http://qbnz.com/highlighter/ and http://geshi.org/)\n".
- " * --------------------------------------\n".
- " */\n";
- } else {
- $stylesheet = "/**\n".
- " * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann\n" .
- " * (http://qbnz.com/highlighter/ and http://geshi.org/)\n".
- " */\n";
- }
-
- // Set the <ol> to have no effect at all if there are line numbers
- // (<ol>s have margins that should be destroyed so all layout is
- // controlled by the set_overall_style method, which works on the
- // <pre> or <div> container). Additionally, set default styles for lines
- if (!$economy_mode || $this->line_numbers != GESHI_NO_LINE_NUMBERS) {
- //$stylesheet .= "$selector, {$selector}ol, {$selector}ol li {margin: 0;}\n";
- $stylesheet .= "$selector.de1, $selector.de2 {{$this->code_style}}\n";
- }
-
- // Add overall styles
- // note: neglect economy_mode, empty styles are meaningless
- if ($this->overall_style != '') {
- $stylesheet .= "$selector {{$this->overall_style}}\n";
- }
-
- // Add styles for links
- // note: economy mode does not make _any_ sense here
- // either the style is empty and thus no selector is needed
- // or the appropriate key is given.
- foreach ($this->link_styles as $key => $style) {
- if ($style != '') {
- switch ($key) {
- case GESHI_LINK:
- $stylesheet .= "{$selector}a:link {{$style}}\n";
- break;
- case GESHI_HOVER:
- $stylesheet .= "{$selector}a:hover {{$style}}\n";
- break;
- case GESHI_ACTIVE:
- $stylesheet .= "{$selector}a:active {{$style}}\n";
- break;
- case GESHI_VISITED:
- $stylesheet .= "{$selector}a:visited {{$style}}\n";
- break;
- }
- }
- }
-
- // Header and footer
- // note: neglect economy_mode, empty styles are meaningless
- if ($this->header_content_style != '') {
- $stylesheet .= "$selector.head {{$this->header_content_style}}\n";
- }
- if ($this->footer_content_style != '') {
- $stylesheet .= "$selector.foot {{$this->footer_content_style}}\n";
- }
-
- // Styles for important stuff
- // note: neglect economy_mode, empty styles are meaningless
- if ($this->important_styles != '') {
- $stylesheet .= "$selector.imp {{$this->important_styles}}\n";
- }
-
- // Simple line number styles
- if ((!$economy_mode || $this->line_numbers != GESHI_NO_LINE_NUMBERS) && $this->line_style1 != '') {
- $stylesheet .= "{$selector}li, {$selector}.li1 {{$this->line_style1}}\n";
- }
- if ((!$economy_mode || $this->line_numbers != GESHI_NO_LINE_NUMBERS) && $this->table_linenumber_style != '') {
- $stylesheet .= "{$selector}.ln {{$this->table_linenumber_style}}\n";
- }
- // If there is a style set for fancy line numbers, echo it out
- if ((!$economy_mode || $this->line_numbers == GESHI_FANCY_LINE_NUMBERS) && $this->line_style2 != '') {
- $stylesheet .= "{$selector}.li2 {{$this->line_style2}}\n";
- }
-
- // note: empty styles are meaningless
- foreach ($this->language_data['STYLES']['KEYWORDS'] as $group => $styles) {
- if ($styles != '' && (!$economy_mode ||
- (isset($this->lexic_permissions['KEYWORDS'][$group]) &&
- $this->lexic_permissions['KEYWORDS'][$group]))) {
- $stylesheet .= "$selector.kw$group {{$styles}}\n";
- }
- }
- foreach ($this->language_data['STYLES']['COMMENTS'] as $group => $styles) {
- if ($styles != '' && (!$economy_mode ||
- (isset($this->lexic_permissions['COMMENTS'][$group]) &&
- $this->lexic_permissions['COMMENTS'][$group]) ||
- (!empty($this->language_data['COMMENT_REGEXP']) &&
- !empty($this->language_data['COMMENT_REGEXP'][$group])))) {
- $stylesheet .= "$selector.co$group {{$styles}}\n";
- }
- }
- foreach ($this->language_data['STYLES']['ESCAPE_CHAR'] as $group => $styles) {
- if ($styles != '' && (!$economy_mode || $this->lexic_permissions['ESCAPE_CHAR'])) {
- // NEW: since 1.0.8 we have to handle hardescapes
- if ($group === 'HARD') {
- $group = '_h';
- }
- $stylesheet .= "$selector.es$group {{$styles}}\n";
- }
- }
- foreach ($this->language_data['STYLES']['BRACKETS'] as $group => $styles) {
- if ($styles != '' && (!$economy_mode || $this->lexic_permissions['BRACKETS'])) {
- $stylesheet .= "$selector.br$group {{$styles}}\n";
- }
- }
- foreach ($this->language_data['STYLES']['SYMBOLS'] as $group => $styles) {
- if ($styles != '' && (!$economy_mode || $this->lexic_permissions['SYMBOLS'])) {
- $stylesheet .= "$selector.sy$group {{$styles}}\n";
- }
- }
- foreach ($this->language_data['STYLES']['STRINGS'] as $group => $styles) {
- if ($styles != '' && (!$economy_mode || $this->lexic_permissions['STRINGS'])) {
- // NEW: since 1.0.8 we have to handle hardquotes
- if ($group === 'HARD') {
- $group = '_h';
- }
- $stylesheet .= "$selector.st$group {{$styles}}\n";
- }
- }
- foreach ($this->language_data['STYLES']['NUMBERS'] as $group => $styles) {
- if ($styles != '' && (!$economy_mode || $this->lexic_permissions['NUMBERS'])) {
- $stylesheet .= "$selector.nu$group {{$styles}}\n";
- }
- }
- foreach ($this->language_data['STYLES']['METHODS'] as $group => $styles) {
- if ($styles != '' && (!$economy_mode || $this->lexic_permissions['METHODS'])) {
- $stylesheet .= "$selector.me$group {{$styles}}\n";
- }
- }
- // note: neglect economy_mode, empty styles are meaningless
- foreach ($this->language_data['STYLES']['SCRIPT'] as $group => $styles) {
- if ($styles != '') {
- $stylesheet .= "$selector.sc$group {{$styles}}\n";
- }
- }
- foreach ($this->language_data['STYLES']['REGEXPS'] as $group => $styles) {
- if ($styles != '' && (!$economy_mode ||
- (isset($this->lexic_permissions['REGEXPS'][$group]) &&
- $this->lexic_permissions['REGEXPS'][$group]))) {
- if (is_array($this->language_data['REGEXPS'][$group]) &&
- array_key_exists(GESHI_CLASS, $this->language_data['REGEXPS'][$group])) {
- $stylesheet .= "$selector.";
- $stylesheet .= $this->language_data['REGEXPS'][$group][GESHI_CLASS];
- $stylesheet .= " {{$styles}}\n";
- } else {
- $stylesheet .= "$selector.re$group {{$styles}}\n";
- }
- }
- }
- // Styles for lines being highlighted extra
- if (!$economy_mode || (count($this->highlight_extra_lines)!=count($this->highlight_extra_lines_styles))) {
- $stylesheet .= "{$selector}.ln-xtra, {$selector}li.ln-xtra, {$selector}div.ln-xtra {{$this->highlight_extra_lines_style}}\n";
- }
- $stylesheet .= "{$selector}span.xtra { display:block; }\n";
- foreach ($this->highlight_extra_lines_styles as $lineid => $linestyle) {
- $stylesheet .= "{$selector}.lx$lineid, {$selector}li.lx$lineid, {$selector}div.lx$lineid {{$linestyle}}\n";
- }
-
- return $stylesheet;
- }
-
- /**
- * Get's the style that is used for the specified line
- *
- * @param int The line number information is requested for
- * @access private
- * @since 1.0.7.21
- */
- function get_line_style($line) {
- //$style = null;
- $style = null;
- if (isset($this->highlight_extra_lines_styles[$line])) {
- $style = $this->highlight_extra_lines_styles[$line];
- } else { // if no "extra" style assigned
- $style = $this->highlight_extra_lines_style;
- }
-
- return $style;
- }
-
- /**
- * this functions creates an optimized regular expression list
- * of an array of strings.
- *
- * Example:
- * <code>$list = array('faa', 'foo', 'foobar');
- * => string 'f(aa|oo(bar)?)'</code>
- *
- * @param $list array of (unquoted) strings
- * @param $regexp_delimiter your regular expression delimiter, @see preg_quote()
- * @return string for regular expression
- * @author Milian Wolff <mail@milianw.de>
- * @since 1.0.8
- * @access private
- */
- function optimize_regexp_list($list, $regexp_delimiter = '/') {
- $regex_chars = array('.', '\\', '+', '*', '?', '[', '^', ']', '$',
- '(', ')', '{', '}', '=', '!', '<', '>', '|', ':', $regexp_delimiter);
- sort($list);
- $regexp_list = array('');
- $num_subpatterns = 0;
- $list_key = 0;
-
- // the tokens which we will use to generate the regexp list
- $tokens = array();
- $prev_keys = array();
- // go through all entries of the list and generate the token list
- $cur_len = 0;
- for ($i = 0, $i_max = count($list); $i < $i_max; ++$i) {
- if ($cur_len > GESHI_MAX_PCRE_LENGTH) {
- // seems like the length of this pcre is growing exorbitantly
- $regexp_list[++$list_key] = $this->_optimize_regexp_list_tokens_to_string($tokens);
- $num_subpatterns = substr_count($regexp_list[$list_key], '(?:');
- $tokens = array();
- $cur_len = 0;
- }
- $level = 0;
- $entry = preg_quote((string) $list[$i], $regexp_delimiter);
- $pointer = &$tokens;
- // properly assign the new entry to the correct position in the token array
- // possibly generate smaller common denominator keys
- while (true) {
- // get the common denominator
- if (isset($prev_keys[$level])) {
- if ($prev_keys[$level] == $entry) {
- // this is a duplicate entry, skip it
- continue 2;
- }
- $char = 0;
- while (isset($entry[$char]) && isset($prev_keys[$level][$char])
- && $entry[$char] == $prev_keys[$level][$char]) {
- ++$char;
- }
- if ($char > 0) {
- // this entry has at least some chars in common with the current key
- if ($char == strlen($prev_keys[$level])) {
- // current key is totally matched, i.e. this entry has just some bits appended
- $pointer = &$pointer[$prev_keys[$level]];
- } else {
- // only part of the keys match
- $new_key_part1 = substr($prev_keys[$level], 0, $char);
- $new_key_part2 = substr($prev_keys[$level], $char);
-
- if (in_array($new_key_part1[0], $regex_chars)
- || in_array($new_key_part2[0], $regex_chars)) {
- // this is bad, a regex char as first character
- $pointer[$entry] = array('' => true);
- array_splice($prev_keys, $level, count($prev_keys), $entry);
- $cur_len += strlen($entry);
- continue;
- } else {
- // relocate previous tokens
- $pointer[$new_key_part1] = array($new_key_part2 => $pointer[$prev_keys[$level]]);
- unset($pointer[$prev_keys[$level]]);
- $pointer = &$pointer[$new_key_part1];
- // recreate key index
- array_splice($prev_keys, $level, count($prev_keys), array($new_key_part1, $new_key_part2));
- $cur_len += strlen($new_key_part2);
- }
- }
- ++$level;
- $entry = substr($entry, $char);
- continue;
- }
- // else: fall trough, i.e. no common denominator was found
- }
- if ($level == 0 && !empty($tokens)) {
- // we can dump current tokens into the string and throw them away afterwards
- $new_entry = $this->_optimize_regexp_list_tokens_to_string($tokens);
- $new_subpatterns = substr_count($new_entry, '(?:');
- if (GESHI_MAX_PCRE_SUBPATTERNS && $num_subpatterns + $new_subpatterns > GESHI_MAX_PCRE_SUBPATTERNS) {
- $regexp_list[++$list_key] = $new_entry;
- $num_subpatterns = $new_subpatterns;
- } else {
- if (!empty($regexp_list[$list_key])) {
- $new_entry = '|' . $new_entry;
- }
- $regexp_list[$list_key] .= $new_entry;
- $num_subpatterns += $new_subpatterns;
- }
- $tokens = array();
- $cur_len = 0;
- }
- // no further common denominator found
- $pointer[$entry] = array('' => true);
- array_splice($prev_keys, $level, count($prev_keys), $entry);
-
- $cur_len += strlen($entry);
- break;
- }
- unset($list[$i]);
- }
- // make sure the last tokens get converted as well
- $new_entry = $this->_optimize_regexp_list_tokens_to_string($tokens);
- if (GESHI_MAX_PCRE_SUBPATTERNS && $num_subpatterns + substr_count($new_entry, '(?:') > GESHI_MAX_PCRE_SUBPATTERNS) {
- if ( !empty($regexp_list[$list_key]) ) {
- ++$list_key;
- }
- $regexp_list[$list_key] = $new_entry;
- } else {
- if (!empty($regexp_list[$list_key])) {
- $new_entry = '|' . $new_entry;
- }
- $regexp_list[$list_key] .= $new_entry;
- }
- return $regexp_list;
- }
- /**
- * this function creates the appropriate regexp string of an token array
- * you should not call this function directly, @see $this->optimize_regexp_list().
- *
- * @param &$tokens array of tokens
- * @param $recursed bool to know wether we recursed or not
- * @return string
- * @author Milian Wolff <mail@milianw.de>
- * @since 1.0.8
- * @access private
- */
- function _optimize_regexp_list_tokens_to_string(&$tokens, $recursed = false) {
- $list = '';
- foreach ($tokens as $token => $sub_tokens) {
- $list .= $token;
- $close_entry = isset($sub_tokens['']);
- unset($sub_tokens['']);
- if (!empty($sub_tokens)) {
- $list .= '(?:' . $this->_optimize_regexp_list_tokens_to_string($sub_tokens, true) . ')';
- if ($close_entry) {
- // make sub_tokens optional
- $list .= '?';
- }
- }
- $list .= '|';
- }
- if (!$recursed) {
- // do some optimizations
- // common trailing strings
- // BUGGY!
- //$list = preg_replace_callback('#(?<=^|\:|\|)\w+?(\w+)(?:\|.+\1)+(?=\|)#', create_function(
- // '$matches', 'return "(?:" . preg_replace("#" . preg_quote($matches[1], "#") . "(?=\||$)#", "", $matches[0]) . ")" . $matches[1];'), $list);
- // (?:p)? => p?
- $list = preg_replace('#\(\?\:(.)\)\?#', '\1?', $list);
- // (?:a|b|c|d|...)? => [abcd...]?
- // TODO: a|bb|c => [ac]|bb
- static $callback_2;
- if (!isset($callback_2)) {
- $callback_2 = create_function('$matches', 'return "[" . str_replace("|", "", $matches[1]) . "]";');
- }
- $list = preg_replace_callback('#\(\?\:((?:.\|)+.)\)#', $callback_2, $list);
- }
- // return $list without trailing pipe
- return substr($list, 0, -1);
- }
-} // End Class GeSHi
-
-
-if (!function_exists('geshi_highlight')) {
- /**
- * Easy way to highlight stuff. Behaves just like highlight_string
- *
- * @param string The code to highlight
- * @param string The language to highlight the code in
- * @param string The path to the language files. You can leave this blank if you need
- * as from version 1.0.7 the path should be automatically detected
- * @param boolean Whether to return the result or to echo
- * @return string The code highlighted (if $return is true)
- * @since 1.0.2
- */
- function geshi_highlight($string, $language, $path = null, $return = false) {
- $geshi = new GeSHi($string, $language, $path);
- $geshi->set_header_type(GESHI_HEADER_NONE);
-
- if ($return) {
- return '<code>' . $geshi->parse_code() . '</code>';
- }
-
- echo '<code>' . $geshi->parse_code() . '</code>';
-
- if ($geshi->error()) {
- return false;
- }
- return true;
- }
-}
-
+<?php
+/**
+ * GeSHi - Generic Syntax Highlighter
+ *
+ * The GeSHi class for Generic Syntax Highlighting. Please refer to the
+ * documentation at http://qbnz.com/highlighter/documentation.php for more
+ * information about how to use this class.
+ *
+ * For changes, release notes, TODOs etc, see the relevant files in the docs/
+ * directory.
+ *
+ * This file is part of GeSHi.
+ *
+ * GeSHi 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 2 of the License, or
+ * (at your option) any later version.
+ *
+ * GeSHi 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 GeSHi; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * @package geshi
+ * @subpackage core
+ * @author Nigel McNie <nigel@geshi.org>, Benny Baumann <BenBE@omorphia.de>
+ * @copyright (C) 2004 - 2007 Nigel McNie, (C) 2007 - 2008 Benny Baumann
+ * @license http://gnu.org/copyleft/gpl.html GNU GPL
+ *
+ */
+
+//
+// GeSHi Constants
+// You should use these constant names in your programs instead of
+// their values - you never know when a value may change in a future
+// version
+//
+
+/** The version of this GeSHi file */
+define('GESHI_VERSION', '1.0.8.11');
+
+// Define the root directory for the GeSHi code tree
+if (!defined('GESHI_ROOT')) {
+ /** The root directory for GeSHi */
+ define('GESHI_ROOT', dirname(__FILE__) . DIRECTORY_SEPARATOR);
+}
+/** The language file directory for GeSHi
+ @access private */
+define('GESHI_LANG_ROOT', GESHI_ROOT . 'geshi' . DIRECTORY_SEPARATOR);
+
+// Define if GeSHi should be paranoid about security
+if (!defined('GESHI_SECURITY_PARANOID')) {
+ /** Tells GeSHi to be paranoid about security settings */
+ define('GESHI_SECURITY_PARANOID', false);
+}
+
+// Line numbers - use with enable_line_numbers()
+/** Use no line numbers when building the result */
+define('GESHI_NO_LINE_NUMBERS', 0);
+/** Use normal line numbers when building the result */
+define('GESHI_NORMAL_LINE_NUMBERS', 1);
+/** Use fancy line numbers when building the result */
+define('GESHI_FANCY_LINE_NUMBERS', 2);
+
+// Container HTML type
+/** Use nothing to surround the source */
+define('GESHI_HEADER_NONE', 0);
+/** Use a "div" to surround the source */
+define('GESHI_HEADER_DIV', 1);
+/** Use a "pre" to surround the source */
+define('GESHI_HEADER_PRE', 2);
+/** Use a pre to wrap lines when line numbers are enabled or to wrap the whole code. */
+define('GESHI_HEADER_PRE_VALID', 3);
+/**
+ * Use a "table" to surround the source:
+ *
+ * <table>
+ * <thead><tr><td colspan="2">$header</td></tr></thead>
+ * <tbody><tr><td><pre>$linenumbers</pre></td><td><pre>$code></pre></td></tr></tbody>
+ * <tfooter><tr><td colspan="2">$footer</td></tr></tfoot>
+ * </table>
+ *
+ * this is essentially only a workaround for Firefox, see sf#1651996 or take a look at
+ * https://bugzilla.mozilla.org/show_bug.cgi?id=365805
+ * @note when linenumbers are disabled this is essentially the same as GESHI_HEADER_PRE
+ */
+define('GESHI_HEADER_PRE_TABLE', 4);
+
+// Capatalisation constants
+/** Lowercase keywords found */
+define('GESHI_CAPS_NO_CHANGE', 0);
+/** Uppercase keywords found */
+define('GESHI_CAPS_UPPER', 1);
+/** Leave keywords found as the case that they are */
+define('GESHI_CAPS_LOWER', 2);
+
+// Link style constants
+/** Links in the source in the :link state */
+define('GESHI_LINK', 0);
+/** Links in the source in the :hover state */
+define('GESHI_HOVER', 1);
+/** Links in the source in the :active state */
+define('GESHI_ACTIVE', 2);
+/** Links in the source in the :visited state */
+define('GESHI_VISITED', 3);
+
+// Important string starter/finisher
+// Note that if you change these, they should be as-is: i.e., don't
+// write them as if they had been run through htmlentities()
+/** The starter for important parts of the source */
+define('GESHI_START_IMPORTANT', '<BEGIN GeSHi>');
+/** The ender for important parts of the source */
+define('GESHI_END_IMPORTANT', '<END GeSHi>');
+
+/**#@+
+ * @access private
+ */
+// When strict mode applies for a language
+/** Strict mode never applies (this is the most common) */
+define('GESHI_NEVER', 0);
+/** Strict mode *might* apply, and can be enabled or
+ disabled by {@link GeSHi->enable_strict_mode()} */
+define('GESHI_MAYBE', 1);
+/** Strict mode always applies */
+define('GESHI_ALWAYS', 2);
+
+// Advanced regexp handling constants, used in language files
+/** The key of the regex array defining what to search for */
+define('GESHI_SEARCH', 0);
+/** The key of the regex array defining what bracket group in a
+ matched search to use as a replacement */
+define('GESHI_REPLACE', 1);
+/** The key of the regex array defining any modifiers to the regular expression */
+define('GESHI_MODIFIERS', 2);
+/** The key of the regex array defining what bracket group in a
+ matched search to put before the replacement */
+define('GESHI_BEFORE', 3);
+/** The key of the regex array defining what bracket group in a
+ matched search to put after the replacement */
+define('GESHI_AFTER', 4);
+/** The key of the regex array defining a custom keyword to use
+ for this regexp's html tag class */
+define('GESHI_CLASS', 5);
+
+/** Used in language files to mark comments */
+define('GESHI_COMMENTS', 0);
+
+/** Used to work around missing PHP features **/
+define('GESHI_PHP_PRE_433', !(version_compare(PHP_VERSION, '4.3.3') === 1));
+
+/** make sure we can call stripos **/
+if (!function_exists('stripos')) {
+ // the offset param of preg_match is not supported below PHP 4.3.3
+ if (GESHI_PHP_PRE_433) {
+ /**
+ * @ignore
+ */
+ function stripos($haystack, $needle, $offset = null) {
+ if (!is_null($offset)) {
+ $haystack = substr($haystack, $offset);
+ }
+ if (preg_match('/'. preg_quote($needle, '/') . '/', $haystack, $match, PREG_OFFSET_CAPTURE)) {
+ return $match[0][1];
+ }
+ return false;
+ }
+ }
+ else {
+ /**
+ * @ignore
+ */
+ function stripos($haystack, $needle, $offset = null) {
+ if (preg_match('/'. preg_quote($needle, '/') . '/', $haystack, $match, PREG_OFFSET_CAPTURE, $offset)) {
+ return $match[0][1];
+ }
+ return false;
+ }
+ }
+}
+
+/** some old PHP / PCRE subpatterns only support up to xxx subpatterns in
+ regular expressions. Set this to false if your PCRE lib is up to date
+ @see GeSHi->optimize_regexp_list()
+ **/
+define('GESHI_MAX_PCRE_SUBPATTERNS', 500);
+/** it's also important not to generate too long regular expressions
+ be generous here... but keep in mind, that when reaching this limit we
+ still have to close open patterns. 12k should do just fine on a 16k limit.
+ @see GeSHi->optimize_regexp_list()
+ **/
+define('GESHI_MAX_PCRE_LENGTH', 12288);
+
+//Number format specification
+/** Basic number format for integers */
+define('GESHI_NUMBER_INT_BASIC', 1); //Default integers \d+
+/** Enhanced number format for integers like seen in C */
+define('GESHI_NUMBER_INT_CSTYLE', 2); //Default C-Style \d+[lL]?
+/** Number format to highlight binary numbers with a suffix "b" */
+define('GESHI_NUMBER_BIN_SUFFIX', 16); //[01]+[bB]
+/** Number format to highlight binary numbers with a prefix % */
+define('GESHI_NUMBER_BIN_PREFIX_PERCENT', 32); //%[01]+
+/** Number format to highlight binary numbers with a prefix 0b (C) */
+define('GESHI_NUMBER_BIN_PREFIX_0B', 64); //0b[01]+
+/** Number format to highlight octal numbers with a leading zero */
+define('GESHI_NUMBER_OCT_PREFIX', 256); //0[0-7]+
+/** Number format to highlight octal numbers with a prefix 0o (logtalk) */
+define('GESHI_NUMBER_OCT_PREFIX_0O', 512); //0[0-7]+
+/** Number format to highlight octal numbers with a leading @ (Used in HiSofts Devpac series). */
+define('GESHI_NUMBER_OCT_PREFIX_AT', 1024); //@[0-7]+
+/** Number format to highlight octal numbers with a suffix of o */
+define('GESHI_NUMBER_OCT_SUFFIX', 2048); //[0-7]+[oO]
+/** Number format to highlight hex numbers with a prefix 0x */
+define('GESHI_NUMBER_HEX_PREFIX', 4096); //0x[0-9a-fA-F]+
+/** Number format to highlight hex numbers with a prefix $ */
+define('GESHI_NUMBER_HEX_PREFIX_DOLLAR', 8192); //$[0-9a-fA-F]+
+/** Number format to highlight hex numbers with a suffix of h */
+define('GESHI_NUMBER_HEX_SUFFIX', 16384); //[0-9][0-9a-fA-F]*h
+/** Number format to highlight floating-point numbers without support for scientific notation */
+define('GESHI_NUMBER_FLT_NONSCI', 65536); //\d+\.\d+
+/** Number format to highlight floating-point numbers without support for scientific notation */
+define('GESHI_NUMBER_FLT_NONSCI_F', 131072); //\d+(\.\d+)?f
+/** Number format to highlight floating-point numbers with support for scientific notation (E) and optional leading zero */
+define('GESHI_NUMBER_FLT_SCI_SHORT', 262144); //\.\d+e\d+
+/** Number format to highlight floating-point numbers with support for scientific notation (E) and required leading digit */
+define('GESHI_NUMBER_FLT_SCI_ZERO', 524288); //\d+(\.\d+)?e\d+
+//Custom formats are passed by RX array
+
+// Error detection - use these to analyse faults
+/** No sourcecode to highlight was specified
+ * @deprecated
+ */
+define('GESHI_ERROR_NO_INPUT', 1);
+/** The language specified does not exist */
+define('GESHI_ERROR_NO_SUCH_LANG', 2);
+/** GeSHi could not open a file for reading (generally a language file) */
+define('GESHI_ERROR_FILE_NOT_READABLE', 3);
+/** The header type passed to {@link GeSHi->set_header_type()} was invalid */
+define('GESHI_ERROR_INVALID_HEADER_TYPE', 4);
+/** The line number type passed to {@link GeSHi->enable_line_numbers()} was invalid */
+define('GESHI_ERROR_INVALID_LINE_NUMBER_TYPE', 5);
+/**#@-*/
+
+
+/**
+ * The GeSHi Class.
+ *
+ * Please refer to the documentation for GeSHi 1.0.X that is available
+ * at http://qbnz.com/highlighter/documentation.php for more information
+ * about how to use this class.
+ *
+ * @package geshi
+ * @author Nigel McNie <nigel@geshi.org>, Benny Baumann <BenBE@omorphia.de>
+ * @copyright (C) 2004 - 2007 Nigel McNie, (C) 2007 - 2008 Benny Baumann
+ */
+class GeSHi {
+ /**#@+
+ * @access private
+ */
+ /**
+ * The source code to highlight
+ * @var string
+ */
+ var $source = '';
+
+ /**
+ * The language to use when highlighting
+ * @var string
+ */
+ var $language = '';
+
+ /**
+ * The data for the language used
+ * @var array
+ */
+ var $language_data = array();
+
+ /**
+ * The path to the language files
+ * @var string
+ */
+ var $language_path = GESHI_LANG_ROOT;
+
+ /**
+ * The error message associated with an error
+ * @var string
+ * @todo check err reporting works
+ */
+ var $error = false;
+
+ /**
+ * Possible error messages
+ * @var array
+ */
+ var $error_messages = array(
+ GESHI_ERROR_NO_SUCH_LANG => 'GeSHi could not find the language {LANGUAGE} (using path {PATH})',
+ GESHI_ERROR_FILE_NOT_READABLE => 'The file specified for load_from_file was not readable',
+ GESHI_ERROR_INVALID_HEADER_TYPE => 'The header type specified is invalid',
+ GESHI_ERROR_INVALID_LINE_NUMBER_TYPE => 'The line number type specified is invalid'
+ );
+
+ /**
+ * Whether highlighting is strict or not
+ * @var boolean
+ */
+ var $strict_mode = false;
+
+ /**
+ * Whether to use CSS classes in output
+ * @var boolean
+ */
+ var $use_classes = false;
+
+ /**
+ * The type of header to use. Can be one of the following
+ * values:
+ *
+ * - GESHI_HEADER_PRE: Source is outputted in a "pre" HTML element.
+ * - GESHI_HEADER_DIV: Source is outputted in a "div" HTML element.
+ * - GESHI_HEADER_NONE: No header is outputted.
+ *
+ * @var int
+ */
+ var $header_type = GESHI_HEADER_PRE;
+
+ /**
+ * Array of permissions for which lexics should be highlighted
+ * @var array
+ */
+ var $lexic_permissions = array(
+ 'KEYWORDS' => array(),
+ 'COMMENTS' => array('MULTI' => true),
+ 'REGEXPS' => array(),
+ 'ESCAPE_CHAR' => true,
+ 'BRACKETS' => true,
+ 'SYMBOLS' => false,
+ 'STRINGS' => true,
+ 'NUMBERS' => true,
+ 'METHODS' => true,
+ 'SCRIPT' => true
+ );
+
+ /**
+ * The time it took to parse the code
+ * @var double
+ */
+ var $time = 0;
+
+ /**
+ * The content of the header block
+ * @var string
+ */
+ var $header_content = '';
+
+ /**
+ * The content of the footer block
+ * @var string
+ */
+ var $footer_content = '';
+
+ /**
+ * The style of the header block
+ * @var string
+ */
+ var $header_content_style = '';
+
+ /**
+ * The style of the footer block
+ * @var string
+ */
+ var $footer_content_style = '';
+
+ /**
+ * Tells if a block around the highlighted source should be forced
+ * if not using line numbering
+ * @var boolean
+ */
+ var $force_code_block = false;
+
+ /**
+ * The styles for hyperlinks in the code
+ * @var array
+ */
+ var $link_styles = array();
+
+ /**
+ * Whether important blocks should be recognised or not
+ * @var boolean
+ * @deprecated
+ * @todo REMOVE THIS FUNCTIONALITY!
+ */
+ var $enable_important_blocks = false;
+
+ /**
+ * Styles for important parts of the code
+ * @var string
+ * @deprecated
+ * @todo As above - rethink the whole idea of important blocks as it is buggy and
+ * will be hard to implement in 1.2
+ */
+ var $important_styles = 'font-weight: bold; color: red;'; // Styles for important parts of the code
+
+ /**
+ * Whether CSS IDs should be added to the code
+ * @var boolean
+ */
+ var $add_ids = false;
+
+ /**
+ * Lines that should be highlighted extra
+ * @var array
+ */
+ var $highlight_extra_lines = array();
+
+ /**
+ * Styles of lines that should be highlighted extra
+ * @var array
+ */
+ var $highlight_extra_lines_styles = array();
+
+ /**
+ * Styles of extra-highlighted lines
+ * @var string
+ */
+ var $highlight_extra_lines_style = 'background-color: #ffc;';
+
+ /**
+ * The line ending
+ * If null, nl2br() will be used on the result string.
+ * Otherwise, all instances of \n will be replaced with $line_ending
+ * @var string
+ */
+ var $line_ending = null;
+
+ /**
+ * Number at which line numbers should start at
+ * @var int
+ */
+ var $line_numbers_start = 1;
+
+ /**
+ * The overall style for this code block
+ * @var string
+ */
+ var $overall_style = 'font-family:monospace;';
+
+ /**
+ * The style for the actual code
+ * @var string
+ */
+ var $code_style = 'font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;';
+
+ /**
+ * The overall class for this code block
+ * @var string
+ */
+ var $overall_class = '';
+
+ /**
+ * The overall ID for this code block
+ * @var string
+ */
+ var $overall_id = '';
+
+ /**
+ * Line number styles
+ * @var string
+ */
+ var $line_style1 = 'font-weight: normal; vertical-align:top;';
+
+ /**
+ * Line number styles for fancy lines
+ * @var string
+ */
+ var $line_style2 = 'font-weight: bold; vertical-align:top;';
+
+ /**
+ * Style for line numbers when GESHI_HEADER_PRE_TABLE is chosen
+ * @var string
+ */
+ var $table_linenumber_style = 'width:1px;text-align:right;margin:0;padding:0 2px;vertical-align:top;';
+
+ /**
+ * Flag for how line numbers are displayed
+ * @var boolean
+ */
+ var $line_numbers = GESHI_NO_LINE_NUMBERS;
+
+ /**
+ * Flag to decide if multi line spans are allowed. Set it to false to make sure
+ * each tag is closed before and reopened after each linefeed.
+ * @var boolean
+ */
+ var $allow_multiline_span = true;
+
+ /**
+ * The "nth" value for fancy line highlighting
+ * @var int
+ */
+ var $line_nth_row = 0;
+
+ /**
+ * The size of tab stops
+ * @var int
+ */
+ var $tab_width = 8;
+
+ /**
+ * Should we use language-defined tab stop widths?
+ * @var int
+ */
+ var $use_language_tab_width = false;
+
+ /**
+ * Default target for keyword links
+ * @var string
+ */
+ var $link_target = '';
+
+ /**
+ * The encoding to use for entity encoding
+ * NOTE: Used with Escape Char Sequences to fix UTF-8 handling (cf. SF#2037598)
+ * @var string
+ */
+ var $encoding = 'utf-8';
+
+ /**
+ * Should keywords be linked?
+ * @var boolean
+ */
+ var $keyword_links = true;
+
+ /**
+ * Currently loaded language file
+ * @var string
+ * @since 1.0.7.22
+ */
+ var $loaded_language = '';
+
+ /**
+ * Wether the caches needed for parsing are built or not
+ *
+ * @var bool
+ * @since 1.0.8
+ */
+ var $parse_cache_built = false;
+
+ /**
+ * Work around for Suhosin Patch with disabled /e modifier
+ *
+ * Note from suhosins author in config file:
+ * <blockquote>
+ * The /e modifier inside <code>preg_replace()</code> allows code execution.
+ * Often it is the cause for remote code execution exploits. It is wise to
+ * deactivate this feature and test where in the application it is used.
+ * The developer using the /e modifier should be made aware that he should
+ * use <code>preg_replace_callback()</code> instead
+ * </blockquote>
+ *
+ * @var array
+ * @since 1.0.8
+ */
+ var $_kw_replace_group = 0;
+ var $_rx_key = 0;
+
+ /**
+ * some "callback parameters" for handle_multiline_regexps
+ *
+ * @since 1.0.8
+ * @access private
+ * @var string
+ */
+ var $_hmr_before = '';
+ var $_hmr_replace = '';
+ var $_hmr_after = '';
+ var $_hmr_key = 0;
+
+ /**#@-*/
+
+ /**
+ * Creates a new GeSHi object, with source and language
+ *
+ * @param string The source code to highlight
+ * @param string The language to highlight the source with
+ * @param string The path to the language file directory. <b>This
+ * is deprecated!</b> I've backported the auto path
+ * detection from the 1.1.X dev branch, so now it
+ * should be automatically set correctly. If you have
+ * renamed the language directory however, you will
+ * still need to set the path using this parameter or
+ * {@link GeSHi->set_language_path()}
+ * @since 1.0.0
+ */
+ function GeSHi($source = '', $language = '', $path = '') {
+ if (!empty($source)) {
+ $this->set_source($source);
+ }
+ if (!empty($language)) {
+ $this->set_language($language);
+ }
+ $this->set_language_path($path);
+ }
+
+ /**
+ * Returns the version of GeSHi
+ *
+ * @return string
+ * @since 1 0.8.11
+ */
+ function get_version()
+ {
+ return GESHI_VERSION;
+ }
+
+ /**
+ * Returns an error message associated with the last GeSHi operation,
+ * or false if no error has occured
+ *
+ * @return string|false An error message if there has been an error, else false
+ * @since 1.0.0
+ */
+ function error() {
+ if ($this->error) {
+ //Put some template variables for debugging here ...
+ $debug_tpl_vars = array(
+ '{LANGUAGE}' => $this->language,
+ '{PATH}' => $this->language_path
+ );
+ $msg = str_replace(
+ array_keys($debug_tpl_vars),
+ array_values($debug_tpl_vars),
+ $this->error_messages[$this->error]);
+
+ return "<br /><strong>GeSHi Error:</strong> $msg (code {$this->error})<br />";
+ }
+ return false;
+ }
+
+ /**
+ * Gets a human-readable language name (thanks to Simon Patterson
+ * for the idea :))
+ *
+ * @return string The name for the current language
+ * @since 1.0.2
+ */
+ function get_language_name() {
+ if (GESHI_ERROR_NO_SUCH_LANG == $this->error) {
+ return $this->language_data['LANG_NAME'] . ' (Unknown Language)';
+ }
+ return $this->language_data['LANG_NAME'];
+ }
+
+ /**
+ * Sets the source code for this object
+ *
+ * @param string The source code to highlight
+ * @since 1.0.0
+ */
+ function set_source($source) {
+ $this->source = $source;
+ $this->highlight_extra_lines = array();
+ }
+
+ /**
+ * Sets the language for this object
+ *
+ * @note since 1.0.8 this function won't reset language-settings by default anymore!
+ * if you need this set $force_reset = true
+ *
+ * @param string The name of the language to use
+ * @since 1.0.0
+ */
+ function set_language($language, $force_reset = false) {
+ if ($force_reset) {
+ $this->loaded_language = false;
+ }
+
+ //Clean up the language name to prevent malicious code injection
+ $language = preg_replace('#[^a-zA-Z0-9\-_]#', '', $language);
+
+ $language = strtolower($language);
+
+ //Retreive the full filename
+ $file_name = $this->language_path . $language . '.php';
+ if ($file_name == $this->loaded_language) {
+ // this language is already loaded!
+ return;
+ }
+
+ $this->language = $language;
+
+ $this->error = false;
+ $this->strict_mode = GESHI_NEVER;
+
+ //Check if we can read the desired file
+ if (!is_readable($file_name)) {
+ $this->error = GESHI_ERROR_NO_SUCH_LANG;
+ return;
+ }
+
+ // Load the language for parsing
+ $this->load_language($file_name);
+ }
+
+ /**
+ * Sets the path to the directory containing the language files. Note
+ * that this path is relative to the directory of the script that included
+ * geshi.php, NOT geshi.php itself.
+ *
+ * @param string The path to the language directory
+ * @since 1.0.0
+ * @deprecated The path to the language files should now be automatically
+ * detected, so this method should no longer be needed. The
+ * 1.1.X branch handles manual setting of the path differently
+ * so this method will disappear in 1.2.0.
+ */
+ function set_language_path($path) {
+ if(strpos($path,':')) {
+ //Security Fix to prevent external directories using fopen wrappers.
+ if(DIRECTORY_SEPARATOR == "\\") {
+ if(!preg_match('#^[a-zA-Z]:#', $path) || false !== strpos($path, ':', 2)) {
+ return;
+ }
+ } else {
+ return;
+ }
+ }
+ if(preg_match('#[^/a-zA-Z0-9_\.\-\\\s:]#', $path)) {
+ //Security Fix to prevent external directories using fopen wrappers.
+ return;
+ }
+ if(GESHI_SECURITY_PARANOID && false !== strpos($path, '/.')) {
+ //Security Fix to prevent external directories using fopen wrappers.
+ return;
+ }
+ if(GESHI_SECURITY_PARANOID && false !== strpos($path, '..')) {
+ //Security Fix to prevent external directories using fopen wrappers.
+ return;
+ }
+ if ($path) {
+ $this->language_path = ('/' == $path[strlen($path) - 1]) ? $path : $path . '/';
+ $this->set_language($this->language); // otherwise set_language_path has no effect
+ }
+ }
+
+ /**
+ * Get supported langs or an associative array lang=>full_name.
+ * @param boolean $longnames
+ * @return array
+ */
+ function get_supported_languages($full_names=false)
+ {
+ // return array
+ $back = array();
+
+ // we walk the lang root
+ $dir = dir($this->language_path);
+
+ // foreach entry
+ while (false !== ($entry = $dir->read()))
+ {
+ $full_path = $this->language_path.$entry;
+
+ // Skip all dirs
+ if (is_dir($full_path)) {
+ continue;
+ }
+
+ // we only want lang.php files
+ if (!preg_match('/^([^.]+)\.php$/', $entry, $matches)) {
+ continue;
+ }
+
+ // Raw lang name is here
+ $langname = $matches[1];
+
+ // We want the fullname too?
+ if ($full_names === true)
+ {
+ if (false !== ($fullname = $this->get_language_fullname($langname)))
+ {
+ $back[$langname] = $fullname; // we go associative
+ }
+ }
+ else
+ {
+ // just store raw langname
+ $back[] = $langname;
+ }
+ }
+
+ $dir->close();
+
+ return $back;
+ }
+
+ /**
+ * Get full_name for a lang or false.
+ * @param string $language short langname (html4strict for example)
+ * @return mixed
+ */
+ function get_language_fullname($language)
+ {
+ //Clean up the language name to prevent malicious code injection
+ $language = preg_replace('#[^a-zA-Z0-9\-_]#', '', $language);
+
+ $language = strtolower($language);
+
+ // get fullpath-filename for a langname
+ $fullpath = $this->language_path.$language.'.php';
+
+ // we need to get contents :S
+ if (false === ($data = file_get_contents($fullpath))) {
+ $this->error = sprintf('Geshi::get_lang_fullname() Unknown Language: %s', $language);
+ return false;
+ }
+
+ // match the langname
+ if (!preg_match('/\'LANG_NAME\'\s*=>\s*\'((?:[^\']|\\\')+?)\'/', $data, $matches)) {
+ $this->error = sprintf('Geshi::get_lang_fullname(%s): Regex can not detect language', $language);
+ return false;
+ }
+
+ // return fullname for langname
+ return stripcslashes($matches[1]);
+ }
+
+ /**
+ * Sets the type of header to be used.
+ *
+ * If GESHI_HEADER_DIV is used, the code is surrounded in a "div".This
+ * means more source code but more control over tab width and line-wrapping.
+ * GESHI_HEADER_PRE means that a "pre" is used - less source, but less
+ * control. Default is GESHI_HEADER_PRE.
+ *
+ * From 1.0.7.2, you can use GESHI_HEADER_NONE to specify that no header code
+ * should be outputted.
+ *
+ * @param int The type of header to be used
+ * @since 1.0.0
+ */
+ function set_header_type($type) {
+ //Check if we got a valid header type
+ if (!in_array($type, array(GESHI_HEADER_NONE, GESHI_HEADER_DIV,
+ GESHI_HEADER_PRE, GESHI_HEADER_PRE_VALID, GESHI_HEADER_PRE_TABLE))) {
+ $this->error = GESHI_ERROR_INVALID_HEADER_TYPE;
+ return;
+ }
+
+ //Set that new header type
+ $this->header_type = $type;
+ }
+
+ /**
+ * Sets the styles for the code that will be outputted
+ * when this object is parsed. The style should be a
+ * string of valid stylesheet declarations
+ *
+ * @param string The overall style for the outputted code block
+ * @param boolean Whether to merge the styles with the current styles or not
+ * @since 1.0.0
+ */
+ function set_overall_style($style, $preserve_defaults = false) {
+ if (!$preserve_defaults) {
+ $this->overall_style = $style;
+ } else {
+ $this->overall_style .= $style;
+ }
+ }
+
+ /**
+ * Sets the overall classname for this block of code. This
+ * class can then be used in a stylesheet to style this object's
+ * output
+ *
+ * @param string The class name to use for this block of code
+ * @since 1.0.0
+ */
+ function set_overall_class($class) {
+ $this->overall_class = $class;
+ }
+
+ /**
+ * Sets the overall id for this block of code. This id can then
+ * be used in a stylesheet to style this object's output
+ *
+ * @param string The ID to use for this block of code
+ * @since 1.0.0
+ */
+ function set_overall_id($id) {
+ $this->overall_id = $id;
+ }
+
+ /**
+ * Sets whether CSS classes should be used to highlight the source. Default
+ * is off, calling this method with no arguments will turn it on
+ *
+ * @param boolean Whether to turn classes on or not
+ * @since 1.0.0
+ */
+ function enable_classes($flag = true) {
+ $this->use_classes = ($flag) ? true : false;
+ }
+
+ /**
+ * Sets the style for the actual code. This should be a string
+ * containing valid stylesheet declarations. If $preserve_defaults is
+ * true, then styles are merged with the default styles, with the
+ * user defined styles having priority
+ *
+ * Note: Use this method to override any style changes you made to
+ * the line numbers if you are using line numbers, else the line of
+ * code will have the same style as the line number! Consult the
+ * GeSHi documentation for more information about this.
+ *
+ * @param string The style to use for actual code
+ * @param boolean Whether to merge the current styles with the new styles
+ * @since 1.0.2
+ */
+ function set_code_style($style, $preserve_defaults = false) {
+ if (!$preserve_defaults) {
+ $this->code_style = $style;
+ } else {
+ $this->code_style .= $style;
+ }
+ }
+
+ /**
+ * Sets the styles for the line numbers.
+ *
+ * @param string The style for the line numbers that are "normal"
+ * @param string|boolean If a string, this is the style of the line
+ * numbers that are "fancy", otherwise if boolean then this
+ * defines whether the normal styles should be merged with the
+ * new normal styles or not
+ * @param boolean If set, is the flag for whether to merge the "fancy"
+ * styles with the current styles or not
+ * @since 1.0.2
+ */
+ function set_line_style($style1, $style2 = '', $preserve_defaults = false) {
+ //Check if we got 2 or three parameters
+ if (is_bool($style2)) {
+ $preserve_defaults = $style2;
+ $style2 = '';
+ }
+
+ //Actually set the new styles
+ if (!$preserve_defaults) {
+ $this->line_style1 = $style1;
+ $this->line_style2 = $style2;
+ } else {
+ $this->line_style1 .= $style1;
+ $this->line_style2 .= $style2;
+ }
+ }
+
+ /**
+ * Sets whether line numbers should be displayed.
+ *
+ * Valid values for the first parameter are:
+ *
+ * - GESHI_NO_LINE_NUMBERS: Line numbers will not be displayed
+ * - GESHI_NORMAL_LINE_NUMBERS: Line numbers will be displayed
+ * - GESHI_FANCY_LINE_NUMBERS: Fancy line numbers will be displayed
+ *
+ * For fancy line numbers, the second parameter is used to signal which lines
+ * are to be fancy. For example, if the value of this parameter is 5 then every
+ * 5th line will be fancy.
+ *
+ * @param int How line numbers should be displayed
+ * @param int Defines which lines are fancy
+ * @since 1.0.0
+ */
+ function enable_line_numbers($flag, $nth_row = 5) {
+ if (GESHI_NO_LINE_NUMBERS != $flag && GESHI_NORMAL_LINE_NUMBERS != $flag
+ && GESHI_FANCY_LINE_NUMBERS != $flag) {
+ $this->error = GESHI_ERROR_INVALID_LINE_NUMBER_TYPE;
+ }
+ $this->line_numbers = $flag;
+ $this->line_nth_row = $nth_row;
+ }
+
+ /**
+ * Sets wether spans and other HTML markup generated by GeSHi can
+ * span over multiple lines or not. Defaults to true to reduce overhead.
+ * Set it to false if you want to manipulate the output or manually display
+ * the code in an ordered list.
+ *
+ * @param boolean Wether multiline spans are allowed or not
+ * @since 1.0.7.22
+ */
+ function enable_multiline_span($flag) {
+ $this->allow_multiline_span = (bool) $flag;
+ }
+
+ /**
+ * Get current setting for multiline spans, see GeSHi->enable_multiline_span().
+ *
+ * @see enable_multiline_span
+ * @return bool
+ */
+ function get_multiline_span() {
+ return $this->allow_multiline_span;
+ }
+
+ /**
+ * Sets the style for a keyword group. If $preserve_defaults is
+ * true, then styles are merged with the default styles, with the
+ * user defined styles having priority
+ *
+ * @param int The key of the keyword group to change the styles of
+ * @param string The style to make the keywords
+ * @param boolean Whether to merge the new styles with the old or just
+ * to overwrite them
+ * @since 1.0.0
+ */
+ function set_keyword_group_style($key, $style, $preserve_defaults = false) {
+ //Set the style for this keyword group
+ if (!$preserve_defaults) {
+ $this->language_data['STYLES']['KEYWORDS'][$key] = $style;
+ } else {
+ $this->language_data['STYLES']['KEYWORDS'][$key] .= $style;
+ }
+
+ //Update the lexic permissions
+ if (!isset($this->lexic_permissions['KEYWORDS'][$key])) {
+ $this->lexic_permissions['KEYWORDS'][$key] = true;
+ }
+ }
+
+ /**
+ * Turns highlighting on/off for a keyword group
+ *
+ * @param int The key of the keyword group to turn on or off
+ * @param boolean Whether to turn highlighting for that group on or off
+ * @since 1.0.0
+ */
+ function set_keyword_group_highlighting($key, $flag = true) {
+ $this->lexic_permissions['KEYWORDS'][$key] = ($flag) ? true : false;
+ }
+
+ /**
+ * Sets the styles for comment groups. If $preserve_defaults is
+ * true, then styles are merged with the default styles, with the
+ * user defined styles having priority
+ *
+ * @param int The key of the comment group to change the styles of
+ * @param string The style to make the comments
+ * @param boolean Whether to merge the new styles with the old or just
+ * to overwrite them
+ * @since 1.0.0
+ */
+ function set_comments_style($key, $style, $preserve_defaults = false) {
+ if (!$preserve_defaults) {
+ $this->language_data['STYLES']['COMMENTS'][$key] = $style;
+ } else {
+ $this->language_data['STYLES']['COMMENTS'][$key] .= $style;
+ }
+ }
+
+ /**
+ * Turns highlighting on/off for comment groups
+ *
+ * @param int The key of the comment group to turn on or off
+ * @param boolean Whether to turn highlighting for that group on or off
+ * @since 1.0.0
+ */
+ function set_comments_highlighting($key, $flag = true) {
+ $this->lexic_permissions['COMMENTS'][$key] = ($flag) ? true : false;
+ }
+
+ /**
+ * Sets the styles for escaped characters. If $preserve_defaults is
+ * true, then styles are merged with the default styles, with the
+ * user defined styles having priority
+ *
+ * @param string The style to make the escape characters
+ * @param boolean Whether to merge the new styles with the old or just
+ * to overwrite them
+ * @since 1.0.0
+ */
+ function set_escape_characters_style($style, $preserve_defaults = false, $group = 0) {
+ if (!$preserve_defaults) {
+ $this->language_data['STYLES']['ESCAPE_CHAR'][$group] = $style;
+ } else {
+ $this->language_data['STYLES']['ESCAPE_CHAR'][$group] .= $style;
+ }
+ }
+
+ /**
+ * Turns highlighting on/off for escaped characters
+ *
+ * @param boolean Whether to turn highlighting for escape characters on or off
+ * @since 1.0.0
+ */
+ function set_escape_characters_highlighting($flag = true) {
+ $this->lexic_permissions['ESCAPE_CHAR'] = ($flag) ? true : false;
+ }
+
+ /**
+ * Sets the styles for brackets. If $preserve_defaults is
+ * true, then styles are merged with the default styles, with the
+ * user defined styles having priority
+ *
+ * This method is DEPRECATED: use set_symbols_style instead.
+ * This method will be removed in 1.2.X
+ *
+ * @param string The style to make the brackets
+ * @param boolean Whether to merge the new styles with the old or just
+ * to overwrite them
+ * @since 1.0.0
+ * @deprecated In favour of set_symbols_style
+ */
+ function set_brackets_style($style, $preserve_defaults = false) {
+ if (!$preserve_defaults) {
+ $this->language_data['STYLES']['BRACKETS'][0] = $style;
+ } else {
+ $this->language_data['STYLES']['BRACKETS'][0] .= $style;
+ }
+ }
+
+ /**
+ * Turns highlighting on/off for brackets
+ *
+ * This method is DEPRECATED: use set_symbols_highlighting instead.
+ * This method will be remove in 1.2.X
+ *
+ * @param boolean Whether to turn highlighting for brackets on or off
+ * @since 1.0.0
+ * @deprecated In favour of set_symbols_highlighting
+ */
+ function set_brackets_highlighting($flag) {
+ $this->lexic_permissions['BRACKETS'] = ($flag) ? true : false;
+ }
+
+ /**
+ * Sets the styles for symbols. If $preserve_defaults is
+ * true, then styles are merged with the default styles, with the
+ * user defined styles having priority
+ *
+ * @param string The style to make the symbols
+ * @param boolean Whether to merge the new styles with the old or just
+ * to overwrite them
+ * @param int Tells the group of symbols for which style should be set.
+ * @since 1.0.1
+ */
+ function set_symbols_style($style, $preserve_defaults = false, $group = 0) {
+ // Update the style of symbols
+ if (!$preserve_defaults) {
+ $this->language_data['STYLES']['SYMBOLS'][$group] = $style;
+ } else {
+ $this->language_data['STYLES']['SYMBOLS'][$group] .= $style;
+ }
+
+ // For backward compatibility
+ if (0 == $group) {
+ $this->set_brackets_style ($style, $preserve_defaults);
+ }
+ }
+
+ /**
+ * Turns highlighting on/off for symbols
+ *
+ * @param boolean Whether to turn highlighting for symbols on or off
+ * @since 1.0.0
+ */
+ function set_symbols_highlighting($flag) {
+ // Update lexic permissions for this symbol group
+ $this->lexic_permissions['SYMBOLS'] = ($flag) ? true : false;
+
+ // For backward compatibility
+ $this->set_brackets_highlighting ($flag);
+ }
+
+ /**
+ * Sets the styles for strings. If $preserve_defaults is
+ * true, then styles are merged with the default styles, with the
+ * user defined styles having priority
+ *
+ * @param string The style to make the escape characters
+ * @param boolean Whether to merge the new styles with the old or just
+ * to overwrite them
+ * @param int Tells the group of strings for which style should be set.
+ * @since 1.0.0
+ */
+ function set_strings_style($style, $preserve_defaults = false, $group = 0) {
+ if (!$preserve_defaults) {
+ $this->language_data['STYLES']['STRINGS'][$group] = $style;
+ } else {
+ $this->language_data['STYLES']['STRINGS'][$group] .= $style;
+ }
+ }
+
+ /**
+ * Turns highlighting on/off for strings
+ *
+ * @param boolean Whether to turn highlighting for strings on or off
+ * @since 1.0.0
+ */
+ function set_strings_highlighting($flag) {
+ $this->lexic_permissions['STRINGS'] = ($flag) ? true : false;
+ }
+
+ /**
+ * Sets the styles for strict code blocks. If $preserve_defaults is
+ * true, then styles are merged with the default styles, with the
+ * user defined styles having priority
+ *
+ * @param string The style to make the script blocks
+ * @param boolean Whether to merge the new styles with the old or just
+ * to overwrite them
+ * @param int Tells the group of script blocks for which style should be set.
+ * @since 1.0.8.4
+ */
+ function set_script_style($style, $preserve_defaults = false, $group = 0) {
+ // Update the style of symbols
+ if (!$preserve_defaults) {
+ $this->language_data['STYLES']['SCRIPT'][$group] = $style;
+ } else {
+ $this->language_data['STYLES']['SCRIPT'][$group] .= $style;
+ }
+ }
+
+ /**
+ * Sets the styles for numbers. If $preserve_defaults is
+ * true, then styles are merged with the default styles, with the
+ * user defined styles having priority
+ *
+ * @param string The style to make the numbers
+ * @param boolean Whether to merge the new styles with the old or just
+ * to overwrite them
+ * @param int Tells the group of numbers for which style should be set.
+ * @since 1.0.0
+ */
+ function set_numbers_style($style, $preserve_defaults = false, $group = 0) {
+ if (!$preserve_defaults) {
+ $this->language_data['STYLES']['NUMBERS'][$group] = $style;
+ } else {
+ $this->language_data['STYLES']['NUMBERS'][$group] .= $style;
+ }
+ }
+
+ /**
+ * Turns highlighting on/off for numbers
+ *
+ * @param boolean Whether to turn highlighting for numbers on or off
+ * @since 1.0.0
+ */
+ function set_numbers_highlighting($flag) {
+ $this->lexic_permissions['NUMBERS'] = ($flag) ? true : false;
+ }
+
+ /**
+ * Sets the styles for methods. $key is a number that references the
+ * appropriate "object splitter" - see the language file for the language
+ * you are highlighting to get this number. If $preserve_defaults is
+ * true, then styles are merged with the default styles, with the
+ * user defined styles having priority
+ *
+ * @param int The key of the object splitter to change the styles of
+ * @param string The style to make the methods
+ * @param boolean Whether to merge the new styles with the old or just
+ * to overwrite them
+ * @since 1.0.0
+ */
+ function set_methods_style($key, $style, $preserve_defaults = false) {
+ if (!$preserve_defaults) {
+ $this->language_data['STYLES']['METHODS'][$key] = $style;
+ } else {
+ $this->language_data['STYLES']['METHODS'][$key] .= $style;
+ }
+ }
+
+ /**
+ * Turns highlighting on/off for methods
+ *
+ * @param boolean Whether to turn highlighting for methods on or off
+ * @since 1.0.0
+ */
+ function set_methods_highlighting($flag) {
+ $this->lexic_permissions['METHODS'] = ($flag) ? true : false;
+ }
+
+ /**
+ * Sets the styles for regexps. If $preserve_defaults is
+ * true, then styles are merged with the default styles, with the
+ * user defined styles having priority
+ *
+ * @param string The style to make the regular expression matches
+ * @param boolean Whether to merge the new styles with the old or just
+ * to overwrite them
+ * @since 1.0.0
+ */
+ function set_regexps_style($key, $style, $preserve_defaults = false) {
+ if (!$preserve_defaults) {
+ $this->language_data['STYLES']['REGEXPS'][$key] = $style;
+ } else {
+ $this->language_data['STYLES']['REGEXPS'][$key] .= $style;
+ }
+ }
+
+ /**
+ * Turns highlighting on/off for regexps
+ *
+ * @param int The key of the regular expression group to turn on or off
+ * @param boolean Whether to turn highlighting for the regular expression group on or off
+ * @since 1.0.0
+ */
+ function set_regexps_highlighting($key, $flag) {
+ $this->lexic_permissions['REGEXPS'][$key] = ($flag) ? true : false;
+ }
+
+ /**
+ * Sets whether a set of keywords are checked for in a case sensitive manner
+ *
+ * @param int The key of the keyword group to change the case sensitivity of
+ * @param boolean Whether to check in a case sensitive manner or not
+ * @since 1.0.0
+ */
+ function set_case_sensitivity($key, $case) {
+ $this->language_data['CASE_SENSITIVE'][$key] = ($case) ? true : false;
+ }
+
+ /**
+ * Sets the case that keywords should use when found. Use the constants:
+ *
+ * - GESHI_CAPS_NO_CHANGE: leave keywords as-is
+ * - GESHI_CAPS_UPPER: convert all keywords to uppercase where found
+ * - GESHI_CAPS_LOWER: convert all keywords to lowercase where found
+ *
+ * @param int A constant specifying what to do with matched keywords
+ * @since 1.0.1
+ */
+ function set_case_keywords($case) {
+ if (in_array($case, array(
+ GESHI_CAPS_NO_CHANGE, GESHI_CAPS_UPPER, GESHI_CAPS_LOWER))) {
+ $this->language_data['CASE_KEYWORDS'] = $case;
+ }
+ }
+
+ /**
+ * Sets how many spaces a tab is substituted for
+ *
+ * Widths below zero are ignored
+ *
+ * @param int The tab width
+ * @since 1.0.0
+ */
+ function set_tab_width($width) {
+ $this->tab_width = intval($width);
+
+ //Check if it fit's the constraints:
+ if ($this->tab_width < 1) {
+ //Return it to the default
+ $this->tab_width = 8;
+ }
+ }
+
+ /**
+ * Sets whether or not to use tab-stop width specifed by language
+ *
+ * @param boolean Whether to use language-specific tab-stop widths
+ * @since 1.0.7.20
+ */
+ function set_use_language_tab_width($use) {
+ $this->use_language_tab_width = (bool) $use;
+ }
+
+ /**
+ * Returns the tab width to use, based on the current language and user
+ * preference
+ *
+ * @return int Tab width
+ * @since 1.0.7.20
+ */
+ function get_real_tab_width() {
+ if (!$this->use_language_tab_width ||
+ !isset($this->language_data['TAB_WIDTH'])) {
+ return $this->tab_width;
+ } else {
+ return $this->language_data['TAB_WIDTH'];
+ }
+ }
+
+ /**
+ * Enables/disables strict highlighting. Default is off, calling this
+ * method without parameters will turn it on. See documentation
+ * for more details on strict mode and where to use it.
+ *
+ * @param boolean Whether to enable strict mode or not
+ * @since 1.0.0
+ */
+ function enable_strict_mode($mode = true) {
+ if (GESHI_MAYBE == $this->language_data['STRICT_MODE_APPLIES']) {
+ $this->strict_mode = ($mode) ? GESHI_ALWAYS : GESHI_NEVER;
+ }
+ }
+
+ /**
+ * Disables all highlighting
+ *
+ * @since 1.0.0
+ * @todo Rewrite with array traversal
+ * @deprecated In favour of enable_highlighting
+ */
+ function disable_highlighting() {
+ $this->enable_highlighting(false);
+ }
+
+ /**
+ * Enables all highlighting
+ *
+ * The optional flag parameter was added in version 1.0.7.21 and can be used
+ * to enable (true) or disable (false) all highlighting.
+ *
+ * @since 1.0.0
+ * @param boolean A flag specifying whether to enable or disable all highlighting
+ * @todo Rewrite with array traversal
+ */
+ function enable_highlighting($flag = true) {
+ $flag = $flag ? true : false;
+ foreach ($this->lexic_permissions as $key => $value) {
+ if (is_array($value)) {
+ foreach ($value as $k => $v) {
+ $this->lexic_permissions[$key][$k] = $flag;
+ }
+ } else {
+ $this->lexic_permissions[$key] = $flag;
+ }
+ }
+
+ // Context blocks
+ $this->enable_important_blocks = $flag;
+ }
+
+ /**
+ * Given a file extension, this method returns either a valid geshi language
+ * name, or the empty string if it couldn't be found
+ *
+ * @param string The extension to get a language name for
+ * @param array A lookup array to use instead of the default one
+ * @since 1.0.5
+ * @todo Re-think about how this method works (maybe make it private and/or make it
+ * a extension->lang lookup?)
+ * @todo static?
+ */
+ function get_language_name_from_extension( $extension, $lookup = array() ) {
+ $extension = strtolower($extension);
+
+ if ( !is_array($lookup) || empty($lookup)) {
+ $lookup = array(
+ '6502acme' => array( 'a', 's', 'asm', 'inc' ),
+ '6502tasm' => array( 'a', 's', 'asm', 'inc' ),
+ '6502kickass' => array( 'a', 's', 'asm', 'inc' ),
+ '68000devpac' => array( 'a', 's', 'asm', 'inc' ),
+ 'abap' => array('abap'),
+ 'actionscript' => array('as'),
+ 'ada' => array('a', 'ada', 'adb', 'ads'),
+ 'apache' => array('conf'),
+ 'asm' => array('ash', 'asm', 'inc'),
+ 'asp' => array('asp'),
+ 'bash' => array('sh'),
+ 'bf' => array('bf'),
+ 'c' => array('c', 'h'),
+ 'c_mac' => array('c', 'h'),
+ 'caddcl' => array(),
+ 'cadlisp' => array(),
+ 'cdfg' => array('cdfg'),
+ 'cobol' => array('cbl'),
+ 'cpp' => array('cpp', 'hpp', 'C', 'H', 'CPP', 'HPP'),
+ 'csharp' => array('cs'),
+ 'css' => array('css'),
+ 'd' => array('d'),
+ 'delphi' => array('dpk', 'dpr', 'pp', 'pas'),
+ 'diff' => array('diff', 'patch'),
+ 'dos' => array('bat', 'cmd'),
+ 'gdb' => array('kcrash', 'crash', 'bt'),
+ 'gettext' => array('po', 'pot'),
+ 'gml' => array('gml'),
+ 'gnuplot' => array('plt'),
+ 'groovy' => array('groovy'),
+ 'haskell' => array('hs'),
+ 'haxe' => array('hx'),
+ 'html4strict' => array('html', 'htm'),
+ 'ini' => array('ini', 'desktop'),
+ 'java' => array('java'),
+ 'javascript' => array('js'),
+ 'klonec' => array('kl1'),
+ 'klonecpp' => array('klx'),
+ 'latex' => array('tex'),
+ 'lisp' => array('lisp'),
+ 'lua' => array('lua'),
+ 'matlab' => array('m'),
+ 'mpasm' => array(),
+ 'mysql' => array('sql'),
+ 'nsis' => array(),
+ 'objc' => array(),
+ 'oobas' => array(),
+ 'oracle8' => array(),
+ 'oracle10' => array(),
+ 'pascal' => array('pas'),
+ 'perl' => array('pl', 'pm'),
+ 'php' => array('php', 'php5', 'phtml', 'phps'),
+ 'povray' => array('pov'),
+ 'providex' => array('pvc', 'pvx'),
+ 'prolog' => array('pl'),
+ 'python' => array('py'),
+ 'qbasic' => array('bi'),
+ 'reg' => array('reg'),
+ 'ruby' => array('rb'),
+ 'sas' => array('sas'),
+ 'scala' => array('scala'),
+ 'scheme' => array('scm'),
+ 'scilab' => array('sci'),
+ 'smalltalk' => array('st'),
+ 'smarty' => array(),
+ 'tcl' => array('tcl'),
+ 'text' => array('txt'),
+ 'vb' => array('bas'),
+ 'vbnet' => array(),
+ 'visualfoxpro' => array(),
+ 'whitespace' => array('ws'),
+ 'xml' => array('xml', 'svg', 'xrc'),
+ 'z80' => array('z80', 'asm', 'inc')
+ );
+ }
+
+ foreach ($lookup as $lang => $extensions) {
+ if (in_array($extension, $extensions)) {
+ return $lang;
+ }
+ }
+
+ return 'text';
+ }
+
+ /**
+ * Given a file name, this method loads its contents in, and attempts
+ * to set the language automatically. An optional lookup table can be
+ * passed for looking up the language name. If not specified a default
+ * table is used
+ *
+ * The language table is in the form
+ * <pre>array(
+ * 'lang_name' => array('extension', 'extension', ...),
+ * 'lang_name' ...
+ * );</pre>
+ *
+ * @param string The filename to load the source from
+ * @param array A lookup array to use instead of the default one
+ * @todo Complete rethink of this and above method
+ * @since 1.0.5
+ */
+ function load_from_file($file_name, $lookup = array()) {
+ if (is_readable($file_name)) {
+ $this->set_source(file_get_contents($file_name));
+ $this->set_language($this->get_language_name_from_extension(substr(strrchr($file_name, '.'), 1), $lookup));
+ } else {
+ $this->error = GESHI_ERROR_FILE_NOT_READABLE;
+ }
+ }
+
+ /**
+ * Adds a keyword to a keyword group for highlighting
+ *
+ * @param int The key of the keyword group to add the keyword to
+ * @param string The word to add to the keyword group
+ * @since 1.0.0
+ */
+ function add_keyword($key, $word) {
+ if (!is_array($this->language_data['KEYWORDS'][$key])) {
+ $this->language_data['KEYWORDS'][$key] = array();
+ }
+ if (!in_array($word, $this->language_data['KEYWORDS'][$key])) {
+ $this->language_data['KEYWORDS'][$key][] = $word;
+
+ //NEW in 1.0.8 don't recompile the whole optimized regexp, simply append it
+ if ($this->parse_cache_built) {
+ $subkey = count($this->language_data['CACHED_KEYWORD_LISTS'][$key]) - 1;
+ $this->language_data['CACHED_KEYWORD_LISTS'][$key][$subkey] .= '|' . preg_quote($word, '/');
+ }
+ }
+ }
+
+ /**
+ * Removes a keyword from a keyword group
+ *
+ * @param int The key of the keyword group to remove the keyword from
+ * @param string The word to remove from the keyword group
+ * @param bool Wether to automatically recompile the optimized regexp list or not.
+ * Note: if you set this to false and @see GeSHi->parse_code() was already called once,
+ * for the current language, you have to manually call @see GeSHi->optimize_keyword_group()
+ * or the removed keyword will stay in cache and still be highlighted! On the other hand
+ * it might be too expensive to recompile the regexp list for every removal if you want to
+ * remove a lot of keywords.
+ * @since 1.0.0
+ */
+ function remove_keyword($key, $word, $recompile = true) {
+ $key_to_remove = array_search($word, $this->language_data['KEYWORDS'][$key]);
+ if ($key_to_remove !== false) {
+ unset($this->language_data['KEYWORDS'][$key][$key_to_remove]);
+
+ //NEW in 1.0.8, optionally recompile keyword group
+ if ($recompile && $this->parse_cache_built) {
+ $this->optimize_keyword_group($key);
+ }
+ }
+ }
+
+ /**
+ * Creates a new keyword group
+ *
+ * @param int The key of the keyword group to create
+ * @param string The styles for the keyword group
+ * @param boolean Whether the keyword group is case sensitive ornot
+ * @param array The words to use for the keyword group
+ * @since 1.0.0
+ */
+ function add_keyword_group($key, $styles, $case_sensitive = true, $words = array()) {
+ $words = (array) $words;
+ if (empty($words)) {
+ // empty word lists mess up highlighting
+ return false;
+ }
+
+ //Add the new keyword group internally
+ $this->language_data['KEYWORDS'][$key] = $words;
+ $this->lexic_permissions['KEYWORDS'][$key] = true;
+ $this->language_data['CASE_SENSITIVE'][$key] = $case_sensitive;
+ $this->language_data['STYLES']['KEYWORDS'][$key] = $styles;
+
+ //NEW in 1.0.8, cache keyword regexp
+ if ($this->parse_cache_built) {
+ $this->optimize_keyword_group($key);
+ }
+ }
+
+ /**
+ * Removes a keyword group
+ *
+ * @param int The key of the keyword group to remove
+ * @since 1.0.0
+ */
+ function remove_keyword_group ($key) {
+ //Remove the keyword group internally
+ unset($this->language_data['KEYWORDS'][$key]);
+ unset($this->lexic_permissions['KEYWORDS'][$key]);
+ unset($this->language_data['CASE_SENSITIVE'][$key]);
+ unset($this->language_data['STYLES']['KEYWORDS'][$key]);
+
+ //NEW in 1.0.8
+ unset($this->language_data['CACHED_KEYWORD_LISTS'][$key]);
+ }
+
+ /**
+ * compile optimized regexp list for keyword group
+ *
+ * @param int The key of the keyword group to compile & optimize
+ * @since 1.0.8
+ */
+ function optimize_keyword_group($key) {
+ $this->language_data['CACHED_KEYWORD_LISTS'][$key] =
+ $this->optimize_regexp_list($this->language_data['KEYWORDS'][$key]);
+ $space_as_whitespace = false;
+ if(isset($this->language_data['PARSER_CONTROL'])) {
+ if(isset($this->language_data['PARSER_CONTROL']['KEYWORDS'])) {
+ if(isset($this->language_data['PARSER_CONTROL']['KEYWORDS']['SPACE_AS_WHITESPACE'])) {
+ $space_as_whitespace = $this->language_data['PARSER_CONTROL']['KEYWORDS']['SPACE_AS_WHITESPACE'];
+ }
+ if(isset($this->language_data['PARSER_CONTROL']['KEYWORDS'][$key]['SPACE_AS_WHITESPACE'])) {
+ if(isset($this->language_data['PARSER_CONTROL']['KEYWORDS'][$key]['SPACE_AS_WHITESPACE'])) {
+ $space_as_whitespace = $this->language_data['PARSER_CONTROL']['KEYWORDS'][$key]['SPACE_AS_WHITESPACE'];
+ }
+ }
+ }
+ }
+ if($space_as_whitespace) {
+ foreach($this->language_data['CACHED_KEYWORD_LISTS'][$key] as $rxk => $rxv) {
+ $this->language_data['CACHED_KEYWORD_LISTS'][$key][$rxk] =
+ str_replace(" ", "\\s+", $rxv);
+ }
+ }
+ }
+
+ /**
+ * Sets the content of the header block
+ *
+ * @param string The content of the header block
+ * @since 1.0.2
+ */
+ function set_header_content($content) {
+ $this->header_content = $content;
+ }
+
+ /**
+ * Sets the content of the footer block
+ *
+ * @param string The content of the footer block
+ * @since 1.0.2
+ */
+ function set_footer_content($content) {
+ $this->footer_content = $content;
+ }
+
+ /**
+ * Sets the style for the header content
+ *
+ * @param string The style for the header content
+ * @since 1.0.2
+ */
+ function set_header_content_style($style) {
+ $this->header_content_style = $style;
+ }
+
+ /**
+ * Sets the style for the footer content
+ *
+ * @param string The style for the footer content
+ * @since 1.0.2
+ */
+ function set_footer_content_style($style) {
+ $this->footer_content_style = $style;
+ }
+
+ /**
+ * Sets whether to force a surrounding block around
+ * the highlighted code or not
+ *
+ * @param boolean Tells whether to enable or disable this feature
+ * @since 1.0.7.20
+ */
+ function enable_inner_code_block($flag) {
+ $this->force_code_block = (bool)$flag;
+ }
+
+ /**
+ * Sets the base URL to be used for keywords
+ *
+ * @param int The key of the keyword group to set the URL for
+ * @param string The URL to set for the group. If {FNAME} is in
+ * the url somewhere, it is replaced by the keyword
+ * that the URL is being made for
+ * @since 1.0.2
+ */
+ function set_url_for_keyword_group($group, $url) {
+ $this->language_data['URLS'][$group] = $url;
+ }
+
+ /**
+ * Sets styles for links in code
+ *
+ * @param int A constant that specifies what state the style is being
+ * set for - e.g. :hover or :visited
+ * @param string The styles to use for that state
+ * @since 1.0.2
+ */
+ function set_link_styles($type, $styles) {
+ $this->link_styles[$type] = $styles;
+ }
+
+ /**
+ * Sets the target for links in code
+ *
+ * @param string The target for links in the code, e.g. _blank
+ * @since 1.0.3
+ */
+ function set_link_target($target) {
+ if (!$target) {
+ $this->link_target = '';
+ } else {
+ $this->link_target = ' target="' . $target . '"';
+ }
+ }
+
+ /**
+ * Sets styles for important parts of the code
+ *
+ * @param string The styles to use on important parts of the code
+ * @since 1.0.2
+ */
+ function set_important_styles($styles) {
+ $this->important_styles = $styles;
+ }
+
+ /**
+ * Sets whether context-important blocks are highlighted
+ *
+ * @param boolean Tells whether to enable or disable highlighting of important blocks
+ * @todo REMOVE THIS SHIZ FROM GESHI!
+ * @deprecated
+ * @since 1.0.2
+ */
+ function enable_important_blocks($flag) {
+ $this->enable_important_blocks = ( $flag ) ? true : false;
+ }
+
+ /**
+ * Whether CSS IDs should be added to each line
+ *
+ * @param boolean If true, IDs will be added to each line.
+ * @since 1.0.2
+ */
+ function enable_ids($flag = true) {
+ $this->add_ids = ($flag) ? true : false;
+ }
+
+ /**
+ * Specifies which lines to highlight extra
+ *
+ * The extra style parameter was added in 1.0.7.21.
+ *
+ * @param mixed An array of line numbers to highlight, or just a line
+ * number on its own.
+ * @param string A string specifying the style to use for this line.
+ * If null is specified, the default style is used.
+ * If false is specified, the line will be removed from
+ * special highlighting
+ * @since 1.0.2
+ * @todo Some data replication here that could be cut down on
+ */
+ function highlight_lines_extra($lines, $style = null) {
+ if (is_array($lines)) {
+ //Split up the job using single lines at a time
+ foreach ($lines as $line) {
+ $this->highlight_lines_extra($line, $style);
+ }
+ } else {
+ //Mark the line as being highlighted specially
+ $lines = intval($lines);
+ $this->highlight_extra_lines[$lines] = $lines;
+
+ //Decide on which style to use
+ if ($style === null) { //Check if we should use default style
+ unset($this->highlight_extra_lines_styles[$lines]);
+ } elseif ($style === false) { //Check if to remove this line
+ unset($this->highlight_extra_lines[$lines]);
+ unset($this->highlight_extra_lines_styles[$lines]);
+ } else {
+ $this->highlight_extra_lines_styles[$lines] = $style;
+ }
+ }
+ }
+
+ /**
+ * Sets the style for extra-highlighted lines
+ *
+ * @param string The style for extra-highlighted lines
+ * @since 1.0.2
+ */
+ function set_highlight_lines_extra_style($styles) {
+ $this->highlight_extra_lines_style = $styles;
+ }
+
+ /**
+ * Sets the line-ending
+ *
+ * @param string The new line-ending
+ * @since 1.0.2
+ */
+ function set_line_ending($line_ending) {
+ $this->line_ending = (string)$line_ending;
+ }
+
+ /**
+ * Sets what number line numbers should start at. Should
+ * be a positive integer, and will be converted to one.
+ *
+ * <b>Warning:</b> Using this method will add the "start"
+ * attribute to the &lt;ol&gt; that is used for line numbering.
+ * This is <b>not</b> valid XHTML strict, so if that's what you
+ * care about then don't use this method. Firefox is getting
+ * support for the CSS method of doing this in 1.1 and Opera
+ * has support for the CSS method, but (of course) IE doesn't
+ * so it's not worth doing it the CSS way yet.
+ *
+ * @param int The number to start line numbers at
+ * @since 1.0.2
+ */
+ function start_line_numbers_at($number) {
+ $this->line_numbers_start = abs(intval($number));
+ }
+
+ /**
+ * Sets the encoding used for htmlspecialchars(), for international
+ * support.
+ *
+ * NOTE: This is not needed for now because htmlspecialchars() is not
+ * being used (it has a security hole in PHP4 that has not been patched).
+ * Maybe in a future version it may make a return for speed reasons, but
+ * I doubt it.
+ *
+ * @param string The encoding to use for the source
+ * @since 1.0.3
+ */
+ function set_encoding($encoding) {
+ if ($encoding) {
+ $this->encoding = strtolower($encoding);
+ }
+ }
+
+ /**
+ * Turns linking of keywords on or off.
+ *
+ * @param boolean If true, links will be added to keywords
+ * @since 1.0.2
+ */
+ function enable_keyword_links($enable = true) {
+ $this->keyword_links = (bool) $enable;
+ }
+
+ /**
+ * Setup caches needed for styling. This is automatically called in
+ * parse_code() and get_stylesheet() when appropriate. This function helps
+ * stylesheet generators as they rely on some style information being
+ * preprocessed
+ *
+ * @since 1.0.8
+ * @access private
+ */
+ function build_style_cache() {
+ //Build the style cache needed to highlight numbers appropriate
+ if($this->lexic_permissions['NUMBERS']) {
+ //First check what way highlighting information for numbers are given
+ if(!isset($this->language_data['NUMBERS'])) {
+ $this->language_data['NUMBERS'] = 0;
+ }
+
+ if(is_array($this->language_data['NUMBERS'])) {
+ $this->language_data['NUMBERS_CACHE'] = $this->language_data['NUMBERS'];
+ } else {
+ $this->language_data['NUMBERS_CACHE'] = array();
+ if(!$this->language_data['NUMBERS']) {
+ $this->language_data['NUMBERS'] =
+ GESHI_NUMBER_INT_BASIC |
+ GESHI_NUMBER_FLT_NONSCI;
+ }
+
+ for($i = 0, $j = $this->language_data['NUMBERS']; $j > 0; ++$i, $j>>=1) {
+ //Rearrange style indices if required ...
+ if(isset($this->language_data['STYLES']['NUMBERS'][1<<$i])) {
+ $this->language_data['STYLES']['NUMBERS'][$i] =
+ $this->language_data['STYLES']['NUMBERS'][1<<$i];
+ unset($this->language_data['STYLES']['NUMBERS'][1<<$i]);
+ }
+
+ //Check if this bit is set for highlighting
+ if($j&1) {
+ //So this bit is set ...
+ //Check if it belongs to group 0 or the actual stylegroup
+ if(isset($this->language_data['STYLES']['NUMBERS'][$i])) {
+ $this->language_data['NUMBERS_CACHE'][$i] = 1 << $i;
+ } else {
+ if(!isset($this->language_data['NUMBERS_CACHE'][0])) {
+ $this->language_data['NUMBERS_CACHE'][0] = 0;
+ }
+ $this->language_data['NUMBERS_CACHE'][0] |= 1 << $i;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Setup caches needed for parsing. This is automatically called in parse_code() when appropriate.
+ * This function makes stylesheet generators much faster as they do not need these caches.
+ *
+ * @since 1.0.8
+ * @access private
+ */
+ function build_parse_cache() {
+ // cache symbol regexp
+ //As this is a costy operation, we avoid doing it for multiple groups ...
+ //Instead we perform it for all symbols at once.
+ //
+ //For this to work, we need to reorganize the data arrays.
+ if ($this->lexic_permissions['SYMBOLS'] && !empty($this->language_data['SYMBOLS'])) {
+ $this->language_data['MULTIPLE_SYMBOL_GROUPS'] = count($this->language_data['STYLES']['SYMBOLS']) > 1;
+
+ $this->language_data['SYMBOL_DATA'] = array();
+ $symbol_preg_multi = array(); // multi char symbols
+ $symbol_preg_single = array(); // single char symbols
+ foreach ($this->language_data['SYMBOLS'] as $key => $symbols) {
+ if (is_array($symbols)) {
+ foreach ($symbols as $sym) {
+ $sym = $this->hsc($sym);
+ if (!isset($this->language_data['SYMBOL_DATA'][$sym])) {
+ $this->language_data['SYMBOL_DATA'][$sym] = $key;
+ if (isset($sym[1])) { // multiple chars
+ $symbol_preg_multi[] = preg_quote($sym, '/');
+ } else { // single char
+ if ($sym == '-') {
+ // don't trigger range out of order error
+ $symbol_preg_single[] = '\-';
+ } else {
+ $symbol_preg_single[] = preg_quote($sym, '/');
+ }
+ }
+ }
+ }
+ } else {
+ $symbols = $this->hsc($symbols);
+ if (!isset($this->language_data['SYMBOL_DATA'][$symbols])) {
+ $this->language_data['SYMBOL_DATA'][$symbols] = 0;
+ if (isset($symbols[1])) { // multiple chars
+ $symbol_preg_multi[] = preg_quote($symbols, '/');
+ } elseif ($symbols == '-') {
+ // don't trigger range out of order error
+ $symbol_preg_single[] = '\-';
+ } else { // single char
+ $symbol_preg_single[] = preg_quote($symbols, '/');
+ }
+ }
+ }
+ }
+
+ //Now we have an array with each possible symbol as the key and the style as the actual data.
+ //This way we can set the correct style just the moment we highlight ...
+ //
+ //Now we need to rewrite our array to get a search string that
+ $symbol_preg = array();
+ if (!empty($symbol_preg_multi)) {
+ rsort($symbol_preg_multi);
+ $symbol_preg[] = implode('|', $symbol_preg_multi);
+ }
+ if (!empty($symbol_preg_single)) {
+ rsort($symbol_preg_single);
+ $symbol_preg[] = '[' . implode('', $symbol_preg_single) . ']';
+ }
+ $this->language_data['SYMBOL_SEARCH'] = implode("|", $symbol_preg);
+ }
+
+ // cache optimized regexp for keyword matching
+ // remove old cache
+ $this->language_data['CACHED_KEYWORD_LISTS'] = array();
+ foreach (array_keys($this->language_data['KEYWORDS']) as $key) {
+ if (!isset($this->lexic_permissions['KEYWORDS'][$key]) ||
+ $this->lexic_permissions['KEYWORDS'][$key]) {
+ $this->optimize_keyword_group($key);
+ }
+ }
+
+ // brackets
+ if ($this->lexic_permissions['BRACKETS']) {
+ $this->language_data['CACHE_BRACKET_MATCH'] = array('[', ']', '(', ')', '{', '}');
+ if (!$this->use_classes && isset($this->language_data['STYLES']['BRACKETS'][0])) {
+ $this->language_data['CACHE_BRACKET_REPLACE'] = array(
+ '<| style="' . $this->language_data['STYLES']['BRACKETS'][0] . '">&#91;|>',
+ '<| style="' . $this->language_data['STYLES']['BRACKETS'][0] . '">&#93;|>',
+ '<| style="' . $this->language_data['STYLES']['BRACKETS'][0] . '">&#40;|>',
+ '<| style="' . $this->language_data['STYLES']['BRACKETS'][0] . '">&#41;|>',
+ '<| style="' . $this->language_data['STYLES']['BRACKETS'][0] . '">&#123;|>',
+ '<| style="' . $this->language_data['STYLES']['BRACKETS'][0] . '">&#125;|>',
+ );
+ }
+ else {
+ $this->language_data['CACHE_BRACKET_REPLACE'] = array(
+ '<| class="br0">&#91;|>',
+ '<| class="br0">&#93;|>',
+ '<| class="br0">&#40;|>',
+ '<| class="br0">&#41;|>',
+ '<| class="br0">&#123;|>',
+ '<| class="br0">&#125;|>',
+ );
+ }
+ }
+
+ //Build the parse cache needed to highlight numbers appropriate
+ if($this->lexic_permissions['NUMBERS']) {
+ //Check if the style rearrangements have been processed ...
+ //This also does some preprocessing to check which style groups are useable ...
+ if(!isset($this->language_data['NUMBERS_CACHE'])) {
+ $this->build_style_cache();
+ }
+
+ //Number format specification
+ //All this formats are matched case-insensitively!
+ static $numbers_format = array(
+ GESHI_NUMBER_INT_BASIC =>
+ '(?:(?<![0-9a-z_\.%$@])|(?<=\.\.))(?<![\d\.]e[+\-])([1-9]\d*?|0)(?![0-9a-z]|\.(?:[eE][+\-]?)?\d)',
+ GESHI_NUMBER_INT_CSTYLE =>
+ '(?<![0-9a-z_\.%])(?<![\d\.]e[+\-])([1-9]\d*?|0)l(?![0-9a-z]|\.(?:[eE][+\-]?)?\d)',
+ GESHI_NUMBER_BIN_SUFFIX =>
+ '(?<![0-9a-z_\.])(?<![\d\.]e[+\-])[01]+?[bB](?![0-9a-z]|\.(?:[eE][+\-]?)?\d)',
+ GESHI_NUMBER_BIN_PREFIX_PERCENT =>
+ '(?<![0-9a-z_\.%])(?<![\d\.]e[+\-])%[01]+?(?![0-9a-z]|\.(?:[eE][+\-]?)?\d)',
+ GESHI_NUMBER_BIN_PREFIX_0B =>
+ '(?<![0-9a-z_\.%])(?<![\d\.]e[+\-])0b[01]+?(?![0-9a-z]|\.(?:[eE][+\-]?)?\d)',
+ GESHI_NUMBER_OCT_PREFIX =>
+ '(?<![0-9a-z_\.])(?<![\d\.]e[+\-])0[0-7]+?(?![0-9a-z]|\.(?:[eE][+\-]?)?\d)',
+ GESHI_NUMBER_OCT_PREFIX_0O =>
+ '(?<![0-9a-z_\.%])(?<![\d\.]e[+\-])0o[0-7]+?(?![0-9a-z]|\.(?:[eE][+\-]?)?\d)',
+ GESHI_NUMBER_OCT_PREFIX_AT =>
+ '(?<![0-9a-z_\.%])(?<![\d\.]e[+\-])\@[0-7]+?(?![0-9a-z]|\.(?:[eE][+\-]?)?\d)',
+ GESHI_NUMBER_OCT_SUFFIX =>
+ '(?<![0-9a-z_\.])(?<![\d\.]e[+\-])[0-7]+?o(?![0-9a-z]|\.(?:[eE][+\-]?)?\d)',
+ GESHI_NUMBER_HEX_PREFIX =>
+ '(?<![0-9a-z_\.])(?<![\d\.]e[+\-])0x[0-9a-fA-F]+?(?![0-9a-z]|\.(?:[eE][+\-]?)?\d)',
+ GESHI_NUMBER_HEX_PREFIX_DOLLAR =>
+ '(?<![0-9a-z_\.])(?<![\d\.]e[+\-])\$[0-9a-fA-F]+?(?![0-9a-z]|\.(?:[eE][+\-]?)?\d)',
+ GESHI_NUMBER_HEX_SUFFIX =>
+ '(?<![0-9a-z_\.])(?<![\d\.]e[+\-])\d[0-9a-fA-F]*?[hH](?![0-9a-z]|\.(?:[eE][+\-]?)?\d)',
+ GESHI_NUMBER_FLT_NONSCI =>
+ '(?<![0-9a-z_\.])(?<![\d\.]e[+\-])\d+?\.\d+?(?![0-9a-z]|\.(?:[eE][+\-]?)?\d)',
+ GESHI_NUMBER_FLT_NONSCI_F =>
+ '(?<![0-9a-z_\.])(?<![\d\.]e[+\-])(?:\d+?(?:\.\d*?)?|\.\d+?)f(?![0-9a-z]|\.(?:[eE][+\-]?)?\d)',
+ GESHI_NUMBER_FLT_SCI_SHORT =>
+ '(?<![0-9a-z_\.])(?<![\d\.]e[+\-])\.\d+?(?:e[+\-]?\d+?)?(?![0-9a-z]|\.(?:[eE][+\-]?)?\d)',
+ GESHI_NUMBER_FLT_SCI_ZERO =>
+ '(?<![0-9a-z_\.])(?<![\d\.]e[+\-])(?:\d+?(?:\.\d*?)?|\.\d+?)(?:e[+\-]?\d+?)?(?![0-9a-z]|\.(?:[eE][+\-]?)?\d)'
+ );
+
+ //At this step we have an associative array with flag groups for a
+ //specific style or an string denoting a regexp given its index.
+ $this->language_data['NUMBERS_RXCACHE'] = array();
+ foreach($this->language_data['NUMBERS_CACHE'] as $key => $rxdata) {
+ if(is_string($rxdata)) {
+ $regexp = $rxdata;
+ } else {
+ //This is a bitfield of number flags to highlight:
+ //Build an array, implode them together and make this the actual RX
+ $rxuse = array();
+ for($i = 1; $i <= $rxdata; $i<<=1) {
+ if($rxdata & $i) {
+ $rxuse[] = $numbers_format[$i];
+ }
+ }
+ $regexp = implode("|", $rxuse);
+ }
+
+ $this->language_data['NUMBERS_RXCACHE'][$key] =
+ "/(?<!<\|\/)(?<!<\|!REG3XP)(?<!<\|\/NUM!)(?<!\d\/>)($regexp)(?!(?:<DOT>|(?>[^\<]))+>)(?![^<]*>)(?!\|>)(?!\/>)/i"; //
+ }
+
+ if(!isset($this->language_data['PARSER_CONTROL']['NUMBERS']['PRECHECK_RX'])) {
+ $this->language_data['PARSER_CONTROL']['NUMBERS']['PRECHECK_RX'] = '#\d#';
+ }
+ }
+
+ $this->parse_cache_built = true;
+ }
+
+ /**
+ * Returns the code in $this->source, highlighted and surrounded by the
+ * nessecary HTML.
+ *
+ * This should only be called ONCE, cos it's SLOW! If you want to highlight
+ * the same source multiple times, you're better off doing a whole lot of
+ * str_replaces to replace the &lt;span&gt;s
+ *
+ * @since 1.0.0
+ */
+ function parse_code () {
+ // Start the timer
+ $start_time = microtime();
+
+ // Replace all newlines to a common form.
+ $code = str_replace("\r\n", "\n", $this->source);
+ $code = str_replace("\r", "\n", $code);
+
+ // Firstly, if there is an error, we won't highlight
+ if ($this->error) {
+ //Escape the source for output
+ $result = $this->hsc($this->source);
+
+ //This fix is related to SF#1923020, but has to be applied regardless of
+ //actually highlighting symbols.
+ $result = str_replace(array('<SEMI>', '<PIPE>'), array(';', '|'), $result);
+
+ // Timing is irrelevant
+ $this->set_time($start_time, $start_time);
+ $this->finalise($result);
+ return $result;
+ }
+
+ // make sure the parse cache is up2date
+ if (!$this->parse_cache_built) {
+ $this->build_parse_cache();
+ }
+
+ // Initialise various stuff
+ $length = strlen($code);
+ $COMMENT_MATCHED = false;
+ $stuff_to_parse = '';
+ $endresult = '';
+
+ // "Important" selections are handled like multiline comments
+ // @todo GET RID OF THIS SHIZ
+ if ($this->enable_important_blocks) {
+ $this->language_data['COMMENT_MULTI'][GESHI_START_IMPORTANT] = GESHI_END_IMPORTANT;
+ }
+
+ if ($this->strict_mode) {
+ // Break the source into bits. Each bit will be a portion of the code
+ // within script delimiters - for example, HTML between < and >
+ $k = 0;
+ $parts = array();
+ $matches = array();
+ $next_match_pointer = null;
+ // we use a copy to unset delimiters on demand (when they are not found)
+ $delim_copy = $this->language_data['SCRIPT_DELIMITERS'];
+ $i = 0;
+ while ($i < $length) {
+ $next_match_pos = $length + 1; // never true
+ foreach ($delim_copy as $dk => $delimiters) {
+ if(is_array($delimiters)) {
+ foreach ($delimiters as $open => $close) {
+ // make sure the cache is setup properly
+ if (!isset($matches[$dk][$open])) {
+ $matches[$dk][$open] = array(
+ 'next_match' => -1,
+ 'dk' => $dk,
+
+ 'open' => $open, // needed for grouping of adjacent code blocks (see below)
+ 'open_strlen' => strlen($open),
+
+ 'close' => $close,
+ 'close_strlen' => strlen($close),
+ );
+ }
+ // Get the next little bit for this opening string
+ if ($matches[$dk][$open]['next_match'] < $i) {
+ // only find the next pos if it was not already cached
+ $open_pos = strpos($code, $open, $i);
+ if ($open_pos === false) {
+ // no match for this delimiter ever
+ unset($delim_copy[$dk][$open]);
+ continue;
+ }
+ $matches[$dk][$open]['next_match'] = $open_pos;
+ }
+ if ($matches[$dk][$open]['next_match'] < $next_match_pos) {
+ //So we got a new match, update the close_pos
+ $matches[$dk][$open]['close_pos'] =
+ strpos($code, $close, $matches[$dk][$open]['next_match']+1);
+
+ $next_match_pointer =& $matches[$dk][$open];
+ $next_match_pos = $matches[$dk][$open]['next_match'];
+ }
+ }
+ } else {
+ //So we should match an RegExp as Strict Block ...
+ /**
+ * The value in $delimiters is expected to be an RegExp
+ * containing exactly 2 matching groups:
+ * - Group 1 is the opener
+ * - Group 2 is the closer
+ */
+ if(!GESHI_PHP_PRE_433 && //Needs proper rewrite to work with PHP >=4.3.0; 4.3.3 is guaranteed to work.
+ preg_match($delimiters, $code, $matches_rx, PREG_OFFSET_CAPTURE, $i)) {
+ //We got a match ...
+ if(isset($matches_rx['start']) && isset($matches_rx['end']))
+ {
+ $matches[$dk] = array(
+ 'next_match' => $matches_rx['start'][1],
+ 'dk' => $dk,
+
+ 'close_strlen' => strlen($matches_rx['end'][0]),
+ 'close_pos' => $matches_rx['end'][1],
+ );
+ } else {
+ $matches[$dk] = array(
+ 'next_match' => $matches_rx[1][1],
+ 'dk' => $dk,
+
+ 'close_strlen' => strlen($matches_rx[2][0]),
+ 'close_pos' => $matches_rx[2][1],
+ );
+ }
+ } else {
+ // no match for this delimiter ever
+ unset($delim_copy[$dk]);
+ continue;
+ }
+
+ if ($matches[$dk]['next_match'] <= $next_match_pos) {
+ $next_match_pointer =& $matches[$dk];
+ $next_match_pos = $matches[$dk]['next_match'];
+ }
+ }
+ }
+
+ // non-highlightable text
+ $parts[$k] = array(
+ 1 => substr($code, $i, $next_match_pos - $i)
+ );
+ ++$k;
+
+ if ($next_match_pos > $length) {
+ // out of bounds means no next match was found
+ break;
+ }
+
+ // highlightable code
+ $parts[$k][0] = $next_match_pointer['dk'];
+
+ //Only combine for non-rx script blocks
+ if(is_array($delim_copy[$next_match_pointer['dk']])) {
+ // group adjacent script blocks, e.g. <foobar><asdf> should be one block, not three!
+ $i = $next_match_pos + $next_match_pointer['open_strlen'];
+ while (true) {
+ $close_pos = strpos($code, $next_match_pointer['close'], $i);
+ if ($close_pos == false) {
+ break;
+ }
+ $i = $close_pos + $next_match_pointer['close_strlen'];
+ if ($i == $length) {
+ break;
+ }
+ if ($code[$i] == $next_match_pointer['open'][0] && ($next_match_pointer['open_strlen'] == 1 ||
+ substr($code, $i, $next_match_pointer['open_strlen']) == $next_match_pointer['open'])) {
+ // merge adjacent but make sure we don't merge things like <tag><!-- comment -->
+ foreach ($matches as $submatches) {
+ foreach ($submatches as $match) {
+ if ($match['next_match'] == $i) {
+ // a different block already matches here!
+ break 3;
+ }
+ }
+ }
+ } else {
+ break;
+ }
+ }
+ } else {
+ $close_pos = $next_match_pointer['close_pos'] + $next_match_pointer['close_strlen'];
+ $i = $close_pos;
+ }
+
+ if ($close_pos === false) {
+ // no closing delimiter found!
+ $parts[$k][1] = substr($code, $next_match_pos);
+ ++$k;
+ break;
+ } else {
+ $parts[$k][1] = substr($code, $next_match_pos, $i - $next_match_pos);
+ ++$k;
+ }
+ }
+ unset($delim_copy, $next_match_pointer, $next_match_pos, $matches);
+ $num_parts = $k;
+
+ if ($num_parts == 1 && $this->strict_mode == GESHI_MAYBE) {
+ // when we have only one part, we don't have anything to highlight at all.
+ // if we have a "maybe" strict language, this should be handled as highlightable code
+ $parts = array(
+ 0 => array(
+ 0 => '',
+ 1 => ''
+ ),
+ 1 => array(
+ 0 => null,
+ 1 => $parts[0][1]
+ )
+ );
+ $num_parts = 2;
+ }
+
+ } else {
+ // Not strict mode - simply dump the source into
+ // the array at index 1 (the first highlightable block)
+ $parts = array(
+ 0 => array(
+ 0 => '',
+ 1 => ''
+ ),
+ 1 => array(
+ 0 => null,
+ 1 => $code
+ )
+ );
+ $num_parts = 2;
+ }
+
+ //Unset variables we won't need any longer
+ unset($code);
+
+ //Preload some repeatedly used values regarding hardquotes ...
+ $hq = isset($this->language_data['HARDQUOTE']) ? $this->language_data['HARDQUOTE'][0] : false;
+ $hq_strlen = strlen($hq);
+
+ //Preload if line numbers are to be generated afterwards
+ //Added a check if line breaks should be forced even without line numbers, fixes SF#1727398
+ $check_linenumbers = $this->line_numbers != GESHI_NO_LINE_NUMBERS ||
+ !empty($this->highlight_extra_lines) || !$this->allow_multiline_span;
+
+ //preload the escape char for faster checking ...
+ $escaped_escape_char = $this->hsc($this->language_data['ESCAPE_CHAR']);
+
+ // this is used for single-line comments
+ $sc_disallowed_before = "";
+ $sc_disallowed_after = "";
+
+ if (isset($this->language_data['PARSER_CONTROL'])) {
+ if (isset($this->language_data['PARSER_CONTROL']['COMMENTS'])) {
+ if (isset($this->language_data['PARSER_CONTROL']['COMMENTS']['DISALLOWED_BEFORE'])) {
+ $sc_disallowed_before = $this->language_data['PARSER_CONTROL']['COMMENTS']['DISALLOWED_BEFORE'];
+ }
+ if (isset($this->language_data['PARSER_CONTROL']['COMMENTS']['DISALLOWED_AFTER'])) {
+ $sc_disallowed_after = $this->language_data['PARSER_CONTROL']['COMMENTS']['DISALLOWED_AFTER'];
+ }
+ }
+ }
+
+ //Fix for SF#1932083: Multichar Quotemarks unsupported
+ $is_string_starter = array();
+ if ($this->lexic_permissions['STRINGS']) {
+ foreach ($this->language_data['QUOTEMARKS'] as $quotemark) {
+ if (!isset($is_string_starter[$quotemark[0]])) {
+ $is_string_starter[$quotemark[0]] = (string)$quotemark;
+ } elseif (is_string($is_string_starter[$quotemark[0]])) {
+ $is_string_starter[$quotemark[0]] = array(
+ $is_string_starter[$quotemark[0]],
+ $quotemark);
+ } else {
+ $is_string_starter[$quotemark[0]][] = $quotemark;
+ }
+ }
+ }
+
+ // Now we go through each part. We know that even-indexed parts are
+ // code that shouldn't be highlighted, and odd-indexed parts should
+ // be highlighted
+ for ($key = 0; $key < $num_parts; ++$key) {
+ $STRICTATTRS = '';
+
+ // If this block should be highlighted...
+ if (!($key & 1)) {
+ // Else not a block to highlight
+ $endresult .= $this->hsc($parts[$key][1]);
+ unset($parts[$key]);
+ continue;
+ }
+
+ $result = '';
+ $part = $parts[$key][1];
+
+ $highlight_part = true;
+ if ($this->strict_mode && !is_null($parts[$key][0])) {
+ // get the class key for this block of code
+ $script_key = $parts[$key][0];
+ $highlight_part = $this->language_data['HIGHLIGHT_STRICT_BLOCK'][$script_key];
+ if ($this->language_data['STYLES']['SCRIPT'][$script_key] != '' &&
+ $this->lexic_permissions['SCRIPT']) {
+ // Add a span element around the source to
+ // highlight the overall source block
+ if (!$this->use_classes &&
+ $this->language_data['STYLES']['SCRIPT'][$script_key] != '') {
+ $attributes = ' style="' . $this->language_data['STYLES']['SCRIPT'][$script_key] . '"';
+ } else {
+ $attributes = ' class="sc' . $script_key . '"';
+ }
+ $result .= "<span$attributes>";
+ $STRICTATTRS = $attributes;
+ }
+ }
+
+ if ($highlight_part) {
+ // Now, highlight the code in this block. This code
+ // is really the engine of GeSHi (along with the method
+ // parse_non_string_part).
+
+ // cache comment regexps incrementally
+ $next_comment_regexp_key = '';
+ $next_comment_regexp_pos = -1;
+ $next_comment_multi_pos = -1;
+ $next_comment_single_pos = -1;
+ $comment_regexp_cache_per_key = array();
+ $comment_multi_cache_per_key = array();
+ $comment_single_cache_per_key = array();
+ $next_open_comment_multi = '';
+ $next_comment_single_key = '';
+ $escape_regexp_cache_per_key = array();
+ $next_escape_regexp_key = '';
+ $next_escape_regexp_pos = -1;
+
+ $length = strlen($part);
+ for ($i = 0; $i < $length; ++$i) {
+ // Get the next char
+ $char = $part[$i];
+ $char_len = 1;
+
+ // update regexp comment cache if needed
+ if (isset($this->language_data['COMMENT_REGEXP']) && $next_comment_regexp_pos < $i) {
+ $next_comment_regexp_pos = $length;
+ foreach ($this->language_data['COMMENT_REGEXP'] as $comment_key => $regexp) {
+ $match_i = false;
+ if (isset($comment_regexp_cache_per_key[$comment_key]) &&
+ ($comment_regexp_cache_per_key[$comment_key]['pos'] >= $i ||
+ $comment_regexp_cache_per_key[$comment_key]['pos'] === false)) {
+ // we have already matched something
+ if ($comment_regexp_cache_per_key[$comment_key]['pos'] === false) {
+ // this comment is never matched
+ continue;
+ }
+ $match_i = $comment_regexp_cache_per_key[$comment_key]['pos'];
+ } elseif (
+ //This is to allow use of the offset parameter in preg_match and stay as compatible with older PHP versions as possible
+ (GESHI_PHP_PRE_433 && preg_match($regexp, substr($part, $i), $match, PREG_OFFSET_CAPTURE)) ||
+ (!GESHI_PHP_PRE_433 && preg_match($regexp, $part, $match, PREG_OFFSET_CAPTURE, $i))
+ ) {
+ $match_i = $match[0][1];
+ if (GESHI_PHP_PRE_433) {
+ $match_i += $i;
+ }
+
+ $comment_regexp_cache_per_key[$comment_key] = array(
+ 'key' => $comment_key,
+ 'length' => strlen($match[0][0]),
+ 'pos' => $match_i
+ );
+ } else {
+ $comment_regexp_cache_per_key[$comment_key]['pos'] = false;
+ continue;
+ }
+
+ if ($match_i !== false && $match_i < $next_comment_regexp_pos) {
+ $next_comment_regexp_pos = $match_i;
+ $next_comment_regexp_key = $comment_key;
+ if ($match_i === $i) {
+ break;
+ }
+ }
+ }
+ }
+
+ $string_started = false;
+
+ if (isset($is_string_starter[$char])) {
+ // Possibly the start of a new string ...
+
+ //Check which starter it was ...
+ //Fix for SF#1932083: Multichar Quotemarks unsupported
+ if (is_array($is_string_starter[$char])) {
+ $char_new = '';
+ foreach ($is_string_starter[$char] as $testchar) {
+ if ($testchar === substr($part, $i, strlen($testchar)) &&
+ strlen($testchar) > strlen($char_new)) {
+ $char_new = $testchar;
+ $string_started = true;
+ }
+ }
+ if ($string_started) {
+ $char = $char_new;
+ }
+ } else {
+ $testchar = $is_string_starter[$char];
+ if ($testchar === substr($part, $i, strlen($testchar))) {
+ $char = $testchar;
+ $string_started = true;
+ }
+ }
+ $char_len = strlen($char);
+ }
+
+ if ($string_started && ($i != $next_comment_regexp_pos)) {
+ // Hand out the correct style information for this string
+ $string_key = array_search($char, $this->language_data['QUOTEMARKS']);
+ if (!isset($this->language_data['STYLES']['STRINGS'][$string_key]) ||
+ !isset($this->language_data['STYLES']['ESCAPE_CHAR'][$string_key])) {
+ $string_key = 0;
+ }
+
+ // parse the stuff before this
+ $result .= $this->parse_non_string_part($stuff_to_parse);
+ $stuff_to_parse = '';
+
+ if (!$this->use_classes) {
+ $string_attributes = ' style="' . $this->language_data['STYLES']['STRINGS'][$string_key] . '"';
+ } else {
+ $string_attributes = ' class="st'.$string_key.'"';
+ }
+
+ // now handle the string
+ $string = "<span$string_attributes>" . GeSHi::hsc($char);
+ $start = $i + $char_len;
+ $string_open = true;
+
+ if(empty($this->language_data['ESCAPE_REGEXP'])) {
+ $next_escape_regexp_pos = $length;
+ }
+
+ do {
+ //Get the regular ending pos ...
+ $close_pos = strpos($part, $char, $start);
+ if(false === $close_pos) {
+ $close_pos = $length;
+ }
+
+ if($this->lexic_permissions['ESCAPE_CHAR']) {
+ // update escape regexp cache if needed
+ if (isset($this->language_data['ESCAPE_REGEXP']) && $next_escape_regexp_pos < $start) {
+ $next_escape_regexp_pos = $length;
+ foreach ($this->language_data['ESCAPE_REGEXP'] as $escape_key => $regexp) {
+ $match_i = false;
+ if (isset($escape_regexp_cache_per_key[$escape_key]) &&
+ ($escape_regexp_cache_per_key[$escape_key]['pos'] >= $start ||
+ $escape_regexp_cache_per_key[$escape_key]['pos'] === false)) {
+ // we have already matched something
+ if ($escape_regexp_cache_per_key[$escape_key]['pos'] === false) {
+ // this comment is never matched
+ continue;
+ }
+ $match_i = $escape_regexp_cache_per_key[$escape_key]['pos'];
+ } elseif (
+ //This is to allow use of the offset parameter in preg_match and stay as compatible with older PHP versions as possible
+ (GESHI_PHP_PRE_433 && preg_match($regexp, substr($part, $start), $match, PREG_OFFSET_CAPTURE)) ||
+ (!GESHI_PHP_PRE_433 && preg_match($regexp, $part, $match, PREG_OFFSET_CAPTURE, $start))
+ ) {
+ $match_i = $match[0][1];
+ if (GESHI_PHP_PRE_433) {
+ $match_i += $start;
+ }
+
+ $escape_regexp_cache_per_key[$escape_key] = array(
+ 'key' => $escape_key,
+ 'length' => strlen($match[0][0]),
+ 'pos' => $match_i
+ );
+ } else {
+ $escape_regexp_cache_per_key[$escape_key]['pos'] = false;
+ continue;
+ }
+
+ if ($match_i !== false && $match_i < $next_escape_regexp_pos) {
+ $next_escape_regexp_pos = $match_i;
+ $next_escape_regexp_key = $escape_key;
+ if ($match_i === $start) {
+ break;
+ }
+ }
+ }
+ }
+
+ //Find the next simple escape position
+ if('' != $this->language_data['ESCAPE_CHAR']) {
+ $simple_escape = strpos($part, $this->language_data['ESCAPE_CHAR'], $start);
+ if(false === $simple_escape) {
+ $simple_escape = $length;
+ }
+ } else {
+ $simple_escape = $length;
+ }
+ } else {
+ $next_escape_regexp_pos = $length;
+ $simple_escape = $length;
+ }
+
+ if($simple_escape < $next_escape_regexp_pos &&
+ $simple_escape < $length &&
+ $simple_escape < $close_pos) {
+ //The nexxt escape sequence is a simple one ...
+ $es_pos = $simple_escape;
+
+ //Add the stuff not in the string yet ...
+ $string .= $this->hsc(substr($part, $start, $es_pos - $start));
+
+ //Get the style for this escaped char ...
+ if (!$this->use_classes) {
+ $escape_char_attributes = ' style="' . $this->language_data['STYLES']['ESCAPE_CHAR'][0] . '"';
+ } else {
+ $escape_char_attributes = ' class="es0"';
+ }
+
+ //Add the style for the escape char ...
+ $string .= "<span$escape_char_attributes>" .
+ GeSHi::hsc($this->language_data['ESCAPE_CHAR']);
+
+ //Get the byte AFTER the ESCAPE_CHAR we just found
+ $es_char = $part[$es_pos + 1];
+ if ($es_char == "\n") {
+ // don't put a newline around newlines
+ $string .= "</span>\n";
+ $start = $es_pos + 2;
+ } elseif (ord($es_char) >= 128) {
+ //This is an non-ASCII char (UTF8 or single byte)
+ //This code tries to work around SF#2037598 ...
+ if(function_exists('mb_substr')) {
+ $es_char_m = mb_substr(substr($part, $es_pos+1, 16), 0, 1, $this->encoding);
+ $string .= $es_char_m . '</span>';
+ } elseif (!GESHI_PHP_PRE_433 && 'utf-8' == $this->encoding) {
+ if(preg_match("/[\xC2-\xDF][\x80-\xBF]".
+ "|\xE0[\xA0-\xBF][\x80-\xBF]".
+ "|[\xE1-\xEC\xEE\xEF][\x80-\xBF]{2}".
+ "|\xED[\x80-\x9F][\x80-\xBF]".
+ "|\xF0[\x90-\xBF][\x80-\xBF]{2}".
+ "|[\xF1-\xF3][\x80-\xBF]{3}".
+ "|\xF4[\x80-\x8F][\x80-\xBF]{2}/s",
+ $part, $es_char_m, null, $es_pos + 1)) {
+ $es_char_m = $es_char_m[0];
+ } else {
+ $es_char_m = $es_char;
+ }
+ $string .= $this->hsc($es_char_m) . '</span>';
+ } else {
+ $es_char_m = $this->hsc($es_char);
+ }
+ $start = $es_pos + strlen($es_char_m) + 1;
+ } else {
+ $string .= $this->hsc($es_char) . '</span>';
+ $start = $es_pos + 2;
+ }
+ } elseif ($next_escape_regexp_pos < $length &&
+ $next_escape_regexp_pos < $close_pos) {
+ $es_pos = $next_escape_regexp_pos;
+ //Add the stuff not in the string yet ...
+ $string .= $this->hsc(substr($part, $start, $es_pos - $start));
+
+ //Get the key and length of this match ...
+ $escape = $escape_regexp_cache_per_key[$next_escape_regexp_key];
+ $escape_str = substr($part, $es_pos, $escape['length']);
+ $escape_key = $escape['key'];
+
+ //Get the style for this escaped char ...
+ if (!$this->use_classes) {
+ $escape_char_attributes = ' style="' . $this->language_data['STYLES']['ESCAPE_CHAR'][$escape_key] . '"';
+ } else {
+ $escape_char_attributes = ' class="es' . $escape_key . '"';
+ }
+
+ //Add the style for the escape char ...
+ $string .= "<span$escape_char_attributes>" .
+ $this->hsc($escape_str) . '</span>';
+
+ $start = $es_pos + $escape['length'];
+ } else {
+ //Copy the remainder of the string ...
+ $string .= $this->hsc(substr($part, $start, $close_pos - $start + $char_len)) . '</span>';
+ $start = $close_pos + $char_len;
+ $string_open = false;
+ }
+ } while($string_open);
+
+ if ($check_linenumbers) {
+ // Are line numbers used? If, we should end the string before
+ // the newline and begin it again (so when <li>s are put in the source
+ // remains XHTML compliant)
+ // note to self: This opens up possibility of config files specifying
+ // that languages can/cannot have multiline strings???
+ $string = str_replace("\n", "</span>\n<span$string_attributes>", $string);
+ }
+
+ $result .= $string;
+ $string = '';
+ $i = $start - 1;
+ continue;
+ } elseif ($this->lexic_permissions['STRINGS'] && $hq && $hq[0] == $char &&
+ substr($part, $i, $hq_strlen) == $hq && ($i != $next_comment_regexp_pos)) {
+ // The start of a hard quoted string
+ if (!$this->use_classes) {
+ $string_attributes = ' style="' . $this->language_data['STYLES']['STRINGS']['HARD'] . '"';
+ $escape_char_attributes = ' style="' . $this->language_data['STYLES']['ESCAPE_CHAR']['HARD'] . '"';
+ } else {
+ $string_attributes = ' class="st_h"';
+ $escape_char_attributes = ' class="es_h"';
+ }
+ // parse the stuff before this
+ $result .= $this->parse_non_string_part($stuff_to_parse);
+ $stuff_to_parse = '';
+
+ // now handle the string
+ $string = '';
+
+ // look for closing quote
+ $start = $i + $hq_strlen;
+ while ($close_pos = strpos($part, $this->language_data['HARDQUOTE'][1], $start)) {
+ $start = $close_pos + 1;
+ if ($this->lexic_permissions['ESCAPE_CHAR'] && $part[$close_pos - 1] == $this->language_data['HARDCHAR'] &&
+ (($i + $hq_strlen) != ($close_pos))) { //Support empty string for HQ escapes if Starter = Escape
+ // make sure this quote is not escaped
+ foreach ($this->language_data['HARDESCAPE'] as $hardescape) {
+ if (substr($part, $close_pos - 1, strlen($hardescape)) == $hardescape) {
+ // check wether this quote is escaped or if it is something like '\\'
+ $escape_char_pos = $close_pos - 1;
+ while ($escape_char_pos > 0
+ && $part[$escape_char_pos - 1] == $this->language_data['HARDCHAR']) {
+ --$escape_char_pos;
+ }
+ if (($close_pos - $escape_char_pos) & 1) {
+ // uneven number of escape chars => this quote is escaped
+ continue 2;
+ }
+ }
+ }
+ }
+
+ // found closing quote
+ break;
+ }
+
+ //Found the closing delimiter?
+ if (!$close_pos) {
+ // span till the end of this $part when no closing delimiter is found
+ $close_pos = $length;
+ }
+
+ //Get the actual string
+ $string = substr($part, $i, $close_pos - $i + 1);
+ $i = $close_pos;
+
+ // handle escape chars and encode html chars
+ // (special because when we have escape chars within our string they may not be escaped)
+ if ($this->lexic_permissions['ESCAPE_CHAR'] && $this->language_data['ESCAPE_CHAR']) {
+ $start = 0;
+ $new_string = '';
+ while ($es_pos = strpos($string, $this->language_data['ESCAPE_CHAR'], $start)) {
+ // hmtl escape stuff before
+ $new_string .= $this->hsc(substr($string, $start, $es_pos - $start));
+ // check if this is a hard escape
+ foreach ($this->language_data['HARDESCAPE'] as $hardescape) {
+ if (substr($string, $es_pos, strlen($hardescape)) == $hardescape) {
+ // indeed, this is a hardescape
+ $new_string .= "<span$escape_char_attributes>" .
+ $this->hsc($hardescape) . '</span>';
+ $start = $es_pos + strlen($hardescape);
+ continue 2;
+ }
+ }
+ // not a hard escape, but a normal escape
+ // they come in pairs of two
+ $c = 0;
+ while (isset($string[$es_pos + $c]) && isset($string[$es_pos + $c + 1])
+ && $string[$es_pos + $c] == $this->language_data['ESCAPE_CHAR']
+ && $string[$es_pos + $c + 1] == $this->language_data['ESCAPE_CHAR']) {
+ $c += 2;
+ }
+ if ($c) {
+ $new_string .= "<span$escape_char_attributes>" .
+ str_repeat($escaped_escape_char, $c) .
+ '</span>';
+ $start = $es_pos + $c;
+ } else {
+ // this is just a single lonely escape char...
+ $new_string .= $escaped_escape_char;
+ $start = $es_pos + 1;
+ }
+ }
+ $string = $new_string . $this->hsc(substr($string, $start));
+ } else {
+ $string = $this->hsc($string);
+ }
+
+ if ($check_linenumbers) {
+ // Are line numbers used? If, we should end the string before
+ // the newline and begin it again (so when <li>s are put in the source
+ // remains XHTML compliant)
+ // note to self: This opens up possibility of config files specifying
+ // that languages can/cannot have multiline strings???
+ $string = str_replace("\n", "</span>\n<span$string_attributes>", $string);
+ }
+
+ $result .= "<span$string_attributes>" . $string . '</span>';
+ $string = '';
+ continue;
+ } else {
+ //Have a look for regexp comments
+ if ($i == $next_comment_regexp_pos) {
+ $COMMENT_MATCHED = true;
+ $comment = $comment_regexp_cache_per_key[$next_comment_regexp_key];
+ $test_str = $this->hsc(substr($part, $i, $comment['length']));
+
+ //@todo If remove important do remove here
+ if ($this->lexic_permissions['COMMENTS']['MULTI']) {
+ if (!$this->use_classes) {
+ $attributes = ' style="' . $this->language_data['STYLES']['COMMENTS'][$comment['key']] . '"';
+ } else {
+ $attributes = ' class="co' . $comment['key'] . '"';
+ }
+
+ $test_str = "<span$attributes>" . $test_str . "</span>";
+
+ // Short-cut through all the multiline code
+ if ($check_linenumbers) {
+ // strreplace to put close span and open span around multiline newlines
+ $test_str = str_replace(
+ "\n", "</span>\n<span$attributes>",
+ str_replace("\n ", "\n&nbsp;", $test_str)
+ );
+ }
+ }
+
+ $i += $comment['length'] - 1;
+
+ // parse the rest
+ $result .= $this->parse_non_string_part($stuff_to_parse);
+ $stuff_to_parse = '';
+ }
+
+ // If we haven't matched a regexp comment, try multi-line comments
+ if (!$COMMENT_MATCHED) {
+ // Is this a multiline comment?
+ if (!empty($this->language_data['COMMENT_MULTI']) && $next_comment_multi_pos < $i) {
+ $next_comment_multi_pos = $length;
+ foreach ($this->language_data['COMMENT_MULTI'] as $open => $close) {
+ $match_i = false;
+ if (isset($comment_multi_cache_per_key[$open]) &&
+ ($comment_multi_cache_per_key[$open] >= $i ||
+ $comment_multi_cache_per_key[$open] === false)) {
+ // we have already matched something
+ if ($comment_multi_cache_per_key[$open] === false) {
+ // this comment is never matched
+ continue;
+ }
+ $match_i = $comment_multi_cache_per_key[$open];
+ } elseif (($match_i = stripos($part, $open, $i)) !== false) {
+ $comment_multi_cache_per_key[$open] = $match_i;
+ } else {
+ $comment_multi_cache_per_key[$open] = false;
+ continue;
+ }
+ if ($match_i !== false && $match_i < $next_comment_multi_pos) {
+ $next_comment_multi_pos = $match_i;
+ $next_open_comment_multi = $open;
+ if ($match_i === $i) {
+ break;
+ }
+ }
+ }
+ }
+ if ($i == $next_comment_multi_pos) {
+ $open = $next_open_comment_multi;
+ $close = $this->language_data['COMMENT_MULTI'][$open];
+ $open_strlen = strlen($open);
+ $close_strlen = strlen($close);
+ $COMMENT_MATCHED = true;
+ $test_str_match = $open;
+ //@todo If remove important do remove here
+ if ($this->lexic_permissions['COMMENTS']['MULTI'] ||
+ $open == GESHI_START_IMPORTANT) {
+ if ($open != GESHI_START_IMPORTANT) {
+ if (!$this->use_classes) {
+ $attributes = ' style="' . $this->language_data['STYLES']['COMMENTS']['MULTI'] . '"';
+ } else {
+ $attributes = ' class="coMULTI"';
+ }
+ $test_str = "<span$attributes>" . $this->hsc($open);
+ } else {
+ if (!$this->use_classes) {
+ $attributes = ' style="' . $this->important_styles . '"';
+ } else {
+ $attributes = ' class="imp"';
+ }
+
+ // We don't include the start of the comment if it's an
+ // "important" part
+ $test_str = "<span$attributes>";
+ }
+ } else {
+ $test_str = $this->hsc($open);
+ }
+
+ $close_pos = strpos( $part, $close, $i + $open_strlen );
+
+ if ($close_pos === false) {
+ $close_pos = $length;
+ }
+
+ // Short-cut through all the multiline code
+ $rest_of_comment = $this->hsc(substr($part, $i + $open_strlen, $close_pos - $i - $open_strlen + $close_strlen));
+ if (($this->lexic_permissions['COMMENTS']['MULTI'] ||
+ $test_str_match == GESHI_START_IMPORTANT) &&
+ $check_linenumbers) {
+
+ // strreplace to put close span and open span around multiline newlines
+ $test_str .= str_replace(
+ "\n", "</span>\n<span$attributes>",
+ str_replace("\n ", "\n&nbsp;", $rest_of_comment)
+ );
+ } else {
+ $test_str .= $rest_of_comment;
+ }
+
+ if ($this->lexic_permissions['COMMENTS']['MULTI'] ||
+ $test_str_match == GESHI_START_IMPORTANT) {
+ $test_str .= '</span>';
+ }
+
+ $i = $close_pos + $close_strlen - 1;
+
+ // parse the rest
+ $result .= $this->parse_non_string_part($stuff_to_parse);
+ $stuff_to_parse = '';
+ }
+ }
+
+ // If we haven't matched a multiline comment, try single-line comments
+ if (!$COMMENT_MATCHED) {
+ // cache potential single line comment occurances
+ if (!empty($this->language_data['COMMENT_SINGLE']) && $next_comment_single_pos < $i) {
+ $next_comment_single_pos = $length;
+ foreach ($this->language_data['COMMENT_SINGLE'] as $comment_key => $comment_mark) {
+ $match_i = false;
+ if (isset($comment_single_cache_per_key[$comment_key]) &&
+ ($comment_single_cache_per_key[$comment_key] >= $i ||
+ $comment_single_cache_per_key[$comment_key] === false)) {
+ // we have already matched something
+ if ($comment_single_cache_per_key[$comment_key] === false) {
+ // this comment is never matched
+ continue;
+ }
+ $match_i = $comment_single_cache_per_key[$comment_key];
+ } elseif (
+ // case sensitive comments
+ ($this->language_data['CASE_SENSITIVE'][GESHI_COMMENTS] &&
+ ($match_i = stripos($part, $comment_mark, $i)) !== false) ||
+ // non case sensitive
+ (!$this->language_data['CASE_SENSITIVE'][GESHI_COMMENTS] &&
+ (($match_i = strpos($part, $comment_mark, $i)) !== false))) {
+ $comment_single_cache_per_key[$comment_key] = $match_i;
+ } else {
+ $comment_single_cache_per_key[$comment_key] = false;
+ continue;
+ }
+ if ($match_i !== false && $match_i < $next_comment_single_pos) {
+ $next_comment_single_pos = $match_i;
+ $next_comment_single_key = $comment_key;
+ if ($match_i === $i) {
+ break;
+ }
+ }
+ }
+ }
+ if ($next_comment_single_pos == $i) {
+ $comment_key = $next_comment_single_key;
+ $comment_mark = $this->language_data['COMMENT_SINGLE'][$comment_key];
+ $com_len = strlen($comment_mark);
+
+ // This check will find special variables like $# in bash
+ // or compiler directives of Delphi beginning {$
+ if ((empty($sc_disallowed_before) || ($i == 0) ||
+ (false === strpos($sc_disallowed_before, $part[$i-1]))) &&
+ (empty($sc_disallowed_after) || ($length <= $i + $com_len) ||
+ (false === strpos($sc_disallowed_after, $part[$i + $com_len]))))
+ {
+ // this is a valid comment
+ $COMMENT_MATCHED = true;
+ if ($this->lexic_permissions['COMMENTS'][$comment_key]) {
+ if (!$this->use_classes) {
+ $attributes = ' style="' . $this->language_data['STYLES']['COMMENTS'][$comment_key] . '"';
+ } else {
+ $attributes = ' class="co' . $comment_key . '"';
+ }
+ $test_str = "<span$attributes>" . $this->hsc($this->change_case($comment_mark));
+ } else {
+ $test_str = $this->hsc($comment_mark);
+ }
+
+ //Check if this comment is the last in the source
+ $close_pos = strpos($part, "\n", $i);
+ $oops = false;
+ if ($close_pos === false) {
+ $close_pos = $length;
+ $oops = true;
+ }
+ $test_str .= $this->hsc(substr($part, $i + $com_len, $close_pos - $i - $com_len));
+ if ($this->lexic_permissions['COMMENTS'][$comment_key]) {
+ $test_str .= "</span>";
+ }
+
+ // Take into account that the comment might be the last in the source
+ if (!$oops) {
+ $test_str .= "\n";
+ }
+
+ $i = $close_pos;
+
+ // parse the rest
+ $result .= $this->parse_non_string_part($stuff_to_parse);
+ $stuff_to_parse = '';
+ }
+ }
+ }
+ }
+
+ // Where are we adding this char?
+ if (!$COMMENT_MATCHED) {
+ $stuff_to_parse .= $char;
+ } else {
+ $result .= $test_str;
+ unset($test_str);
+ $COMMENT_MATCHED = false;
+ }
+ }
+ // Parse the last bit
+ $result .= $this->parse_non_string_part($stuff_to_parse);
+ $stuff_to_parse = '';
+ } else {
+ $result .= $this->hsc($part);
+ }
+ // Close the <span> that surrounds the block
+ if ($STRICTATTRS != '') {
+ $result = str_replace("\n", "</span>\n<span$STRICTATTRS>", $result);
+ $result .= '</span>';
+ }
+
+ $endresult .= $result;
+ unset($part, $parts[$key], $result);
+ }
+
+ //This fix is related to SF#1923020, but has to be applied regardless of
+ //actually highlighting symbols.
+ /** NOTE: memorypeak #3 */
+ $endresult = str_replace(array('<SEMI>', '<PIPE>'), array(';', '|'), $endresult);
+
+// // Parse the last stuff (redundant?)
+// $result .= $this->parse_non_string_part($stuff_to_parse);
+
+ // Lop off the very first and last spaces
+// $result = substr($result, 1, -1);
+
+ // We're finished: stop timing
+ $this->set_time($start_time, microtime());
+
+ $this->finalise($endresult);
+ return $endresult;
+ }
+
+ /**
+ * Swaps out spaces and tabs for HTML indentation. Not needed if
+ * the code is in a pre block...
+ *
+ * @param string The source to indent (reference!)
+ * @since 1.0.0
+ * @access private
+ */
+ function indent(&$result) {
+ /// Replace tabs with the correct number of spaces
+ if (false !== strpos($result, "\t")) {
+ $lines = explode("\n", $result);
+ $result = null;//Save memory while we process the lines individually
+ $tab_width = $this->get_real_tab_width();
+ $tab_string = '&nbsp;' . str_repeat(' ', $tab_width);
+
+ for ($key = 0, $n = count($lines); $key < $n; $key++) {
+ $line = $lines[$key];
+ if (false === strpos($line, "\t")) {
+ continue;
+ }
+
+ $pos = 0;
+ $length = strlen($line);
+ $lines[$key] = ''; // reduce memory
+
+ $IN_TAG = false;
+ for ($i = 0; $i < $length; ++$i) {
+ $char = $line[$i];
+ // Simple engine to work out whether we're in a tag.
+ // If we are we modify $pos. This is so we ignore HTML
+ // in the line and only workout the tab replacement
+ // via the actual content of the string
+ // This test could be improved to include strings in the
+ // html so that < or > would be allowed in user's styles
+ // (e.g. quotes: '<' '>'; or similar)
+ if ($IN_TAG) {
+ if ('>' == $char) {
+ $IN_TAG = false;
+ }
+ $lines[$key] .= $char;
+ } elseif ('<' == $char) {
+ $IN_TAG = true;
+ $lines[$key] .= '<';
+ } elseif ('&' == $char) {
+ $substr = substr($line, $i + 3, 5);
+ $posi = strpos($substr, ';');
+ if (false === $posi) {
+ ++$pos;
+ } else {
+ $pos -= $posi+2;
+ }
+ $lines[$key] .= $char;
+ } elseif ("\t" == $char) {
+ $str = '';
+ // OPTIMISE - move $strs out. Make an array:
+ // $tabs = array(
+ // 1 => '&nbsp;',
+ // 2 => '&nbsp; ',
+ // 3 => '&nbsp; &nbsp;' etc etc
+ // to use instead of building a string every time
+ $tab_end_width = $tab_width - ($pos % $tab_width); //Moved out of the look as it doesn't change within the loop
+ if (($pos & 1) || 1 == $tab_end_width) {
+ $str .= substr($tab_string, 6, $tab_end_width);
+ } else {
+ $str .= substr($tab_string, 0, $tab_end_width+5);
+ }
+ $lines[$key] .= $str;
+ $pos += $tab_end_width;
+
+ if (false === strpos($line, "\t", $i + 1)) {
+ $lines[$key] .= substr($line, $i + 1);
+ break;
+ }
+ } elseif (0 == $pos && ' ' == $char) {
+ $lines[$key] .= '&nbsp;';
+ ++$pos;
+ } else {
+ $lines[$key] .= $char;
+ ++$pos;
+ }
+ }
+ }
+ $result = implode("\n", $lines);
+ unset($lines);//We don't need the lines separated beyond this --- free them!
+ }
+ // Other whitespace
+ // BenBE: Fix to reduce the number of replacements to be done
+ $result = preg_replace('/^ /m', '&nbsp;', $result);
+ $result = str_replace(' ', ' &nbsp;', $result);
+
+ if ($this->line_numbers == GESHI_NO_LINE_NUMBERS && $this->header_type != GESHI_HEADER_PRE_TABLE) {
+ if ($this->line_ending === null) {
+ $result = nl2br($result);
+ } else {
+ $result = str_replace("\n", $this->line_ending, $result);
+ }
+ }
+ }
+
+ /**
+ * Changes the case of a keyword for those languages where a change is asked for
+ *
+ * @param string The keyword to change the case of
+ * @return string The keyword with its case changed
+ * @since 1.0.0
+ * @access private
+ */
+ function change_case($instr) {
+ switch ($this->language_data['CASE_KEYWORDS']) {
+ case GESHI_CAPS_UPPER:
+ return strtoupper($instr);
+ case GESHI_CAPS_LOWER:
+ return strtolower($instr);
+ default:
+ return $instr;
+ }
+ }
+
+ /**
+ * Handles replacements of keywords to include markup and links if requested
+ *
+ * @param string The keyword to add the Markup to
+ * @return The HTML for the match found
+ * @since 1.0.8
+ * @access private
+ *
+ * @todo Get rid of ender in keyword links
+ */
+ function handle_keyword_replace($match) {
+ $k = $this->_kw_replace_group;
+ $keyword = $match[0];
+ $keyword_match = $match[1];
+
+ $before = '';
+ $after = '';
+
+ if ($this->keyword_links) {
+ // Keyword links have been ebabled
+
+ if (isset($this->language_data['URLS'][$k]) &&
+ $this->language_data['URLS'][$k] != '') {
+ // There is a base group for this keyword
+
+ // Old system: strtolower
+ //$keyword = ( $this->language_data['CASE_SENSITIVE'][$group] ) ? $keyword : strtolower($keyword);
+ // New system: get keyword from language file to get correct case
+ if (!$this->language_data['CASE_SENSITIVE'][$k] &&
+ strpos($this->language_data['URLS'][$k], '{FNAME}') !== false) {
+ foreach ($this->language_data['KEYWORDS'][$k] as $word) {
+ if (strcasecmp($word, $keyword_match) == 0) {
+ break;
+ }
+ }
+ } else {
+ $word = $keyword_match;
+ }
+
+ $before = '<|UR1|"' .
+ str_replace(
+ array(
+ '{FNAME}',
+ '{FNAMEL}',
+ '{FNAMEU}',
+ '.'),
+ array(
+ str_replace('+', '%20', urlencode($this->hsc($word))),
+ str_replace('+', '%20', urlencode($this->hsc(strtolower($word)))),
+ str_replace('+', '%20', urlencode($this->hsc(strtoupper($word)))),
+ '<DOT>'),
+ $this->language_data['URLS'][$k]
+ ) . '">';
+ $after = '</a>';
+ }
+ }
+
+ return $before . '<|/'. $k .'/>' . $this->change_case($keyword) . '|>' . $after;
+ }
+
+ /**
+ * handles regular expressions highlighting-definitions with callback functions
+ *
+ * @note this is a callback, don't use it directly
+ *
+ * @param array the matches array
+ * @return The highlighted string
+ * @since 1.0.8
+ * @access private
+ */
+ function handle_regexps_callback($matches) {
+ // before: "' style=\"' . call_user_func(\"$func\", '\\1') . '\"\\1|>'",
+ return ' style="' . call_user_func($this->language_data['STYLES']['REGEXPS'][$this->_rx_key], $matches[1]) . '"'. $matches[1] . '|>';
+ }
+
+ /**
+ * handles newlines in REGEXPS matches. Set the _hmr_* vars before calling this
+ *
+ * @note this is a callback, don't use it directly
+ *
+ * @param array the matches array
+ * @return string
+ * @since 1.0.8
+ * @access private
+ */
+ function handle_multiline_regexps($matches) {
+ $before = $this->_hmr_before;
+ $after = $this->_hmr_after;
+ if ($this->_hmr_replace) {
+ $replace = $this->_hmr_replace;
+ $search = array();
+
+ foreach (array_keys($matches) as $k) {
+ $search[] = '\\' . $k;
+ }
+
+ $before = str_replace($search, $matches, $before);
+ $after = str_replace($search, $matches, $after);
+ $replace = str_replace($search, $matches, $replace);
+ } else {
+ $replace = $matches[0];
+ }
+ return $before
+ . '<|!REG3XP' . $this->_hmr_key .'!>'
+ . str_replace("\n", "|>\n<|!REG3XP" . $this->_hmr_key . '!>', $replace)
+ . '|>'
+ . $after;
+ }
+
+ /**
+ * Takes a string that has no strings or comments in it, and highlights
+ * stuff like keywords, numbers and methods.
+ *
+ * @param string The string to parse for keyword, numbers etc.
+ * @since 1.0.0
+ * @access private
+ * @todo BUGGY! Why? Why not build string and return?
+ */
+ function parse_non_string_part($stuff_to_parse) {
+ $stuff_to_parse = ' ' . $this->hsc($stuff_to_parse);
+
+ // Highlight keywords
+ $disallowed_before = "(?<![a-zA-Z0-9\$_\|\#|^&";
+ $disallowed_after = "(?![a-zA-Z0-9_\|%\\-&;";
+ if ($this->lexic_permissions['STRINGS']) {
+ $quotemarks = preg_quote(implode($this->language_data['QUOTEMARKS']), '/');
+ $disallowed_before .= $quotemarks;
+ $disallowed_after .= $quotemarks;
+ }
+ $disallowed_before .= "])";
+ $disallowed_after .= "])";
+
+ $parser_control_pergroup = false;
+ if (isset($this->language_data['PARSER_CONTROL'])) {
+ if (isset($this->language_data['PARSER_CONTROL']['KEYWORDS'])) {
+ $x = 0; // check wether per-keyword-group parser_control is enabled
+ if (isset($this->language_data['PARSER_CONTROL']['KEYWORDS']['DISALLOWED_BEFORE'])) {
+ $disallowed_before = $this->language_data['PARSER_CONTROL']['KEYWORDS']['DISALLOWED_BEFORE'];
+ ++$x;
+ }
+ if (isset($this->language_data['PARSER_CONTROL']['KEYWORDS']['DISALLOWED_AFTER'])) {
+ $disallowed_after = $this->language_data['PARSER_CONTROL']['KEYWORDS']['DISALLOWED_AFTER'];
+ ++$x;
+ }
+ $parser_control_pergroup = (count($this->language_data['PARSER_CONTROL']['KEYWORDS']) - $x) > 0;
+ }
+ }
+
+ foreach (array_keys($this->language_data['KEYWORDS']) as $k) {
+ if (!isset($this->lexic_permissions['KEYWORDS'][$k]) ||
+ $this->lexic_permissions['KEYWORDS'][$k]) {
+
+ $case_sensitive = $this->language_data['CASE_SENSITIVE'][$k];
+ $modifiers = $case_sensitive ? '' : 'i';
+
+ // NEW in 1.0.8 - per-keyword-group parser control
+ $disallowed_before_local = $disallowed_before;
+ $disallowed_after_local = $disallowed_after;
+ if ($parser_control_pergroup && isset($this->language_data['PARSER_CONTROL']['KEYWORDS'][$k])) {
+ if (isset($this->language_data['PARSER_CONTROL']['KEYWORDS'][$k]['DISALLOWED_BEFORE'])) {
+ $disallowed_before_local =
+ $this->language_data['PARSER_CONTROL']['KEYWORDS'][$k]['DISALLOWED_BEFORE'];
+ }
+
+ if (isset($this->language_data['PARSER_CONTROL']['KEYWORDS'][$k]['DISALLOWED_AFTER'])) {
+ $disallowed_after_local =
+ $this->language_data['PARSER_CONTROL']['KEYWORDS'][$k]['DISALLOWED_AFTER'];
+ }
+ }
+
+ $this->_kw_replace_group = $k;
+
+ //NEW in 1.0.8, the cached regexp list
+ // since we don't want PHP / PCRE to crash due to too large patterns we split them into smaller chunks
+ for ($set = 0, $set_length = count($this->language_data['CACHED_KEYWORD_LISTS'][$k]); $set < $set_length; ++$set) {
+ $keywordset =& $this->language_data['CACHED_KEYWORD_LISTS'][$k][$set];
+ // Might make a more unique string for putting the number in soon
+ // Basically, we don't put the styles in yet because then the styles themselves will
+ // get highlighted if the language has a CSS keyword in it (like CSS, for example ;))
+ $stuff_to_parse = preg_replace_callback(
+ "/$disallowed_before_local({$keywordset})(?!\<DOT\>(?:htm|php|aspx?))$disallowed_after_local/$modifiers",
+ array($this, 'handle_keyword_replace'),
+ $stuff_to_parse
+ );
+ }
+ }
+ }
+
+ // Regular expressions
+ foreach ($this->language_data['REGEXPS'] as $key => $regexp) {
+ if ($this->lexic_permissions['REGEXPS'][$key]) {
+ if (is_array($regexp)) {
+ if ($this->line_numbers != GESHI_NO_LINE_NUMBERS) {
+ // produce valid HTML when we match multiple lines
+ $this->_hmr_replace = $regexp[GESHI_REPLACE];
+ $this->_hmr_before = $regexp[GESHI_BEFORE];
+ $this->_hmr_key = $key;
+ $this->_hmr_after = $regexp[GESHI_AFTER];
+ $stuff_to_parse = preg_replace_callback(
+ "/" . $regexp[GESHI_SEARCH] . "/{$regexp[GESHI_MODIFIERS]}",
+ array($this, 'handle_multiline_regexps'),
+ $stuff_to_parse);
+ $this->_hmr_replace = false;
+ $this->_hmr_before = '';
+ $this->_hmr_after = '';
+ } else {
+ $stuff_to_parse = preg_replace(
+ '/' . $regexp[GESHI_SEARCH] . '/' . $regexp[GESHI_MODIFIERS],
+ $regexp[GESHI_BEFORE] . '<|!REG3XP'. $key .'!>' . $regexp[GESHI_REPLACE] . '|>' . $regexp[GESHI_AFTER],
+ $stuff_to_parse);
+ }
+ } else {
+ if ($this->line_numbers != GESHI_NO_LINE_NUMBERS) {
+ // produce valid HTML when we match multiple lines
+ $this->_hmr_key = $key;
+ $stuff_to_parse = preg_replace_callback( "/(" . $regexp . ")/",
+ array($this, 'handle_multiline_regexps'), $stuff_to_parse);
+ $this->_hmr_key = '';
+ } else {
+ $stuff_to_parse = preg_replace( "/(" . $regexp . ")/", "<|!REG3XP$key!>\\1|>", $stuff_to_parse);
+ }
+ }
+ }
+ }
+
+ // Highlight numbers. As of 1.0.8 we support different types of numbers
+ $numbers_found = false;
+
+ if ($this->lexic_permissions['NUMBERS'] && preg_match($this->language_data['PARSER_CONTROL']['NUMBERS']['PRECHECK_RX'], $stuff_to_parse )) {
+ $numbers_found = true;
+
+ //For each of the formats ...
+ foreach($this->language_data['NUMBERS_RXCACHE'] as $id => $regexp) {
+ //Check if it should be highlighted ...
+ $stuff_to_parse = preg_replace($regexp, "<|/NUM!$id/>\\1|>", $stuff_to_parse);
+ }
+ }
+
+ //
+ // Now that's all done, replace /[number]/ with the correct styles
+ //
+ foreach (array_keys($this->language_data['KEYWORDS']) as $k) {
+ if (!$this->use_classes) {
+ $attributes = ' style="' .
+ (isset($this->language_data['STYLES']['KEYWORDS'][$k]) ?
+ $this->language_data['STYLES']['KEYWORDS'][$k] : "") . '"';
+ } else {
+ $attributes = ' class="kw' . $k . '"';
+ }
+ $stuff_to_parse = str_replace("<|/$k/>", "<|$attributes>", $stuff_to_parse);
+ }
+
+ if ($numbers_found) {
+ // Put number styles in
+ foreach($this->language_data['NUMBERS_RXCACHE'] as $id => $regexp) {
+ //Commented out for now, as this needs some review ...
+ // if ($numbers_permissions & $id) {
+ //Get the appropriate style ...
+ //Checking for unset styles is done by the style cache builder ...
+ if (!$this->use_classes) {
+ $attributes = ' style="' . $this->language_data['STYLES']['NUMBERS'][$id] . '"';
+ } else {
+ $attributes = ' class="nu'.$id.'"';
+ }
+
+ //Set in the correct styles ...
+ $stuff_to_parse = str_replace("/NUM!$id/", $attributes, $stuff_to_parse);
+ // }
+ }
+ }
+
+ // Highlight methods and fields in objects
+ if ($this->lexic_permissions['METHODS'] && $this->language_data['OOLANG']) {
+ $oolang_spaces = "[\s]*";
+ $oolang_before = "";
+ $oolang_after = "[a-zA-Z][a-zA-Z0-9_]*";
+ if (isset($this->language_data['PARSER_CONTROL'])) {
+ if (isset($this->language_data['PARSER_CONTROL']['OOLANG'])) {
+ if (isset($this->language_data['PARSER_CONTROL']['OOLANG']['MATCH_BEFORE'])) {
+ $oolang_before = $this->language_data['PARSER_CONTROL']['OOLANG']['MATCH_BEFORE'];
+ }
+ if (isset($this->language_data['PARSER_CONTROL']['OOLANG']['MATCH_AFTER'])) {
+ $oolang_after = $this->language_data['PARSER_CONTROL']['OOLANG']['MATCH_AFTER'];
+ }
+ if (isset($this->language_data['PARSER_CONTROL']['OOLANG']['MATCH_SPACES'])) {
+ $oolang_spaces = $this->language_data['PARSER_CONTROL']['OOLANG']['MATCH_SPACES'];
+ }
+ }
+ }
+
+ foreach ($this->language_data['OBJECT_SPLITTERS'] as $key => $splitter) {
+ if (false !== strpos($stuff_to_parse, $splitter)) {
+ if (!$this->use_classes) {
+ $attributes = ' style="' . $this->language_data['STYLES']['METHODS'][$key] . '"';
+ } else {
+ $attributes = ' class="me' . $key . '"';
+ }
+ $stuff_to_parse = preg_replace("/($oolang_before)(" . preg_quote($this->language_data['OBJECT_SPLITTERS'][$key], '/') . ")($oolang_spaces)($oolang_after)/", "\\1\\2\\3<|$attributes>\\4|>", $stuff_to_parse);
+ }
+ }
+ }
+
+ //
+ // Highlight brackets. Yes, I've tried adding a semi-colon to this list.
+ // You try it, and see what happens ;)
+ // TODO: Fix lexic permissions not converting entities if shouldn't
+ // be highlighting regardless
+ //
+ if ($this->lexic_permissions['BRACKETS']) {
+ $stuff_to_parse = str_replace( $this->language_data['CACHE_BRACKET_MATCH'],
+ $this->language_data['CACHE_BRACKET_REPLACE'], $stuff_to_parse );
+ }
+
+
+ //FIX for symbol highlighting ...
+ if ($this->lexic_permissions['SYMBOLS'] && !empty($this->language_data['SYMBOLS'])) {
+ //Get all matches and throw away those witin a block that is already highlighted... (i.e. matched by a regexp)
+ $n_symbols = preg_match_all("/<\|(?:<DOT>|[^>])+>(?:(?!\|>).*?)\|>|<\/a>|(?:" . $this->language_data['SYMBOL_SEARCH'] . ")+(?![^<]+?>)/", $stuff_to_parse, $pot_symbols, PREG_OFFSET_CAPTURE | PREG_SET_ORDER);
+ $global_offset = 0;
+ for ($s_id = 0; $s_id < $n_symbols; ++$s_id) {
+ $symbol_match = $pot_symbols[$s_id][0][0];
+ if (strpos($symbol_match, '<') !== false || strpos($symbol_match, '>') !== false) {
+ // already highlighted blocks _must_ include either < or >
+ // so if this conditional applies, we have to skip this match
+ // BenBE: UNLESS the block contains <SEMI> or <PIPE>
+ if(strpos($symbol_match, '<SEMI>') === false &&
+ strpos($symbol_match, '<PIPE>') === false) {
+ continue;
+ }
+ }
+
+ // if we reach this point, we have a valid match which needs to be highlighted
+
+ $symbol_length = strlen($symbol_match);
+ $symbol_offset = $pot_symbols[$s_id][0][1];
+ unset($pot_symbols[$s_id]);
+ $symbol_end = $symbol_length + $symbol_offset;
+ $symbol_hl = "";
+
+ // if we have multiple styles, we have to handle them properly
+ if ($this->language_data['MULTIPLE_SYMBOL_GROUPS']) {
+ $old_sym = -1;
+ // Split the current stuff to replace into its atomic symbols ...
+ preg_match_all("/" . $this->language_data['SYMBOL_SEARCH'] . "/", $symbol_match, $sym_match_syms, PREG_PATTERN_ORDER);
+ foreach ($sym_match_syms[0] as $sym_ms) {
+ //Check if consequtive symbols belong to the same group to save output ...
+ if (isset($this->language_data['SYMBOL_DATA'][$sym_ms])
+ && ($this->language_data['SYMBOL_DATA'][$sym_ms] != $old_sym)) {
+ if (-1 != $old_sym) {
+ $symbol_hl .= "|>";
+ }
+ $old_sym = $this->language_data['SYMBOL_DATA'][$sym_ms];
+ if (!$this->use_classes) {
+ $symbol_hl .= '<| style="' . $this->language_data['STYLES']['SYMBOLS'][$old_sym] . '">';
+ } else {
+ $symbol_hl .= '<| class="sy' . $old_sym . '">';
+ }
+ }
+ $symbol_hl .= $sym_ms;
+ }
+ unset($sym_match_syms);
+
+ //Close remaining tags and insert the replacement at the right position ...
+ //Take caution if symbol_hl is empty to avoid doubled closing spans.
+ if (-1 != $old_sym) {
+ $symbol_hl .= "|>";
+ }
+ } else {
+ if (!$this->use_classes) {
+ $symbol_hl = '<| style="' . $this->language_data['STYLES']['SYMBOLS'][0] . '">';
+ } else {
+ $symbol_hl = '<| class="sy0">';
+ }
+ $symbol_hl .= $symbol_match . '|>';
+ }
+
+ $stuff_to_parse = substr_replace($stuff_to_parse, $symbol_hl, $symbol_offset + $global_offset, $symbol_length);
+
+ // since we replace old text with something of different size,
+ // we'll have to keep track of the differences
+ $global_offset += strlen($symbol_hl) - $symbol_length;
+ }
+ }
+ //FIX for symbol highlighting ...
+
+ // Add class/style for regexps
+ foreach (array_keys($this->language_data['REGEXPS']) as $key) {
+ if ($this->lexic_permissions['REGEXPS'][$key]) {
+ if (is_callable($this->language_data['STYLES']['REGEXPS'][$key])) {
+ $this->_rx_key = $key;
+ $stuff_to_parse = preg_replace_callback("/!REG3XP$key!(.*)\|>/U",
+ array($this, 'handle_regexps_callback'),
+ $stuff_to_parse);
+ } else {
+ if (!$this->use_classes) {
+ $attributes = ' style="' . $this->language_data['STYLES']['REGEXPS'][$key] . '"';
+ } else {
+ if (is_array($this->language_data['REGEXPS'][$key]) &&
+ array_key_exists(GESHI_CLASS, $this->language_data['REGEXPS'][$key])) {
+ $attributes = ' class="' .
+ $this->language_data['REGEXPS'][$key][GESHI_CLASS] . '"';
+ } else {
+ $attributes = ' class="re' . $key . '"';
+ }
+ }
+ $stuff_to_parse = str_replace("!REG3XP$key!", "$attributes", $stuff_to_parse);
+ }
+ }
+ }
+
+ // Replace <DOT> with . for urls
+ $stuff_to_parse = str_replace('<DOT>', '.', $stuff_to_parse);
+ // Replace <|UR1| with <a href= for urls also
+ if (isset($this->link_styles[GESHI_LINK])) {
+ if ($this->use_classes) {
+ $stuff_to_parse = str_replace('<|UR1|', '<a' . $this->link_target . ' href=', $stuff_to_parse);
+ } else {
+ $stuff_to_parse = str_replace('<|UR1|', '<a' . $this->link_target . ' style="' . $this->link_styles[GESHI_LINK] . '" href=', $stuff_to_parse);
+ }
+ } else {
+ $stuff_to_parse = str_replace('<|UR1|', '<a' . $this->link_target . ' href=', $stuff_to_parse);
+ }
+
+ //
+ // NOW we add the span thingy ;)
+ //
+
+ $stuff_to_parse = str_replace('<|', '<span', $stuff_to_parse);
+ $stuff_to_parse = str_replace ( '|>', '</span>', $stuff_to_parse );
+ return substr($stuff_to_parse, 1);
+ }
+
+ /**
+ * Sets the time taken to parse the code
+ *
+ * @param microtime The time when parsing started
+ * @param microtime The time when parsing ended
+ * @since 1.0.2
+ * @access private
+ */
+ function set_time($start_time, $end_time) {
+ $start = explode(' ', $start_time);
+ $end = explode(' ', $end_time);
+ $this->time = $end[0] + $end[1] - $start[0] - $start[1];
+ }
+
+ /**
+ * Gets the time taken to parse the code
+ *
+ * @return double The time taken to parse the code
+ * @since 1.0.2
+ */
+ function get_time() {
+ return $this->time;
+ }
+
+ /**
+ * Merges arrays recursively, overwriting values of the first array with values of later arrays
+ *
+ * @since 1.0.8
+ * @access private
+ */
+ function merge_arrays() {
+ $arrays = func_get_args();
+ $narrays = count($arrays);
+
+ // check arguments
+ // comment out if more performance is necessary (in this case the foreach loop will trigger a warning if the argument is not an array)
+ for ($i = 0; $i < $narrays; $i ++) {
+ if (!is_array($arrays[$i])) {
+ // also array_merge_recursive returns nothing in this case
+ trigger_error('Argument #' . ($i+1) . ' is not an array - trying to merge array with scalar! Returning false!', E_USER_WARNING);
+ return false;
+ }
+ }
+
+ // the first array is in the output set in every case
+ $ret = $arrays[0];
+
+ // merege $ret with the remaining arrays
+ for ($i = 1; $i < $narrays; $i ++) {
+ foreach ($arrays[$i] as $key => $value) {
+ if (is_array($value) && isset($ret[$key])) {
+ // if $ret[$key] is not an array you try to merge an scalar value with an array - the result is not defined (incompatible arrays)
+ // in this case the call will trigger an E_USER_WARNING and the $ret[$key] will be false.
+ $ret[$key] = $this->merge_arrays($ret[$key], $value);
+ } else {
+ $ret[$key] = $value;
+ }
+ }
+ }
+
+ return $ret;
+ }
+
+ /**
+ * Gets language information and stores it for later use
+ *
+ * @param string The filename of the language file you want to load
+ * @since 1.0.0
+ * @access private
+ * @todo Needs to load keys for lexic permissions for keywords, regexps etc
+ */
+ function load_language($file_name) {
+ if ($file_name == $this->loaded_language) {
+ // this file is already loaded!
+ return;
+ }
+
+ //Prepare some stuff before actually loading the language file
+ $this->loaded_language = $file_name;
+ $this->parse_cache_built = false;
+ $this->enable_highlighting();
+ $language_data = array();
+
+ //Load the language file
+ require $file_name;
+
+ // Perhaps some checking might be added here later to check that
+ // $language data is a valid thing but maybe not
+ $this->language_data = $language_data;
+
+ // Set strict mode if should be set
+ $this->strict_mode = $this->language_data['STRICT_MODE_APPLIES'];
+
+ // Set permissions for all lexics to true
+ // so they'll be highlighted by default
+ foreach (array_keys($this->language_data['KEYWORDS']) as $key) {
+ if (!empty($this->language_data['KEYWORDS'][$key])) {
+ $this->lexic_permissions['KEYWORDS'][$key] = true;
+ } else {
+ $this->lexic_permissions['KEYWORDS'][$key] = false;
+ }
+ }
+
+ foreach (array_keys($this->language_data['COMMENT_SINGLE']) as $key) {
+ $this->lexic_permissions['COMMENTS'][$key] = true;
+ }
+ foreach (array_keys($this->language_data['REGEXPS']) as $key) {
+ $this->lexic_permissions['REGEXPS'][$key] = true;
+ }
+
+ // for BenBE and future code reviews:
+ // we can use empty here since we only check for existance and emptiness of an array
+ // if it is not an array at all but rather false or null this will work as intended as well
+ // even if $this->language_data['PARSER_CONTROL'] is undefined this won't trigger a notice
+ if (!empty($this->language_data['PARSER_CONTROL']['ENABLE_FLAGS'])) {
+ foreach ($this->language_data['PARSER_CONTROL']['ENABLE_FLAGS'] as $flag => $value) {
+ // it's either true or false and maybe is true as well
+ $perm = $value !== GESHI_NEVER;
+ if ($flag == 'ALL') {
+ $this->enable_highlighting($perm);
+ continue;
+ }
+ if (!isset($this->lexic_permissions[$flag])) {
+ // unknown lexic permission
+ continue;
+ }
+ if (is_array($this->lexic_permissions[$flag])) {
+ foreach ($this->lexic_permissions[$flag] as $key => $val) {
+ $this->lexic_permissions[$flag][$key] = $perm;
+ }
+ } else {
+ $this->lexic_permissions[$flag] = $perm;
+ }
+ }
+ unset($this->language_data['PARSER_CONTROL']['ENABLE_FLAGS']);
+ }
+
+ //Fix: Problem where hardescapes weren't handled if no ESCAPE_CHAR was given
+ //You need to set one for HARDESCAPES only in this case.
+ if(!isset($this->language_data['HARDCHAR'])) {
+ $this->language_data['HARDCHAR'] = $this->language_data['ESCAPE_CHAR'];
+ }
+
+ //NEW in 1.0.8: Allow styles to be loaded from a separate file to override defaults
+ $style_filename = substr($file_name, 0, -4) . '.style.php';
+ if (is_readable($style_filename)) {
+ //Clear any style_data that could have been set before ...
+ if (isset($style_data)) {
+ unset($style_data);
+ }
+
+ //Read the Style Information from the style file
+ include $style_filename;
+
+ //Apply the new styles to our current language styles
+ if (isset($style_data) && is_array($style_data)) {
+ $this->language_data['STYLES'] =
+ $this->merge_arrays($this->language_data['STYLES'], $style_data);
+ }
+ }
+ }
+
+ /**
+ * Takes the parsed code and various options, and creates the HTML
+ * surrounding it to make it look nice.
+ *
+ * @param string The code already parsed (reference!)
+ * @since 1.0.0
+ * @access private
+ */
+ function finalise(&$parsed_code) {
+ // Remove end parts of important declarations
+ // This is BUGGY!! My fault for bad code: fix coming in 1.2
+ // @todo Remove this crap
+ if ($this->enable_important_blocks &&
+ (strpos($parsed_code, $this->hsc(GESHI_START_IMPORTANT)) === false)) {
+ $parsed_code = str_replace($this->hsc(GESHI_END_IMPORTANT), '', $parsed_code);
+ }
+
+ // Add HTML whitespace stuff if we're using the <div> header
+ if ($this->header_type != GESHI_HEADER_PRE && $this->header_type != GESHI_HEADER_PRE_VALID) {
+ $this->indent($parsed_code);
+ }
+
+ // purge some unnecessary stuff
+ /** NOTE: memorypeak #1 */
+ $parsed_code = preg_replace('#<span[^>]+>(\s*)</span>#', '\\1', $parsed_code);
+
+ // If we are using IDs for line numbers, there needs to be an overall
+ // ID set to prevent collisions.
+ if ($this->add_ids && !$this->overall_id) {
+ $this->overall_id = 'geshi-' . substr(md5(microtime()), 0, 4);
+ }
+
+ // Get code into lines
+ /** NOTE: memorypeak #2 */
+ $code = explode("\n", $parsed_code);
+ $parsed_code = $this->header();
+
+ // If we're using line numbers, we insert <li>s and appropriate
+ // markup to style them (otherwise we don't need to do anything)
+ if ($this->line_numbers != GESHI_NO_LINE_NUMBERS && $this->header_type != GESHI_HEADER_PRE_TABLE) {
+ // If we're using the <pre> header, we shouldn't add newlines because
+ // the <pre> will line-break them (and the <li>s already do this for us)
+ $ls = ($this->header_type != GESHI_HEADER_PRE && $this->header_type != GESHI_HEADER_PRE_VALID) ? "\n" : '';
+
+ // Set vars to defaults for following loop
+ $i = 0;
+
+ // Foreach line...
+ for ($i = 0, $n = count($code); $i < $n;) {
+ //Reset the attributes for a new line ...
+ $attrs = array();
+
+ // Make lines have at least one space in them if they're empty
+ // BenBE: Checking emptiness using trim instead of relying on blanks
+ if ('' == trim($code[$i])) {
+ $code[$i] = '&nbsp;';
+ }
+
+ // If this is a "special line"...
+ if ($this->line_numbers == GESHI_FANCY_LINE_NUMBERS &&
+ $i % $this->line_nth_row == ($this->line_nth_row - 1)) {
+ // Set the attributes to style the line
+ if ($this->use_classes) {
+ //$attr = ' class="li2"';
+ $attrs['class'][] = 'li2';
+ $def_attr = ' class="de2"';
+ } else {
+ //$attr = ' style="' . $this->line_style2 . '"';
+ $attrs['style'][] = $this->line_style2;
+ // This style "covers up" the special styles set for special lines
+ // so that styles applied to special lines don't apply to the actual
+ // code on that line
+ $def_attr = ' style="' . $this->code_style . '"';
+ }
+ } else {
+ if ($this->use_classes) {
+ //$attr = ' class="li1"';
+ $attrs['class'][] = 'li1';
+ $def_attr = ' class="de1"';
+ } else {
+ //$attr = ' style="' . $this->line_style1 . '"';
+ $attrs['style'][] = $this->line_style1;
+ $def_attr = ' style="' . $this->code_style . '"';
+ }
+ }
+
+ //Check which type of tag to insert for this line
+ if ($this->header_type == GESHI_HEADER_PRE_VALID) {
+ $start = "<pre$def_attr>";
+ $end = '</pre>';
+ } else {
+ // Span or div?
+ $start = "<div$def_attr>";
+ $end = '</div>';
+ }
+
+ ++$i;
+
+ // Are we supposed to use ids? If so, add them
+ if ($this->add_ids) {
+ $attrs['id'][] = "$this->overall_id-$i";
+ }
+
+ //Is this some line with extra styles???
+ if (in_array($i, $this->highlight_extra_lines)) {
+ if ($this->use_classes) {
+ if (isset($this->highlight_extra_lines_styles[$i])) {
+ $attrs['class'][] = "lx$i";
+ } else {
+ $attrs['class'][] = "ln-xtra";
+ }
+ } else {
+ array_push($attrs['style'], $this->get_line_style($i));
+ }
+ }
+
+ // Add in the line surrounded by appropriate list HTML
+ $attr_string = '';
+ foreach ($attrs as $key => $attr) {
+ $attr_string .= ' ' . $key . '="' . implode(' ', $attr) . '"';
+ }
+
+ $parsed_code .= "<li$attr_string>$start{$code[$i-1]}$end</li>$ls";
+ unset($code[$i - 1]);
+ }
+ } else {
+ $n = count($code);
+ if ($this->use_classes) {
+ $attributes = ' class="de1"';
+ } else {
+ $attributes = ' style="'. $this->code_style .'"';
+ }
+ if ($this->header_type == GESHI_HEADER_PRE_VALID) {
+ $parsed_code .= '<pre'. $attributes .'>';
+ } elseif ($this->header_type == GESHI_HEADER_PRE_TABLE) {
+ if ($this->line_numbers != GESHI_NO_LINE_NUMBERS) {
+ if ($this->use_classes) {
+ $attrs = ' class="ln"';
+ } else {
+ $attrs = ' style="'. $this->table_linenumber_style .'"';
+ }
+ $parsed_code .= '<td'.$attrs.'><pre'.$attributes.'>';
+ // get linenumbers
+ // we don't merge it with the for below, since it should be better for
+ // memory consumption this way
+ // @todo: but... actually it would still be somewhat nice to merge the two loops
+ // the mem peaks are at different positions
+ for ($i = 0; $i < $n; ++$i) {
+ $close = 0;
+ // fancy lines
+ if ($this->line_numbers == GESHI_FANCY_LINE_NUMBERS &&
+ $i % $this->line_nth_row == ($this->line_nth_row - 1)) {
+ // Set the attributes to style the line
+ if ($this->use_classes) {
+ $parsed_code .= '<span class="xtra li2"><span class="de2">';
+ } else {
+ // This style "covers up" the special styles set for special lines
+ // so that styles applied to special lines don't apply to the actual
+ // code on that line
+ $parsed_code .= '<span style="display:block;' . $this->line_style2 . '">'
+ .'<span style="' . $this->code_style .'">';
+ }
+ $close += 2;
+ }
+ //Is this some line with extra styles???
+ if (in_array($i + 1, $this->highlight_extra_lines)) {
+ if ($this->use_classes) {
+ if (isset($this->highlight_extra_lines_styles[$i])) {
+ $parsed_code .= "<span class=\"xtra lx$i\">";
+ } else {
+ $parsed_code .= "<span class=\"xtra ln-xtra\">";
+ }
+ } else {
+ $parsed_code .= "<span style=\"display:block;" . $this->get_line_style($i) . "\">";
+ }
+ ++$close;
+ }
+ $parsed_code .= $this->line_numbers_start + $i;
+ if ($close) {
+ $parsed_code .= str_repeat('</span>', $close);
+ } elseif ($i != $n) {
+ $parsed_code .= "\n";
+ }
+ }
+ $parsed_code .= '</pre></td><td'.$attributes.'>';
+ }
+ $parsed_code .= '<pre'. $attributes .'>';
+ }
+ // No line numbers, but still need to handle highlighting lines extra.
+ // Have to use divs so the full width of the code is highlighted
+ $close = 0;
+ for ($i = 0; $i < $n; ++$i) {
+ // Make lines have at least one space in them if they're empty
+ // BenBE: Checking emptiness using trim instead of relying on blanks
+ if ('' == trim($code[$i])) {
+ $code[$i] = '&nbsp;';
+ }
+ // fancy lines
+ if ($this->line_numbers == GESHI_FANCY_LINE_NUMBERS &&
+ $i % $this->line_nth_row == ($this->line_nth_row - 1)) {
+ // Set the attributes to style the line
+ if ($this->use_classes) {
+ $parsed_code .= '<span class="xtra li2"><span class="de2">';
+ } else {
+ // This style "covers up" the special styles set for special lines
+ // so that styles applied to special lines don't apply to the actual
+ // code on that line
+ $parsed_code .= '<span style="display:block;' . $this->line_style2 . '">'
+ .'<span style="' . $this->code_style .'">';
+ }
+ $close += 2;
+ }
+ //Is this some line with extra styles???
+ if (in_array($i + 1, $this->highlight_extra_lines)) {
+ if ($this->use_classes) {
+ if (isset($this->highlight_extra_lines_styles[$i])) {
+ $parsed_code .= "<span class=\"xtra lx$i\">";
+ } else {
+ $parsed_code .= "<span class=\"xtra ln-xtra\">";
+ }
+ } else {
+ $parsed_code .= "<span style=\"display:block;" . $this->get_line_style($i) . "\">";
+ }
+ ++$close;
+ }
+
+ $parsed_code .= $code[$i];
+
+ if ($close) {
+ $parsed_code .= str_repeat('</span>', $close);
+ $close = 0;
+ }
+ elseif ($i + 1 < $n) {
+ $parsed_code .= "\n";
+ }
+ unset($code[$i]);
+ }
+
+ if ($this->header_type == GESHI_HEADER_PRE_VALID || $this->header_type == GESHI_HEADER_PRE_TABLE) {
+ $parsed_code .= '</pre>';
+ }
+ if ($this->header_type == GESHI_HEADER_PRE_TABLE && $this->line_numbers != GESHI_NO_LINE_NUMBERS) {
+ $parsed_code .= '</td>';
+ }
+ }
+
+ $parsed_code .= $this->footer();
+ }
+
+ /**
+ * Creates the header for the code block (with correct attributes)
+ *
+ * @return string The header for the code block
+ * @since 1.0.0
+ * @access private
+ */
+ function header() {
+ // Get attributes needed
+ /**
+ * @todo Document behaviour change - class is outputted regardless of whether
+ * we're using classes or not. Same with style
+ */
+ $attributes = ' class="' . $this->_genCSSName($this->language);
+ if ($this->overall_class != '') {
+ $attributes .= " ".$this->_genCSSName($this->overall_class);
+ }
+ $attributes .= '"';
+
+ if ($this->overall_id != '') {
+ $attributes .= " id=\"{$this->overall_id}\"";
+ }
+ if ($this->overall_style != '' && !$this->use_classes) {
+ $attributes .= ' style="' . $this->overall_style . '"';
+ }
+
+ $ol_attributes = '';
+
+ if ($this->line_numbers_start != 1) {
+ $ol_attributes .= ' start="' . $this->line_numbers_start . '"';
+ }
+
+ // Get the header HTML
+ $header = $this->header_content;
+ if ($header) {
+ if ($this->header_type == GESHI_HEADER_PRE || $this->header_type == GESHI_HEADER_PRE_VALID) {
+ $header = str_replace("\n", '', $header);
+ }
+ $header = $this->replace_keywords($header);
+
+ if ($this->use_classes) {
+ $attr = ' class="head"';
+ } else {
+ $attr = " style=\"{$this->header_content_style}\"";
+ }
+ if ($this->header_type == GESHI_HEADER_PRE_TABLE && $this->line_numbers != GESHI_NO_LINE_NUMBERS) {
+ $header = "<thead><tr><td colspan=\"2\" $attr>$header</td></tr></thead>";
+ } else {
+ $header = "<div$attr>$header</div>";
+ }
+ }
+
+ if (GESHI_HEADER_NONE == $this->header_type) {
+ if ($this->line_numbers != GESHI_NO_LINE_NUMBERS) {
+ return "$header<ol$attributes$ol_attributes>";
+ }
+ return $header . ($this->force_code_block ? '<div>' : '');
+ }
+
+ // Work out what to return and do it
+ if ($this->line_numbers != GESHI_NO_LINE_NUMBERS) {
+ if ($this->header_type == GESHI_HEADER_PRE) {
+ return "<pre$attributes>$header<ol$ol_attributes>";
+ } elseif ($this->header_type == GESHI_HEADER_DIV ||
+ $this->header_type == GESHI_HEADER_PRE_VALID) {
+ return "<div$attributes>$header<ol$ol_attributes>";
+ } elseif ($this->header_type == GESHI_HEADER_PRE_TABLE) {
+ return "<table$attributes>$header<tbody><tr class=\"li1\">";
+ }
+ } else {
+ if ($this->header_type == GESHI_HEADER_PRE) {
+ return "<pre$attributes>$header" .
+ ($this->force_code_block ? '<div>' : '');
+ } else {
+ return "<div$attributes>$header" .
+ ($this->force_code_block ? '<div>' : '');
+ }
+ }
+ }
+
+ /**
+ * Returns the footer for the code block.
+ *
+ * @return string The footer for the code block
+ * @since 1.0.0
+ * @access private
+ */
+ function footer() {
+ $footer = $this->footer_content;
+ if ($footer) {
+ if ($this->header_type == GESHI_HEADER_PRE) {
+ $footer = str_replace("\n", '', $footer);;
+ }
+ $footer = $this->replace_keywords($footer);
+
+ if ($this->use_classes) {
+ $attr = ' class="foot"';
+ } else {
+ $attr = " style=\"{$this->footer_content_style}\"";
+ }
+ if ($this->header_type == GESHI_HEADER_PRE_TABLE && $this->line_numbers != GESHI_NO_LINE_NUMBERS) {
+ $footer = "<tfoot><tr><td colspan=\"2\">$footer</td></tr></tfoot>";
+ } else {
+ $footer = "<div$attr>$footer</div>";
+ }
+ }
+
+ if (GESHI_HEADER_NONE == $this->header_type) {
+ return ($this->line_numbers != GESHI_NO_LINE_NUMBERS) ? '</ol>' . $footer : $footer;
+ }
+
+ if ($this->header_type == GESHI_HEADER_DIV || $this->header_type == GESHI_HEADER_PRE_VALID) {
+ if ($this->line_numbers != GESHI_NO_LINE_NUMBERS) {
+ return "</ol>$footer</div>";
+ }
+ return ($this->force_code_block ? '</div>' : '') .
+ "$footer</div>";
+ }
+ elseif ($this->header_type == GESHI_HEADER_PRE_TABLE) {
+ if ($this->line_numbers != GESHI_NO_LINE_NUMBERS) {
+ return "</tr></tbody>$footer</table>";
+ }
+ return ($this->force_code_block ? '</div>' : '') .
+ "$footer</div>";
+ }
+ else {
+ if ($this->line_numbers != GESHI_NO_LINE_NUMBERS) {
+ return "</ol>$footer</pre>";
+ }
+ return ($this->force_code_block ? '</div>' : '') .
+ "$footer</pre>";
+ }
+ }
+
+ /**
+ * Replaces certain keywords in the header and footer with
+ * certain configuration values
+ *
+ * @param string The header or footer content to do replacement on
+ * @return string The header or footer with replaced keywords
+ * @since 1.0.2
+ * @access private
+ */
+ function replace_keywords($instr) {
+ $keywords = $replacements = array();
+
+ $keywords[] = '<TIME>';
+ $keywords[] = '{TIME}';
+ $replacements[] = $replacements[] = number_format($time = $this->get_time(), 3);
+
+ $keywords[] = '<LANGUAGE>';
+ $keywords[] = '{LANGUAGE}';
+ $replacements[] = $replacements[] = $this->language_data['LANG_NAME'];
+
+ $keywords[] = '<VERSION>';
+ $keywords[] = '{VERSION}';
+ $replacements[] = $replacements[] = GESHI_VERSION;
+
+ $keywords[] = '<SPEED>';
+ $keywords[] = '{SPEED}';
+ if ($time <= 0) {
+ $speed = 'N/A';
+ } else {
+ $speed = strlen($this->source) / $time;
+ if ($speed >= 1024) {
+ $speed = sprintf("%.2f KB/s", $speed / 1024.0);
+ } else {
+ $speed = sprintf("%.0f B/s", $speed);
+ }
+ }
+ $replacements[] = $replacements[] = $speed;
+
+ return str_replace($keywords, $replacements, $instr);
+ }
+
+ /**
+ * Secure replacement for PHP built-in function htmlspecialchars().
+ *
+ * See ticket #427 (http://wush.net/trac/wikka/ticket/427) for the rationale
+ * for this replacement function.
+ *
+ * The INTERFACE for this function is almost the same as that for
+ * htmlspecialchars(), with the same default for quote style; however, there
+ * is no 'charset' parameter. The reason for this is as follows:
+ *
+ * The PHP docs say:
+ * "The third argument charset defines character set used in conversion."
+ *
+ * I suspect PHP's htmlspecialchars() is working at the byte-value level and
+ * thus _needs_ to know (or asssume) a character set because the special
+ * characters to be replaced could exist at different code points in
+ * different character sets. (If indeed htmlspecialchars() works at
+ * byte-value level that goes some way towards explaining why the
+ * vulnerability would exist in this function, too, and not only in
+ * htmlentities() which certainly is working at byte-value level.)
+ *
+ * This replacement function however works at character level and should
+ * therefore be "immune" to character set differences - so no charset
+ * parameter is needed or provided. If a third parameter is passed, it will
+ * be silently ignored.
+ *
+ * In the OUTPUT there is a minor difference in that we use '&#39;' instead
+ * of PHP's '&#039;' for a single quote: this provides compatibility with
+ * get_html_translation_table(HTML_SPECIALCHARS, ENT_QUOTES)
+ * (see comment by mikiwoz at yahoo dot co dot uk on
+ * http://php.net/htmlspecialchars); it also matches the entity definition
+ * for XML 1.0
+ * (http://www.w3.org/TR/xhtml1/dtds.html#a_dtd_Special_characters).
+ * Like PHP we use a numeric character reference instead of '&apos;' for the
+ * single quote. For the other special characters we use the named entity
+ * references, as PHP is doing.
+ *
+ * @author {@link http://wikkawiki.org/JavaWoman Marjolein Katsma}
+ *
+ * @license http://www.gnu.org/copyleft/lgpl.html
+ * GNU Lesser General Public License
+ * @copyright Copyright 2007, {@link http://wikkawiki.org/CreditsPage
+ * Wikka Development Team}
+ *
+ * @access private
+ * @param string $string string to be converted
+ * @param integer $quote_style
+ * - ENT_COMPAT: escapes &, <, > and double quote (default)
+ * - ENT_NOQUOTES: escapes only &, < and >
+ * - ENT_QUOTES: escapes &, <, >, double and single quotes
+ * @return string converted string
+ * @since 1.0.7.18
+ */
+ function hsc($string, $quote_style = ENT_COMPAT) {
+ // init
+ static $aTransSpecchar = array(
+ '&' => '&amp;',
+ '"' => '&quot;',
+ '<' => '&lt;',
+ '>' => '&gt;',
+
+ //This fix is related to SF#1923020, but has to be applied
+ //regardless of actually highlighting symbols.
+
+ //Circumvent a bug with symbol highlighting
+ //This is required as ; would produce undesirable side-effects if it
+ //was not to be processed as an entity.
+ ';' => '<SEMI>', // Force ; to be processed as entity
+ '|' => '<PIPE>' // Force | to be processed as entity
+ ); // ENT_COMPAT set
+
+ switch ($quote_style) {
+ case ENT_NOQUOTES: // don't convert double quotes
+ unset($aTransSpecchar['"']);
+ break;
+ case ENT_QUOTES: // convert single quotes as well
+ $aTransSpecchar["'"] = '&#39;'; // (apos) htmlspecialchars() uses '&#039;'
+ break;
+ }
+
+ // return translated string
+ return strtr($string, $aTransSpecchar);
+ }
+
+ function _genCSSName($name){
+ return (is_numeric($name[0]) ? '_' : '') . $name;
+ }
+
+ /**
+ * Returns a stylesheet for the highlighted code. If $economy mode
+ * is true, we only return the stylesheet declarations that matter for
+ * this code block instead of the whole thing
+ *
+ * @param boolean Whether to use economy mode or not
+ * @return string A stylesheet built on the data for the current language
+ * @since 1.0.0
+ */
+ function get_stylesheet($economy_mode = true) {
+ // If there's an error, chances are that the language file
+ // won't have populated the language data file, so we can't
+ // risk getting a stylesheet...
+ if ($this->error) {
+ return '';
+ }
+
+ //Check if the style rearrangements have been processed ...
+ //This also does some preprocessing to check which style groups are useable ...
+ if(!isset($this->language_data['NUMBERS_CACHE'])) {
+ $this->build_style_cache();
+ }
+
+ // First, work out what the selector should be. If there's an ID,
+ // that should be used, the same for a class. Otherwise, a selector
+ // of '' means that these styles will be applied anywhere
+ if ($this->overall_id) {
+ $selector = '#' . $this->_genCSSName($this->overall_id);
+ } else {
+ $selector = '.' . $this->_genCSSName($this->language);
+ if ($this->overall_class) {
+ $selector .= '.' . $this->_genCSSName($this->overall_class);
+ }
+ }
+ $selector .= ' ';
+
+ // Header of the stylesheet
+ if (!$economy_mode) {
+ $stylesheet = "/**\n".
+ " * GeSHi Dynamically Generated Stylesheet\n".
+ " * --------------------------------------\n".
+ " * Dynamically generated stylesheet for {$this->language}\n".
+ " * CSS class: {$this->overall_class}, CSS id: {$this->overall_id}\n".
+ " * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann\n" .
+ " * (http://qbnz.com/highlighter/ and http://geshi.org/)\n".
+ " * --------------------------------------\n".
+ " */\n";
+ } else {
+ $stylesheet = "/**\n".
+ " * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann\n" .
+ " * (http://qbnz.com/highlighter/ and http://geshi.org/)\n".
+ " */\n";
+ }
+
+ // Set the <ol> to have no effect at all if there are line numbers
+ // (<ol>s have margins that should be destroyed so all layout is
+ // controlled by the set_overall_style method, which works on the
+ // <pre> or <div> container). Additionally, set default styles for lines
+ if (!$economy_mode || $this->line_numbers != GESHI_NO_LINE_NUMBERS) {
+ //$stylesheet .= "$selector, {$selector}ol, {$selector}ol li {margin: 0;}\n";
+ $stylesheet .= "$selector.de1, $selector.de2 {{$this->code_style}}\n";
+ }
+
+ // Add overall styles
+ // note: neglect economy_mode, empty styles are meaningless
+ if ($this->overall_style != '') {
+ $stylesheet .= "$selector {{$this->overall_style}}\n";
+ }
+
+ // Add styles for links
+ // note: economy mode does not make _any_ sense here
+ // either the style is empty and thus no selector is needed
+ // or the appropriate key is given.
+ foreach ($this->link_styles as $key => $style) {
+ if ($style != '') {
+ switch ($key) {
+ case GESHI_LINK:
+ $stylesheet .= "{$selector}a:link {{$style}}\n";
+ break;
+ case GESHI_HOVER:
+ $stylesheet .= "{$selector}a:hover {{$style}}\n";
+ break;
+ case GESHI_ACTIVE:
+ $stylesheet .= "{$selector}a:active {{$style}}\n";
+ break;
+ case GESHI_VISITED:
+ $stylesheet .= "{$selector}a:visited {{$style}}\n";
+ break;
+ }
+ }
+ }
+
+ // Header and footer
+ // note: neglect economy_mode, empty styles are meaningless
+ if ($this->header_content_style != '') {
+ $stylesheet .= "$selector.head {{$this->header_content_style}}\n";
+ }
+ if ($this->footer_content_style != '') {
+ $stylesheet .= "$selector.foot {{$this->footer_content_style}}\n";
+ }
+
+ // Styles for important stuff
+ // note: neglect economy_mode, empty styles are meaningless
+ if ($this->important_styles != '') {
+ $stylesheet .= "$selector.imp {{$this->important_styles}}\n";
+ }
+
+ // Simple line number styles
+ if ((!$economy_mode || $this->line_numbers != GESHI_NO_LINE_NUMBERS) && $this->line_style1 != '') {
+ $stylesheet .= "{$selector}li, {$selector}.li1 {{$this->line_style1}}\n";
+ }
+ if ((!$economy_mode || $this->line_numbers != GESHI_NO_LINE_NUMBERS) && $this->table_linenumber_style != '') {
+ $stylesheet .= "{$selector}.ln {{$this->table_linenumber_style}}\n";
+ }
+ // If there is a style set for fancy line numbers, echo it out
+ if ((!$economy_mode || $this->line_numbers == GESHI_FANCY_LINE_NUMBERS) && $this->line_style2 != '') {
+ $stylesheet .= "{$selector}.li2 {{$this->line_style2}}\n";
+ }
+
+ // note: empty styles are meaningless
+ foreach ($this->language_data['STYLES']['KEYWORDS'] as $group => $styles) {
+ if ($styles != '' && (!$economy_mode ||
+ (isset($this->lexic_permissions['KEYWORDS'][$group]) &&
+ $this->lexic_permissions['KEYWORDS'][$group]))) {
+ $stylesheet .= "$selector.kw$group {{$styles}}\n";
+ }
+ }
+ foreach ($this->language_data['STYLES']['COMMENTS'] as $group => $styles) {
+ if ($styles != '' && (!$economy_mode ||
+ (isset($this->lexic_permissions['COMMENTS'][$group]) &&
+ $this->lexic_permissions['COMMENTS'][$group]) ||
+ (!empty($this->language_data['COMMENT_REGEXP']) &&
+ !empty($this->language_data['COMMENT_REGEXP'][$group])))) {
+ $stylesheet .= "$selector.co$group {{$styles}}\n";
+ }
+ }
+ foreach ($this->language_data['STYLES']['ESCAPE_CHAR'] as $group => $styles) {
+ if ($styles != '' && (!$economy_mode || $this->lexic_permissions['ESCAPE_CHAR'])) {
+ // NEW: since 1.0.8 we have to handle hardescapes
+ if ($group === 'HARD') {
+ $group = '_h';
+ }
+ $stylesheet .= "$selector.es$group {{$styles}}\n";
+ }
+ }
+ foreach ($this->language_data['STYLES']['BRACKETS'] as $group => $styles) {
+ if ($styles != '' && (!$economy_mode || $this->lexic_permissions['BRACKETS'])) {
+ $stylesheet .= "$selector.br$group {{$styles}}\n";
+ }
+ }
+ foreach ($this->language_data['STYLES']['SYMBOLS'] as $group => $styles) {
+ if ($styles != '' && (!$economy_mode || $this->lexic_permissions['SYMBOLS'])) {
+ $stylesheet .= "$selector.sy$group {{$styles}}\n";
+ }
+ }
+ foreach ($this->language_data['STYLES']['STRINGS'] as $group => $styles) {
+ if ($styles != '' && (!$economy_mode || $this->lexic_permissions['STRINGS'])) {
+ // NEW: since 1.0.8 we have to handle hardquotes
+ if ($group === 'HARD') {
+ $group = '_h';
+ }
+ $stylesheet .= "$selector.st$group {{$styles}}\n";
+ }
+ }
+ foreach ($this->language_data['STYLES']['NUMBERS'] as $group => $styles) {
+ if ($styles != '' && (!$economy_mode || $this->lexic_permissions['NUMBERS'])) {
+ $stylesheet .= "$selector.nu$group {{$styles}}\n";
+ }
+ }
+ foreach ($this->language_data['STYLES']['METHODS'] as $group => $styles) {
+ if ($styles != '' && (!$economy_mode || $this->lexic_permissions['METHODS'])) {
+ $stylesheet .= "$selector.me$group {{$styles}}\n";
+ }
+ }
+ // note: neglect economy_mode, empty styles are meaningless
+ foreach ($this->language_data['STYLES']['SCRIPT'] as $group => $styles) {
+ if ($styles != '') {
+ $stylesheet .= "$selector.sc$group {{$styles}}\n";
+ }
+ }
+ foreach ($this->language_data['STYLES']['REGEXPS'] as $group => $styles) {
+ if ($styles != '' && (!$economy_mode ||
+ (isset($this->lexic_permissions['REGEXPS'][$group]) &&
+ $this->lexic_permissions['REGEXPS'][$group]))) {
+ if (is_array($this->language_data['REGEXPS'][$group]) &&
+ array_key_exists(GESHI_CLASS, $this->language_data['REGEXPS'][$group])) {
+ $stylesheet .= "$selector.";
+ $stylesheet .= $this->language_data['REGEXPS'][$group][GESHI_CLASS];
+ $stylesheet .= " {{$styles}}\n";
+ } else {
+ $stylesheet .= "$selector.re$group {{$styles}}\n";
+ }
+ }
+ }
+ // Styles for lines being highlighted extra
+ if (!$economy_mode || (count($this->highlight_extra_lines)!=count($this->highlight_extra_lines_styles))) {
+ $stylesheet .= "{$selector}.ln-xtra, {$selector}li.ln-xtra, {$selector}div.ln-xtra {{$this->highlight_extra_lines_style}}\n";
+ }
+ $stylesheet .= "{$selector}span.xtra { display:block; }\n";
+ foreach ($this->highlight_extra_lines_styles as $lineid => $linestyle) {
+ $stylesheet .= "{$selector}.lx$lineid, {$selector}li.lx$lineid, {$selector}div.lx$lineid {{$linestyle}}\n";
+ }
+
+ return $stylesheet;
+ }
+
+ /**
+ * Get's the style that is used for the specified line
+ *
+ * @param int The line number information is requested for
+ * @access private
+ * @since 1.0.7.21
+ */
+ function get_line_style($line) {
+ //$style = null;
+ $style = null;
+ if (isset($this->highlight_extra_lines_styles[$line])) {
+ $style = $this->highlight_extra_lines_styles[$line];
+ } else { // if no "extra" style assigned
+ $style = $this->highlight_extra_lines_style;
+ }
+
+ return $style;
+ }
+
+ /**
+ * this functions creates an optimized regular expression list
+ * of an array of strings.
+ *
+ * Example:
+ * <code>$list = array('faa', 'foo', 'foobar');
+ * => string 'f(aa|oo(bar)?)'</code>
+ *
+ * @param $list array of (unquoted) strings
+ * @param $regexp_delimiter your regular expression delimiter, @see preg_quote()
+ * @return string for regular expression
+ * @author Milian Wolff <mail@milianw.de>
+ * @since 1.0.8
+ * @access private
+ */
+ function optimize_regexp_list($list, $regexp_delimiter = '/') {
+ $regex_chars = array('.', '\\', '+', '-', '*', '?', '[', '^', ']', '$',
+ '(', ')', '{', '}', '=', '!', '<', '>', '|', ':', $regexp_delimiter);
+ sort($list);
+ $regexp_list = array('');
+ $num_subpatterns = 0;
+ $list_key = 0;
+
+ // the tokens which we will use to generate the regexp list
+ $tokens = array();
+ $prev_keys = array();
+ // go through all entries of the list and generate the token list
+ $cur_len = 0;
+ for ($i = 0, $i_max = count($list); $i < $i_max; ++$i) {
+ if ($cur_len > GESHI_MAX_PCRE_LENGTH) {
+ // seems like the length of this pcre is growing exorbitantly
+ $regexp_list[++$list_key] = $this->_optimize_regexp_list_tokens_to_string($tokens);
+ $num_subpatterns = substr_count($regexp_list[$list_key], '(?:');
+ $tokens = array();
+ $cur_len = 0;
+ }
+ $level = 0;
+ $entry = preg_quote((string) $list[$i], $regexp_delimiter);
+ $pointer = &$tokens;
+ // properly assign the new entry to the correct position in the token array
+ // possibly generate smaller common denominator keys
+ while (true) {
+ // get the common denominator
+ if (isset($prev_keys[$level])) {
+ if ($prev_keys[$level] == $entry) {
+ // this is a duplicate entry, skip it
+ continue 2;
+ }
+ $char = 0;
+ while (isset($entry[$char]) && isset($prev_keys[$level][$char])
+ && $entry[$char] == $prev_keys[$level][$char]) {
+ ++$char;
+ }
+ if ($char > 0) {
+ // this entry has at least some chars in common with the current key
+ if ($char == strlen($prev_keys[$level])) {
+ // current key is totally matched, i.e. this entry has just some bits appended
+ $pointer = &$pointer[$prev_keys[$level]];
+ } else {
+ // only part of the keys match
+ $new_key_part1 = substr($prev_keys[$level], 0, $char);
+ $new_key_part2 = substr($prev_keys[$level], $char);
+
+ if (in_array($new_key_part1[0], $regex_chars)
+ || in_array($new_key_part2[0], $regex_chars)) {
+ // this is bad, a regex char as first character
+ $pointer[$entry] = array('' => true);
+ array_splice($prev_keys, $level, count($prev_keys), $entry);
+ $cur_len += strlen($entry);
+ continue;
+ } else {
+ // relocate previous tokens
+ $pointer[$new_key_part1] = array($new_key_part2 => $pointer[$prev_keys[$level]]);
+ unset($pointer[$prev_keys[$level]]);
+ $pointer = &$pointer[$new_key_part1];
+ // recreate key index
+ array_splice($prev_keys, $level, count($prev_keys), array($new_key_part1, $new_key_part2));
+ $cur_len += strlen($new_key_part2);
+ }
+ }
+ ++$level;
+ $entry = substr($entry, $char);
+ continue;
+ }
+ // else: fall trough, i.e. no common denominator was found
+ }
+ if ($level == 0 && !empty($tokens)) {
+ // we can dump current tokens into the string and throw them away afterwards
+ $new_entry = $this->_optimize_regexp_list_tokens_to_string($tokens);
+ $new_subpatterns = substr_count($new_entry, '(?:');
+ if (GESHI_MAX_PCRE_SUBPATTERNS && $num_subpatterns + $new_subpatterns > GESHI_MAX_PCRE_SUBPATTERNS) {
+ $regexp_list[++$list_key] = $new_entry;
+ $num_subpatterns = $new_subpatterns;
+ } else {
+ if (!empty($regexp_list[$list_key])) {
+ $new_entry = '|' . $new_entry;
+ }
+ $regexp_list[$list_key] .= $new_entry;
+ $num_subpatterns += $new_subpatterns;
+ }
+ $tokens = array();
+ $cur_len = 0;
+ }
+ // no further common denominator found
+ $pointer[$entry] = array('' => true);
+ array_splice($prev_keys, $level, count($prev_keys), $entry);
+
+ $cur_len += strlen($entry);
+ break;
+ }
+ unset($list[$i]);
+ }
+ // make sure the last tokens get converted as well
+ $new_entry = $this->_optimize_regexp_list_tokens_to_string($tokens);
+ if (GESHI_MAX_PCRE_SUBPATTERNS && $num_subpatterns + substr_count($new_entry, '(?:') > GESHI_MAX_PCRE_SUBPATTERNS) {
+ if ( !empty($regexp_list[$list_key]) ) {
+ ++$list_key;
+ }
+ $regexp_list[$list_key] = $new_entry;
+ } else {
+ if (!empty($regexp_list[$list_key])) {
+ $new_entry = '|' . $new_entry;
+ }
+ $regexp_list[$list_key] .= $new_entry;
+ }
+ return $regexp_list;
+ }
+ /**
+ * this function creates the appropriate regexp string of an token array
+ * you should not call this function directly, @see $this->optimize_regexp_list().
+ *
+ * @param &$tokens array of tokens
+ * @param $recursed bool to know wether we recursed or not
+ * @return string
+ * @author Milian Wolff <mail@milianw.de>
+ * @since 1.0.8
+ * @access private
+ */
+ function _optimize_regexp_list_tokens_to_string(&$tokens, $recursed = false) {
+ $list = '';
+ foreach ($tokens as $token => $sub_tokens) {
+ $list .= $token;
+ $close_entry = isset($sub_tokens['']);
+ unset($sub_tokens['']);
+ if (!empty($sub_tokens)) {
+ $list .= '(?:' . $this->_optimize_regexp_list_tokens_to_string($sub_tokens, true) . ')';
+ if ($close_entry) {
+ // make sub_tokens optional
+ $list .= '?';
+ }
+ }
+ $list .= '|';
+ }
+ if (!$recursed) {
+ // do some optimizations
+ // common trailing strings
+ // BUGGY!
+ //$list = preg_replace_callback('#(?<=^|\:|\|)\w+?(\w+)(?:\|.+\1)+(?=\|)#', create_function(
+ // '$matches', 'return "(?:" . preg_replace("#" . preg_quote($matches[1], "#") . "(?=\||$)#", "", $matches[0]) . ")" . $matches[1];'), $list);
+ // (?:p)? => p?
+ $list = preg_replace('#\(\?\:(.)\)\?#', '\1?', $list);
+ // (?:a|b|c|d|...)? => [abcd...]?
+ // TODO: a|bb|c => [ac]|bb
+ static $callback_2;
+ if (!isset($callback_2)) {
+ $callback_2 = create_function('$matches', 'return "[" . str_replace("|", "", $matches[1]) . "]";');
+ }
+ $list = preg_replace_callback('#\(\?\:((?:.\|)+.)\)#', $callback_2, $list);
+ }
+ // return $list without trailing pipe
+ return substr($list, 0, -1);
+ }
+} // End Class GeSHi
+
+
+if (!function_exists('geshi_highlight')) {
+ /**
+ * Easy way to highlight stuff. Behaves just like highlight_string
+ *
+ * @param string The code to highlight
+ * @param string The language to highlight the code in
+ * @param string The path to the language files. You can leave this blank if you need
+ * as from version 1.0.7 the path should be automatically detected
+ * @param boolean Whether to return the result or to echo
+ * @return string The code highlighted (if $return is true)
+ * @since 1.0.2
+ */
+ function geshi_highlight($string, $language, $path = null, $return = false) {
+ $geshi = new GeSHi($string, $language, $path);
+ $geshi->set_header_type(GESHI_HEADER_NONE);
+
+ if ($return) {
+ return '<code>' . $geshi->parse_code() . '</code>';
+ }
+
+ echo '<code>' . $geshi->parse_code() . '</code>';
+
+ if ($geshi->error()) {
+ return false;
+ }
+ return true;
+ }
+}
+
?> \ No newline at end of file
diff --git a/plugins/wp-syntax/geshi/geshi/4cs.php b/plugins/wp-syntax/geshi/geshi/4cs.php
index c00792e6..5209c51e 100644
--- a/plugins/wp-syntax/geshi/geshi/4cs.php
+++ b/plugins/wp-syntax/geshi/geshi/4cs.php
@@ -4,7 +4,7 @@
* ------
* Author: Jason Curl (jason.curl@continental-corporation.com)
* Copyright: (c) 2009 Jason Curl
- * Release Version: 1.0.8.9
+ * Release Version: 1.0.8.11
* Date Started: 2009/09/05
*
* 4CS language file for GeSHi.
diff --git a/plugins/wp-syntax/geshi/geshi/6502acme.php b/plugins/wp-syntax/geshi/geshi/6502acme.php
index 07f9eaf9..203e04df 100644
--- a/plugins/wp-syntax/geshi/geshi/6502acme.php
+++ b/plugins/wp-syntax/geshi/geshi/6502acme.php
@@ -4,7 +4,7 @@
* -------
* Author: Warren Willmey
* Copyright: (c) 2010 Warren Willmey.
- * Release Version: 1.0.8.9
+ * Release Version: 1.0.8.11
* Date Started: 2010/05/26
*
* MOS 6502 (more specifically 6510) ACME Cross Assembler 0.93 by Marco Baye language file for GeSHi.
diff --git a/plugins/wp-syntax/geshi/geshi/6502kickass.php b/plugins/wp-syntax/geshi/geshi/6502kickass.php
index f4a4bd86..80428262 100644
--- a/plugins/wp-syntax/geshi/geshi/6502kickass.php
+++ b/plugins/wp-syntax/geshi/geshi/6502kickass.php
@@ -4,7 +4,7 @@
* -------
* Author: Warren Willmey
* Copyright: (c) 2010 Warren Willmey.
- * Release Version: 1.0.8.9
+ * Release Version: 1.0.8.11
* Date Started: 2010/06/07
*
* MOS 6502 (6510) Kick Assembler 3.13 language file for GeSHi.
diff --git a/plugins/wp-syntax/geshi/geshi/6502tasm.php b/plugins/wp-syntax/geshi/geshi/6502tasm.php
index 391e0170..86aa479d 100644
--- a/plugins/wp-syntax/geshi/geshi/6502tasm.php
+++ b/plugins/wp-syntax/geshi/geshi/6502tasm.php
@@ -4,7 +4,7 @@
* -------
* Author: Warren Willmey
* Copyright: (c) 2010 Warren Willmey.
- * Release Version: 1.0.8.9
+ * Release Version: 1.0.8.11
* Date Started: 2010/06/02
*
* MOS 6502 (6510) TASM/64TASS (64TASS being the super set of TASM) language file for GeSHi.
diff --git a/plugins/wp-syntax/geshi/geshi/68000devpac.php b/plugins/wp-syntax/geshi/geshi/68000devpac.php
index d0f3a507..f46387ae 100644
--- a/plugins/wp-syntax/geshi/geshi/68000devpac.php
+++ b/plugins/wp-syntax/geshi/geshi/68000devpac.php
@@ -4,7 +4,7 @@
* -------
* Author: Warren Willmey
* Copyright: (c) 2010 Warren Willmey.
- * Release Version: 1.0.8.9
+ * Release Version: 1.0.8.11
* Date Started: 2010/06/09
*
* Motorola 68000 - HiSoft Devpac ST 2 Assembler language file for GeSHi.
diff --git a/plugins/wp-syntax/geshi/geshi/abap.php b/plugins/wp-syntax/geshi/geshi/abap.php
index 8b510df0..5acd261c 100644
--- a/plugins/wp-syntax/geshi/geshi/abap.php
+++ b/plugins/wp-syntax/geshi/geshi/abap.php
@@ -7,7 +7,7 @@
* - Sandra Rossi (sandra.rossi@gmail.com)
* - Jacob Laursen (jlu@kmd.dk)
* Copyright: (c) 2007 Andres Picazo
- * Release Version: 1.0.8.9
+ * Release Version: 1.0.8.11
* Date Started: 2004/06/04
*
* ABAP language file for GeSHi.
diff --git a/plugins/wp-syntax/geshi/geshi/actionscript.php b/plugins/wp-syntax/geshi/geshi/actionscript.php
index 276cf4fe..08e5b49a 100644
--- a/plugins/wp-syntax/geshi/geshi/actionscript.php
+++ b/plugins/wp-syntax/geshi/geshi/actionscript.php
@@ -4,7 +4,7 @@
* ----------------
* Author: Steffen Krause (Steffen.krause@muse.de)
* Copyright: (c) 2004 Steffen Krause, Nigel McNie (http://qbnz.com/highlighter)
- * Release Version: 1.0.8.9
+ * Release Version: 1.0.8.11
* Date Started: 2004/06/20
*
* Actionscript language file for GeSHi.
diff --git a/plugins/wp-syntax/geshi/geshi/actionscript3.php b/plugins/wp-syntax/geshi/geshi/actionscript3.php
index ceaa61d1..189d714b 100644
--- a/plugins/wp-syntax/geshi/geshi/actionscript3.php
+++ b/plugins/wp-syntax/geshi/geshi/actionscript3.php
@@ -4,7 +4,7 @@
* ----------------
* Author: Jordi Boggiano (j.boggiano@seld.be)
* Copyright: (c) 2007 Jordi Boggiano (http://www.seld.be/), Benny Baumann (http://qbnz.com/highlighter)
- * Release Version: 1.0.8.9
+ * Release Version: 1.0.8.11
* Date Started: 2007/11/26
*
* ActionScript3 language file for GeSHi.
@@ -60,7 +60,7 @@ $language_data = array (
'COMMENT_MULTI' => array('/*' => '*/'),
'COMMENT_REGEXP' => array(
//Regular expressions
- 2 => "/(?<=[\\s^])(s|tr|y)\\/(?:\\\\.|(?!\n)[^\\/\\\\])+\\/(?:\\\\.|(?!\n)[^\\/\\\\])*\\/[msixpogcde]*(?=[\\s$\\.\\;])|(?<=[\\s^(=])(m|q[qrwx]?)?\\/(?:\\\\.|(?!\n)[^\\/\\\\])+\\/[msixpogc]*(?=[\\s$\\.\\,\\;\\)])/iU",
+ 2 => "/(?<=[\\s^])(s|tr|y)\\/(?!\s)(?:\\\\.|(?!\n)[^\\/\\\\])+(?<!\s)\\/(?!\s)(?:\\\\.|(?!\n)[^\\/\\\\])*(?<!\s)\\/[msixpogcde]*(?=[\\s$\\.\\;])|(?<=[\\s^(=])(m|q[qrwx]?)?\\/(?!\s)(?:\\\\.|(?!\n)[^\\/\\\\])+(?<!\s)\\/[msixpogc]*(?=[\\s$\\.\\,\\;\\)])/iU",
),
'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE,
'QUOTEMARKS' => array("'", '"'),
@@ -72,7 +72,7 @@ $language_data = array (
'private', 'null', 'new', 'is', 'internal', 'instanceof', 'in',
'import', 'if', 'get', 'for', 'false', 'else', 'each', 'do',
'delete', 'default', 'continue', 'catch', 'case', 'break', 'as',
- 'extends'
+ 'extends', 'override'
),
2 => array(
'var'
diff --git a/plugins/wp-syntax/geshi/geshi/ada.php b/plugins/wp-syntax/geshi/geshi/ada.php
index eb98c978..c4ef2c39 100644
--- a/plugins/wp-syntax/geshi/geshi/ada.php
+++ b/plugins/wp-syntax/geshi/geshi/ada.php
@@ -4,7 +4,7 @@
* -------
* Author: Tux (tux@inmail.cz)
* Copyright: (c) 2004 Tux (http://tux.a4.cz/), Nigel McNie (http://qbnz.com/highlighter)
- * Release Version: 1.0.8.9
+ * Release Version: 1.0.8.11
* Date Started: 2004/07/29
*
* Ada language file for GeSHi.
diff --git a/plugins/wp-syntax/geshi/geshi/algol68.php b/plugins/wp-syntax/geshi/geshi/algol68.php
index e9f19da4..5b1e5aa7 100644
--- a/plugins/wp-syntax/geshi/geshi/algol68.php
+++ b/plugins/wp-syntax/geshi/geshi/algol68.php
@@ -1,49 +1,147 @@
<?php
-/**
+/*************************************************************************************
* algol68.php
* --------
* Author: Neville Dempsey (NevilleD.sourceforge@sgr-a.net)
* Copyright: (c) 2010 Neville Dempsey (https://sourceforge.net/projects/algol68/files/)
- * Release Version: v.v.v.v
+ * Release Version: 1.0.8.11
* Date Started: 2010/04/24
*
* ALGOL 68 language file for GeSHi.
*
* CHANGES
* -------
- * yyyy/mm/dd (v.v.v.v)
- * - First Release
+ * 2010/04/24 (1.0.8.8.0)
+ * - First Release - machine generated by http://rosettacode.org/geshi/
+ * 2010/05/24 (1.0.8.8.1)
+ * - #2324 - converted comment detection to RegEx
+ * 2010/06/16 (1.0.8.8.2)
+ * - separate symbols from keywords - quick fix
+ * 2010/06/16 (1.0.8.8.3)
+ * - reverse length order symbols
+ * - Add RegEx for BITS and REAL literals (INT to do)
+ * - recognise LONG and SHORT prefixes to literals
+ * 2010/07/23 (1.0.8.8.4)
+ * - fix errors detected by langcheck.php, eg rm tab, fix indenting, rm duplicate keywords, fix symbols as keywords etc
+ * - removed bulk of local variables from name space.
+ * - unfolded arrays
*
* TODO (updated yyyy/mm/dd)
* -------------------------
+ * - Use "Parser Control" to fix KEYWORD parsing, eg: (INT minus one= -1; print(ABSminus one))
+ * - Parse $FORMATS$ more fully - if possible.
+ * - Pull reserved words from the source of A68G and A68RS
+ * - Pull stdlib PROC/OP/MODE symbols from the soruce of A68G and A68RS
+ * - Pull PROC/OP/MODE extensions from the soruce of A68G and A68RS
+ * - Use RegEx to detect extended precision PROC names, eg 'long long sin' etc
+ * - Use RegEx to detect white space std PROC names, eg 'new line'
+ * - Use RegEx to detect white space ext PROC names, eg 'cgs speed of light'
+ * - Use RegEx to detect BOLD symbols, eg userdefined MODEs and OPs
+ * - Add REgEx for INT literals - Adding INT breaks formatting...
+ * - Adding PIPE as a key word breaks formatting of "|" symbols!!
*
+ *************************************************************************************
*
+ * This file is part of GeSHi.
*
+ * GeSHi 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 2 of the License, or
+ * (at your option) any later version.
*
- * This file is part of GeSHi.
+ * GeSHi 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.
*
- * GeSHi 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 2 of the License, or
- * (at your option) any later version.
+ * You should have received a copy of the GNU General Public License
+ * along with GeSHi; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * GeSHi 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 GeSHi; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
+ ************************************************************************************/
+
+if(!function_exists('geshi_langfile_algol68_vars')) {
+ function geshi_langfile_algol68_vars(){
+ $pre='(?<![0-9a-z_\.])';
+ $post='?(?![0-9a-z]|\.(?:[eE][+\-]?)?\d)';
+ $post=""; # assuming the RegEx is greedy #
+
+ $_="\s*";
+
+ $srad="Rr"; $rrad="[".$srad."]"; # either one digit, OR opt-space in digits #
+ $sbin="0-1"; $rbin="[".$sbin."]"; $_bin=$rbin."(?:[".$sbin."\s]*".$rbin."|)";
+ $snib="0-3"; $rnib="[".$snib."]"; $_nib=$rnib."(?:[".$snib."\s]*".$rnib."|)";
+ $soct="0-7"; $roct="[".$soct."]"; $_oct=$roct."(?:[".$soct."\s]*".$roct."|)";
+ $sdec="0-9"; $rdec="[".$sdec."]"; $_dec=$rdec."(?:[".$sdec."\s]*".$rdec."|)";
+ $shex="0-9A-Fa-f"; $rhex="[".$shex."]"; $_hex=$rhex."(?:[".$shex."\s]*".$rhex."|)";
+
+ # Define BITS: #
+ $prebits=$pre; $postbits=$post;
+ $bl="2".$_.$rrad.$_.$_bin;
+ $bl=$bl."|"."2".$_.$rrad.$_.$_bin;
+ $bl=$bl."|"."4".$_.$rrad.$_.$_nib;
+ $bl=$bl."|"."8".$_.$rrad.$_.$_oct;
+ $bl=$bl."|"."1".$_."0".$_.$rrad.$_.$_dec;
+ $bl=$bl."|"."1".$_."6".$_.$rrad.$_.$_hex;
+
+ # Define INT: #
+ $preint=$pre; $postint=$post;
+ # for some reason ".0 e - 2" is not recognised, but ".0 e + 2" IS!
+ # work around: remove spaces between sign and digits! Maybe because
+ # of the Unary '-' Operator
+ $sign_="(?:-|\-|[-]|[\-]|\+|)"; # attempts #
+
+ $sign_="(?:-\s*|\+\s*|)"; # n.b. sign is followed by white space #
+
+ $_int=$sign_.$_dec;
+ $il= $_int; # +_9 #
+
+ $GESHI_NUMBER_INT_BASIC='(?:(?<![0-9a-z_\.%])|(?<=\.\.))(?<![\d\.]e[+\-])([1-9]\d*?|0)(?![0-9a-z]|\.(?:[eE][+\-]?)?\d)';
+
+ # Define REAL: #
+ $prereal=$pre; $postreal=$post;
+ $sexp="Ee\\\\"; $_exp="(?:⏨|[".$sexp."])".$_.$_int;
+ $_decimal="[.]".$_.$_dec;
+
+ # Add permitted permutations of various parts #
+ $rl= $_int.$_.$_decimal.$_.$_exp; # +_9_._9_e_+_9 #
+ $rl=$rl."|".$_int.$_."[.]".$_.$_exp; # +_9_.___e_+_9 #
+ $rl=$rl."|".$_int.$_.$_exp; # +_9_____e_+_9 #
+ $rl=$rl."|".$sign_.$_decimal.$_.$_exp; # +___._9_e_+_9 #
+
+ $rl=$rl."|".$_int.$_.$_decimal; # +_9_._9 #
+ $rl=$rl."|".$sign_.$_decimal; # +___._9 #
+
+ # The following line damaged formatting...
+ #$rl=$rl."|".$_int; # +_9 #
+
+ # Apparently Algol68 does not support '2.', c.f. Algol 68G
+ #$rl=$rl."|".$_int.$_."[.]"; # +_9_. #
+
+ # Literal prefixes are overridden by KEYWORDS :-(
+ $LONGS="(?:(?:(LONG\s+)*|(SHORT\s+))*|)";
+
+ return array(
+ "BITS" => $prebits.$LONGS."(?:".$bl.")".$postbits,
+ "INT" => $preint.$LONGS."(?:".$il.")".$postint,
+ "REAL" => $prereal.$LONGS."(?:".$rl.")".$postreal,
+
+ "BOLD" => 'color: #b1b100; font-weight: bold;',
+ "ITALIC" => 'color: #b1b100;', # procedures traditionally italic #
+ "NONSTD" => 'color: #FF0000; font-weight: bold;', # RED #
+ "COMMENT" => 'color: #666666; font-style: italic;'
+ );
+ }
+}
+$a68=geshi_langfile_algol68_vars();
$language_data = array(
'LANG_NAME' => 'ALGOL 68',
'COMMENT_SINGLE' => array(),
'COMMENT_MULTI' => array(
- '#' => '#',
'¢' => '¢',
'£' => '£',
+ '#' => '#',
),
'COMMENT_REGEXP' => array(
1 => '/\bCO((?:MMENT)?)\b.*?\bCO\\1\b/i',
@@ -53,42 +151,59 @@ $language_data = array(
'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE,
'QUOTEMARKS' => array('"'),
'ESCAPE_CHAR' => '"',
+ 'NUMBERS' => GESHI_NUMBER_HEX_SUFFIX, # Warning: Feature!! #
+# GESHI_NUMBER_HEX_SUFFIX, # Attempt ignore default #
'KEYWORDS' => array(
- 1 => array('KEEP', 'FINISH', 'USE', 'SYSPROCS', 'IOSTATE', 'USING', 'ENVIRON'),
- 2 => array('CASE', 'IN', 'OUSE', 'IN', 'OUT', 'ESAC', '(', '|', '|:', ')', 'FOR', 'FROM', 'TO', 'BY', 'WHILE', 'DO', 'OD', 'IF', 'THEN', 'ELIF', 'THEN', 'ELSE', 'FI', 'PAR', 'BEGIN', 'EXIT', 'END', 'GO', 'GOTO', 'FORALL', 'UPTO', 'DOWNTO', 'FOREACH', 'ASSERT'),
- 3 => array('BITS', 'BOOL', 'BYTES', 'CHAR', 'COMPL', 'INT', 'REAL', 'SEMA', 'STRING', 'VOID', 'COMPLEX', 'VECTOR'),
- 4 => array('MODE', 'OP', 'PRIO', 'PROC'),
- 5 => array('FLEX', 'HEAP', 'LOC', 'LONG', 'REF', 'SHORT', 'EITHER'),
- 6 => array('CHANNEL', 'FILE', 'FORMAT', 'STRUCT', 'UNION'),
- 7 => array('OF', 'AT', '@', 'IS', ':=:', 'ISNT', ':/=:', ':≠:', 'CTB', 'CT', '::', 'CTAB', '::=', 'TRUE', 'FALSE', 'EMPTY', 'NIL', '○', 'SKIP', '~'),
- 8 => array('NOT', 'UP', 'DOWN', 'LWB', 'UPB', '-', 'ABS', 'ARG', 'BIN', 'ENTIER', 'LENG', 'LEVEL', 'ODD', 'REPR', 'ROUND', 'SHORTEN', 'CONJ', 'SIGN'),
- 9 => array('¬', '↑', '↓', '⌊', '⌈', '~', '⎩', '⎧'),
- 10 => array('+*', 'I', '+×', '⊥', '!', '⏨'),
- 11 => array('SHL', 'SHR', '**', 'UP', 'DOWN', 'LWB', 'UPB', '↑', '↓', '⌊', '⌈', '⎩', '⎧'),
- 12 => array('*', '/', '%', 'OVER', '%*', 'MOD', 'ELEM', '×', '÷', '÷×', '÷*', '%×', '□', '÷:'),
- 13 => array('-', '+'),
- 14 => array('<', 'LT', '<=', 'LE', '>=', 'GE', '>', 'GT', '≤', '≥'),
- 15 => array('=', 'EQ', '/=', 'NE', '≠', '~='),
- 16 => array('&', 'AND', '∧', 'OR', '∨'),
+# Extensions
+ 1 => array('KEEP', 'FINISH', 'USE', 'SYSPROCS', 'IOSTATE', 'USING', 'ENVIRON', 'PROGRAM', 'CONTEXT'),
+# 2 => array('CASE', 'IN', 'OUSE', 'IN', 'OUT', 'ESAC', '(', '|', '|:', ')', 'FOR', 'FROM', 'TO', 'BY', 'WHILE', 'DO', 'OD', 'IF', 'THEN', 'ELIF', 'THEN', 'ELSE', 'FI', 'PAR', 'BEGIN', 'EXIT', 'END', 'GO', 'GOTO', 'FORALL', 'UPTO', 'DOWNTO', 'FOREACH', 'ASSERT'), #
+ 2 => array('CASE', 'IN', 'OUSE', /* 'IN',*/ 'OUT', 'ESAC', 'PAR', 'BEGIN', 'EXIT', 'END', 'GO TO', 'GOTO', 'FOR', 'FROM', 'TO', 'BY', 'WHILE', 'DO', 'OD', 'IF', 'THEN', 'ELIF', /* 'THEN',*/ 'ELSE', 'FI' ),
+ 3 => array('BITS', 'BOOL', 'BYTES', 'CHAR', 'COMPL', 'INT', 'REAL', 'SEMA', 'STRING', 'VOID'),
+ 4 => array('MODE', 'OP', 'PRIO', 'PROC', 'FLEX', 'HEAP', 'LOC', 'REF', 'LONG', 'SHORT', 'EITHER'),
+# Extensions or deprecated keywords
+# 'PIPE': keyword somehow interferes with the internal operation of GeSHi
+ 5 => array('FORALL', 'UPTO', 'DOWNTO', 'FOREACH', 'ASSERT', 'CTB', 'CT', 'CTAB', 'COMPLEX', 'VECTOR', 'SOUND' /*, 'PIPE'*/),
+ 6 => array('CHANNEL', 'FILE', 'FORMAT', 'STRUCT', 'UNION', 'OF'),
+# '(', '|', '|:', ')', #
+# 7 => array('OF', 'AT', '@', 'IS', ':=:', 'ISNT', ':/=:', ':≠:', 'CTB', 'CT', '::', 'CTAB', '::=', 'TRUE', 'FALSE', 'EMPTY', 'NIL', '○', 'SKIP', '~'),
+ 7 => array('AT', 'IS', 'ISNT', 'TRUE', 'FALSE', 'EMPTY', 'NIL', 'SKIP'),
+ 8 => array('NOT', 'UP', 'DOWN', 'LWB', 'UPB', /* '-',*/ 'ABS', 'ARG', 'BIN', 'ENTIER', 'LENG', 'LEVEL', 'ODD', 'REPR', 'ROUND', 'SHORTEN', 'CONJ', 'SIGN'),
+# OPERATORS ordered roughtly by PRIORITY #
+# 9 => array('¬', '↑', '↓', '⌊', '⌈', '~', '⎩', '⎧'),
+# 10 => array('+*', 'I', '+×', '⊥', '!', '⏨'),
+ 10 => array('I'),
+# 11 => array('SHL', 'SHR', '**', 'UP', 'DOWN', 'LWB', 'UPB', '↑', '↓', '⌊', '⌈', '⎩', '⎧'),
+ 11 => array('SHL', 'SHR', /*'UP', 'DOWN', 'LWB', 'UPB'*/),
+# 12 => array('*', '/', '%', 'OVER', '%*', 'MOD', 'ELEM', '×', '÷', '÷×', '÷*', '%×', '□', '÷:'),
+ 12 => array('OVER', 'MOD', 'ELEM'),
+# 13 => array('-', '+'),
+# 14 => array('<', 'LT', '<=', 'LE', '>=', 'GE', '>', 'GT', '≤', '≥'),
+ 14 => array('LT', 'LE', 'GE', 'GT'),
+# 15 => array('=', 'EQ', '/=', 'NE', '≠', '~='),
+ 15 => array('EQ', 'NE'),
+# 16 => array('&', 'AND', '∧', 'OR', '∨', '/\\', '\\/'),
+ 16 => array('AND', 'OR'),
17 => array('MINUSAB', 'PLUSAB', 'TIMESAB', 'DIVAB', 'OVERAB', 'MODAB', 'PLUSTO'),
- 18 => array('-:=', '+:=', '*:=', '/:=', '%:=', '%*:=', '+=:', '×:=', '÷:=', '÷×:=', '÷*:=', '%×:=', '÷::=', 'MINUS', 'PLUS', 'DIV', 'MOD', 'PRUS'),
+# 18 => array('-:=', '+:=', '*:=', '/:=', '%:=', '%*:=', '+=:', '×:=', '÷:=', '÷×:=', '÷*:=', '%×:=', '÷::=', 'MINUS', 'PLUS', 'DIV', 'MOD', 'PRUS'),
+# Extensions or deprecated keywords
+ 18 => array('MINUS', 'PLUS', 'DIV', /* 'MOD',*/ 'PRUS', 'IS NOT'),
+# Extensions or deprecated keywords
19 => array('THEF', 'ANDF', 'ORF', 'ANDTH', 'OREL', 'ANDTHEN', 'ORELSE'),
- 20 => array('int_lengths', 'intlengths', 'int_shorths', 'intshorths', 'max_int', 'maxint', 'real_lengths', 'reallengths', 'real_shorths', 'realshorths', 'bits_lengths', 'bitslengths', 'bits_shorths', 'bitsshorths', 'bytes_lengths', 'byteslengths', 'bytes_shorths', 'bytesshorths', 'max_abs_char', 'maxabschar', 'int_width', 'intwidth', 'long_int_width', 'longintwidth', 'long_long_int_width', 'longlongintwidth', 'real_width', 'realwidth', 'long_real_width', 'longrealwidth', 'long_long_real_width', 'longlongrealwidth', 'exp_width', 'expwidth', 'long_exp_width', 'longexpwidth', 'long_long_exp_width', 'longlongexpwidth', 'bits_width', 'bitswidth', 'long_bits_width', 'longbitswidth', 'long_long_bits_width', 'longlongbitswidth', 'bytes_width', 'byteswidth', 'long_bytes_width', 'longbyteswidth', 'max_real', 'maxreal', 'small_real', 'smallreal', 'long_max_int', 'longmaxint', 'long_long_max_int', 'longlongmaxint', 'long_max_real', 'longmaxreal', 'long_small_real', 'longsmallreal', 'long_long_max_real', 'longlongmaxreal', 'long_long_small_real', 'longlongsmallreal', 'long_max_bits', 'longmaxbits', 'long_long_max_bits', 'longlongmaxbits', 'null_character', 'nullcharacter', 'blank', 'flip', 'flop', 'error_char', 'errorchar', 'exp_char', 'expchar', 'newline_char', 'newlinechar', 'formfeed_char', 'formfeedchar', 'tab_char', 'tabchar'),
- 21 => array('stand_in_channel', 'standinchannel', 'stand_out_channel', 'standoutchannel', 'stand_back_channel', 'standbackchannel', 'stand_draw_channel', 'standdrawchannel', 'stand_error_channel', 'standerrorchannel'),
- 22 => array('put_possible', 'putpossible', 'get_possible', 'getpossible', 'bin_possible', 'binpossible', 'set_possible', 'setpossible', 'reset_possible', 'resetpossible', 'reidf_possible', 'reidfpossible', 'draw_possible', 'drawpossible', 'compressible', 'on_logical_file_end', 'onlogicalfileend', 'on_physical_file_end', 'onphysicalfileend', 'on_line_end', 'onlineend', 'on_page_end', 'onpageend', 'on_format_end', 'onformatend', 'on_value_error', 'onvalueerror', 'on_open_error', 'onopenerror', 'on_transput_error', 'ontransputerror', 'on_format_error', 'onformaterror', 'open', 'establish', 'create', 'associate', 'close', 'lock', 'scratch', 'space', 'new_line', 'newline', 'print', 'write_f', 'writef', 'print_f', 'printf', 'write_bin', 'writebin', 'print_bin', 'printbin', 'read_f', 'readf', 'read_bin', 'readbin', 'put_f', 'putf', 'get_f', 'getf', 'make_term', 'maketerm', 'make_device', 'makedevice', 'idf', 'term', 'read_int', 'readint', 'read_long_int', 'readlongint', 'read_long_long_int', 'readlonglongint', 'read_real', 'readreal', 'read_long_real', 'readlongreal', 'read_long_long_real', 'readlonglongreal', 'read_complex', 'readcomplex', 'read_long_complex', 'readlongcomplex', 'read_long_long_complex', 'readlonglongcomplex', 'read_bool', 'readbool', 'read_bits', 'readbits', 'read_long_bits', 'readlongbits', 'read_long_long_bits', 'readlonglongbits', 'read_char', 'readchar', 'read_string', 'readstring', 'print_int', 'printint', 'print_long_int', 'printlongint', 'print_long_long_int', 'printlonglongint', 'print_real', 'printreal', 'print_long_real', 'printlongreal', 'print_long_long_real', 'printlonglongreal', 'print_complex', 'printcomplex', 'print_long_complex', 'printlongcomplex', 'print_long_long_complex', 'printlonglongcomplex', 'print_bool', 'printbool', 'print_bits', 'printbits', 'print_long_bits', 'printlongbits', 'print_long_long_bits', 'printlonglongbits', 'print_char', 'printchar', 'print_string', 'printstring', 'whole', 'fixed', 'float'),
- 23 => array('pi', 'long_pi', 'longpi', 'long_long_pi', 'longlongpi'),
- 24 => array('sqrt', 'curt', 'cbrt', 'exp', 'ln', 'log', 'sin', 'arc_sin', 'arcsin', 'cos', 'arc_cos', 'arccos', 'tan', 'arc_tan', 'arctan', 'long_sqrt', 'longsqrt', 'long_curt', 'longcurt', 'long_cbrt', 'longcbrt', 'long_exp', 'longexp', 'long_ln', 'longln', 'long_log', 'longlog', 'long_sin', 'longsin', 'long_arc_sin', 'longarcsin', 'long_cos', 'longcos', 'long_arc_cos', 'longarccos', 'long_tan', 'longtan', 'long_arc_tan', 'longarctan', 'long_long_sqrt', 'longlongsqrt', 'long_long_curt', 'longlongcurt', 'long_long_cbrt', 'longlongcbrt', 'long_long_exp', 'longlongexp', 'long_long_ln', 'longlongln', 'long_long_log', 'longlonglog', 'long_long_sin', 'longlongsin', 'long_long_arc_sin', 'longlongarcsin', 'long_long_cos', 'longlongcos', 'long_long_arc_cos', 'longlongarccos', 'long_long_tan', 'longlongtan', 'long_long_arc_tan', 'longlongarctan'),
- 25 => array('first_random', 'firstrandom', 'next_random', 'nextrandom', 'long_next_random', 'longnextrandom', 'long_long_next_random', 'longlongnextrandom'),
- 26 => array('real', 'bits_pack', 'bitspack', 'long_bits_pack', 'longbitspack', 'long_long_bits_pack', 'longlongbitspack', 'bytes_pack', 'bytespack', 'long_bytes_pack', 'longbytespack', 'char_in_string', 'charinstring', 'last_char_in_string', 'lastcharinstring', 'string_in_string', 'stringinstring'),
- 27 => array('utc_time', 'utctime', 'local_time', 'localtime', 'argc', 'argv', 'get_env', 'getenv', 'reset_errno', 'reseterrno', 'errno', 'strerror'),
- 28 => array('sinh', 'long_sinh', 'longsinh', 'long_long_sinh', 'longlongsinh', 'arc_sinh', 'arcsinh', 'long_arc_sinh', 'longarcsinh', 'long_long_arc_sinh', 'longlongarcsinh', 'cosh', 'long_cosh', 'longcosh', 'long_long_cosh', 'longlongcosh', 'arc_cosh', 'arccosh', 'long_arc_cosh', 'longarccosh', 'long_long_arc_cosh', 'longlongarccosh', 'tanh', 'long_tanh', 'longtanh', 'long_long_tanh', 'longlongtanh', 'arc_tanh', 'arctanh', 'long_arc_tanh', 'longarctanh', 'long_long_arc_tanh', 'longlongarctanh', 'arc_tan2', 'arctan2', 'long_arc_tan2', 'longarctan2', 'long_long_arc_tan2', 'longlongarctan2'),
- 29 => array('complex_sqrt', 'complexsqrt', 'long_complex_sqrt', 'longcomplexsqrt', 'long_long_complex_sqrt', 'longlongcomplexsqrt', 'complex_exp', 'complexexp', 'long_complex_exp', 'longcomplexexp', 'long_long_complex_exp', 'longlongcomplexexp', 'complex_ln', 'complexln', 'long_complex_ln', 'longcomplexln', 'long_long_complex_ln', 'longlongcomplexln', 'complex_sin', 'complexsin', 'long_complex_sin', 'longcomplexsin', 'long_long_complex_sin', 'longlongcomplexsin', 'complex_arc_sin', 'complexarcsin', 'long_complex_arc_sin', 'longcomplexarcsin', 'long_long_complex_arc_sin', 'longlongcomplexarcsin', 'complex_cos', 'complexcos', 'long_complex_cos', 'longcomplexcos', 'long_long_complex_cos', 'longlongcomplexcos', 'complex_arc_cos', 'complexarccos', 'long_complex_arc_cos', 'longcomplexarccos', 'long_long_complex_arc_cos', 'longlongcomplexarccos', 'complex_tan', 'complextan', 'long_complex_tan', 'longcomplextan', 'long_long_complex_tan', 'longlongcomplextan', 'complex_arc_tan', 'complexarctan', 'long_complex_arc_tan', 'longcomplexarctan', 'long_long_complex_arc_tan', 'longlongcomplexarctan', 'complex_sinh', 'complexsinh', 'complex_arc_sinh', 'complexarcsinh', 'complex_cosh', 'complexcosh', 'complex_arc_cosh', 'complexarccosh', 'complex_tanh', 'complextanh', 'complex_arc_tanh', 'complexarctanh')
+# Built in procedures - from standard prelude #
+ 20 => array('int lengths', 'intlengths', 'int shorths', 'intshorths', 'max int', 'maxint', 'real lengths', 'reallengths', 'real shorths', 'realshorths', 'bits lengths', 'bitslengths', 'bits shorths', 'bitsshorths', 'bytes lengths', 'byteslengths', 'bytes shorths', 'bytesshorths', 'max abs char', 'maxabschar', 'int width', 'intwidth', 'long int width', 'longintwidth', 'long long int width', 'longlongintwidth', 'real width', 'realwidth', 'long real width', 'longrealwidth', 'long long real width', 'longlongrealwidth', 'exp width', 'expwidth', 'long exp width', 'longexpwidth', 'long long exp width', 'longlongexpwidth', 'bits width', 'bitswidth', 'long bits width', 'longbitswidth', 'long long bits width', 'longlongbitswidth', 'bytes width', 'byteswidth', 'long bytes width', 'longbyteswidth', 'max real', 'maxreal', 'small real', 'smallreal', 'long max int', 'longmaxint', 'long long max int', 'longlongmaxint', 'long max real', 'longmaxreal', 'long small real', 'longsmallreal', 'long long max real', 'longlongmaxreal', 'long long small real', 'longlongsmallreal', 'long max bits', 'longmaxbits', 'long long max bits', 'longlongmaxbits', 'null character', 'nullcharacter', 'blank', 'flip', 'flop', 'error char', 'errorchar', 'exp char', 'expchar', 'newline char', 'newlinechar', 'formfeed char', 'formfeedchar', 'tab char', 'tabchar'),
+ 21 => array('stand in channel', 'standinchannel', 'stand out channel', 'standoutchannel', 'stand back channel', 'standbackchannel', 'stand draw channel', 'standdrawchannel', 'stand error channel', 'standerrorchannel'),
+ 22 => array('put possible', 'putpossible', 'get possible', 'getpossible', 'bin possible', 'binpossible', 'set possible', 'setpossible', 'reset possible', 'resetpossible', 'reidf possible', 'reidfpossible', 'draw possible', 'drawpossible', 'compressible', 'on logical file end', 'onlogicalfileend', 'on physical file end', 'onphysicalfileend', 'on line end', 'onlineend', 'on page end', 'onpageend', 'on format end', 'onformatend', 'on value error', 'onvalueerror', 'on open error', 'onopenerror', 'on transput error', 'ontransputerror', 'on format error', 'onformaterror', 'open', 'establish', 'create', 'associate', 'close', 'lock', 'scratch', 'space', 'new line', 'newline', 'print', 'write f', 'writef', 'print f', 'printf', 'write bin', 'writebin', 'print bin', 'printbin', 'read f', 'readf', 'read bin', 'readbin', 'put f', 'putf', 'get f', 'getf', 'make term', 'maketerm', 'make device', 'makedevice', 'idf', 'term', 'read int', 'readint', 'read long int', 'readlongint', 'read long long int', 'readlonglongint', 'read real', 'readreal', 'read long real', 'readlongreal', 'read long long real', 'readlonglongreal', 'read complex', 'readcomplex', 'read long complex', 'readlongcomplex', 'read long long complex', 'readlonglongcomplex', 'read bool', 'readbool', 'read bits', 'readbits', 'read long bits', 'readlongbits', 'read long long bits', 'readlonglongbits', 'read char', 'readchar', 'read string', 'readstring', 'print int', 'printint', 'print long int', 'printlongint', 'print long long int', 'printlonglongint', 'print real', 'printreal', 'print long real', 'printlongreal', 'print long long real', 'printlonglongreal', 'print complex', 'printcomplex', 'print long complex', 'printlongcomplex', 'print long long complex', 'printlonglongcomplex', 'print bool', 'printbool', 'print bits', 'printbits', 'print long bits', 'printlongbits', 'print long long bits', 'printlonglongbits', 'print char', 'printchar', 'print string', 'printstring', 'whole', 'fixed', 'float'),
+ 23 => array('pi', 'long pi', 'longpi', 'long long pi', 'longlongpi'),
+ 24 => array('sqrt', 'curt', 'cbrt', 'exp', 'ln', 'log', 'sin', 'arc sin', 'arcsin', 'cos', 'arc cos', 'arccos', 'tan', 'arc tan', 'arctan', 'long sqrt', 'longsqrt', 'long curt', 'longcurt', 'long cbrt', 'longcbrt', 'long exp', 'longexp', 'long ln', 'longln', 'long log', 'longlog', 'long sin', 'longsin', 'long arc sin', 'longarcsin', 'long cos', 'longcos', 'long arc cos', 'longarccos', 'long tan', 'longtan', 'long arc tan', 'longarctan', 'long long sqrt', 'longlongsqrt', 'long long curt', 'longlongcurt', 'long long cbrt', 'longlongcbrt', 'long long exp', 'longlongexp', 'long long ln', 'longlongln', 'long long log', 'longlonglog', 'long long sin', 'longlongsin', 'long long arc sin', 'longlongarcsin', 'long long cos', 'longlongcos', 'long long arc cos', 'longlongarccos', 'long long tan', 'longlongtan', 'long long arc tan', 'longlongarctan'),
+ 25 => array('first random', 'firstrandom', 'next random', 'nextrandom', 'long next random', 'longnextrandom', 'long long next random', 'longlongnextrandom'),
+ 26 => array('real', 'bits pack', 'bitspack', 'long bits pack', 'longbitspack', 'long long bits pack', 'longlongbitspack', 'bytes pack', 'bytespack', 'long bytes pack', 'longbytespack', 'char in string', 'charinstring', 'last char in string', 'lastcharinstring', 'string in string', 'stringinstring'),
+ 27 => array('utc time', 'utctime', 'local time', 'localtime', 'argc', 'argv', 'get env', 'getenv', 'reset errno', 'reseterrno', 'errno', 'strerror'),
+ 28 => array('sinh', 'long sinh', 'longsinh', 'long long sinh', 'longlongsinh', 'arc sinh', 'arcsinh', 'long arc sinh', 'longarcsinh', 'long long arc sinh', 'longlongarcsinh', 'cosh', 'long cosh', 'longcosh', 'long long cosh', 'longlongcosh', 'arc cosh', 'arccosh', 'long arc cosh', 'longarccosh', 'long long arc cosh', 'longlongarccosh', 'tanh', 'long tanh', 'longtanh', 'long long tanh', 'longlongtanh', 'arc tanh', 'arctanh', 'long arc tanh', 'longarctanh', 'long long arc tanh', 'longlongarctanh', 'arc tan2', 'arctan2', 'long arc tan2', 'longarctan2', 'long long arc tan2', 'longlongarctan2'),
+ 29 => array('complex sqrt', 'complexsqrt', 'long complex sqrt', 'longcomplexsqrt', 'long long complex sqrt', 'longlongcomplexsqrt', 'complex exp', 'complexexp', 'long complex exp', 'longcomplexexp', 'long long complex exp', 'longlongcomplexexp', 'complex ln', 'complexln', 'long complex ln', 'longcomplexln', 'long long complex ln', 'longlongcomplexln', 'complex sin', 'complexsin', 'long complex sin', 'longcomplexsin', 'long long complex sin', 'longlongcomplexsin', 'complex arc sin', 'complexarcsin', 'long complex arc sin', 'longcomplexarcsin', 'long long complex arc sin', 'longlongcomplexarcsin', 'complex cos', 'complexcos', 'long complex cos', 'longcomplexcos', 'long long complex cos', 'longlongcomplexcos', 'complex arc cos', 'complexarccos', 'long complex arc cos', 'longcomplexarccos', 'long long complex arc cos', 'longlongcomplexarccos', 'complex tan', 'complextan', 'long complex tan', 'longcomplextan', 'long long complex tan', 'longlongcomplextan', 'complex arc tan', 'complexarctan', 'long complex arc tan', 'longcomplexarctan', 'long long complex arc tan', 'longlongcomplexarctan', 'complex sinh', 'complexsinh', 'complex arc sinh', 'complexarcsinh', 'complex cosh', 'complexcosh', 'complex arc cosh', 'complexarccosh', 'complex tanh', 'complextanh', 'complex arc tanh', 'complexarctanh')
),
'SYMBOLS' => array(
- 1 => array(
- '(', ')', '{', '}', '[', ']', '+', '-', '*', '/', '%', '=', '<', '>', '!', '^', '&', '|', '?', ':', ';', ','
- )
- ),
+ 1 => array( /* reverse length sorted... */ '÷×:=', '%×:=', ':≠:', '÷*:=', '÷::=', '%*:=', ':/=:', '×:=', '÷:=', '÷×', '%:=', '%×', '*:=', '+:=', '+=:', '+×', '-:=', '/:=', '::=', ':=:', '÷*', '÷:', '↑', '↓', '∧', '∨', '≠', '≤', '≥', '⊥', '⌈', '⌊', '⎧', '⎩', /* '⏨', */ '□', '○', '%*', '**', '+*', '/=', '::', '/\\', '\\/', '<=', '>=', '|:', '~=', '¬', '×', '÷', '!', '%', '&', '(', ')', '*', '+', ',', '-', '/', ':', ';', '<', '=', '>', '?', '@', '[', ']', '^', '{', '|', '}', '~')
+ ),
'CASE_SENSITIVE' => array(
GESHI_COMMENTS => false,
1 => true,
@@ -99,11 +214,11 @@ $language_data = array(
6 => true,
7 => true,
8 => true,
- 9 => true,
+# 9 => true,
10 => true,
11 => true,
12 => true,
- 13 => true,
+# 13 => true,
14 => true,
15 => true,
16 => true,
@@ -123,43 +238,18 @@ $language_data = array(
),
'STYLES' => array(
'KEYWORDS' => array(
- 1 => 'color: #b1b100; font-weight: bold;',
- 2 => 'color: #b1b100; font-weight: bold;',
- 3 => 'color: #b1b100; font-weight: bold;',
- 4 => 'color: #b1b100; font-weight: bold;',
- 5 => 'color: #b1b100; font-weight: bold;',
- 6 => 'color: #b1b100; font-weight: bold;',
- 7 => 'color: #b1b100; font-weight: bold;',
- 8 => 'color: #b1b100; font-weight: bold;',
- 9 => 'color: #b1b100; font-weight: bold;',
- 10 => 'color: #b1b100; font-weight: bold;',
- 11 => 'color: #b1b100; font-weight: bold;',
- 12 => 'color: #b1b100; font-weight: bold;',
- 13 => 'color: #b1b100; font-weight: bold;',
- 14 => 'color: #b1b100; font-weight: bold;',
- 15 => 'color: #b1b100; font-weight: bold;',
- 16 => 'color: #b1b100; font-weight: bold;',
- 17 => 'color: #b1b100; font-weight: bold;',
- 18 => 'color: #b1b100; font-weight: bold;',
- 19 => 'color: #b1b100; font-weight: bold;',
- 20 => 'color: #b1b100;',
- 21 => 'color: #b1b100;',
- 22 => 'color: #b1b100;',
- 23 => 'color: #b1b100;',
- 24 => 'color: #b1b100;',
- 25 => 'color: #b1b100;',
- 26 => 'color: #b1b100;',
- 27 => 'color: #b1b100;',
- 28 => 'color: #b1b100;',
- 29 => 'color: #b1b100;'
+ 1 => $a68['NONSTD'], 2 => $a68['BOLD'], 3 => $a68['BOLD'], 4 => $a68['BOLD'],
+ 5 => $a68['NONSTD'], 6 => $a68['BOLD'], 7 => $a68['BOLD'], 8 => $a68['BOLD'],
+ /* 9 => $a68['BOLD'],*/ 10 => $a68['BOLD'], 11 => $a68['BOLD'], 12 => $a68['BOLD'],
+ /* 13 => $a68['BOLD'],*/ 14 => $a68['BOLD'], 15 => $a68['BOLD'], 16 => $a68['BOLD'], 17 => $a68['BOLD'],
+ 18 => $a68['NONSTD'], 19 => $a68['NONSTD'],
+ 20 => $a68['ITALIC'], 21 => $a68['ITALIC'], 22 => $a68['ITALIC'], 23 => $a68['ITALIC'],
+ 24 => $a68['ITALIC'], 25 => $a68['ITALIC'], 26 => $a68['ITALIC'], 27 => $a68['ITALIC'],
+ 28 => $a68['ITALIC'], 29 => $a68['ITALIC']
),
'COMMENTS' => array(
- 1 => 'color: #666666; font-style: italic;',
- 2 => 'color: #666666; font-style: italic;',
- 3 => 'color: #666666; font-style: italic;',
- 4 => 'color: #666666; font-style: italic;',
- 5 => 'color: #666666; font-style: italic;',
- 'MULTI' => 'color: #666666; font-style: italic;'
+ 1 => $a68['COMMENT'], 2 => $a68['COMMENT'], 3 => $a68['COMMENT'], /* 4 => $a68['COMMENT'],
+ 5 => $a68['COMMENT'],*/ 'MULTI' => $a68['COMMENT']
),
'ESCAPE_CHAR' => array(
0 => 'color: #000099; font-weight: bold;'
@@ -174,12 +264,18 @@ $language_data = array(
0 => 'color: #cc66cc;',
),
'METHODS' => array(
- 0 => 'color: #004000;'
+ 0 => 'color: #004000;',
+ 1 => 'color: #004000;'
),
'SYMBOLS' => array(
+ 0 => 'color: #339933;',
1 => 'color: #339933;'
),
- 'REGEXPS' => array(),
+ 'REGEXPS' => array(
+ 0 => 'color: #cc66cc;', # BITS #
+ 1 => 'color: #cc66cc;', # REAL #
+ /* 2 => 'color: #cc66cc;', # INT # */
+ ),
'SCRIPT' => array()
),
'URLS' => array(
@@ -191,11 +287,11 @@ $language_data = array(
6 => '',
7 => '',
8 => '',
- 9 => '',
+# 9 => '',
10 => '',
11 => '',
12 => '',
- 13 => '',
+# 13 => '',
14 => '',
15 => '',
16 => '',
@@ -215,12 +311,19 @@ $language_data = array(
),
'OOLANG' => true,
'OBJECT_SPLITTERS' => array(
+ 0 => '→',
1 => 'OF'
),
- 'REGEXPS' => array(),
+ 'REGEXPS' => array(
+ 0 => $a68['BITS'],
+ 1 => $a68['REAL']
+ # 2 => $a68['INT'], # Breaks formatting for some reason #
+ # 2 => $GESHI_NUMBER_INT_BASIC # Also breaks formatting #
+ ),
'STRICT_MODE_APPLIES' => GESHI_NEVER,
'SCRIPT_DELIMITERS' => array(),
'HIGHLIGHT_STRICT_BLOCK' => array()
);
+unset($a68);
?> \ No newline at end of file
diff --git a/plugins/wp-syntax/geshi/geshi/apache.php b/plugins/wp-syntax/geshi/geshi/apache.php
index ddd4d6a0..c944443c 100644
--- a/plugins/wp-syntax/geshi/geshi/apache.php
+++ b/plugins/wp-syntax/geshi/geshi/apache.php
@@ -4,7 +4,7 @@
* ----------
* Author: Tux (tux@inmail.cz)
* Copyright: (c) 2004 Tux (http://tux.a4.cz/), Nigel McNie (http://qbnz.com/highlighter)
- * Release Version: 1.0.8.9
+ * Release Version: 1.0.8.11
* Date Started: 2004/29/07
*
* Apache language file for GeSHi.
@@ -344,6 +344,9 @@ $language_data = array (
//mod_unique_id.c
+ //mod_upload_progress
+ 'ReportUploads', 'TrackUploads', 'UploadProgressSharedMemorySize',
+
//mod_userdir.c
'UserDir',
diff --git a/plugins/wp-syntax/geshi/geshi/applescript.php b/plugins/wp-syntax/geshi/geshi/applescript.php
index 870ac0fd..603fa4a3 100644
--- a/plugins/wp-syntax/geshi/geshi/applescript.php
+++ b/plugins/wp-syntax/geshi/geshi/applescript.php
@@ -4,7 +4,7 @@
* --------
* Author: Stephan Klimek (http://www.initware.org)
* Copyright: Stephan Klimek (http://www.initware.org)
- * Release Version: 1.0.8.9
+ * Release Version: 1.0.8.11
* Date Started: 2005/07/20
*
* AppleScript language file for GeSHi.
diff --git a/plugins/wp-syntax/geshi/geshi/apt_sources.php b/plugins/wp-syntax/geshi/geshi/apt_sources.php
index 0512380b..9f1ed045 100644
--- a/plugins/wp-syntax/geshi/geshi/apt_sources.php
+++ b/plugins/wp-syntax/geshi/geshi/apt_sources.php
@@ -4,7 +4,7 @@
* ----------
* Author: Milian Wolff (mail@milianw.de)
* Copyright: (c) 2008 Milian Wolff (http://milianw.de)
- * Release Version: 1.0.8.9
+ * Release Version: 1.0.8.11
* Date Started: 2008/06/17
*
* Apt sources.list language file for GeSHi.
@@ -55,7 +55,7 @@ $language_data = array (
'stable/updates',
//Debian
'buzz', 'rex', 'bo', 'hamm', 'slink', 'potato', 'woody', 'sarge',
- 'etch', 'lenny', 'sid',
+ 'etch', 'lenny', 'wheezy', 'sid',
//Ubuntu
'warty', 'warty-updates', 'warty-security', 'warty-proposed', 'warty-backports',
'hoary', 'hoary-updates', 'hoary-security', 'hoary-proposed', 'hoary-backports',
@@ -65,7 +65,11 @@ $language_data = array (
'feisty', 'feisty-updates', 'feisty-security', 'feisty-proposed', 'feisty-backports',
'gutsy', 'gutsy-updates', 'gutsy-security', 'gutsy-proposed', 'gutsy-backports',
'hardy', 'hardy-updates', 'hardy-security', 'hardy-proposed', 'hardy-backports',
- 'intrepid', 'intrepid-updates', 'intrepid-security', 'intrepid-proposed', 'intrepid-backports'
+ 'intrepid', 'intrepid-updates', 'intrepid-security', 'intrepid-proposed', 'intrepid-backports',
+ 'jaunty', 'jaunty-updates', 'jaunty-security', 'jaunty-proposed', 'jaunty-backports',
+ 'karmic', 'karmic-updates', 'karmic-security', 'karmic-proposed', 'karmic-backports',
+ 'lucid', 'lucid-updates', 'lucid-security', 'lucid-proposed', 'lucid-backports',
+ 'maverick', 'maverick-updates', 'maverick-security', 'maverick-proposed', 'maverick-backports'
),
3 => array(
'main', 'restricted', 'preview', 'contrib', 'non-free',
@@ -141,4 +145,4 @@ $language_data = array (
'TAB_WIDTH' => 4
);
-?>
+?> \ No newline at end of file
diff --git a/plugins/wp-syntax/geshi/geshi/arm.php b/plugins/wp-syntax/geshi/geshi/arm.php
new file mode 100644
index 00000000..8e3c0a37
--- /dev/null
+++ b/plugins/wp-syntax/geshi/geshi/arm.php
@@ -0,0 +1,3318 @@
+<?php
+/*************************************************************************************
+ * arm.php
+ * -------
+ * Author: Marat Dukhan (mdukhan3.at.gatech.dot.edu)
+ * Copyright: (c) Marat Dukhan (mdukhan3.at.gatech.dot.edu)
+ * Release Version: 1.0.8.11
+ * Date Started: 2011/10/06
+ *
+ * ARM Assembler language file for GeSHi.
+ * Based on the following documents:
+ * - "ARM Architecture Reference Manual: ARMv7-A and ARMv7-R edition"
+ * - "Intel XScale Technology: Intel Wireless MMX2 Coprocessor",
+ * Revision 1.5, July 2006
+ *
+ * CHANGES
+ * -------
+ * 2011/10/06
+ * - First Release (supported UAL syntax for up to ARMv7 A/R, VFPv3, NEON, WMMX/WMMX2)
+ *
+ * TODO (updated 2011/10/06)
+ * -------------------------
+ *
+ *************************************************************************************
+ *
+ * This file is part of GeSHi.
+ *
+ * GeSHi 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 2 of the License, or
+ * (at your option) any later version.
+ *
+ * GeSHi 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 GeSHi; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ ************************************************************************************/
+
+$language_data = array (
+ 'LANG_NAME' => 'ARM ASSEMBLER',
+ 'COMMENT_SINGLE' => array(
+ 1 => ';'
+ ),
+ 'COMMENT_MULTI' => array(),
+ //Line address prefix suppression
+ 'COMMENT_REGEXP' => array(
+ 2 => "/^(?:[0-9a-f]{0,4}:)?[0-9a-f]{4}(?:[0-9a-f]{4})?/mi"
+ ),
+ 'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE,
+ 'QUOTEMARKS' => array("'", '"'),
+ 'ESCAPE_CHAR' => '',
+ 'KEYWORDS' => array(
+ /* Unconditional Data Processing Instructions */
+ 1 => array(
+ /* Data Processing: Unconditional Addition & Subtraction */
+ 'adc.w','adcal.w',
+ 'adc','adcal',
+ 'add.w','addal.w',
+ 'add','addal',
+ 'addw','addwal',
+ 'rsb.w','rsbal.w',
+ 'rsb','rsbal',
+ 'rsc','rscal',
+ 'sbc.w','sbcal.w',
+ 'sbc','sbcal',
+ 'sub.w','subal.w',
+ 'sub','subal',
+ 'neg.w','negal.w',
+ 'neg','negal',
+ 'adr.w','adral.w',
+ 'adr','adral',
+ /* Data Processing: Unconditional Logical */
+ 'and.w','andal.w',
+ 'and','andal',
+ 'bic.w','bical.w',
+ 'bic','bical',
+ 'orr.w','orral.w',
+ 'orr','orral',
+ 'orn.w','ornal.w',
+ 'orn','ornal',
+ 'eor.w','eoral.w',
+ 'eor','eoral',
+ 'mov.w','moval.w',
+ 'mov','moval',
+ 'movw','movwal',
+ 'movt','movtal',
+ 'cpy','cpyal',
+ 'mvn.w','mvnal.w',
+ 'mvn','mvnal',
+ /* Data Processing: Unconditional Shifts and Rotates */
+ 'asr.w','asral.w',
+ 'asr','asral',
+ 'lsl.w','lslal.w',
+ 'lsl','lslal',
+ 'lsr.w','lsral.w',
+ 'lsr','lsral',
+ 'ror.w','roral.w',
+ 'ror','roral',
+ 'rrx','rrxal',
+ /* Data Processing: Unconditional Word Multiply and Multiply-Add */
+ 'mul','mulal',
+ 'mla','mlaal',
+ 'mls','mlsal',
+ 'smull','smullal',
+ 'muls','mulsal',
+ 'umull','umullal',
+ 'smlal','smlalal',
+ 'umlal','umlalal',
+ /* Data Processing: Unconditional Halfword Multiply and Multiply-Add (ARMv5TE) */
+ 'smulbb','smulbbal',
+ 'smulbt','smulbtal',
+ 'smultb','smultbal',
+ 'smultt','smulttal',
+ 'smulwb','smulwbal',
+ 'smulwt','smulwtal',
+ 'smlalbb','smlalbbal',
+ 'smlalbt','smlalbtal',
+ 'smlaltb','smlaltbal',
+ 'smlaltt','smlalttal',
+ 'smlabb','smlabbal',
+ 'smlabt','smlabtal',
+ 'smlatb','smlatbal',
+ 'smlatt','smlattal',
+ 'smlawb','smlawbal',
+ 'smlawt','smlawtal',
+ /* Data Processing: Unconditional Bit Operations */
+ 'ubfx','ubfxal',
+ 'sbfx','sbfxal',
+ 'bfc','bfcal',
+ 'bfi','bfial',
+ 'clz','clzal',
+ /* Data Processing: Unconditional Divide (ARMv7-R) */
+ 'sdiv','sdival',
+ 'udiv','udival'
+ ),
+ /* Conditional Data Processing Instructions */
+ 2 => array(
+ /* Data Processing: Conditional Addition & Subtraction */
+ 'adceq.w','adcne.w','adccs.w','adchs.w','adccc.w','adclo.w','adcmi.w','adcpl.w','adcvs.w','adcvc.w','adchi.w','adcls.w','adcge.w','adclt.w','adcgt.w','adcle.w',
+ 'adceq','adcne','adccs','adchs','adccc','adclo','adcmi','adcpl','adcvs','adcvc','adchi','adcls','adcge','adclt','adcgt','adcle',
+ 'addeq.w','addne.w','addcs.w','addhs.w','addcc.w','addlo.w','addmi.w','addpl.w','addvs.w','addvc.w','addhi.w','addls.w','addge.w','addlt.w','addgt.w','addle.w',
+ 'addeq','addne','addcs','addhs','addcc','addlo','addmi','addpl','addvs','addvc','addhi','addls','addge','addlt','addgt','addle',
+ 'addweq','addwne','addwcs','addwhs','addwcc','addwlo','addwmi','addwpl','addwvs','addwvc','addwhi','addwls','addwge','addwlt','addwgt','addwle',
+ 'rsbeq.w','rsbne.w','rsbcs.w','rsbhs.w','rsbcc.w','rsblo.w','rsbmi.w','rsbpl.w','rsbvs.w','rsbvc.w','rsbhi.w','rsbls.w','rsbge.w','rsblt.w','rsbgt.w','rsble.w',
+ 'rsbeq','rsbne','rsbcs','rsbhs','rsbcc','rsblo','rsbmi','rsbpl','rsbvs','rsbvc','rsbhi','rsbls','rsbge','rsblt','rsbgt','rsble',
+ 'rsceq','rscne','rsccs','rschs','rsccc','rsclo','rscmi','rscpl','rscvs','rscvc','rschi','rscls','rscge','rsclt','rscgt','rscle',
+ 'sbceq.w','sbcne.w','sbccs.w','sbchs.w','sbccc.w','sbclo.w','sbcmi.w','sbcpl.w','sbcvs.w','sbcvc.w','sbchi.w','sbcls.w','sbcge.w','sbclt.w','sbcgt.w','sbcle.w',
+ 'sbceq','sbcne','sbccs','sbchs','sbccc','sbclo','sbcmi','sbcpl','sbcvs','sbcvc','sbchi','sbcls','sbcge','sbclt','sbcgt','sbcle',
+ 'subeq.w','subne.w','subcs.w','subhs.w','subcc.w','sublo.w','submi.w','subpl.w','subvs.w','subvc.w','subhi.w','subls.w','subge.w','sublt.w','subgt.w','suble.w',
+ 'subeq','subne','subcs','subhs','subcc','sublo','submi','subpl','subvs','subvc','subhi','subls','subge','sublt','subgt','suble',
+ 'negeq.w','negne.w','negcs.w','neghs.w','negcc.w','neglo.w','negmi.w','negpl.w','negvs.w','negvc.w','neghi.w','negls.w','negge.w','neglt.w','neggt.w','negle.w',
+ 'negeq','negne','negcs','neghs','negcc','neglo','negmi','negpl','negvs','negvc','neghi','negls','negge','neglt','neggt','negle',
+ 'adreq.w','adrne.w','adrcs.w','adrhs.w','adrcc.w','adrlo.w','adrmi.w','adrpl.w','adrvs.w','adrvc.w','adrhi.w','adrls.w','adrge.w','adrlt.w','adrgt.w','adrle.w',
+ 'adreq','adrne','adrcs','adrhs','adrcc','adrlo','adrmi','adrpl','adrvs','adrvc','adrhi','adrls','adrge','adrlt','adrgt','adrle',
+ /* Data Processing: Conditional Logical */
+ 'andeq.w','andne.w','andcs.w','andhs.w','andcc.w','andlo.w','andmi.w','andpl.w','andvs.w','andvc.w','andhi.w','andls.w','andge.w','andlt.w','andgt.w','andle.w',
+ 'andeq','andne','andcs','andhs','andcc','andlo','andmi','andpl','andvs','andvc','andhi','andls','andge','andlt','andgt','andle',
+ 'biceq.w','bicne.w','biccs.w','bichs.w','biccc.w','biclo.w','bicmi.w','bicpl.w','bicvs.w','bicvc.w','bichi.w','bicls.w','bicge.w','biclt.w','bicgt.w','bicle.w',
+ 'biceq','bicne','biccs','bichs','biccc','biclo','bicmi','bicpl','bicvs','bicvc','bichi','bicls','bicge','biclt','bicgt','bicle',
+ 'orreq.w','orrne.w','orrcs.w','orrhs.w','orrcc.w','orrlo.w','orrmi.w','orrpl.w','orrvs.w','orrvc.w','orrhi.w','orrls.w','orrge.w','orrlt.w','orrgt.w','orrle.w',
+ 'orreq','orrne','orrcs','orrhs','orrcc','orrlo','orrmi','orrpl','orrvs','orrvc','orrhi','orrls','orrge','orrlt','orrgt','orrle',
+ 'orneq.w','ornne.w','orncs.w','ornhs.w','orncc.w','ornlo.w','ornmi.w','ornpl.w','ornvs.w','ornvc.w','ornhi.w','ornls.w','ornge.w','ornlt.w','orngt.w','ornle.w',
+ 'orneq','ornne','orncs','ornhs','orncc','ornlo','ornmi','ornpl','ornvs','ornvc','ornhi','ornls','ornge','ornlt','orngt','ornle',
+ 'eoreq.w','eorne.w','eorcs.w','eorhs.w','eorcc.w','eorlo.w','eormi.w','eorpl.w','eorvs.w','eorvc.w','eorhi.w','eorls.w','eorge.w','eorlt.w','eorgt.w','eorle.w',
+ 'eoreq','eorne','eorcs','eorhs','eorcc','eorlo','eormi','eorpl','eorvs','eorvc','eorhi','eorls','eorge','eorlt','eorgt','eorle',
+ 'moveq.w','movne.w','movcs.w','movhs.w','movcc.w','movlo.w','movmi.w','movpl.w','movvs.w','movvc.w','movhi.w','movls.w','movge.w','movlt.w','movgt.w','movle.w',
+ 'moveq','movne','movcs','movhs','movcc','movlo','movmi','movpl','movvs','movvc','movhi','movls','movge','movlt','movgt','movle',
+ 'movweq','movwne','movwcs','movwhs','movwcc','movwlo','movwmi','movwpl','movwvs','movwvc','movwhi','movwls','movwge','movwlt','movwgt','movwle',
+ 'movteq','movtne','movtcs','movths','movtcc','movtlo','movtmi','movtpl','movtvs','movtvc','movthi','movtls','movtge','movtlt','movtgt','movtle',
+ 'cpyeq','cpyne','cpycs','cpyhs','cpycc','cpylo','cpymi','cpypl','cpyvs','cpyvc','cpyhi','cpyls','cpyge','cpylt','cpygt','cpyle',
+ 'mvneq.w','mvnne.w','mvncs.w','mvnhs.w','mvncc.w','mvnlo.w','mvnmi.w','mvnpl.w','mvnvs.w','mvnvc.w','mvnhi.w','mvnls.w','mvnge.w','mvnlt.w','mvngt.w','mvnle.w',
+ 'mvneq','mvnne','mvncs','mvnhs','mvncc','mvnlo','mvnmi','mvnpl','mvnvs','mvnvc','mvnhi','mvnls','mvnge','mvnlt','mvngt','mvnle',
+ /* Data Processing: Conditional Shifts and Rotates */
+ 'asreq.w','asrne.w','asrcs.w','asrhs.w','asrcc.w','asrlo.w','asrmi.w','asrpl.w','asrvs.w','asrvc.w','asrhi.w','asrls.w','asrge.w','asrlt.w','asrgt.w','asrle.w',
+ 'asreq','asrne','asrcs','asrhs','asrcc','asrlo','asrmi','asrpl','asrvs','asrvc','asrhi','asrls','asrge','asrlt','asrgt','asrle',
+ 'lsleq.w','lslne.w','lslcs.w','lslhs.w','lslcc.w','lsllo.w','lslmi.w','lslpl.w','lslvs.w','lslvc.w','lslhi.w','lslls.w','lslge.w','lsllt.w','lslgt.w','lslle.w',
+ 'lsleq','lslne','lslcs','lslhs','lslcc','lsllo','lslmi','lslpl','lslvs','lslvc','lslhi','lslls','lslge','lsllt','lslgt','lslle',
+ 'lsreq.w','lsrne.w','lsrcs.w','lsrhs.w','lsrcc.w','lsrlo.w','lsrmi.w','lsrpl.w','lsrvs.w','lsrvc.w','lsrhi.w','lsrls.w','lsrge.w','lsrlt.w','lsrgt.w','lsrle.w',
+ 'lsreq','lsrne','lsrcs','lsrhs','lsrcc','lsrlo','lsrmi','lsrpl','lsrvs','lsrvc','lsrhi','lsrls','lsrge','lsrlt','lsrgt','lsrle',
+ 'roreq.w','rorne.w','rorcs.w','rorhs.w','rorcc.w','rorlo.w','rormi.w','rorpl.w','rorvs.w','rorvc.w','rorhi.w','rorls.w','rorge.w','rorlt.w','rorgt.w','rorle.w',
+ 'roreq','rorne','rorcs','rorhs','rorcc','rorlo','rormi','rorpl','rorvs','rorvc','rorhi','rorls','rorge','rorlt','rorgt','rorle',
+ 'rrxeq','rrxne','rrxcs','rrxhs','rrxcc','rrxlo','rrxmi','rrxpl','rrxvs','rrxvc','rrxhi','rrxls','rrxge','rrxlt','rrxgt','rrxle',
+ /* Data Processing: Conditional Word Multiply and Multiply-Add */
+ 'muleq','mulne','mulcs','mulhs','mulcc','mullo','mulmi','mulpl','mulvs','mulvc','mulhi','mulls','mulge','mullt','mulgt','mulle',
+ 'mlaeq','mlane','mlacs','mlahs','mlacc','mlalo','mlami','mlapl','mlavs','mlavc','mlahi','mlals','mlage','mlalt','mlagt','mlale',
+ 'mlseq','mlsne','mlscs','mlshs','mlscc','mlslo','mlsmi','mlspl','mlsvs','mlsvc','mlshi','mlsls','mlsge','mlslt','mlsgt','mlsle',
+ 'smulleq','smullne','smullcs','smullhs','smullcc','smulllo','smullmi','smullpl','smullvs','smullvc','smullhi','smullls','smullge','smulllt','smullgt','smullle',
+ 'mulseq','mulsne','mulscs','mulshs','mulscc','mulslo','mulsmi','mulspl','mulsvs','mulsvc','mulshi','mulsls','mulsge','mulslt','mulsgt','mulsle',
+ 'umulleq','umullne','umullcs','umullhs','umullcc','umulllo','umullmi','umullpl','umullvs','umullvc','umullhi','umullls','umullge','umulllt','umullgt','umullle',
+ 'smlaleq','smlalne','smlalcs','smlalhs','smlalcc','smlallo','smlalmi','smlalpl','smlalvs','smlalvc','smlalhi','smlalls','smlalge','smlallt','smlalgt','smlalle',
+ 'umlaleq','umlalne','umlalcs','umlalhs','umlalcc','umlallo','umlalmi','umlalpl','umlalvs','umlalvc','umlalhi','umlalls','umlalge','umlallt','umlalgt','umlalle',
+ /* Data Processing: Conditional Halfword Multiply and Multiply-Add (ARMv5TE) */
+ 'smulbbeq','smulbbne','smulbbcs','smulbbhs','smulbbcc','smulbblo','smulbbmi','smulbbpl','smulbbvs','smulbbvc','smulbbhi','smulbbls','smulbbge','smulbblt','smulbbgt','smulbble',
+ 'smulbteq','smulbtne','smulbtcs','smulbths','smulbtcc','smulbtlo','smulbtmi','smulbtpl','smulbtvs','smulbtvc','smulbthi','smulbtls','smulbtge','smulbtlt','smulbtgt','smulbtle',
+ 'smultbeq','smultbne','smultbcs','smultbhs','smultbcc','smultblo','smultbmi','smultbpl','smultbvs','smultbvc','smultbhi','smultbls','smultbge','smultblt','smultbgt','smultble',
+ 'smultteq','smulttne','smulttcs','smultths','smulttcc','smulttlo','smulttmi','smulttpl','smulttvs','smulttvc','smultthi','smulttls','smulttge','smulttlt','smulttgt','smulttle',
+ 'smulwbeq','smulwbne','smulwbcs','smulwbhs','smulwbcc','smulwblo','smulwbmi','smulwbpl','smulwbvs','smulwbvc','smulwbhi','smulwbls','smulwbge','smulwblt','smulwbgt','smulwble',
+ 'smulwteq','smulwtne','smulwtcs','smulwths','smulwtcc','smulwtlo','smulwtmi','smulwtpl','smulwtvs','smulwtvc','smulwthi','smulwtls','smulwtge','smulwtlt','smulwtgt','smulwtle',
+ 'smlalbbeq','smlalbbne','smlalbbcs','smlalbbhs','smlalbbcc','smlalbblo','smlalbbmi','smlalbbpl','smlalbbvs','smlalbbvc','smlalbbhi','smlalbbls','smlalbbge','smlalbblt','smlalbbgt','smlalbble',
+ 'smlalbteq','smlalbtne','smlalbtcs','smlalbths','smlalbtcc','smlalbtlo','smlalbtmi','smlalbtpl','smlalbtvs','smlalbtvc','smlalbthi','smlalbtls','smlalbtge','smlalbtlt','smlalbtgt','smlalbtle',
+ 'smlaltbeq','smlaltbne','smlaltbcs','smlaltbhs','smlaltbcc','smlaltblo','smlaltbmi','smlaltbpl','smlaltbvs','smlaltbvc','smlaltbhi','smlaltbls','smlaltbge','smlaltblt','smlaltbgt','smlaltble',
+ 'smlaltteq','smlalttne','smlalttcs','smlaltths','smlalttcc','smlalttlo','smlalttmi','smlalttpl','smlalttvs','smlalttvc','smlaltthi','smlalttls','smlalttge','smlalttlt','smlalttgt','smlalttle',
+ 'smlabbeq','smlabbne','smlabbcs','smlabbhs','smlabbcc','smlabblo','smlabbmi','smlabbpl','smlabbvs','smlabbvc','smlabbhi','smlabbls','smlabbge','smlabblt','smlabbgt','smlabble',
+ 'smlabteq','smlabtne','smlabtcs','smlabths','smlabtcc','smlabtlo','smlabtmi','smlabtpl','smlabtvs','smlabtvc','smlabthi','smlabtls','smlabtge','smlabtlt','smlabtgt','smlabtle',
+ 'smlatbeq','smlatbne','smlatbcs','smlatbhs','smlatbcc','smlatblo','smlatbmi','smlatbpl','smlatbvs','smlatbvc','smlatbhi','smlatbls','smlatbge','smlatblt','smlatbgt','smlatble',
+ 'smlatteq','smlattne','smlattcs','smlatths','smlattcc','smlattlo','smlattmi','smlattpl','smlattvs','smlattvc','smlatthi','smlattls','smlattge','smlattlt','smlattgt','smlattle',
+ 'smlawbeq','smlawbne','smlawbcs','smlawbhs','smlawbcc','smlawblo','smlawbmi','smlawbpl','smlawbvs','smlawbvc','smlawbhi','smlawbls','smlawbge','smlawblt','smlawbgt','smlawble',
+ 'smlawteq','smlawtne','smlawtcs','smlawths','smlawtcc','smlawtlo','smlawtmi','smlawtpl','smlawtvs','smlawtvc','smlawthi','smlawtls','smlawtge','smlawtlt','smlawtgt','smlawtle',
+ /* Data Processing: Conditional Bit Operations */
+ 'ubfxeq','ubfxne','ubfxcs','ubfxhs','ubfxcc','ubfxlo','ubfxmi','ubfxpl','ubfxvs','ubfxvc','ubfxhi','ubfxls','ubfxge','ubfxlt','ubfxgt','ubfxle',
+ 'sbfxeq','sbfxne','sbfxcs','sbfxhs','sbfxcc','sbfxlo','sbfxmi','sbfxpl','sbfxvs','sbfxvc','sbfxhi','sbfxls','sbfxge','sbfxlt','sbfxgt','sbfxle',
+ 'bfceq','bfcne','bfccs','bfchs','bfccc','bfclo','bfcmi','bfcpl','bfcvs','bfcvc','bfchi','bfcls','bfcge','bfclt','bfcgt','bfcle',
+ 'bfieq','bfine','bfics','bfihs','bficc','bfilo','bfimi','bfipl','bfivs','bfivc','bfihi','bfils','bfige','bfilt','bfigt','bfile',
+ 'clzeq','clzne','clzcs','clzhs','clzcc','clzlo','clzmi','clzpl','clzvs','clzvc','clzhi','clzls','clzge','clzlt','clzgt','clzle',
+ /* ARMv7-R: Conditional Divide */
+ 'sdiveq','sdivne','sdivcs','sdivhs','sdivcc','sdivlo','sdivmi','sdivpl','sdivvs','sdivvc','sdivhi','sdivls','sdivge','sdivlt','sdivgt','sdivle',
+ 'udiveq','udivne','udivcs','udivhs','udivcc','udivlo','udivmi','udivpl','udivvs','udivvc','udivhi','udivls','udivge','udivlt','udivgt','udivle'
+ ),
+ /* Unconditional Memory Access */
+ 3 => array(
+ /* Memory Access: Unconditional Memory Loads and Prefetches */
+ 'ldm.w','ldmal.w',
+ 'ldm','ldmal',
+ 'ldmda','ldmdaal',
+ 'ldmdb','ldmdbal',
+ 'ldmib','ldmibal',
+ 'ldmia','ldmiaal',
+ 'ldmea','ldmeaal',
+ 'ldmed','ldmedal',
+ 'ldmfa','ldmfaal',
+ 'ldmfd','ldmfdal',
+ 'ldrd','ldrdal',
+ 'ldr.w','ldral.w',
+ 'ldr','ldral',
+ 'ldrh.w','ldrhal.w',
+ 'ldrh','ldrhal',
+ 'ldrb.w','ldrbal.w',
+ 'ldrb','ldrbal',
+ 'ldrsh.w','ldrshal.w',
+ 'ldrsh','ldrshal',
+ 'ldrsb.w','ldrsbal.w',
+ 'ldrsb','ldrsbal',
+ 'ldrt','ldrtal',
+ 'ldrht','ldrhtal',
+ 'ldrbt','ldrbtal',
+ 'ldrsht','ldrshtal',
+ 'ldrsbt','ldrsbtal',
+ 'pop.w','popal.w',
+ 'pop','popal',
+ 'pld','pldal',
+ 'pldw','pldwal',
+ 'pli','plial',
+ /* Memory Access: Unconditional Memory Stores */
+ 'stm.w','stmal.w',
+ 'stm','stmal',
+ 'stmda','stmdaal',
+ 'stmdb','stmdbal',
+ 'stmib','stmibal',
+ 'stmia','stmiaal',
+ 'stmea','stmeaal',
+ 'stmed','stmedal',
+ 'stdfa','stdfaal',
+ 'stdfd','stdfdal',
+ 'strd','strdal',
+ 'str.w','stral.w',
+ 'str','stral',
+ 'strh.w','strhal.w',
+ 'strh','strhal',
+ 'strb.w','strbal.w',
+ 'strb','strbal',
+ 'strt','strtal',
+ 'strht','strhtal',
+ 'strbt','strbtal',
+ 'push.w','pushal.w',
+ 'push','pushal'
+ ),
+ /* Conditional Memory Access */
+ 4 => array(
+ /* Memory Access: Conditional Memory Loads and Prefetches */
+ 'ldmeq.w','ldmne.w','ldmcs.w','ldmhs.w','ldmcc.w','ldmlo.w','ldmmi.w','ldmpl.w','ldmvs.w','ldmvc.w','ldmhi.w','ldmls.w','ldmge.w','ldmlt.w','ldmgt.w','ldmle.w',
+ 'ldmeq','ldmne','ldmcs','ldmhs','ldmcc','ldmlo','ldmmi','ldmpl','ldmvs','ldmvc','ldmhi','ldmls','ldmge','ldmlt','ldmgt','ldmle',
+ 'ldmdaeq','ldmdane','ldmdacs','ldmdahs','ldmdacc','ldmdalo','ldmdami','ldmdapl','ldmdavs','ldmdavc','ldmdahi','ldmdals','ldmdage','ldmdalt','ldmdagt','ldmdale',
+ 'ldmdbeq','ldmdbne','ldmdbcs','ldmdbhs','ldmdbcc','ldmdblo','ldmdbmi','ldmdbpl','ldmdbvs','ldmdbvc','ldmdbhi','ldmdbls','ldmdbge','ldmdblt','ldmdbgt','ldmdble',
+ 'ldmibeq','ldmibne','ldmibcs','ldmibhs','ldmibcc','ldmiblo','ldmibmi','ldmibpl','ldmibvs','ldmibvc','ldmibhi','ldmibls','ldmibge','ldmiblt','ldmibgt','ldmible',
+ 'ldmiaeq','ldmiane','ldmiacs','ldmiahs','ldmiacc','ldmialo','ldmiami','ldmiapl','ldmiavs','ldmiavc','ldmiahi','ldmials','ldmiage','ldmialt','ldmiagt','ldmiale',
+ 'ldmeaeq','ldmeane','ldmeacs','ldmeahs','ldmeacc','ldmealo','ldmeami','ldmeapl','ldmeavs','ldmeavc','ldmeahi','ldmeals','ldmeage','ldmealt','ldmeagt','ldmeale',
+ 'ldmedeq','ldmedne','ldmedcs','ldmedhs','ldmedcc','ldmedlo','ldmedmi','ldmedpl','ldmedvs','ldmedvc','ldmedhi','ldmedls','ldmedge','ldmedlt','ldmedgt','ldmedle',
+ 'ldmfaeq','ldmfane','ldmfacs','ldmfahs','ldmfacc','ldmfalo','ldmfami','ldmfapl','ldmfavs','ldmfavc','ldmfahi','ldmfals','ldmfage','ldmfalt','ldmfagt','ldmfale',
+ 'ldmfdeq','ldmfdne','ldmfdcs','ldmfdhs','ldmfdcc','ldmfdlo','ldmfdmi','ldmfdpl','ldmfdvs','ldmfdvc','ldmfdhi','ldmfdls','ldmfdge','ldmfdlt','ldmfdgt','ldmfdle',
+ 'ldrdeq','ldrdne','ldrdcs','ldrdhs','ldrdcc','ldrdlo','ldrdmi','ldrdpl','ldrdvs','ldrdvc','ldrdhi','ldrdls','ldrdge','ldrdlt','ldrdgt','ldrdle',
+ 'ldreq.w','ldrne.w','ldrcs.w','ldrhs.w','ldrcc.w','ldrlo.w','ldrmi.w','ldrpl.w','ldrvs.w','ldrvc.w','ldrhi.w','ldrls.w','ldrge.w','ldrlt.w','ldrgt.w','ldrle.w',
+ 'ldreq','ldrne','ldrcs','ldrhs','ldrcc','ldrlo','ldrmi','ldrpl','ldrvs','ldrvc','ldrhi','ldrls','ldrge','ldrlt','ldrgt','ldrle',
+ 'ldrheq.w','ldrhne.w','ldrhcs.w','ldrhhs.w','ldrhcc.w','ldrhlo.w','ldrhmi.w','ldrhpl.w','ldrhvs.w','ldrhvc.w','ldrhhi.w','ldrhls.w','ldrhge.w','ldrhlt.w','ldrhgt.w','ldrhle.w',
+ 'ldrheq','ldrhne','ldrhcs','ldrhhs','ldrhcc','ldrhlo','ldrhmi','ldrhpl','ldrhvs','ldrhvc','ldrhhi','ldrhls','ldrhge','ldrhlt','ldrhgt','ldrhle',
+ 'ldrbeq.w','ldrbne.w','ldrbcs.w','ldrbhs.w','ldrbcc.w','ldrblo.w','ldrbmi.w','ldrbpl.w','ldrbvs.w','ldrbvc.w','ldrbhi.w','ldrbls.w','ldrbge.w','ldrblt.w','ldrbgt.w','ldrble.w',
+ 'ldrbeq','ldrbne','ldrbcs','ldrbhs','ldrbcc','ldrblo','ldrbmi','ldrbpl','ldrbvs','ldrbvc','ldrbhi','ldrbls','ldrbge','ldrblt','ldrbgt','ldrble',
+ 'ldrsheq.w','ldrshne.w','ldrshcs.w','ldrshhs.w','ldrshcc.w','ldrshlo.w','ldrshmi.w','ldrshpl.w','ldrshvs.w','ldrshvc.w','ldrshhi.w','ldrshls.w','ldrshge.w','ldrshlt.w','ldrshgt.w','ldrshle.w',
+ 'ldrsheq','ldrshne','ldrshcs','ldrshhs','ldrshcc','ldrshlo','ldrshmi','ldrshpl','ldrshvs','ldrshvc','ldrshhi','ldrshls','ldrshge','ldrshlt','ldrshgt','ldrshle',
+ 'ldrsbeq.w','ldrsbne.w','ldrsbcs.w','ldrsbhs.w','ldrsbcc.w','ldrsblo.w','ldrsbmi.w','ldrsbpl.w','ldrsbvs.w','ldrsbvc.w','ldrsbhi.w','ldrsbls.w','ldrsbge.w','ldrsblt.w','ldrsbgt.w','ldrsble.w',
+ 'ldrsbeq','ldrsbne','ldrsbcs','ldrsbhs','ldrsbcc','ldrsblo','ldrsbmi','ldrsbpl','ldrsbvs','ldrsbvc','ldrsbhi','ldrsbls','ldrsbge','ldrsblt','ldrsbgt','ldrsble',
+ 'ldrteq','ldrtne','ldrtcs','ldrths','ldrtcc','ldrtlo','ldrtmi','ldrtpl','ldrtvs','ldrtvc','ldrthi','ldrtls','ldrtge','ldrtlt','ldrtgt','ldrtle',
+ 'ldrhteq','ldrhtne','ldrhtcs','ldrhths','ldrhtcc','ldrhtlo','ldrhtmi','ldrhtpl','ldrhtvs','ldrhtvc','ldrhthi','ldrhtls','ldrhtge','ldrhtlt','ldrhtgt','ldrhtle',
+ 'ldrbteq','ldrbtne','ldrbtcs','ldrbths','ldrbtcc','ldrbtlo','ldrbtmi','ldrbtpl','ldrbtvs','ldrbtvc','ldrbthi','ldrbtls','ldrbtge','ldrbtlt','ldrbtgt','ldrbtle',
+ 'ldrshteq','ldrshtne','ldrshtcs','ldrshths','ldrshtcc','ldrshtlo','ldrshtmi','ldrshtpl','ldrshtvs','ldrshtvc','ldrshthi','ldrshtls','ldrshtge','ldrshtlt','ldrshtgt','ldrshtle',
+ 'ldrsbteq','ldrsbtne','ldrsbtcs','ldrsbths','ldrsbtcc','ldrsbtlo','ldrsbtmi','ldrsbtpl','ldrsbtvs','ldrsbtvc','ldrsbthi','ldrsbtls','ldrsbtge','ldrsbtlt','ldrsbtgt','ldrsbtle',
+ 'popeq.w','popne.w','popcs.w','pophs.w','popcc.w','poplo.w','popmi.w','poppl.w','popvs.w','popvc.w','pophi.w','popls.w','popge.w','poplt.w','popgt.w','pople.w',
+ 'popeq','popne','popcs','pophs','popcc','poplo','popmi','poppl','popvs','popvc','pophi','popls','popge','poplt','popgt','pople',
+ 'pldeq','pldne','pldcs','pldhs','pldcc','pldlo','pldmi','pldpl','pldvs','pldvc','pldhi','pldls','pldge','pldlt','pldgt','pldle',
+ 'pldweq','pldwne','pldwcs','pldwhs','pldwcc','pldwlo','pldwmi','pldwpl','pldwvs','pldwvc','pldwhi','pldwls','pldwge','pldwlt','pldwgt','pldwle',
+ 'plieq','pline','plics','plihs','plicc','plilo','plimi','plipl','plivs','plivc','plihi','plils','plige','plilt','pligt','plile',
+ /* Memory Access: Conditional Memory Stores */
+ 'stmeq.w','stmne.w','stmcs.w','stmhs.w','stmcc.w','stmlo.w','stmmi.w','stmpl.w','stmvs.w','stmvc.w','stmhi.w','stmls.w','stmge.w','stmlt.w','stmgt.w','stmle.w',
+ 'stmeq','stmne','stmcs','stmhs','stmcc','stmlo','stmmi','stmpl','stmvs','stmvc','stmhi','stmls','stmge','stmlt','stmgt','stmle',
+ 'stmdaeq','stmdane','stmdacs','stmdahs','stmdacc','stmdalo','stmdami','stmdapl','stmdavs','stmdavc','stmdahi','stmdals','stmdage','stmdalt','stmdagt','stmdale',
+ 'stmdbeq','stmdbne','stmdbcs','stmdbhs','stmdbcc','stmdblo','stmdbmi','stmdbpl','stmdbvs','stmdbvc','stmdbhi','stmdbls','stmdbge','stmdblt','stmdbgt','stmdble',
+ 'stmibeq','stmibne','stmibcs','stmibhs','stmibcc','stmiblo','stmibmi','stmibpl','stmibvs','stmibvc','stmibhi','stmibls','stmibge','stmiblt','stmibgt','stmible',
+ 'stmiaeq','stmiane','stmiacs','stmiahs','stmiacc','stmialo','stmiami','stmiapl','stmiavs','stmiavc','stmiahi','stmials','stmiage','stmialt','stmiagt','stmiale',
+ 'stmeaeq','stmeane','stmeacs','stmeahs','stmeacc','stmealo','stmeami','stmeapl','stmeavs','stmeavc','stmeahi','stmeals','stmeage','stmealt','stmeagt','stmeale',
+ 'stmedeq','stmedne','stmedcs','stmedhs','stmedcc','stmedlo','stmedmi','stmedpl','stmedvs','stmedvc','stmedhi','stmedls','stmedge','stmedlt','stmedgt','stmedle',
+ 'stdfaeq','stdfane','stdfacs','stdfahs','stdfacc','stdfalo','stdfami','stdfapl','stdfavs','stdfavc','stdfahi','stdfals','stdfage','stdfalt','stdfagt','stdfale',
+ 'stdfdeq','stdfdne','stdfdcs','stdfdhs','stdfdcc','stdfdlo','stdfdmi','stdfdpl','stdfdvs','stdfdvc','stdfdhi','stdfdls','stdfdge','stdfdlt','stdfdgt','stdfdle',
+ 'strdeq','strdne','strdcs','strdhs','strdcc','strdlo','strdmi','strdpl','strdvs','strdvc','strdhi','strdls','strdge','strdlt','strdgt','strdle',
+ 'streq.w','strne.w','strcs.w','strhs.w','strcc.w','strlo.w','strmi.w','strpl.w','strvs.w','strvc.w','strhi.w','strls.w','strge.w','strlt.w','strgt.w','strle.w',
+ 'streq','strne','strcs','strhs','strcc','strlo','strmi','strpl','strvs','strvc','strhi','strls','strge','strlt','strgt','strle',
+ 'strheq.w','strhne.w','strhcs.w','strhhs.w','strhcc.w','strhlo.w','strhmi.w','strhpl.w','strhvs.w','strhvc.w','strhhi.w','strhls.w','strhge.w','strhlt.w','strhgt.w','strhle.w',
+ 'strheq','strhne','strhcs','strhhs','strhcc','strhlo','strhmi','strhpl','strhvs','strhvc','strhhi','strhls','strhge','strhlt','strhgt','strhle',
+ 'strbeq.w','strbne.w','strbcs.w','strbhs.w','strbcc.w','strblo.w','strbmi.w','strbpl.w','strbvs.w','strbvc.w','strbhi.w','strbls.w','strbge.w','strblt.w','strbgt.w','strble.w',
+ 'strbeq','strbne','strbcs','strbhs','strbcc','strblo','strbmi','strbpl','strbvs','strbvc','strbhi','strbls','strbge','strblt','strbgt','strble',
+ 'strteq','strtne','strtcs','strths','strtcc','strtlo','strtmi','strtpl','strtvs','strtvc','strthi','strtls','strtge','strtlt','strtgt','strtle',
+ 'strhteq','strhtne','strhtcs','strhths','strhtcc','strhtlo','strhtmi','strhtpl','strhtvs','strhtvc','strhthi','strhtls','strhtge','strhtlt','strhtgt','strhtle',
+ 'strbteq','strbtne','strbtcs','strbths','strbtcc','strbtlo','strbtmi','strbtpl','strbtvs','strbtvc','strbthi','strbtls','strbtge','strbtlt','strbtgt','strbtle',
+ 'pusheq.w','pushne.w','pushcs.w','pushhs.w','pushcc.w','pushlo.w','pushmi.w','pushpl.w','pushvs.w','pushvc.w','pushhi.w','pushls.w','pushge.w','pushlt.w','pushgt.w','pushle.w',
+ 'pusheq','pushne','pushcs','pushhs','pushcc','pushlo','pushmi','pushpl','pushvs','pushvc','pushhi','pushls','pushge','pushlt','pushgt','pushle'
+ ),
+ /* Unconditional Flags-Affecting Instructions */
+ 5 => array(
+ /* Set Flags: Unconditional Addition and Subtraction */
+ 'adds.w','addsal.w',
+ 'adds','addsal',
+ 'subs.w','subsal.w',
+ 'subs','subsal',
+ 'rsbs.w','rsbsal.w',
+ 'rsbs','rsbsal',
+ 'negs.w','negsal.w',
+ 'negs','negsal',
+ 'adcs.w','adcsal.w',
+ 'adcs','adcsal',
+ 'sbcs.w','sbcsal.w',
+ 'sbcs','sbcsal',
+ 'rscs','rscsal',
+ 'cmp.w','cmpal.w',
+ 'cmp','cmpal',
+ 'cmn.w','cmnal.w',
+ 'cmn','cmnal',
+ /* Set Flags: Unconditional Logical */
+ 'ands.w','andsal.w',
+ 'ands','andsal',
+ 'bics.w','bicsal.w',
+ 'bics','bicsal',
+ 'orrs.w','orrsal.w',
+ 'orrs','orrsal',
+ 'orns.w','ornsal.w',
+ 'orns','ornsal',
+ 'eors.w','eorsal.w',
+ 'eors','eorsal',
+ 'mvns.w','mvnsal.w',
+ 'mvns','mvnsal',
+ 'movs.w','movsal.w',
+ 'movs','movsal',
+ 'teq','teqal',
+ 'tst.w','tstal.w',
+ 'tst','tstal',
+ 'mrs','mrsal',
+ 'msr','msral',
+ /* Set Flags: Unconditional Shifts and Rotates */
+ 'asrs.w','asrsal.w',
+ 'asrs','asrsal',
+ 'lsls.w','lslsal.w',
+ 'lsls','lslsal',
+ 'lsrs.w','lsrsal.w',
+ 'lsrs','lsrsal',
+ 'rors.w','rorsal.w',
+ 'rors','rorsal',
+ 'rrxs','rrxsal',
+ /* Set Flags: Unconditional Multiply and Multiply-Add */
+ 'mlas','mlasal',
+ 'smulls','smullsal',
+ 'umulls','umullsal',
+ 'smlals','smlalsal',
+ 'umlals','umlalsal'
+ ),
+ /* Conditional Flags-Affecting Instructions */
+ 6 => array(
+ /* Set Flags: Conditional Addition and Subtraction */
+ 'addseq.w','addsne.w','addscs.w','addshs.w','addscc.w','addslo.w','addsmi.w','addspl.w','addsvs.w','addsvc.w','addshi.w','addsls.w','addsge.w','addslt.w','addsgt.w','addsle.w',
+ 'addseq','addsne','addscs','addshs','addscc','addslo','addsmi','addspl','addsvs','addsvc','addshi','addsls','addsge','addslt','addsgt','addsle',
+ 'subseq.w','subsne.w','subscs.w','subshs.w','subscc.w','subslo.w','subsmi.w','subspl.w','subsvs.w','subsvc.w','subshi.w','subsls.w','subsge.w','subslt.w','subsgt.w','subsle.w',
+ 'subseq','subsne','subscs','subshs','subscc','subslo','subsmi','subspl','subsvs','subsvc','subshi','subsls','subsge','subslt','subsgt','subsle',
+ 'rsbseq.w','rsbsne.w','rsbscs.w','rsbshs.w','rsbscc.w','rsbslo.w','rsbsmi.w','rsbspl.w','rsbsvs.w','rsbsvc.w','rsbshi.w','rsbsls.w','rsbsge.w','rsbslt.w','rsbsgt.w','rsbsle.w',
+ 'rsbseq','rsbsne','rsbscs','rsbshs','rsbscc','rsbslo','rsbsmi','rsbspl','rsbsvs','rsbsvc','rsbshi','rsbsls','rsbsge','rsbslt','rsbsgt','rsbsle',
+ 'negseq.w','negsne.w','negscs.w','negshs.w','negscc.w','negslo.w','negsmi.w','negspl.w','negsvs.w','negsvc.w','negshi.w','negsls.w','negsge.w','negslt.w','negsgt.w','negsle.w',
+ 'negseq','negsne','negscs','negshs','negscc','negslo','negsmi','negspl','negsvs','negsvc','negshi','negsls','negsge','negslt','negsgt','negsle',
+ 'adcseq.w','adcsne.w','adcscs.w','adcshs.w','adcscc.w','adcslo.w','adcsmi.w','adcspl.w','adcsvs.w','adcsvc.w','adcshi.w','adcsls.w','adcsge.w','adcslt.w','adcsgt.w','adcsle.w',
+ 'adcseq','adcsne','adcscs','adcshs','adcscc','adcslo','adcsmi','adcspl','adcsvs','adcsvc','adcshi','adcsls','adcsge','adcslt','adcsgt','adcsle',
+ 'sbcseq.w','sbcsne.w','sbcscs.w','sbcshs.w','sbcscc.w','sbcslo.w','sbcsmi.w','sbcspl.w','sbcsvs.w','sbcsvc.w','sbcshi.w','sbcsls.w','sbcsge.w','sbcslt.w','sbcsgt.w','sbcsle.w',
+ 'sbcseq','sbcsne','sbcscs','sbcshs','sbcscc','sbcslo','sbcsmi','sbcspl','sbcsvs','sbcsvc','sbcshi','sbcsls','sbcsge','sbcslt','sbcsgt','sbcsle',
+ 'rscseq','rscsne','rscscs','rscshs','rscscc','rscslo','rscsmi','rscspl','rscsvs','rscsvc','rscshi','rscsls','rscsge','rscslt','rscsgt','rscsle',
+ 'cmpeq.w','cmpne.w','cmpcs.w','cmphs.w','cmpcc.w','cmplo.w','cmpmi.w','cmppl.w','cmpvs.w','cmpvc.w','cmphi.w','cmpls.w','cmpge.w','cmplt.w','cmpgt.w','cmple.w',
+ 'cmpeq','cmpne','cmpcs','cmphs','cmpcc','cmplo','cmpmi','cmppl','cmpvs','cmpvc','cmphi','cmpls','cmpge','cmplt','cmpgt','cmple',
+ 'cmneq.w','cmnne.w','cmncs.w','cmnhs.w','cmncc.w','cmnlo.w','cmnmi.w','cmnpl.w','cmnvs.w','cmnvc.w','cmnhi.w','cmnls.w','cmnge.w','cmnlt.w','cmngt.w','cmnle.w',
+ 'cmneq','cmnne','cmncs','cmnhs','cmncc','cmnlo','cmnmi','cmnpl','cmnvs','cmnvc','cmnhi','cmnls','cmnge','cmnlt','cmngt','cmnle',
+ /* Set Flags: Conditional Logical */
+ 'andseq.w','andsne.w','andscs.w','andshs.w','andscc.w','andslo.w','andsmi.w','andspl.w','andsvs.w','andsvc.w','andshi.w','andsls.w','andsge.w','andslt.w','andsgt.w','andsle.w',
+ 'andseq','andsne','andscs','andshs','andscc','andslo','andsmi','andspl','andsvs','andsvc','andshi','andsls','andsge','andslt','andsgt','andsle',
+ 'bicseq.w','bicsne.w','bicscs.w','bicshs.w','bicscc.w','bicslo.w','bicsmi.w','bicspl.w','bicsvs.w','bicsvc.w','bicshi.w','bicsls.w','bicsge.w','bicslt.w','bicsgt.w','bicsle.w',
+ 'bicseq','bicsne','bicscs','bicshs','bicscc','bicslo','bicsmi','bicspl','bicsvs','bicsvc','bicshi','bicsls','bicsge','bicslt','bicsgt','bicsle',
+ 'orrseq.w','orrsne.w','orrscs.w','orrshs.w','orrscc.w','orrslo.w','orrsmi.w','orrspl.w','orrsvs.w','orrsvc.w','orrshi.w','orrsls.w','orrsge.w','orrslt.w','orrsgt.w','orrsle.w',
+ 'orrseq','orrsne','orrscs','orrshs','orrscc','orrslo','orrsmi','orrspl','orrsvs','orrsvc','orrshi','orrsls','orrsge','orrslt','orrsgt','orrsle',
+ 'ornseq.w','ornsne.w','ornscs.w','ornshs.w','ornscc.w','ornslo.w','ornsmi.w','ornspl.w','ornsvs.w','ornsvc.w','ornshi.w','ornsls.w','ornsge.w','ornslt.w','ornsgt.w','ornsle.w',
+ 'ornseq','ornsne','ornscs','ornshs','ornscc','ornslo','ornsmi','ornspl','ornsvs','ornsvc','ornshi','ornsls','ornsge','ornslt','ornsgt','ornsle',
+ 'eorseq.w','eorsne.w','eorscs.w','eorshs.w','eorscc.w','eorslo.w','eorsmi.w','eorspl.w','eorsvs.w','eorsvc.w','eorshi.w','eorsls.w','eorsge.w','eorslt.w','eorsgt.w','eorsle.w',
+ 'eorseq','eorsne','eorscs','eorshs','eorscc','eorslo','eorsmi','eorspl','eorsvs','eorsvc','eorshi','eorsls','eorsge','eorslt','eorsgt','eorsle',
+ 'mvnseq.w','mvnsne.w','mvnscs.w','mvnshs.w','mvnscc.w','mvnslo.w','mvnsmi.w','mvnspl.w','mvnsvs.w','mvnsvc.w','mvnshi.w','mvnsls.w','mvnsge.w','mvnslt.w','mvnsgt.w','mvnsle.w',
+ 'mvnseq','mvnsne','mvnscs','mvnshs','mvnscc','mvnslo','mvnsmi','mvnspl','mvnsvs','mvnsvc','mvnshi','mvnsls','mvnsge','mvnslt','mvnsgt','mvnsle',
+ 'movseq.w','movsne.w','movscs.w','movshs.w','movscc.w','movslo.w','movsmi.w','movspl.w','movsvs.w','movsvc.w','movshi.w','movsls.w','movsge.w','movslt.w','movsgt.w','movsle.w',
+ 'movseq','movsne','movscs','movshs','movscc','movslo','movsmi','movspl','movsvs','movsvc','movshi','movsls','movsge','movslt','movsgt','movsle',
+ 'teqeq','teqne','teqcs','teqhs','teqcc','teqlo','teqmi','teqpl','teqvs','teqvc','teqhi','teqls','teqge','teqlt','teqgt','teqle',
+ 'tsteq.w','tstne.w','tstcs.w','tsths.w','tstcc.w','tstlo.w','tstmi.w','tstpl.w','tstvs.w','tstvc.w','tsthi.w','tstls.w','tstge.w','tstlt.w','tstgt.w','tstle.w',
+ 'tsteq','tstne','tstcs','tsths','tstcc','tstlo','tstmi','tstpl','tstvs','tstvc','tsthi','tstls','tstge','tstlt','tstgt','tstle',
+ 'mrseq','mrsne','mrscs','mrshs','mrscc','mrslo','mrsmi','mrspl','mrsvs','mrsvc','mrshi','mrsls','mrsge','mrslt','mrsgt','mrsle',
+ 'msreq','msrne','msrcs','msrhs','msrcc','msrlo','msrmi','msrpl','msrvs','msrvc','msrhi','msrls','msrge','msrlt','msrgt','msrle',
+ /* Set Flags: Conditional Shifts and Rotates */
+ 'asrseq.w','asrsne.w','asrscs.w','asrshs.w','asrscc.w','asrslo.w','asrsmi.w','asrspl.w','asrsvs.w','asrsvc.w','asrshi.w','asrsls.w','asrsge.w','asrslt.w','asrsgt.w','asrsle.w',
+ 'asrseq','asrsne','asrscs','asrshs','asrscc','asrslo','asrsmi','asrspl','asrsvs','asrsvc','asrshi','asrsls','asrsge','asrslt','asrsgt','asrsle',
+ 'lslseq.w','lslsne.w','lslscs.w','lslshs.w','lslscc.w','lslslo.w','lslsmi.w','lslspl.w','lslsvs.w','lslsvc.w','lslshi.w','lslsls.w','lslsge.w','lslslt.w','lslsgt.w','lslsle.w',
+ 'lslseq','lslsne','lslscs','lslshs','lslscc','lslslo','lslsmi','lslspl','lslsvs','lslsvc','lslshi','lslsls','lslsge','lslslt','lslsgt','lslsle',
+ 'lsrseq.w','lsrsne.w','lsrscs.w','lsrshs.w','lsrscc.w','lsrslo.w','lsrsmi.w','lsrspl.w','lsrsvs.w','lsrsvc.w','lsrshi.w','lsrsls.w','lsrsge.w','lsrslt.w','lsrsgt.w','lsrsle.w',
+ 'lsrseq','lsrsne','lsrscs','lsrshs','lsrscc','lsrslo','lsrsmi','lsrspl','lsrsvs','lsrsvc','lsrshi','lsrsls','lsrsge','lsrslt','lsrsgt','lsrsle',
+ 'rorseq.w','rorsne.w','rorscs.w','rorshs.w','rorscc.w','rorslo.w','rorsmi.w','rorspl.w','rorsvs.w','rorsvc.w','rorshi.w','rorsls.w','rorsge.w','rorslt.w','rorsgt.w','rorsle.w',
+ 'rorseq','rorsne','rorscs','rorshs','rorscc','rorslo','rorsmi','rorspl','rorsvs','rorsvc','rorshi','rorsls','rorsge','rorslt','rorsgt','rorsle',
+ 'rrxseq','rrxsne','rrxscs','rrxshs','rrxscc','rrxslo','rrxsmi','rrxspl','rrxsvs','rrxsvc','rrxshi','rrxsls','rrxsge','rrxslt','rrxsgt','rrxsle',
+ /* Set Flags: Conditional Multiply and Multiply-Add */
+ 'mlaseq','mlasne','mlascs','mlashs','mlascc','mlaslo','mlasmi','mlaspl','mlasvs','mlasvc','mlashi','mlasls','mlasge','mlaslt','mlasgt','mlasle',
+ 'smullseq','smullsne','smullscs','smullshs','smullscc','smullslo','smullsmi','smullspl','smullsvs','smullsvc','smullshi','smullsls','smullsge','smullslt','smullsgt','smullsle',
+ 'umullseq','umullsne','umullscs','umullshs','umullscc','umullslo','umullsmi','umullspl','umullsvs','umullsvc','umullshi','umullsls','umullsge','umullslt','umullsgt','umullsle',
+ 'smlalseq','smlalsne','smlalscs','smlalshs','smlalscc','smlalslo','smlalsmi','smlalspl','smlalsvs','smlalsvc','smlalshi','smlalsls','smlalsge','smlalslt','smlalsgt','smlalsle',
+ 'umlalseq','umlalsne','umlalscs','umlalshs','umlalscc','umlalslo','umlalsmi','umlalspl','umlalsvs','umlalsvc','umlalshi','umlalsls','umlalsge','umlalslt','umlalsgt','umlalsle'
+ ),
+ /* Unconditional Flow Control Instructions */
+ 7 => array(
+ /* Flow Control: Unconditional Branch and If-Then-Else */
+ 'b.w','bal.w',
+ 'b','bal',
+ 'bl','blal',
+ 'bx','bxal',
+ 'blx','blxal',
+ 'bxj','bxjal',
+ 'cbnz',
+ 'cbz',
+ 'tbb','tbbal',
+ 'tbh','tbhal',
+ 'it',
+ 'itt',
+ 'ite',
+ 'ittt',
+ 'itet',
+ 'itte',
+ 'itee',
+ 'itttt',
+ 'itett',
+ 'ittet',
+ 'iteet',
+ 'ittte',
+ 'itete',
+ 'ittee',
+ 'iteee'
+ ),
+ /* Conditional Flow Control Instructions */
+ 8 => array(
+ /* Flow Control: Conditional Branch and If-Then-Else */
+ 'beq.w','bne.w','bcs.w','bhs.w','bcc.w','blo.w','bmi.w','bpl.w','bvs.w','bvc.w','bhi.w','bls.w','bge.w','blt.w','bgt.w','ble.w',
+ 'beq','bne','bcs','bhs','bcc','blo','bmi','bpl','bvs','bvc','bhi','bls','bge','blt','bgt','ble',
+ 'bleq','blne','blcs','blhs','blcc','bllo','blmi','blpl','blvs','blvc','blhi','blls','blge','bllt','blgt','blle',
+ 'bxeq','bxne','bxcs','bxhs','bxcc','bxlo','bxmi','bxpl','bxvs','bxvc','bxhi','bxls','bxge','bxlt','bxgt','bxle',
+ 'blxeq','blxne','blxcs','blxhs','blxcc','blxlo','blxmi','blxpl','blxvs','blxvc','blxhi','blxls','blxge','blxlt','blxgt','blxle',
+ 'bxjeq','bxjne','bxjcs','bxjhs','bxjcc','bxjlo','bxjmi','bxjpl','bxjvs','bxjvc','bxjhi','bxjls','bxjge','bxjlt','bxjgt','bxjle',
+ 'tbbeq','tbbne','tbbcs','tbbhs','tbbcc','tbblo','tbbmi','tbbpl','tbbvs','tbbvc','tbbhi','tbbls','tbbge','tbblt','tbbgt','tbble',
+ 'tbheq','tbhne','tbhcs','tbhhs','tbhcc','tbhlo','tbhmi','tbhpl','tbhvs','tbhvc','tbhhi','tbhls','tbhge','tbhlt','tbhgt','tbhle'
+ ),
+ /* Unconditional Syncronization Instructions */
+ 9 => array(
+ /* Synchronization: Unconditional Loads, Stores and Barriers */
+ 'ldrexd','ldrexdal',
+ 'ldrex','ldrexal',
+ 'ldrexh','ldrexhal',
+ 'ldrexb','ldrexbal',
+ 'strexd','strexdal',
+ 'strex','strexal',
+ 'strexh','strexhal',
+ 'strexb','strexbal',
+ 'clrex','clrexal',
+ 'swp','swpal',
+ 'swpb','swpbal',
+ 'dbc','dbcal',
+ 'dsb','dsbal',
+ 'isb','isbal',
+ 'yield.w','yieldal.w',
+ 'yield','yieldal',
+ 'nop.w','nopal.w',
+ 'nop','nopal'
+ ),
+ /* Conditional Syncronization Instructions */
+ 10 => array(
+ /* Synchronization: Conditional Loads, Stores and Barriers */
+ 'ldrexdeq','ldrexdne','ldrexdcs','ldrexdhs','ldrexdcc','ldrexdlo','ldrexdmi','ldrexdpl','ldrexdvs','ldrexdvc','ldrexdhi','ldrexdls','ldrexdge','ldrexdlt','ldrexdgt','ldrexdle',
+ 'ldrexeq','ldrexne','ldrexcs','ldrexhs','ldrexcc','ldrexlo','ldrexmi','ldrexpl','ldrexvs','ldrexvc','ldrexhi','ldrexls','ldrexge','ldrexlt','ldrexgt','ldrexle',
+ 'ldrexheq','ldrexhne','ldrexhcs','ldrexhhs','ldrexhcc','ldrexhlo','ldrexhmi','ldrexhpl','ldrexhvs','ldrexhvc','ldrexhhi','ldrexhls','ldrexhge','ldrexhlt','ldrexhgt','ldrexhle',
+ 'ldrexbeq','ldrexbne','ldrexbcs','ldrexbhs','ldrexbcc','ldrexblo','ldrexbmi','ldrexbpl','ldrexbvs','ldrexbvc','ldrexbhi','ldrexbls','ldrexbge','ldrexblt','ldrexbgt','ldrexble',
+ 'strexdeq','strexdne','strexdcs','strexdhs','strexdcc','strexdlo','strexdmi','strexdpl','strexdvs','strexdvc','strexdhi','strexdls','strexdge','strexdlt','strexdgt','strexdle',
+ 'strexeq','strexne','strexcs','strexhs','strexcc','strexlo','strexmi','strexpl','strexvs','strexvc','strexhi','strexls','strexge','strexlt','strexgt','strexle',
+ 'strexheq','strexhne','strexhcs','strexhhs','strexhcc','strexhlo','strexhmi','strexhpl','strexhvs','strexhvc','strexhhi','strexhls','strexhge','strexhlt','strexhgt','strexhle',
+ 'strexbeq','strexbne','strexbcs','strexbhs','strexbcc','strexblo','strexbmi','strexbpl','strexbvs','strexbvc','strexbhi','strexbls','strexbge','strexblt','strexbgt','strexble',
+ 'clrexeq','clrexne','clrexcs','clrexhs','clrexcc','clrexlo','clrexmi','clrexpl','clrexvs','clrexvc','clrexhi','clrexls','clrexge','clrexlt','clrexgt','clrexle',
+ 'swpeq','swpne','swpcs','swphs','swpcc','swplo','swpmi','swppl','swpvs','swpvc','swphi','swpls','swpge','swplt','swpgt','swple',
+ 'swpbeq','swpbne','swpbcs','swpbhs','swpbcc','swpblo','swpbmi','swpbpl','swpbvs','swpbvc','swpbhi','swpbls','swpbge','swpblt','swpbgt','swpble',
+ 'dbceq','dbcne','dbccs','dbchs','dbccc','dbclo','dbcmi','dbcpl','dbcvs','dbcvc','dbchi','dbcls','dbcge','dbclt','dbcgt','dbcle',
+ 'dsbeq','dsbne','dsbcs','dsbhs','dsbcc','dsblo','dsbmi','dsbpl','dsbvs','dsbvc','dsbhi','dsbls','dsbge','dsblt','dsbgt','dsble',
+ 'isbeq','isbne','isbcs','isbhs','isbcc','isblo','isbmi','isbpl','isbvs','isbvc','isbhi','isbls','isbge','isblt','isbgt','isble',
+ 'yieldeq.w','yieldne.w','yieldcs.w','yieldhs.w','yieldcc.w','yieldlo.w','yieldmi.w','yieldpl.w','yieldvs.w','yieldvc.w','yieldhi.w','yieldls.w','yieldge.w','yieldlt.w','yieldgt.w','yieldle.w',
+ 'yieldeq','yieldne','yieldcs','yieldhs','yieldcc','yieldlo','yieldmi','yieldpl','yieldvs','yieldvc','yieldhi','yieldls','yieldge','yieldlt','yieldgt','yieldle',
+ 'nopeq.w','nopne.w','nopcs.w','nophs.w','nopcc.w','noplo.w','nopmi.w','noppl.w','nopvs.w','nopvc.w','nophi.w','nopls.w','nopge.w','noplt.w','nopgt.w','nople.w',
+ 'nopeq','nopne','nopcs','nophs','nopcc','noplo','nopmi','noppl','nopvs','nopvc','nophi','nopls','nopge','noplt','nopgt','nople'
+ ),
+ /* Unconditional ARMv6 SIMD */
+ 11 => array(
+ /* ARMv6 SIMD: Unconditional Addition, Subtraction & Saturation */
+ 'sadd16','sadd16al',
+ 'sadd8','sadd8al',
+ 'uadd16','uadd16al',
+ 'uadd8','uadd8al',
+ 'ssub16','ssub16al',
+ 'ssub8','ssub8al',
+ 'usub16','usub16al',
+ 'usub8','usub8al',
+ 'sasx','sasxal',
+ 'ssax','ssaxal',
+ 'uasx','uasxal',
+ 'usax','usaxal',
+ 'usad8','usad8al',
+ 'usada8','usada8al',
+ /* ARMv6 SIMD: Unconditional Halving Addition & Subtraction */
+ 'shadd16','shadd16al',
+ 'shadd8','shadd8al',
+ 'uhadd16','uhadd16al',
+ 'uhadd8','uhadd8al',
+ 'shsub16','shsub16al',
+ 'shsub8','shsub8al',
+ 'uhsub16','uhsub16al',
+ 'uhsub8','uhsub8al',
+ 'shasx','shasxal',
+ 'shsax','shsaxal',
+ 'uhasx','uhasxal',
+ 'uhsax','uhsaxal',
+ /* ARMv6 SIMD: Unconditional Saturating Operations */
+ 'qadd','qaddal',
+ 'qadd16','qadd16al',
+ 'qadd8','qadd8al',
+ 'uqadd16','uqadd16al',
+ 'uqadd8','uqadd8al',
+ 'qsub','qsubal',
+ 'qsub16','qsub16al',
+ 'qsub8','qsub8al',
+ 'uqsub16','uqsub16al',
+ 'uqsub8','uqsub8al',
+ 'qasx','qasxal',
+ 'qsax','qsaxal',
+ 'uqasx','uqasxal',
+ 'uqsax','uqsaxal',
+ 'qdadd','qdaddal',
+ 'qdsub','qdsubal',
+ 'ssat','ssatal',
+ 'ssat16','ssat16al',
+ 'usat','usatal',
+ 'usat16','usat16al',
+ /* ARMv6 SIMD: Unconditional Permutation and Combine Operations */
+ 'sxtah','sxtahal',
+ 'sxtab','sxtabal',
+ 'sxtab16','sxtab16al',
+ 'uxtah','uxtahal',
+ 'uxtab','uxtabal',
+ 'uxtab16','uxtab16al',
+ 'sxth.w','sxthal.w',
+ 'sxth','sxthal',
+ 'sxtb.w','sxtbal.w',
+ 'sxtb','sxtbal',
+ 'sxtb16','sxtb16al',
+ 'uxth.w','uxthal.w',
+ 'uxth','uxthal',
+ 'uxtb.w','uxtbal.w',
+ 'uxtb','uxtbal',
+ 'uxtb16','uxtb16al',
+ 'pkhbt','pkhbtal',
+ 'pkhtb','pkhtbal',
+ 'rbit','rbital',
+ 'rev.w','reval.w',
+ 'rev','reval',
+ 'rev16.w','rev16al.w',
+ 'rev16','rev16al',
+ 'revsh.w','revshal.w',
+ 'revsh','revshal',
+ 'sel','selal',
+ /* ARMv6 SIMD: Unconditional Multiply and Multiply-Add */
+ 'smlad','smladal',
+ 'smladx','smladxal',
+ 'smlsd','smlsdal',
+ 'smlsdx','smlsdxal',
+ 'smlald','smlaldal',
+ 'smlaldx','smlaldxal',
+ 'smlsld','smlsldal',
+ 'smlsldx','smlsldxal',
+ 'smmul','smmulal',
+ 'smmulr','smmulral',
+ 'smmla','smmlaal',
+ 'smmlar','smmlaral',
+ 'smmls','smmlsal',
+ 'smmlsr','smmlsral',
+ 'smuad','smuadal',
+ 'smuadx','smuadxal',
+ 'smusd','smusdal',
+ 'smusdx','smusdxal',
+ 'umaal','umaalal'
+ ),
+ /* Conditional ARMv6 SIMD */
+ 12 => array(
+ /* ARMv6 SIMD: Conditional Addition, Subtraction & Saturation */
+ 'sadd16eq','sadd16ne','sadd16cs','sadd16hs','sadd16cc','sadd16lo','sadd16mi','sadd16pl','sadd16vs','sadd16vc','sadd16hi','sadd16ls','sadd16ge','sadd16lt','sadd16gt','sadd16le',
+ 'sadd8eq','sadd8ne','sadd8cs','sadd8hs','sadd8cc','sadd8lo','sadd8mi','sadd8pl','sadd8vs','sadd8vc','sadd8hi','sadd8ls','sadd8ge','sadd8lt','sadd8gt','sadd8le',
+ 'uadd16eq','uadd16ne','uadd16cs','uadd16hs','uadd16cc','uadd16lo','uadd16mi','uadd16pl','uadd16vs','uadd16vc','uadd16hi','uadd16ls','uadd16ge','uadd16lt','uadd16gt','uadd16le',
+ 'uadd8eq','uadd8ne','uadd8cs','uadd8hs','uadd8cc','uadd8lo','uadd8mi','uadd8pl','uadd8vs','uadd8vc','uadd8hi','uadd8ls','uadd8ge','uadd8lt','uadd8gt','uadd8le',
+ 'ssub16eq','ssub16ne','ssub16cs','ssub16hs','ssub16cc','ssub16lo','ssub16mi','ssub16pl','ssub16vs','ssub16vc','ssub16hi','ssub16ls','ssub16ge','ssub16lt','ssub16gt','ssub16le',
+ 'ssub8eq','ssub8ne','ssub8cs','ssub8hs','ssub8cc','ssub8lo','ssub8mi','ssub8pl','ssub8vs','ssub8vc','ssub8hi','ssub8ls','ssub8ge','ssub8lt','ssub8gt','ssub8le',
+ 'usub16eq','usub16ne','usub16cs','usub16hs','usub16cc','usub16lo','usub16mi','usub16pl','usub16vs','usub16vc','usub16hi','usub16ls','usub16ge','usub16lt','usub16gt','usub16le',
+ 'usub8eq','usub8ne','usub8cs','usub8hs','usub8cc','usub8lo','usub8mi','usub8pl','usub8vs','usub8vc','usub8hi','usub8ls','usub8ge','usub8lt','usub8gt','usub8le',
+ 'sasxeq','sasxne','sasxcs','sasxhs','sasxcc','sasxlo','sasxmi','sasxpl','sasxvs','sasxvc','sasxhi','sasxls','sasxge','sasxlt','sasxgt','sasxle',
+ 'ssaxeq','ssaxne','ssaxcs','ssaxhs','ssaxcc','ssaxlo','ssaxmi','ssaxpl','ssaxvs','ssaxvc','ssaxhi','ssaxls','ssaxge','ssaxlt','ssaxgt','ssaxle',
+ 'uasxeq','uasxne','uasxcs','uasxhs','uasxcc','uasxlo','uasxmi','uasxpl','uasxvs','uasxvc','uasxhi','uasxls','uasxge','uasxlt','uasxgt','uasxle',
+ 'usaxeq','usaxne','usaxcs','usaxhs','usaxcc','usaxlo','usaxmi','usaxpl','usaxvs','usaxvc','usaxhi','usaxls','usaxge','usaxlt','usaxgt','usaxle',
+ 'usad8eq','usad8ne','usad8cs','usad8hs','usad8cc','usad8lo','usad8mi','usad8pl','usad8vs','usad8vc','usad8hi','usad8ls','usad8ge','usad8lt','usad8gt','usad8le',
+ 'usada8eq','usada8ne','usada8cs','usada8hs','usada8cc','usada8lo','usada8mi','usada8pl','usada8vs','usada8vc','usada8hi','usada8ls','usada8ge','usada8lt','usada8gt','usada8le',
+ /* ARMv6 SIMD: Conditional Halving Addition & Subtraction */
+ 'shadd16eq','shadd16ne','shadd16cs','shadd16hs','shadd16cc','shadd16lo','shadd16mi','shadd16pl','shadd16vs','shadd16vc','shadd16hi','shadd16ls','shadd16ge','shadd16lt','shadd16gt','shadd16le',
+ 'shadd8eq','shadd8ne','shadd8cs','shadd8hs','shadd8cc','shadd8lo','shadd8mi','shadd8pl','shadd8vs','shadd8vc','shadd8hi','shadd8ls','shadd8ge','shadd8lt','shadd8gt','shadd8le',
+ 'uhadd16eq','uhadd16ne','uhadd16cs','uhadd16hs','uhadd16cc','uhadd16lo','uhadd16mi','uhadd16pl','uhadd16vs','uhadd16vc','uhadd16hi','uhadd16ls','uhadd16ge','uhadd16lt','uhadd16gt','uhadd16le',
+ 'uhadd8eq','uhadd8ne','uhadd8cs','uhadd8hs','uhadd8cc','uhadd8lo','uhadd8mi','uhadd8pl','uhadd8vs','uhadd8vc','uhadd8hi','uhadd8ls','uhadd8ge','uhadd8lt','uhadd8gt','uhadd8le',
+ 'shsub16eq','shsub16ne','shsub16cs','shsub16hs','shsub16cc','shsub16lo','shsub16mi','shsub16pl','shsub16vs','shsub16vc','shsub16hi','shsub16ls','shsub16ge','shsub16lt','shsub16gt','shsub16le',
+ 'shsub8eq','shsub8ne','shsub8cs','shsub8hs','shsub8cc','shsub8lo','shsub8mi','shsub8pl','shsub8vs','shsub8vc','shsub8hi','shsub8ls','shsub8ge','shsub8lt','shsub8gt','shsub8le',
+ 'uhsub16eq','uhsub16ne','uhsub16cs','uhsub16hs','uhsub16cc','uhsub16lo','uhsub16mi','uhsub16pl','uhsub16vs','uhsub16vc','uhsub16hi','uhsub16ls','uhsub16ge','uhsub16lt','uhsub16gt','uhsub16le',
+ 'uhsub8eq','uhsub8ne','uhsub8cs','uhsub8hs','uhsub8cc','uhsub8lo','uhsub8mi','uhsub8pl','uhsub8vs','uhsub8vc','uhsub8hi','uhsub8ls','uhsub8ge','uhsub8lt','uhsub8gt','uhsub8le',
+ 'shasxeq','shasxne','shasxcs','shasxhs','shasxcc','shasxlo','shasxmi','shasxpl','shasxvs','shasxvc','shasxhi','shasxls','shasxge','shasxlt','shasxgt','shasxle',
+ 'shsaxeq','shsaxne','shsaxcs','shsaxhs','shsaxcc','shsaxlo','shsaxmi','shsaxpl','shsaxvs','shsaxvc','shsaxhi','shsaxls','shsaxge','shsaxlt','shsaxgt','shsaxle',
+ 'uhasxeq','uhasxne','uhasxcs','uhasxhs','uhasxcc','uhasxlo','uhasxmi','uhasxpl','uhasxvs','uhasxvc','uhasxhi','uhasxls','uhasxge','uhasxlt','uhasxgt','uhasxle',
+ 'uhsaxeq','uhsaxne','uhsaxcs','uhsaxhs','uhsaxcc','uhsaxlo','uhsaxmi','uhsaxpl','uhsaxvs','uhsaxvc','uhsaxhi','uhsaxls','uhsaxge','uhsaxlt','uhsaxgt','uhsaxle',
+ /* ARMv6 SIMD: Conditional Saturating Operations */
+ 'qaddeq','qaddne','qaddcs','qaddhs','qaddcc','qaddlo','qaddmi','qaddpl','qaddvs','qaddvc','qaddhi','qaddls','qaddge','qaddlt','qaddgt','qaddle',
+ 'qadd16eq','qadd16ne','qadd16cs','qadd16hs','qadd16cc','qadd16lo','qadd16mi','qadd16pl','qadd16vs','qadd16vc','qadd16hi','qadd16ls','qadd16ge','qadd16lt','qadd16gt','qadd16le',
+ 'qadd8eq','qadd8ne','qadd8cs','qadd8hs','qadd8cc','qadd8lo','qadd8mi','qadd8pl','qadd8vs','qadd8vc','qadd8hi','qadd8ls','qadd8ge','qadd8lt','qadd8gt','qadd8le',
+ 'uqadd16eq','uqadd16ne','uqadd16cs','uqadd16hs','uqadd16cc','uqadd16lo','uqadd16mi','uqadd16pl','uqadd16vs','uqadd16vc','uqadd16hi','uqadd16ls','uqadd16ge','uqadd16lt','uqadd16gt','uqadd16le',
+ 'uqadd8eq','uqadd8ne','uqadd8cs','uqadd8hs','uqadd8cc','uqadd8lo','uqadd8mi','uqadd8pl','uqadd8vs','uqadd8vc','uqadd8hi','uqadd8ls','uqadd8ge','uqadd8lt','uqadd8gt','uqadd8le',
+ 'qsubeq','qsubne','qsubcs','qsubhs','qsubcc','qsublo','qsubmi','qsubpl','qsubvs','qsubvc','qsubhi','qsubls','qsubge','qsublt','qsubgt','qsuble',
+ 'qsub16eq','qsub16ne','qsub16cs','qsub16hs','qsub16cc','qsub16lo','qsub16mi','qsub16pl','qsub16vs','qsub16vc','qsub16hi','qsub16ls','qsub16ge','qsub16lt','qsub16gt','qsub16le',
+ 'qsub8eq','qsub8ne','qsub8cs','qsub8hs','qsub8cc','qsub8lo','qsub8mi','qsub8pl','qsub8vs','qsub8vc','qsub8hi','qsub8ls','qsub8ge','qsub8lt','qsub8gt','qsub8le',
+ 'uqsub16eq','uqsub16ne','uqsub16cs','uqsub16hs','uqsub16cc','uqsub16lo','uqsub16mi','uqsub16pl','uqsub16vs','uqsub16vc','uqsub16hi','uqsub16ls','uqsub16ge','uqsub16lt','uqsub16gt','uqsub16le',
+ 'uqsub8eq','uqsub8ne','uqsub8cs','uqsub8hs','uqsub8cc','uqsub8lo','uqsub8mi','uqsub8pl','uqsub8vs','uqsub8vc','uqsub8hi','uqsub8ls','uqsub8ge','uqsub8lt','uqsub8gt','uqsub8le',
+ 'qasxeq','qasxne','qasxcs','qasxhs','qasxcc','qasxlo','qasxmi','qasxpl','qasxvs','qasxvc','qasxhi','qasxls','qasxge','qasxlt','qasxgt','qasxle',
+ 'qsaxeq','qsaxne','qsaxcs','qsaxhs','qsaxcc','qsaxlo','qsaxmi','qsaxpl','qsaxvs','qsaxvc','qsaxhi','qsaxls','qsaxge','qsaxlt','qsaxgt','qsaxle',
+ 'uqasxeq','uqasxne','uqasxcs','uqasxhs','uqasxcc','uqasxlo','uqasxmi','uqasxpl','uqasxvs','uqasxvc','uqasxhi','uqasxls','uqasxge','uqasxlt','uqasxgt','uqasxle',
+ 'uqsaxeq','uqsaxne','uqsaxcs','uqsaxhs','uqsaxcc','uqsaxlo','uqsaxmi','uqsaxpl','uqsaxvs','uqsaxvc','uqsaxhi','uqsaxls','uqsaxge','uqsaxlt','uqsaxgt','uqsaxle',
+ 'qdaddeq','qdaddne','qdaddcs','qdaddhs','qdaddcc','qdaddlo','qdaddmi','qdaddpl','qdaddvs','qdaddvc','qdaddhi','qdaddls','qdaddge','qdaddlt','qdaddgt','qdaddle',
+ 'qdsubeq','qdsubne','qdsubcs','qdsubhs','qdsubcc','qdsublo','qdsubmi','qdsubpl','qdsubvs','qdsubvc','qdsubhi','qdsubls','qdsubge','qdsublt','qdsubgt','qdsuble',
+ 'ssateq','ssatne','ssatcs','ssaths','ssatcc','ssatlo','ssatmi','ssatpl','ssatvs','ssatvc','ssathi','ssatls','ssatge','ssatlt','ssatgt','ssatle',
+ 'ssat16eq','ssat16ne','ssat16cs','ssat16hs','ssat16cc','ssat16lo','ssat16mi','ssat16pl','ssat16vs','ssat16vc','ssat16hi','ssat16ls','ssat16ge','ssat16lt','ssat16gt','ssat16le',
+ 'usateq','usatne','usatcs','usaths','usatcc','usatlo','usatmi','usatpl','usatvs','usatvc','usathi','usatls','usatge','usatlt','usatgt','usatle',
+ 'usat16eq','usat16ne','usat16cs','usat16hs','usat16cc','usat16lo','usat16mi','usat16pl','usat16vs','usat16vc','usat16hi','usat16ls','usat16ge','usat16lt','usat16gt','usat16le',
+ /* ARMv6 SIMD: Conditional Permutation and Combine Operations */
+ 'sxtaheq','sxtahne','sxtahcs','sxtahhs','sxtahcc','sxtahlo','sxtahmi','sxtahpl','sxtahvs','sxtahvc','sxtahhi','sxtahls','sxtahge','sxtahlt','sxtahgt','sxtahle',
+ 'sxtabeq','sxtabne','sxtabcs','sxtabhs','sxtabcc','sxtablo','sxtabmi','sxtabpl','sxtabvs','sxtabvc','sxtabhi','sxtabls','sxtabge','sxtablt','sxtabgt','sxtable',
+ 'sxtab16eq','sxtab16ne','sxtab16cs','sxtab16hs','sxtab16cc','sxtab16lo','sxtab16mi','sxtab16pl','sxtab16vs','sxtab16vc','sxtab16hi','sxtab16ls','sxtab16ge','sxtab16lt','sxtab16gt','sxtab16le',
+ 'uxtaheq','uxtahne','uxtahcs','uxtahhs','uxtahcc','uxtahlo','uxtahmi','uxtahpl','uxtahvs','uxtahvc','uxtahhi','uxtahls','uxtahge','uxtahlt','uxtahgt','uxtahle',
+ 'uxtabeq','uxtabne','uxtabcs','uxtabhs','uxtabcc','uxtablo','uxtabmi','uxtabpl','uxtabvs','uxtabvc','uxtabhi','uxtabls','uxtabge','uxtablt','uxtabgt','uxtable',
+ 'uxtab16eq','uxtab16ne','uxtab16cs','uxtab16hs','uxtab16cc','uxtab16lo','uxtab16mi','uxtab16pl','uxtab16vs','uxtab16vc','uxtab16hi','uxtab16ls','uxtab16ge','uxtab16lt','uxtab16gt','uxtab16le',
+ 'sxtheq.w','sxthne.w','sxthcs.w','sxthhs.w','sxthcc.w','sxthlo.w','sxthmi.w','sxthpl.w','sxthvs.w','sxthvc.w','sxthhi.w','sxthls.w','sxthge.w','sxthlt.w','sxthgt.w','sxthle.w',
+ 'sxtheq','sxthne','sxthcs','sxthhs','sxthcc','sxthlo','sxthmi','sxthpl','sxthvs','sxthvc','sxthhi','sxthls','sxthge','sxthlt','sxthgt','sxthle',
+ 'sxtbeq.w','sxtbne.w','sxtbcs.w','sxtbhs.w','sxtbcc.w','sxtblo.w','sxtbmi.w','sxtbpl.w','sxtbvs.w','sxtbvc.w','sxtbhi.w','sxtbls.w','sxtbge.w','sxtblt.w','sxtbgt.w','sxtble.w',
+ 'sxtbeq','sxtbne','sxtbcs','sxtbhs','sxtbcc','sxtblo','sxtbmi','sxtbpl','sxtbvs','sxtbvc','sxtbhi','sxtbls','sxtbge','sxtblt','sxtbgt','sxtble',
+ 'sxtb16eq','sxtb16ne','sxtb16cs','sxtb16hs','sxtb16cc','sxtb16lo','sxtb16mi','sxtb16pl','sxtb16vs','sxtb16vc','sxtb16hi','sxtb16ls','sxtb16ge','sxtb16lt','sxtb16gt','sxtb16le',
+ 'uxtheq.w','uxthne.w','uxthcs.w','uxthhs.w','uxthcc.w','uxthlo.w','uxthmi.w','uxthpl.w','uxthvs.w','uxthvc.w','uxthhi.w','uxthls.w','uxthge.w','uxthlt.w','uxthgt.w','uxthle.w',
+ 'uxtheq','uxthne','uxthcs','uxthhs','uxthcc','uxthlo','uxthmi','uxthpl','uxthvs','uxthvc','uxthhi','uxthls','uxthge','uxthlt','uxthgt','uxthle',
+ 'uxtbeq.w','uxtbne.w','uxtbcs.w','uxtbhs.w','uxtbcc.w','uxtblo.w','uxtbmi.w','uxtbpl.w','uxtbvs.w','uxtbvc.w','uxtbhi.w','uxtbls.w','uxtbge.w','uxtblt.w','uxtbgt.w','uxtble.w',
+ 'uxtbeq','uxtbne','uxtbcs','uxtbhs','uxtbcc','uxtblo','uxtbmi','uxtbpl','uxtbvs','uxtbvc','uxtbhi','uxtbls','uxtbge','uxtblt','uxtbgt','uxtble',
+ 'uxtb16eq','uxtb16ne','uxtb16cs','uxtb16hs','uxtb16cc','uxtb16lo','uxtb16mi','uxtb16pl','uxtb16vs','uxtb16vc','uxtb16hi','uxtb16ls','uxtb16ge','uxtb16lt','uxtb16gt','uxtb16le',
+ 'pkhbteq','pkhbtne','pkhbtcs','pkhbths','pkhbtcc','pkhbtlo','pkhbtmi','pkhbtpl','pkhbtvs','pkhbtvc','pkhbthi','pkhbtls','pkhbtge','pkhbtlt','pkhbtgt','pkhbtle',
+ 'pkhtbeq','pkhtbne','pkhtbcs','pkhtbhs','pkhtbcc','pkhtblo','pkhtbmi','pkhtbpl','pkhtbvs','pkhtbvc','pkhtbhi','pkhtbls','pkhtbge','pkhtblt','pkhtbgt','pkhtble',
+ 'rbiteq','rbitne','rbitcs','rbiths','rbitcc','rbitlo','rbitmi','rbitpl','rbitvs','rbitvc','rbithi','rbitls','rbitge','rbitlt','rbitgt','rbitle',
+ 'reveq.w','revne.w','revcs.w','revhs.w','revcc.w','revlo.w','revmi.w','revpl.w','revvs.w','revvc.w','revhi.w','revls.w','revge.w','revlt.w','revgt.w','revle.w',
+ 'reveq','revne','revcs','revhs','revcc','revlo','revmi','revpl','revvs','revvc','revhi','revls','revge','revlt','revgt','revle',
+ 'rev16eq.w','rev16ne.w','rev16cs.w','rev16hs.w','rev16cc.w','rev16lo.w','rev16mi.w','rev16pl.w','rev16vs.w','rev16vc.w','rev16hi.w','rev16ls.w','rev16ge.w','rev16lt.w','rev16gt.w','rev16le.w',
+ 'rev16eq','rev16ne','rev16cs','rev16hs','rev16cc','rev16lo','rev16mi','rev16pl','rev16vs','rev16vc','rev16hi','rev16ls','rev16ge','rev16lt','rev16gt','rev16le',
+ 'revsheq.w','revshne.w','revshcs.w','revshhs.w','revshcc.w','revshlo.w','revshmi.w','revshpl.w','revshvs.w','revshvc.w','revshhi.w','revshls.w','revshge.w','revshlt.w','revshgt.w','revshle.w',
+ 'revsheq','revshne','revshcs','revshhs','revshcc','revshlo','revshmi','revshpl','revshvs','revshvc','revshhi','revshls','revshge','revshlt','revshgt','revshle',
+ 'seleq','selne','selcs','selhs','selcc','sello','selmi','selpl','selvs','selvc','selhi','sells','selge','sellt','selgt','selle',
+ /* ARMv6 SIMD: Conditional Multiply and Multiply-Add */
+ 'smladeq','smladne','smladcs','smladhs','smladcc','smladlo','smladmi','smladpl','smladvs','smladvc','smladhi','smladls','smladge','smladlt','smladgt','smladle',
+ 'smladxeq','smladxne','smladxcs','smladxhs','smladxcc','smladxlo','smladxmi','smladxpl','smladxvs','smladxvc','smladxhi','smladxls','smladxge','smladxlt','smladxgt','smladxle',
+ 'smlsdeq','smlsdne','smlsdcs','smlsdhs','smlsdcc','smlsdlo','smlsdmi','smlsdpl','smlsdvs','smlsdvc','smlsdhi','smlsdls','smlsdge','smlsdlt','smlsdgt','smlsdle',
+ 'smlsdxeq','smlsdxne','smlsdxcs','smlsdxhs','smlsdxcc','smlsdxlo','smlsdxmi','smlsdxpl','smlsdxvs','smlsdxvc','smlsdxhi','smlsdxls','smlsdxge','smlsdxlt','smlsdxgt','smlsdxle',
+ 'smlaldeq','smlaldne','smlaldcs','smlaldhs','smlaldcc','smlaldlo','smlaldmi','smlaldpl','smlaldvs','smlaldvc','smlaldhi','smlaldls','smlaldge','smlaldlt','smlaldgt','smlaldle',
+ 'smlaldxeq','smlaldxne','smlaldxcs','smlaldxhs','smlaldxcc','smlaldxlo','smlaldxmi','smlaldxpl','smlaldxvs','smlaldxvc','smlaldxhi','smlaldxls','smlaldxge','smlaldxlt','smlaldxgt','smlaldxle',
+ 'smlsldeq','smlsldne','smlsldcs','smlsldhs','smlsldcc','smlsldlo','smlsldmi','smlsldpl','smlsldvs','smlsldvc','smlsldhi','smlsldls','smlsldge','smlsldlt','smlsldgt','smlsldle',
+ 'smlsldxeq','smlsldxne','smlsldxcs','smlsldxhs','smlsldxcc','smlsldxlo','smlsldxmi','smlsldxpl','smlsldxvs','smlsldxvc','smlsldxhi','smlsldxls','smlsldxge','smlsldxlt','smlsldxgt','smlsldxle',
+ 'smmuleq','smmulne','smmulcs','smmulhs','smmulcc','smmullo','smmulmi','smmulpl','smmulvs','smmulvc','smmulhi','smmulls','smmulge','smmullt','smmulgt','smmulle',
+ 'smmulreq','smmulrne','smmulrcs','smmulrhs','smmulrcc','smmulrlo','smmulrmi','smmulrpl','smmulrvs','smmulrvc','smmulrhi','smmulrls','smmulrge','smmulrlt','smmulrgt','smmulrle',
+ 'smmlaeq','smmlane','smmlacs','smmlahs','smmlacc','smmlalo','smmlami','smmlapl','smmlavs','smmlavc','smmlahi','smmlals','smmlage','smmlalt','smmlagt','smmlale',
+ 'smmlareq','smmlarne','smmlarcs','smmlarhs','smmlarcc','smmlarlo','smmlarmi','smmlarpl','smmlarvs','smmlarvc','smmlarhi','smmlarls','smmlarge','smmlarlt','smmlargt','smmlarle',
+ 'smmlseq','smmlsne','smmlscs','smmlshs','smmlscc','smmlslo','smmlsmi','smmlspl','smmlsvs','smmlsvc','smmlshi','smmlsls','smmlsge','smmlslt','smmlsgt','smmlsle',
+ 'smmlsreq','smmlsrne','smmlsrcs','smmlsrhs','smmlsrcc','smmlsrlo','smmlsrmi','smmlsrpl','smmlsrvs','smmlsrvc','smmlsrhi','smmlsrls','smmlsrge','smmlsrlt','smmlsrgt','smmlsrle',
+ 'smuadeq','smuadne','smuadcs','smuadhs','smuadcc','smuadlo','smuadmi','smuadpl','smuadvs','smuadvc','smuadhi','smuadls','smuadge','smuadlt','smuadgt','smuadle',
+ 'smuadxeq','smuadxne','smuadxcs','smuadxhs','smuadxcc','smuadxlo','smuadxmi','smuadxpl','smuadxvs','smuadxvc','smuadxhi','smuadxls','smuadxge','smuadxlt','smuadxgt','smuadxle',
+ 'smusdeq','smusdne','smusdcs','smusdhs','smusdcc','smusdlo','smusdmi','smusdpl','smusdvs','smusdvc','smusdhi','smusdls','smusdge','smusdlt','smusdgt','smusdle',
+ 'smusdxeq','smusdxne','smusdxcs','smusdxhs','smusdxcc','smusdxlo','smusdxmi','smusdxpl','smusdxvs','smusdxvc','smusdxhi','smusdxls','smusdxge','smusdxlt','smusdxgt','smusdxle',
+ 'umaaleq','umaalne','umaalcs','umaalhs','umaalcc','umaallo','umaalmi','umaalpl','umaalvs','umaalvc','umaalhi','umaalls','umaalge','umaallt','umaalgt','umaalle'
+ ),
+ /* Unconditional Coprocessor Instructions */
+ 13 => array(
+ /* Data Processing: Unconditional Coprocessor Instructions */
+ 'cdp','cdpal',
+ 'cdp2','cdp2al',
+ 'ldc','ldcal',
+ 'ldcl','ldclal',
+ 'ldc2','ldc2al',
+ 'ldc2l','ldc2lal',
+ 'stc','stcal',
+ 'stcl','stclal',
+ 'stc2','stc2al',
+ 'stc2l','stc2lal',
+ 'mcr','mcral',
+ 'mcr2','mcr2al',
+ 'mcrr','mcrral',
+ 'mcrr2','mcrr2al',
+ 'mrc','mrcal',
+ 'mrc2','mrc2al',
+ 'mrrc','mrrcal',
+ 'mrrc2','mrrc2al'
+ ),
+ /* Conditional Coprocessor Instructions */
+ 14 => array(
+ /* Data Processing: Conditional Coprocessor Instructions */
+ 'cdpeq','cdpne','cdpcs','cdphs','cdpcc','cdplo','cdpmi','cdppl','cdpvs','cdpvc','cdphi','cdpls','cdpge','cdplt','cdpgt','cdple',
+ 'cdp2eq','cdp2ne','cdp2cs','cdp2hs','cdp2cc','cdp2lo','cdp2mi','cdp2pl','cdp2vs','cdp2vc','cdp2hi','cdp2ls','cdp2ge','cdp2lt','cdp2gt','cdp2le',
+ 'ldceq','ldcne','ldccs','ldchs','ldccc','ldclo','ldcmi','ldcpl','ldcvs','ldcvc','ldchi','ldcls','ldcge','ldclt','ldcgt','ldcle',
+ 'ldcleq','ldclne','ldclcs','ldclhs','ldclcc','ldcllo','ldclmi','ldclpl','ldclvs','ldclvc','ldclhi','ldclls','ldclge','ldcllt','ldclgt','ldclle',
+ 'ldc2eq','ldc2ne','ldc2cs','ldc2hs','ldc2cc','ldc2lo','ldc2mi','ldc2pl','ldc2vs','ldc2vc','ldc2hi','ldc2ls','ldc2ge','ldc2lt','ldc2gt','ldc2le',
+ 'ldc2leq','ldc2lne','ldc2lcs','ldc2lhs','ldc2lcc','ldc2llo','ldc2lmi','ldc2lpl','ldc2lvs','ldc2lvc','ldc2lhi','ldc2lls','ldc2lge','ldc2llt','ldc2lgt','ldc2lle',
+ 'stceq','stcne','stccs','stchs','stccc','stclo','stcmi','stcpl','stcvs','stcvc','stchi','stcls','stcge','stclt','stcgt','stcle',
+ 'stcleq','stclne','stclcs','stclhs','stclcc','stcllo','stclmi','stclpl','stclvs','stclvc','stclhi','stclls','stclge','stcllt','stclgt','stclle',
+ 'stc2eq','stc2ne','stc2cs','stc2hs','stc2cc','stc2lo','stc2mi','stc2pl','stc2vs','stc2vc','stc2hi','stc2ls','stc2ge','stc2lt','stc2gt','stc2le',
+ 'stc2leq','stc2lne','stc2lcs','stc2lhs','stc2lcc','stc2llo','stc2lmi','stc2lpl','stc2lvs','stc2lvc','stc2lhi','stc2lls','stc2lge','stc2llt','stc2lgt','stc2lle',
+ 'mcreq','mcrne','mcrcs','mcrhs','mcrcc','mcrlo','mcrmi','mcrpl','mcrvs','mcrvc','mcrhi','mcrls','mcrge','mcrlt','mcrgt','mcrle',
+ 'mcr2eq','mcr2ne','mcr2cs','mcr2hs','mcr2cc','mcr2lo','mcr2mi','mcr2pl','mcr2vs','mcr2vc','mcr2hi','mcr2ls','mcr2ge','mcr2lt','mcr2gt','mcr2le',
+ 'mcrreq','mcrrne','mcrrcs','mcrrhs','mcrrcc','mcrrlo','mcrrmi','mcrrpl','mcrrvs','mcrrvc','mcrrhi','mcrrls','mcrrge','mcrrlt','mcrrgt','mcrrle',
+ 'mcrr2eq','mcrr2ne','mcrr2cs','mcrr2hs','mcrr2cc','mcrr2lo','mcrr2mi','mcrr2pl','mcrr2vs','mcrr2vc','mcrr2hi','mcrr2ls','mcrr2ge','mcrr2lt','mcrr2gt','mcrr2le',
+ 'mrceq','mrcne','mrccs','mrchs','mrccc','mrclo','mrcmi','mrcpl','mrcvs','mrcvc','mrchi','mrcls','mrcge','mrclt','mrcgt','mrcle',
+ 'mrc2eq','mrc2ne','mrc2cs','mrc2hs','mrc2cc','mrc2lo','mrc2mi','mrc2pl','mrc2vs','mrc2vc','mrc2hi','mrc2ls','mrc2ge','mrc2lt','mrc2gt','mrc2le',
+ 'mrrceq','mrrcne','mrrccs','mrrchs','mrrccc','mrrclo','mrrcmi','mrrcpl','mrrcvs','mrrcvc','mrrchi','mrrcls','mrrcge','mrrclt','mrrcgt','mrrcle',
+ 'mrrc2eq','mrrc2ne','mrrc2cs','mrrc2hs','mrrc2cc','mrrc2lo','mrrc2mi','mrrc2pl','mrrc2vs','mrrc2vc','mrrc2hi','mrrc2ls','mrrc2ge','mrrc2lt','mrrc2gt','mrrc2le'
+ ),
+ /* Unconditional System Instructions */
+ 15 => array(
+ /* System: Unconditional Debug and State-Change Instructions */
+ 'bkpt',
+ 'dbg','dbgal',
+ 'setend',
+ 'svc','svcal',
+ 'sev.w','seval.w',
+ 'sev','seval',
+ 'wfe.w','wfeal.w',
+ 'wfe','wfeal',
+ 'wfi.w','wfial.w',
+ 'wfi','wfial',
+ /* System: Unconditional ThumbEE Instructions */
+ 'enterx',
+ 'leavex',
+ 'chka.n','chkaal.n',
+ 'chka','chkaal',
+ 'hb.n','hbal.n',
+ 'hb','hbal',
+ 'hbl.n','hblal.n',
+ 'hbl','hblal',
+ 'hblp.n','hblpal.n',
+ 'hblp','hblpal',
+ 'hbp.n','hbpal.n',
+ 'hbp','hbpal',
+ /* System: Unconditional Privileged Instructions */
+ 'cpsie.n',
+ 'cpsie.w',
+ 'cpsie',
+ 'cpsid.n',
+ 'cpsid.w',
+ 'cpsid',
+ 'smc','smcal',
+ 'rfeda','rfedaal',
+ 'rfedb','rfedbal',
+ 'rfeia','rfeiaal',
+ 'rfeib','rfeibal',
+ 'srsda','srsdaal',
+ 'srsdb','srsdbal',
+ 'srsia','srsiaal',
+ 'srsib','srsibal'
+ ),
+ /* Conditional System Instructions */
+ 16 => array(
+ /* System: Conditional Debug and State-Change Instructions */
+ 'dbgeq','dbgne','dbgcs','dbghs','dbgcc','dbglo','dbgmi','dbgpl','dbgvs','dbgvc','dbghi','dbgls','dbgge','dbglt','dbggt','dbgle',
+ 'svceq','svcne','svccs','svchs','svccc','svclo','svcmi','svcpl','svcvs','svcvc','svchi','svcls','svcge','svclt','svcgt','svcle',
+ 'seveq.w','sevne.w','sevcs.w','sevhs.w','sevcc.w','sevlo.w','sevmi.w','sevpl.w','sevvs.w','sevvc.w','sevhi.w','sevls.w','sevge.w','sevlt.w','sevgt.w','sevle.w',
+ 'seveq','sevne','sevcs','sevhs','sevcc','sevlo','sevmi','sevpl','sevvs','sevvc','sevhi','sevls','sevge','sevlt','sevgt','sevle',
+ 'wfeeq.w','wfene.w','wfecs.w','wfehs.w','wfecc.w','wfelo.w','wfemi.w','wfepl.w','wfevs.w','wfevc.w','wfehi.w','wfels.w','wfege.w','wfelt.w','wfegt.w','wfele.w',
+ 'wfeeq','wfene','wfecs','wfehs','wfecc','wfelo','wfemi','wfepl','wfevs','wfevc','wfehi','wfels','wfege','wfelt','wfegt','wfele',
+ 'wfieq.w','wfine.w','wfics.w','wfihs.w','wficc.w','wfilo.w','wfimi.w','wfipl.w','wfivs.w','wfivc.w','wfihi.w','wfils.w','wfige.w','wfilt.w','wfigt.w','wfile.w',
+ 'wfieq','wfine','wfics','wfihs','wficc','wfilo','wfimi','wfipl','wfivs','wfivc','wfihi','wfils','wfige','wfilt','wfigt','wfile',
+ /* System: Conditional ThumbEE Instructions */
+ 'chkaeq.n','chkane.n','chkacs.n','chkahs.n','chkacc.n','chkalo.n','chkami.n','chkapl.n','chkavs.n','chkavc.n','chkahi.n','chkals.n','chkage.n','chkalt.n','chkagt.n','chkale.n',
+ 'chkaeq','chkane','chkacs','chkahs','chkacc','chkalo','chkami','chkapl','chkavs','chkavc','chkahi','chkals','chkage','chkalt','chkagt','chkale',
+ 'hbeq.n','hbne.n','hbcs.n','hbhs.n','hbcc.n','hblo.n','hbmi.n','hbpl.n','hbvs.n','hbvc.n','hbhi.n','hbls.n','hbge.n','hblt.n','hbgt.n','hble.n',
+ 'hbeq','hbne','hbcs','hbhs','hbcc','hblo','hbmi','hbpl','hbvs','hbvc','hbhi','hbls','hbge','hblt','hbgt','hble',
+ 'hbleq.n','hblne.n','hblcs.n','hblhs.n','hblcc.n','hbllo.n','hblmi.n','hblpl.n','hblvs.n','hblvc.n','hblhi.n','hblls.n','hblge.n','hbllt.n','hblgt.n','hblle.n',
+ 'hbleq','hblne','hblcs','hblhs','hblcc','hbllo','hblmi','hblpl','hblvs','hblvc','hblhi','hblls','hblge','hbllt','hblgt','hblle',
+ 'hblpeq.n','hblpne.n','hblpcs.n','hblphs.n','hblpcc.n','hblplo.n','hblpmi.n','hblppl.n','hblpvs.n','hblpvc.n','hblphi.n','hblpls.n','hblpge.n','hblplt.n','hblpgt.n','hblple.n',
+ 'hblpeq','hblpne','hblpcs','hblphs','hblpcc','hblplo','hblpmi','hblppl','hblpvs','hblpvc','hblphi','hblpls','hblpge','hblplt','hblpgt','hblple',
+ 'hbpeq.n','hbpne.n','hbpcs.n','hbphs.n','hbpcc.n','hbplo.n','hbpmi.n','hbppl.n','hbpvs.n','hbpvc.n','hbphi.n','hbpls.n','hbpge.n','hbplt.n','hbpgt.n','hbple.n',
+ 'hbpeq','hbpne','hbpcs','hbphs','hbpcc','hbplo','hbpmi','hbppl','hbpvs','hbpvc','hbphi','hbpls','hbpge','hbplt','hbpgt','hbple',
+ /* System: Conditional Privileged Instructions */
+ 'smceq','smcne','smccs','smchs','smccc','smclo','smcmi','smcpl','smcvs','smcvc','smchi','smcls','smcge','smclt','smcgt','smcle',
+ 'rfedaeq','rfedane','rfedacs','rfedahs','rfedacc','rfedalo','rfedami','rfedapl','rfedavs','rfedavc','rfedahi','rfedals','rfedage','rfedalt','rfedagt','rfedale',
+ 'rfedbeq','rfedbne','rfedbcs','rfedbhs','rfedbcc','rfedblo','rfedbmi','rfedbpl','rfedbvs','rfedbvc','rfedbhi','rfedbls','rfedbge','rfedblt','rfedbgt','rfedble',
+ 'rfeiaeq','rfeiane','rfeiacs','rfeiahs','rfeiacc','rfeialo','rfeiami','rfeiapl','rfeiavs','rfeiavc','rfeiahi','rfeials','rfeiage','rfeialt','rfeiagt','rfeiale',
+ 'rfeibeq','rfeibne','rfeibcs','rfeibhs','rfeibcc','rfeiblo','rfeibmi','rfeibpl','rfeibvs','rfeibvc','rfeibhi','rfeibls','rfeibge','rfeiblt','rfeibgt','rfeible',
+ 'srsdaeq','srsdane','srsdacs','srsdahs','srsdacc','srsdalo','srsdami','srsdapl','srsdavs','srsdavc','srsdahi','srsdals','srsdage','srsdalt','srsdagt','srsdale',
+ 'srsdbeq','srsdbne','srsdbcs','srsdbhs','srsdbcc','srsdblo','srsdbmi','srsdbpl','srsdbvs','srsdbvc','srsdbhi','srsdbls','srsdbge','srsdblt','srsdbgt','srsdble',
+ 'srsiaeq','srsiane','srsiacs','srsiahs','srsiacc','srsialo','srsiami','srsiapl','srsiavs','srsiavc','srsiahi','srsials','srsiage','srsialt','srsiagt','srsiale',
+ 'srsibeq','srsibne','srsibcs','srsibhs','srsibcc','srsiblo','srsibmi','srsibpl','srsibvs','srsibvc','srsibhi','srsibls','srsibge','srsiblt','srsibgt','srsible'
+ ),
+ /* Unconditional WMMX/WMMX2 instructions */
+ 17 => array(
+ /* Unconditional WMMX/WMMX2 SIMD Instructions */
+ 'tandcb','tandcbal',
+ 'tandch','tandchal',
+ 'tandcw','tandcwal',
+ 'tbcstb','tbcstbal',
+ 'tbcsth','tbcsthal',
+ 'tbcstw','tbcstwal',
+ 'textrcb','textrcbal',
+ 'textrch','textrchal',
+ 'textrcw','textrcwal',
+ 'textrmsb','textrmsbal',
+ 'textrmsh','textrmshal',
+ 'textrmsw','textrmswal',
+ 'textrmub','textrmubal',
+ 'textrmuh','textrmuhal',
+ 'textrmuw','textrmuwal',
+ 'tinsrb','tinsrbal',
+ 'tinsrh','tinsrhal',
+ 'tinsrw','tinsrwal',
+ 'tmcr','tmcral',
+ 'tmcrr','tmcrral',
+ 'tmia','tmiaal',
+ 'tmiaph','tmiaphal',
+ 'tmiabb','tmiabbal',
+ 'tmiabt','tmiabtal',
+ 'tmiatb','tmiatbal',
+ 'tmiatt','tmiattal',
+ 'tmovmskb','tmovmskbal',
+ 'tmovmskh','tmovmskhal',
+ 'tmovmskw','tmovmskwal',
+ 'tmrc','tmrcal',
+ 'tmrrc','tmrrcal',
+ 'torcb','torcbal',
+ 'torch','torchal',
+ 'torcw','torcwal',
+ 'torvscb','torvscbal',
+ 'torvsch','torvschal',
+ 'torvscw','torvscwal',
+ 'wabsb','wabsbal',
+ 'wabsh','wabshal',
+ 'wabsw','wabswal',
+ 'wabsdiffb','wabsdiffbal',
+ 'wabsdiffh','wabsdiffhal',
+ 'wabsdiffw','wabsdiffwal',
+ 'waccb','waccbal',
+ 'wacch','wacchal',
+ 'waccw','waccwal',
+ 'waddb','waddbal',
+ 'waddh','waddhal',
+ 'waddw','waddwal',
+ 'waddbc','waddbcal',
+ 'waddhc','waddhcal',
+ 'waddwc','waddwcal',
+ 'waddbss','waddbssal',
+ 'waddhss','waddhssal',
+ 'waddwss','waddwssal',
+ 'waddbus','waddbusal',
+ 'waddhus','waddhusal',
+ 'waddwus','waddwusal',
+ 'waddsubhx','waddsubhxal',
+ 'waligni','walignial',
+ 'walignr0','walignr0al',
+ 'walignr1','walignr1al',
+ 'walignr2','walignr2al',
+ 'walignr3','walignr3al',
+ 'wand','wandal',
+ 'wandn','wandnal',
+ 'wavg2b','wavg2bal',
+ 'wavg2h','wavg2hal',
+ 'wavg2br','wavg2bral',
+ 'wavg2hr','wavg2hral',
+ 'wavg4','wavg4al',
+ 'wavg4r','wavg4ral',
+ 'wcmpeqb','wcmpeqbal',
+ 'wcmpeqh','wcmpeqhal',
+ 'wcmpeqw','wcmpeqwal',
+ 'wcmpgtsb','wcmpgtsbal',
+ 'wcmpgtsh','wcmpgtshal',
+ 'wcmpgtsw','wcmpgtswal',
+ 'wcmpgtub','wcmpgtubal',
+ 'wcmpgtuh','wcmpgtuhal',
+ 'wcmpgtuw','wcmpgtuwal',
+ 'wldrb','wldrbal',
+ 'wldrh','wldrhal',
+ 'wldrw','wldrwal',
+ 'wldrd','wldrdal',
+ 'wmacs','wmacsal',
+ 'wmacu','wmacual',
+ 'wmacsz','wmacszal',
+ 'wmacuz','wmacuzal',
+ 'wmadds','wmaddsal',
+ 'wmaddu','wmaddual',
+ 'wmaddsx','wmaddsxal',
+ 'wmaddux','wmadduxal',
+ 'wmaddsn','wmaddsnal',
+ 'wmaddun','wmaddunal',
+ 'wmaxsb','wmaxsbal',
+ 'wmaxsh','wmaxshal',
+ 'wmaxsw','wmaxswal',
+ 'wmaxub','wmaxubal',
+ 'wmaxuh','wmaxuhal',
+ 'wmaxuw','wmaxuwal',
+ 'wmerge','wmergeal',
+ 'wmiabb','wmiabbal',
+ 'wmiabt','wmiabtal',
+ 'wmiatb','wmiatbal',
+ 'wmiatt','wmiattal',
+ 'wmiabbn','wmiabbnal',
+ 'wmiabtn','wmiabtnal',
+ 'wmiatbn','wmiatbnal',
+ 'wmiattn','wmiattnal',
+ 'wmiawbb','wmiawbbal',
+ 'wmiawbt','wmiawbtal',
+ 'wmiawtb','wmiawtbal',
+ 'wmiawtt','wmiawttal',
+ 'wmiawbbn','wmiawbbnal',
+ 'wmiawbtn','wmiawbtnal',
+ 'wmiawtbn','wmiawtbnal',
+ 'wmiawttn','wmiawttnal',
+ 'wminsb','wminsbal',
+ 'wminsh','wminshal',
+ 'wminsw','wminswal',
+ 'wminub','wminubal',
+ 'wminuh','wminuhal',
+ 'wminuw','wminuwal',
+ 'wmov','wmoval',
+ 'wmulsm','wmulsmal',
+ 'wmulsl','wmulslal',
+ 'wmulum','wmulumal',
+ 'wmulul','wmululal',
+ 'wmulsmr','wmulsmral',
+ 'wmulslr','wmulslral',
+ 'wmulumr','wmulumral',
+ 'wmululr','wmululral',
+ 'wmulwum','wmulwumal',
+ 'wmulwsm','wmulwsmal',
+ 'wmulwl','wmulwlal',
+ 'wmulwumr','wmulwumral',
+ 'wmulwsmr','wmulwsmral',
+ 'wor','woral',
+ 'wpackhss','wpackhssal',
+ 'wpackwss','wpackwssal',
+ 'wpackdss','wpackdssal',
+ 'wpackhus','wpackhusal',
+ 'wpackwus','wpackwusal',
+ 'wpackdus','wpackdusal',
+ 'wqmiabb','wqmiabbal',
+ 'wqmiabt','wqmiabtal',
+ 'wqmiatb','wqmiatbal',
+ 'wqmiatt','wqmiattal',
+ 'wqmiabbn','wqmiabbnal',
+ 'wqmiabtn','wqmiabtnal',
+ 'wqmiatbn','wqmiatbnal',
+ 'wqmiattn','wqmiattnal',
+ 'wqmulm','wqmulmal',
+ 'wqmulmr','wqmulmral',
+ 'wqmulwm','wqmulwmal',
+ 'wqmulwmr','wqmulwmral',
+ 'wrorh','wrorhal',
+ 'wrorw','wrorwal',
+ 'wrord','wrordal',
+ 'wrorhg','wrorhgal',
+ 'wrorwg','wrorwgal',
+ 'wrordg','wrordgal',
+ 'wsadb','wsadbal',
+ 'wsadh','wsadhal',
+ 'wsadbz','wsadbzal',
+ 'wsadhz','wsadhzal',
+ 'wshufh','wshufhal',
+ 'wsllh','wsllhal',
+ 'wsllw','wsllwal',
+ 'wslld','wslldal',
+ 'wsllhg','wsllhgal',
+ 'wsllwg','wsllwgal',
+ 'wslldg','wslldgal',
+ 'wsrah','wsrahal',
+ 'wsraw','wsrawal',
+ 'wsrad','wsradal',
+ 'wsrahg','wsrahgal',
+ 'wsrawg','wsrawgal',
+ 'wsradg','wsradgal',
+ 'wsrlh','wsrlhal',
+ 'wsrlw','wsrlwal',
+ 'wsrld','wsrldal',
+ 'wsrlhg','wsrlhgal',
+ 'wsrlwg','wsrlwgal',
+ 'wsrldg','wsrldgal',
+ 'wstrb','wstrbal',
+ 'wstrh','wstrhal',
+ 'wstrw','wstrwal',
+ 'wstrd','wstrdal',
+ 'wsubb','wsubbal',
+ 'wsubh','wsubhal',
+ 'wsubw','wsubwal',
+ 'wsubbss','wsubbssal',
+ 'wsubhss','wsubhssal',
+ 'wsubwss','wsubwssal',
+ 'wsubbus','wsubbusal',
+ 'wsubhus','wsubhusal',
+ 'wsubwus','wsubwusal',
+ 'wsubaddhx','wsubaddhxal',
+ 'wunpckehsb','wunpckehsbal',
+ 'wunpckehsh','wunpckehshal',
+ 'wunpckehsw','wunpckehswal',
+ 'wunpckehub','wunpckehubal',
+ 'wunpckehuh','wunpckehuhal',
+ 'wunpckehuw','wunpckehuwal',
+ 'wunpckihb','wunpckihbal',
+ 'wunpckihh','wunpckihhal',
+ 'wunpckihw','wunpckihwal',
+ 'wunpckelsb','wunpckelsbal',
+ 'wunpckelsh','wunpckelshal',
+ 'wunpckelsw','wunpckelswal',
+ 'wunpckelub','wunpckelubal',
+ 'wunpckeluh','wunpckeluhal',
+ 'wunpckeluw','wunpckeluwal',
+ 'wunpckilb','wunpckilbal',
+ 'wunpckilh','wunpckilhal',
+ 'wunpckilw','wunpckilwal',
+ 'wxor','wxoral',
+ 'wzero','wzeroal'
+ ),
+ /* Conditional WMMX/WMMX2 SIMD Instructions */
+ 18 => array(
+ /* Conditional WMMX/WMMX2 SIMD Instructions */
+ 'tandcbeq','tandcbne','tandcbcs','tandcbhs','tandcbcc','tandcblo','tandcbmi','tandcbpl','tandcbvs','tandcbvc','tandcbhi','tandcbls','tandcbge','tandcblt','tandcbgt','tandcble',
+ 'tandcheq','tandchne','tandchcs','tandchhs','tandchcc','tandchlo','tandchmi','tandchpl','tandchvs','tandchvc','tandchhi','tandchls','tandchge','tandchlt','tandchgt','tandchle',
+ 'tandcweq','tandcwne','tandcwcs','tandcwhs','tandcwcc','tandcwlo','tandcwmi','tandcwpl','tandcwvs','tandcwvc','tandcwhi','tandcwls','tandcwge','tandcwlt','tandcwgt','tandcwle',
+ 'tbcstbeq','tbcstbne','tbcstbcs','tbcstbhs','tbcstbcc','tbcstblo','tbcstbmi','tbcstbpl','tbcstbvs','tbcstbvc','tbcstbhi','tbcstbls','tbcstbge','tbcstblt','tbcstbgt','tbcstble',
+ 'tbcstheq','tbcsthne','tbcsthcs','tbcsthhs','tbcsthcc','tbcsthlo','tbcsthmi','tbcsthpl','tbcsthvs','tbcsthvc','tbcsthhi','tbcsthls','tbcsthge','tbcsthlt','tbcsthgt','tbcsthle',
+ 'tbcstweq','tbcstwne','tbcstwcs','tbcstwhs','tbcstwcc','tbcstwlo','tbcstwmi','tbcstwpl','tbcstwvs','tbcstwvc','tbcstwhi','tbcstwls','tbcstwge','tbcstwlt','tbcstwgt','tbcstwle',
+ 'textrcbeq','textrcbne','textrcbcs','textrcbhs','textrcbcc','textrcblo','textrcbmi','textrcbpl','textrcbvs','textrcbvc','textrcbhi','textrcbls','textrcbge','textrcblt','textrcbgt','textrcble',
+ 'textrcheq','textrchne','textrchcs','textrchhs','textrchcc','textrchlo','textrchmi','textrchpl','textrchvs','textrchvc','textrchhi','textrchls','textrchge','textrchlt','textrchgt','textrchle',
+ 'textrcweq','textrcwne','textrcwcs','textrcwhs','textrcwcc','textrcwlo','textrcwmi','textrcwpl','textrcwvs','textrcwvc','textrcwhi','textrcwls','textrcwge','textrcwlt','textrcwgt','textrcwle',
+ 'textrmsbeq','textrmsbne','textrmsbcs','textrmsbhs','textrmsbcc','textrmsblo','textrmsbmi','textrmsbpl','textrmsbvs','textrmsbvc','textrmsbhi','textrmsbls','textrmsbge','textrmsblt','textrmsbgt','textrmsble',
+ 'textrmsheq','textrmshne','textrmshcs','textrmshhs','textrmshcc','textrmshlo','textrmshmi','textrmshpl','textrmshvs','textrmshvc','textrmshhi','textrmshls','textrmshge','textrmshlt','textrmshgt','textrmshle',
+ 'textrmsweq','textrmswne','textrmswcs','textrmswhs','textrmswcc','textrmswlo','textrmswmi','textrmswpl','textrmswvs','textrmswvc','textrmswhi','textrmswls','textrmswge','textrmswlt','textrmswgt','textrmswle',
+ 'textrmubeq','textrmubne','textrmubcs','textrmubhs','textrmubcc','textrmublo','textrmubmi','textrmubpl','textrmubvs','textrmubvc','textrmubhi','textrmubls','textrmubge','textrmublt','textrmubgt','textrmuble',
+ 'textrmuheq','textrmuhne','textrmuhcs','textrmuhhs','textrmuhcc','textrmuhlo','textrmuhmi','textrmuhpl','textrmuhvs','textrmuhvc','textrmuhhi','textrmuhls','textrmuhge','textrmuhlt','textrmuhgt','textrmuhle',
+ 'textrmuweq','textrmuwne','textrmuwcs','textrmuwhs','textrmuwcc','textrmuwlo','textrmuwmi','textrmuwpl','textrmuwvs','textrmuwvc','textrmuwhi','textrmuwls','textrmuwge','textrmuwlt','textrmuwgt','textrmuwle',
+ 'tinsrbeq','tinsrbne','tinsrbcs','tinsrbhs','tinsrbcc','tinsrblo','tinsrbmi','tinsrbpl','tinsrbvs','tinsrbvc','tinsrbhi','tinsrbls','tinsrbge','tinsrblt','tinsrbgt','tinsrble',
+ 'tinsrheq','tinsrhne','tinsrhcs','tinsrhhs','tinsrhcc','tinsrhlo','tinsrhmi','tinsrhpl','tinsrhvs','tinsrhvc','tinsrhhi','tinsrhls','tinsrhge','tinsrhlt','tinsrhgt','tinsrhle',
+ 'tinsrweq','tinsrwne','tinsrwcs','tinsrwhs','tinsrwcc','tinsrwlo','tinsrwmi','tinsrwpl','tinsrwvs','tinsrwvc','tinsrwhi','tinsrwls','tinsrwge','tinsrwlt','tinsrwgt','tinsrwle',
+ 'tmcreq','tmcrne','tmcrcs','tmcrhs','tmcrcc','tmcrlo','tmcrmi','tmcrpl','tmcrvs','tmcrvc','tmcrhi','tmcrls','tmcrge','tmcrlt','tmcrgt','tmcrle',
+ 'tmcrreq','tmcrrne','tmcrrcs','tmcrrhs','tmcrrcc','tmcrrlo','tmcrrmi','tmcrrpl','tmcrrvs','tmcrrvc','tmcrrhi','tmcrrls','tmcrrge','tmcrrlt','tmcrrgt','tmcrrle',
+ 'tmiaeq','tmiane','tmiacs','tmiahs','tmiacc','tmialo','tmiami','tmiapl','tmiavs','tmiavc','tmiahi','tmials','tmiage','tmialt','tmiagt','tmiale',
+ 'tmiapheq','tmiaphne','tmiaphcs','tmiaphhs','tmiaphcc','tmiaphlo','tmiaphmi','tmiaphpl','tmiaphvs','tmiaphvc','tmiaphhi','tmiaphls','tmiaphge','tmiaphlt','tmiaphgt','tmiaphle',
+ 'tmiabbeq','tmiabbne','tmiabbcs','tmiabbhs','tmiabbcc','tmiabblo','tmiabbmi','tmiabbpl','tmiabbvs','tmiabbvc','tmiabbhi','tmiabbls','tmiabbge','tmiabblt','tmiabbgt','tmiabble',
+ 'tmiabteq','tmiabtne','tmiabtcs','tmiabths','tmiabtcc','tmiabtlo','tmiabtmi','tmiabtpl','tmiabtvs','tmiabtvc','tmiabthi','tmiabtls','tmiabtge','tmiabtlt','tmiabtgt','tmiabtle',
+ 'tmiatbeq','tmiatbne','tmiatbcs','tmiatbhs','tmiatbcc','tmiatblo','tmiatbmi','tmiatbpl','tmiatbvs','tmiatbvc','tmiatbhi','tmiatbls','tmiatbge','tmiatblt','tmiatbgt','tmiatble',
+ 'tmiatteq','tmiattne','tmiattcs','tmiatths','tmiattcc','tmiattlo','tmiattmi','tmiattpl','tmiattvs','tmiattvc','tmiatthi','tmiattls','tmiattge','tmiattlt','tmiattgt','tmiattle',
+ 'tmovmskbeq','tmovmskbne','tmovmskbcs','tmovmskbhs','tmovmskbcc','tmovmskblo','tmovmskbmi','tmovmskbpl','tmovmskbvs','tmovmskbvc','tmovmskbhi','tmovmskbls','tmovmskbge','tmovmskblt','tmovmskbgt','tmovmskble',
+ 'tmovmskheq','tmovmskhne','tmovmskhcs','tmovmskhhs','tmovmskhcc','tmovmskhlo','tmovmskhmi','tmovmskhpl','tmovmskhvs','tmovmskhvc','tmovmskhhi','tmovmskhls','tmovmskhge','tmovmskhlt','tmovmskhgt','tmovmskhle',
+ 'tmovmskweq','tmovmskwne','tmovmskwcs','tmovmskwhs','tmovmskwcc','tmovmskwlo','tmovmskwmi','tmovmskwpl','tmovmskwvs','tmovmskwvc','tmovmskwhi','tmovmskwls','tmovmskwge','tmovmskwlt','tmovmskwgt','tmovmskwle',
+ 'tmrceq','tmrcne','tmrccs','tmrchs','tmrccc','tmrclo','tmrcmi','tmrcpl','tmrcvs','tmrcvc','tmrchi','tmrcls','tmrcge','tmrclt','tmrcgt','tmrcle',
+ 'tmrrceq','tmrrcne','tmrrccs','tmrrchs','tmrrccc','tmrrclo','tmrrcmi','tmrrcpl','tmrrcvs','tmrrcvc','tmrrchi','tmrrcls','tmrrcge','tmrrclt','tmrrcgt','tmrrcle',
+ 'torcbeq','torcbne','torcbcs','torcbhs','torcbcc','torcblo','torcbmi','torcbpl','torcbvs','torcbvc','torcbhi','torcbls','torcbge','torcblt','torcbgt','torcble',
+ 'torcheq','torchne','torchcs','torchhs','torchcc','torchlo','torchmi','torchpl','torchvs','torchvc','torchhi','torchls','torchge','torchlt','torchgt','torchle',
+ 'torcweq','torcwne','torcwcs','torcwhs','torcwcc','torcwlo','torcwmi','torcwpl','torcwvs','torcwvc','torcwhi','torcwls','torcwge','torcwlt','torcwgt','torcwle',
+ 'torvscbeq','torvscbne','torvscbcs','torvscbhs','torvscbcc','torvscblo','torvscbmi','torvscbpl','torvscbvs','torvscbvc','torvscbhi','torvscbls','torvscbge','torvscblt','torvscbgt','torvscble',
+ 'torvscheq','torvschne','torvschcs','torvschhs','torvschcc','torvschlo','torvschmi','torvschpl','torvschvs','torvschvc','torvschhi','torvschls','torvschge','torvschlt','torvschgt','torvschle',
+ 'torvscweq','torvscwne','torvscwcs','torvscwhs','torvscwcc','torvscwlo','torvscwmi','torvscwpl','torvscwvs','torvscwvc','torvscwhi','torvscwls','torvscwge','torvscwlt','torvscwgt','torvscwle',
+ 'wabsbeq','wabsbne','wabsbcs','wabsbhs','wabsbcc','wabsblo','wabsbmi','wabsbpl','wabsbvs','wabsbvc','wabsbhi','wabsbls','wabsbge','wabsblt','wabsbgt','wabsble',
+ 'wabsheq','wabshne','wabshcs','wabshhs','wabshcc','wabshlo','wabshmi','wabshpl','wabshvs','wabshvc','wabshhi','wabshls','wabshge','wabshlt','wabshgt','wabshle',
+ 'wabsweq','wabswne','wabswcs','wabswhs','wabswcc','wabswlo','wabswmi','wabswpl','wabswvs','wabswvc','wabswhi','wabswls','wabswge','wabswlt','wabswgt','wabswle',
+ 'wabsdiffbeq','wabsdiffbne','wabsdiffbcs','wabsdiffbhs','wabsdiffbcc','wabsdiffblo','wabsdiffbmi','wabsdiffbpl','wabsdiffbvs','wabsdiffbvc','wabsdiffbhi','wabsdiffbls','wabsdiffbge','wabsdiffblt','wabsdiffbgt','wabsdiffble',
+ 'wabsdiffheq','wabsdiffhne','wabsdiffhcs','wabsdiffhhs','wabsdiffhcc','wabsdiffhlo','wabsdiffhmi','wabsdiffhpl','wabsdiffhvs','wabsdiffhvc','wabsdiffhhi','wabsdiffhls','wabsdiffhge','wabsdiffhlt','wabsdiffhgt','wabsdiffhle',
+ 'wabsdiffweq','wabsdiffwne','wabsdiffwcs','wabsdiffwhs','wabsdiffwcc','wabsdiffwlo','wabsdiffwmi','wabsdiffwpl','wabsdiffwvs','wabsdiffwvc','wabsdiffwhi','wabsdiffwls','wabsdiffwge','wabsdiffwlt','wabsdiffwgt','wabsdiffwle',
+ 'waccbeq','waccbne','waccbcs','waccbhs','waccbcc','waccblo','waccbmi','waccbpl','waccbvs','waccbvc','waccbhi','waccbls','waccbge','waccblt','waccbgt','waccble',
+ 'waccheq','wacchne','wacchcs','wacchhs','wacchcc','wacchlo','wacchmi','wacchpl','wacchvs','wacchvc','wacchhi','wacchls','wacchge','wacchlt','wacchgt','wacchle',
+ 'waccweq','waccwne','waccwcs','waccwhs','waccwcc','waccwlo','waccwmi','waccwpl','waccwvs','waccwvc','waccwhi','waccwls','waccwge','waccwlt','waccwgt','waccwle',
+ 'waddbeq','waddbne','waddbcs','waddbhs','waddbcc','waddblo','waddbmi','waddbpl','waddbvs','waddbvc','waddbhi','waddbls','waddbge','waddblt','waddbgt','waddble',
+ 'waddheq','waddhne','waddhcs','waddhhs','waddhcc','waddhlo','waddhmi','waddhpl','waddhvs','waddhvc','waddhhi','waddhls','waddhge','waddhlt','waddhgt','waddhle',
+ 'waddweq','waddwne','waddwcs','waddwhs','waddwcc','waddwlo','waddwmi','waddwpl','waddwvs','waddwvc','waddwhi','waddwls','waddwge','waddwlt','waddwgt','waddwle',
+ 'waddbceq','waddbcne','waddbccs','waddbchs','waddbccc','waddbclo','waddbcmi','waddbcpl','waddbcvs','waddbcvc','waddbchi','waddbcls','waddbcge','waddbclt','waddbcgt','waddbcle',
+ 'waddhceq','waddhcne','waddhccs','waddhchs','waddhccc','waddhclo','waddhcmi','waddhcpl','waddhcvs','waddhcvc','waddhchi','waddhcls','waddhcge','waddhclt','waddhcgt','waddhcle',
+ 'waddwceq','waddwcne','waddwccs','waddwchs','waddwccc','waddwclo','waddwcmi','waddwcpl','waddwcvs','waddwcvc','waddwchi','waddwcls','waddwcge','waddwclt','waddwcgt','waddwcle',
+ 'waddbsseq','waddbssne','waddbsscs','waddbsshs','waddbsscc','waddbsslo','waddbssmi','waddbsspl','waddbssvs','waddbssvc','waddbsshi','waddbssls','waddbssge','waddbsslt','waddbssgt','waddbssle',
+ 'waddhsseq','waddhssne','waddhsscs','waddhsshs','waddhsscc','waddhsslo','waddhssmi','waddhsspl','waddhssvs','waddhssvc','waddhsshi','waddhssls','waddhssge','waddhsslt','waddhssgt','waddhssle',
+ 'waddwsseq','waddwssne','waddwsscs','waddwsshs','waddwsscc','waddwsslo','waddwssmi','waddwsspl','waddwssvs','waddwssvc','waddwsshi','waddwssls','waddwssge','waddwsslt','waddwssgt','waddwssle',
+ 'waddbuseq','waddbusne','waddbuscs','waddbushs','waddbuscc','waddbuslo','waddbusmi','waddbuspl','waddbusvs','waddbusvc','waddbushi','waddbusls','waddbusge','waddbuslt','waddbusgt','waddbusle',
+ 'waddhuseq','waddhusne','waddhuscs','waddhushs','waddhuscc','waddhuslo','waddhusmi','waddhuspl','waddhusvs','waddhusvc','waddhushi','waddhusls','waddhusge','waddhuslt','waddhusgt','waddhusle',
+ 'waddwuseq','waddwusne','waddwuscs','waddwushs','waddwuscc','waddwuslo','waddwusmi','waddwuspl','waddwusvs','waddwusvc','waddwushi','waddwusls','waddwusge','waddwuslt','waddwusgt','waddwusle',
+ 'waddsubhxeq','waddsubhxne','waddsubhxcs','waddsubhxhs','waddsubhxcc','waddsubhxlo','waddsubhxmi','waddsubhxpl','waddsubhxvs','waddsubhxvc','waddsubhxhi','waddsubhxls','waddsubhxge','waddsubhxlt','waddsubhxgt','waddsubhxle',
+ 'walignieq','walignine','walignics','walignihs','walignicc','walignilo','walignimi','walignipl','walignivs','walignivc','walignihi','walignils','walignige','walignilt','walignigt','walignile',
+ 'walignr0eq','walignr0ne','walignr0cs','walignr0hs','walignr0cc','walignr0lo','walignr0mi','walignr0pl','walignr0vs','walignr0vc','walignr0hi','walignr0ls','walignr0ge','walignr0lt','walignr0gt','walignr0le',
+ 'walignr1eq','walignr1ne','walignr1cs','walignr1hs','walignr1cc','walignr1lo','walignr1mi','walignr1pl','walignr1vs','walignr1vc','walignr1hi','walignr1ls','walignr1ge','walignr1lt','walignr1gt','walignr1le',
+ 'walignr2eq','walignr2ne','walignr2cs','walignr2hs','walignr2cc','walignr2lo','walignr2mi','walignr2pl','walignr2vs','walignr2vc','walignr2hi','walignr2ls','walignr2ge','walignr2lt','walignr2gt','walignr2le',
+ 'walignr3eq','walignr3ne','walignr3cs','walignr3hs','walignr3cc','walignr3lo','walignr3mi','walignr3pl','walignr3vs','walignr3vc','walignr3hi','walignr3ls','walignr3ge','walignr3lt','walignr3gt','walignr3le',
+ 'wandeq','wandne','wandcs','wandhs','wandcc','wandlo','wandmi','wandpl','wandvs','wandvc','wandhi','wandls','wandge','wandlt','wandgt','wandle',
+ 'wandneq','wandnne','wandncs','wandnhs','wandncc','wandnlo','wandnmi','wandnpl','wandnvs','wandnvc','wandnhi','wandnls','wandnge','wandnlt','wandngt','wandnle',
+ 'wavg2beq','wavg2bne','wavg2bcs','wavg2bhs','wavg2bcc','wavg2blo','wavg2bmi','wavg2bpl','wavg2bvs','wavg2bvc','wavg2bhi','wavg2bls','wavg2bge','wavg2blt','wavg2bgt','wavg2ble',
+ 'wavg2heq','wavg2hne','wavg2hcs','wavg2hhs','wavg2hcc','wavg2hlo','wavg2hmi','wavg2hpl','wavg2hvs','wavg2hvc','wavg2hhi','wavg2hls','wavg2hge','wavg2hlt','wavg2hgt','wavg2hle',
+ 'wavg2breq','wavg2brne','wavg2brcs','wavg2brhs','wavg2brcc','wavg2brlo','wavg2brmi','wavg2brpl','wavg2brvs','wavg2brvc','wavg2brhi','wavg2brls','wavg2brge','wavg2brlt','wavg2brgt','wavg2brle',
+ 'wavg2hreq','wavg2hrne','wavg2hrcs','wavg2hrhs','wavg2hrcc','wavg2hrlo','wavg2hrmi','wavg2hrpl','wavg2hrvs','wavg2hrvc','wavg2hrhi','wavg2hrls','wavg2hrge','wavg2hrlt','wavg2hrgt','wavg2hrle',
+ 'wavg4eq','wavg4ne','wavg4cs','wavg4hs','wavg4cc','wavg4lo','wavg4mi','wavg4pl','wavg4vs','wavg4vc','wavg4hi','wavg4ls','wavg4ge','wavg4lt','wavg4gt','wavg4le',
+ 'wavg4req','wavg4rne','wavg4rcs','wavg4rhs','wavg4rcc','wavg4rlo','wavg4rmi','wavg4rpl','wavg4rvs','wavg4rvc','wavg4rhi','wavg4rls','wavg4rge','wavg4rlt','wavg4rgt','wavg4rle',
+ 'wcmpeqbeq','wcmpeqbne','wcmpeqbcs','wcmpeqbhs','wcmpeqbcc','wcmpeqblo','wcmpeqbmi','wcmpeqbpl','wcmpeqbvs','wcmpeqbvc','wcmpeqbhi','wcmpeqbls','wcmpeqbge','wcmpeqblt','wcmpeqbgt','wcmpeqble',
+ 'wcmpeqheq','wcmpeqhne','wcmpeqhcs','wcmpeqhhs','wcmpeqhcc','wcmpeqhlo','wcmpeqhmi','wcmpeqhpl','wcmpeqhvs','wcmpeqhvc','wcmpeqhhi','wcmpeqhls','wcmpeqhge','wcmpeqhlt','wcmpeqhgt','wcmpeqhle',
+ 'wcmpeqweq','wcmpeqwne','wcmpeqwcs','wcmpeqwhs','wcmpeqwcc','wcmpeqwlo','wcmpeqwmi','wcmpeqwpl','wcmpeqwvs','wcmpeqwvc','wcmpeqwhi','wcmpeqwls','wcmpeqwge','wcmpeqwlt','wcmpeqwgt','wcmpeqwle',
+ 'wcmpgtsbeq','wcmpgtsbne','wcmpgtsbcs','wcmpgtsbhs','wcmpgtsbcc','wcmpgtsblo','wcmpgtsbmi','wcmpgtsbpl','wcmpgtsbvs','wcmpgtsbvc','wcmpgtsbhi','wcmpgtsbls','wcmpgtsbge','wcmpgtsblt','wcmpgtsbgt','wcmpgtsble',
+ 'wcmpgtsheq','wcmpgtshne','wcmpgtshcs','wcmpgtshhs','wcmpgtshcc','wcmpgtshlo','wcmpgtshmi','wcmpgtshpl','wcmpgtshvs','wcmpgtshvc','wcmpgtshhi','wcmpgtshls','wcmpgtshge','wcmpgtshlt','wcmpgtshgt','wcmpgtshle',
+ 'wcmpgtsweq','wcmpgtswne','wcmpgtswcs','wcmpgtswhs','wcmpgtswcc','wcmpgtswlo','wcmpgtswmi','wcmpgtswpl','wcmpgtswvs','wcmpgtswvc','wcmpgtswhi','wcmpgtswls','wcmpgtswge','wcmpgtswlt','wcmpgtswgt','wcmpgtswle',
+ 'wcmpgtubeq','wcmpgtubne','wcmpgtubcs','wcmpgtubhs','wcmpgtubcc','wcmpgtublo','wcmpgtubmi','wcmpgtubpl','wcmpgtubvs','wcmpgtubvc','wcmpgtubhi','wcmpgtubls','wcmpgtubge','wcmpgtublt','wcmpgtubgt','wcmpgtuble',
+ 'wcmpgtuheq','wcmpgtuhne','wcmpgtuhcs','wcmpgtuhhs','wcmpgtuhcc','wcmpgtuhlo','wcmpgtuhmi','wcmpgtuhpl','wcmpgtuhvs','wcmpgtuhvc','wcmpgtuhhi','wcmpgtuhls','wcmpgtuhge','wcmpgtuhlt','wcmpgtuhgt','wcmpgtuhle',
+ 'wcmpgtuweq','wcmpgtuwne','wcmpgtuwcs','wcmpgtuwhs','wcmpgtuwcc','wcmpgtuwlo','wcmpgtuwmi','wcmpgtuwpl','wcmpgtuwvs','wcmpgtuwvc','wcmpgtuwhi','wcmpgtuwls','wcmpgtuwge','wcmpgtuwlt','wcmpgtuwgt','wcmpgtuwle',
+ 'wldrbeq','wldrbne','wldrbcs','wldrbhs','wldrbcc','wldrblo','wldrbmi','wldrbpl','wldrbvs','wldrbvc','wldrbhi','wldrbls','wldrbge','wldrblt','wldrbgt','wldrble',
+ 'wldrheq','wldrhne','wldrhcs','wldrhhs','wldrhcc','wldrhlo','wldrhmi','wldrhpl','wldrhvs','wldrhvc','wldrhhi','wldrhls','wldrhge','wldrhlt','wldrhgt','wldrhle',
+ 'wldrweq','wldrwne','wldrwcs','wldrwhs','wldrwcc','wldrwlo','wldrwmi','wldrwpl','wldrwvs','wldrwvc','wldrwhi','wldrwls','wldrwge','wldrwlt','wldrwgt','wldrwle',
+ 'wldrdeq','wldrdne','wldrdcs','wldrdhs','wldrdcc','wldrdlo','wldrdmi','wldrdpl','wldrdvs','wldrdvc','wldrdhi','wldrdls','wldrdge','wldrdlt','wldrdgt','wldrdle',
+ 'wmacseq','wmacsne','wmacscs','wmacshs','wmacscc','wmacslo','wmacsmi','wmacspl','wmacsvs','wmacsvc','wmacshi','wmacsls','wmacsge','wmacslt','wmacsgt','wmacsle',
+ 'wmacueq','wmacune','wmacucs','wmacuhs','wmacucc','wmaculo','wmacumi','wmacupl','wmacuvs','wmacuvc','wmacuhi','wmaculs','wmacuge','wmacult','wmacugt','wmacule',
+ 'wmacszeq','wmacszne','wmacszcs','wmacszhs','wmacszcc','wmacszlo','wmacszmi','wmacszpl','wmacszvs','wmacszvc','wmacszhi','wmacszls','wmacszge','wmacszlt','wmacszgt','wmacszle',
+ 'wmacuzeq','wmacuzne','wmacuzcs','wmacuzhs','wmacuzcc','wmacuzlo','wmacuzmi','wmacuzpl','wmacuzvs','wmacuzvc','wmacuzhi','wmacuzls','wmacuzge','wmacuzlt','wmacuzgt','wmacuzle',
+ 'wmaddseq','wmaddsne','wmaddscs','wmaddshs','wmaddscc','wmaddslo','wmaddsmi','wmaddspl','wmaddsvs','wmaddsvc','wmaddshi','wmaddsls','wmaddsge','wmaddslt','wmaddsgt','wmaddsle',
+ 'wmaddueq','wmaddune','wmadducs','wmadduhs','wmadducc','wmaddulo','wmaddumi','wmaddupl','wmadduvs','wmadduvc','wmadduhi','wmadduls','wmadduge','wmaddult','wmaddugt','wmaddule',
+ 'wmaddsxeq','wmaddsxne','wmaddsxcs','wmaddsxhs','wmaddsxcc','wmaddsxlo','wmaddsxmi','wmaddsxpl','wmaddsxvs','wmaddsxvc','wmaddsxhi','wmaddsxls','wmaddsxge','wmaddsxlt','wmaddsxgt','wmaddsxle',
+ 'wmadduxeq','wmadduxne','wmadduxcs','wmadduxhs','wmadduxcc','wmadduxlo','wmadduxmi','wmadduxpl','wmadduxvs','wmadduxvc','wmadduxhi','wmadduxls','wmadduxge','wmadduxlt','wmadduxgt','wmadduxle',
+ 'wmaddsneq','wmaddsnne','wmaddsncs','wmaddsnhs','wmaddsncc','wmaddsnlo','wmaddsnmi','wmaddsnpl','wmaddsnvs','wmaddsnvc','wmaddsnhi','wmaddsnls','wmaddsnge','wmaddsnlt','wmaddsngt','wmaddsnle',
+ 'wmadduneq','wmaddunne','wmadduncs','wmaddunhs','wmadduncc','wmaddunlo','wmaddunmi','wmaddunpl','wmaddunvs','wmaddunvc','wmaddunhi','wmaddunls','wmaddunge','wmaddunlt','wmaddungt','wmaddunle',
+ 'wmaxsbeq','wmaxsbne','wmaxsbcs','wmaxsbhs','wmaxsbcc','wmaxsblo','wmaxsbmi','wmaxsbpl','wmaxsbvs','wmaxsbvc','wmaxsbhi','wmaxsbls','wmaxsbge','wmaxsblt','wmaxsbgt','wmaxsble',
+ 'wmaxsheq','wmaxshne','wmaxshcs','wmaxshhs','wmaxshcc','wmaxshlo','wmaxshmi','wmaxshpl','wmaxshvs','wmaxshvc','wmaxshhi','wmaxshls','wmaxshge','wmaxshlt','wmaxshgt','wmaxshle',
+ 'wmaxsweq','wmaxswne','wmaxswcs','wmaxswhs','wmaxswcc','wmaxswlo','wmaxswmi','wmaxswpl','wmaxswvs','wmaxswvc','wmaxswhi','wmaxswls','wmaxswge','wmaxswlt','wmaxswgt','wmaxswle',
+ 'wmaxubeq','wmaxubne','wmaxubcs','wmaxubhs','wmaxubcc','wmaxublo','wmaxubmi','wmaxubpl','wmaxubvs','wmaxubvc','wmaxubhi','wmaxubls','wmaxubge','wmaxublt','wmaxubgt','wmaxuble',
+ 'wmaxuheq','wmaxuhne','wmaxuhcs','wmaxuhhs','wmaxuhcc','wmaxuhlo','wmaxuhmi','wmaxuhpl','wmaxuhvs','wmaxuhvc','wmaxuhhi','wmaxuhls','wmaxuhge','wmaxuhlt','wmaxuhgt','wmaxuhle',
+ 'wmaxuweq','wmaxuwne','wmaxuwcs','wmaxuwhs','wmaxuwcc','wmaxuwlo','wmaxuwmi','wmaxuwpl','wmaxuwvs','wmaxuwvc','wmaxuwhi','wmaxuwls','wmaxuwge','wmaxuwlt','wmaxuwgt','wmaxuwle',
+ 'wmergeeq','wmergene','wmergecs','wmergehs','wmergecc','wmergelo','wmergemi','wmergepl','wmergevs','wmergevc','wmergehi','wmergels','wmergege','wmergelt','wmergegt','wmergele',
+ 'wmiabbeq','wmiabbne','wmiabbcs','wmiabbhs','wmiabbcc','wmiabblo','wmiabbmi','wmiabbpl','wmiabbvs','wmiabbvc','wmiabbhi','wmiabbls','wmiabbge','wmiabblt','wmiabbgt','wmiabble',
+ 'wmiabteq','wmiabtne','wmiabtcs','wmiabths','wmiabtcc','wmiabtlo','wmiabtmi','wmiabtpl','wmiabtvs','wmiabtvc','wmiabthi','wmiabtls','wmiabtge','wmiabtlt','wmiabtgt','wmiabtle',
+ 'wmiatbeq','wmiatbne','wmiatbcs','wmiatbhs','wmiatbcc','wmiatblo','wmiatbmi','wmiatbpl','wmiatbvs','wmiatbvc','wmiatbhi','wmiatbls','wmiatbge','wmiatblt','wmiatbgt','wmiatble',
+ 'wmiatteq','wmiattne','wmiattcs','wmiatths','wmiattcc','wmiattlo','wmiattmi','wmiattpl','wmiattvs','wmiattvc','wmiatthi','wmiattls','wmiattge','wmiattlt','wmiattgt','wmiattle',
+ 'wmiabbneq','wmiabbnne','wmiabbncs','wmiabbnhs','wmiabbncc','wmiabbnlo','wmiabbnmi','wmiabbnpl','wmiabbnvs','wmiabbnvc','wmiabbnhi','wmiabbnls','wmiabbnge','wmiabbnlt','wmiabbngt','wmiabbnle',
+ 'wmiabtneq','wmiabtnne','wmiabtncs','wmiabtnhs','wmiabtncc','wmiabtnlo','wmiabtnmi','wmiabtnpl','wmiabtnvs','wmiabtnvc','wmiabtnhi','wmiabtnls','wmiabtnge','wmiabtnlt','wmiabtngt','wmiabtnle',
+ 'wmiatbneq','wmiatbnne','wmiatbncs','wmiatbnhs','wmiatbncc','wmiatbnlo','wmiatbnmi','wmiatbnpl','wmiatbnvs','wmiatbnvc','wmiatbnhi','wmiatbnls','wmiatbnge','wmiatbnlt','wmiatbngt','wmiatbnle',
+ 'wmiattneq','wmiattnne','wmiattncs','wmiattnhs','wmiattncc','wmiattnlo','wmiattnmi','wmiattnpl','wmiattnvs','wmiattnvc','wmiattnhi','wmiattnls','wmiattnge','wmiattnlt','wmiattngt','wmiattnle',
+ 'wmiawbbeq','wmiawbbne','wmiawbbcs','wmiawbbhs','wmiawbbcc','wmiawbblo','wmiawbbmi','wmiawbbpl','wmiawbbvs','wmiawbbvc','wmiawbbhi','wmiawbbls','wmiawbbge','wmiawbblt','wmiawbbgt','wmiawbble',
+ 'wmiawbteq','wmiawbtne','wmiawbtcs','wmiawbths','wmiawbtcc','wmiawbtlo','wmiawbtmi','wmiawbtpl','wmiawbtvs','wmiawbtvc','wmiawbthi','wmiawbtls','wmiawbtge','wmiawbtlt','wmiawbtgt','wmiawbtle',
+ 'wmiawtbeq','wmiawtbne','wmiawtbcs','wmiawtbhs','wmiawtbcc','wmiawtblo','wmiawtbmi','wmiawtbpl','wmiawtbvs','wmiawtbvc','wmiawtbhi','wmiawtbls','wmiawtbge','wmiawtblt','wmiawtbgt','wmiawtble',
+ 'wmiawtteq','wmiawttne','wmiawttcs','wmiawtths','wmiawttcc','wmiawttlo','wmiawttmi','wmiawttpl','wmiawttvs','wmiawttvc','wmiawtthi','wmiawttls','wmiawttge','wmiawttlt','wmiawttgt','wmiawttle',
+ 'wmiawbbneq','wmiawbbnne','wmiawbbncs','wmiawbbnhs','wmiawbbncc','wmiawbbnlo','wmiawbbnmi','wmiawbbnpl','wmiawbbnvs','wmiawbbnvc','wmiawbbnhi','wmiawbbnls','wmiawbbnge','wmiawbbnlt','wmiawbbngt','wmiawbbnle',
+ 'wmiawbtneq','wmiawbtnne','wmiawbtncs','wmiawbtnhs','wmiawbtncc','wmiawbtnlo','wmiawbtnmi','wmiawbtnpl','wmiawbtnvs','wmiawbtnvc','wmiawbtnhi','wmiawbtnls','wmiawbtnge','wmiawbtnlt','wmiawbtngt','wmiawbtnle',
+ 'wmiawtbneq','wmiawtbnne','wmiawtbncs','wmiawtbnhs','wmiawtbncc','wmiawtbnlo','wmiawtbnmi','wmiawtbnpl','wmiawtbnvs','wmiawtbnvc','wmiawtbnhi','wmiawtbnls','wmiawtbnge','wmiawtbnlt','wmiawtbngt','wmiawtbnle',
+ 'wmiawttneq','wmiawttnne','wmiawttncs','wmiawttnhs','wmiawttncc','wmiawttnlo','wmiawttnmi','wmiawttnpl','wmiawttnvs','wmiawttnvc','wmiawttnhi','wmiawttnls','wmiawttnge','wmiawttnlt','wmiawttngt','wmiawttnle',
+ 'wminsbeq','wminsbne','wminsbcs','wminsbhs','wminsbcc','wminsblo','wminsbmi','wminsbpl','wminsbvs','wminsbvc','wminsbhi','wminsbls','wminsbge','wminsblt','wminsbgt','wminsble',
+ 'wminsheq','wminshne','wminshcs','wminshhs','wminshcc','wminshlo','wminshmi','wminshpl','wminshvs','wminshvc','wminshhi','wminshls','wminshge','wminshlt','wminshgt','wminshle',
+ 'wminsweq','wminswne','wminswcs','wminswhs','wminswcc','wminswlo','wminswmi','wminswpl','wminswvs','wminswvc','wminswhi','wminswls','wminswge','wminswlt','wminswgt','wminswle',
+ 'wminubeq','wminubne','wminubcs','wminubhs','wminubcc','wminublo','wminubmi','wminubpl','wminubvs','wminubvc','wminubhi','wminubls','wminubge','wminublt','wminubgt','wminuble',
+ 'wminuheq','wminuhne','wminuhcs','wminuhhs','wminuhcc','wminuhlo','wminuhmi','wminuhpl','wminuhvs','wminuhvc','wminuhhi','wminuhls','wminuhge','wminuhlt','wminuhgt','wminuhle',
+ 'wminuweq','wminuwne','wminuwcs','wminuwhs','wminuwcc','wminuwlo','wminuwmi','wminuwpl','wminuwvs','wminuwvc','wminuwhi','wminuwls','wminuwge','wminuwlt','wminuwgt','wminuwle',
+ 'wmoveq','wmovne','wmovcs','wmovhs','wmovcc','wmovlo','wmovmi','wmovpl','wmovvs','wmovvc','wmovhi','wmovls','wmovge','wmovlt','wmovgt','wmovle',
+ 'wmulsmeq','wmulsmne','wmulsmcs','wmulsmhs','wmulsmcc','wmulsmlo','wmulsmmi','wmulsmpl','wmulsmvs','wmulsmvc','wmulsmhi','wmulsmls','wmulsmge','wmulsmlt','wmulsmgt','wmulsmle',
+ 'wmulsleq','wmulslne','wmulslcs','wmulslhs','wmulslcc','wmulsllo','wmulslmi','wmulslpl','wmulslvs','wmulslvc','wmulslhi','wmulslls','wmulslge','wmulsllt','wmulslgt','wmulslle',
+ 'wmulumeq','wmulumne','wmulumcs','wmulumhs','wmulumcc','wmulumlo','wmulummi','wmulumpl','wmulumvs','wmulumvc','wmulumhi','wmulumls','wmulumge','wmulumlt','wmulumgt','wmulumle',
+ 'wmululeq','wmululne','wmululcs','wmululhs','wmululcc','wmulullo','wmululmi','wmululpl','wmululvs','wmululvc','wmululhi','wmululls','wmululge','wmulullt','wmululgt','wmululle',
+ 'wmulsmreq','wmulsmrne','wmulsmrcs','wmulsmrhs','wmulsmrcc','wmulsmrlo','wmulsmrmi','wmulsmrpl','wmulsmrvs','wmulsmrvc','wmulsmrhi','wmulsmrls','wmulsmrge','wmulsmrlt','wmulsmrgt','wmulsmrle',
+ 'wmulslreq','wmulslrne','wmulslrcs','wmulslrhs','wmulslrcc','wmulslrlo','wmulslrmi','wmulslrpl','wmulslrvs','wmulslrvc','wmulslrhi','wmulslrls','wmulslrge','wmulslrlt','wmulslrgt','wmulslrle',
+ 'wmulumreq','wmulumrne','wmulumrcs','wmulumrhs','wmulumrcc','wmulumrlo','wmulumrmi','wmulumrpl','wmulumrvs','wmulumrvc','wmulumrhi','wmulumrls','wmulumrge','wmulumrlt','wmulumrgt','wmulumrle',
+ 'wmululreq','wmululrne','wmululrcs','wmululrhs','wmululrcc','wmululrlo','wmululrmi','wmululrpl','wmululrvs','wmululrvc','wmululrhi','wmululrls','wmululrge','wmululrlt','wmululrgt','wmululrle',
+ 'wmulwumeq','wmulwumne','wmulwumcs','wmulwumhs','wmulwumcc','wmulwumlo','wmulwummi','wmulwumpl','wmulwumvs','wmulwumvc','wmulwumhi','wmulwumls','wmulwumge','wmulwumlt','wmulwumgt','wmulwumle',
+ 'wmulwsmeq','wmulwsmne','wmulwsmcs','wmulwsmhs','wmulwsmcc','wmulwsmlo','wmulwsmmi','wmulwsmpl','wmulwsmvs','wmulwsmvc','wmulwsmhi','wmulwsmls','wmulwsmge','wmulwsmlt','wmulwsmgt','wmulwsmle',
+ 'wmulwleq','wmulwlne','wmulwlcs','wmulwlhs','wmulwlcc','wmulwllo','wmulwlmi','wmulwlpl','wmulwlvs','wmulwlvc','wmulwlhi','wmulwlls','wmulwlge','wmulwllt','wmulwlgt','wmulwlle',
+ 'wmulwumreq','wmulwumrne','wmulwumrcs','wmulwumrhs','wmulwumrcc','wmulwumrlo','wmulwumrmi','wmulwumrpl','wmulwumrvs','wmulwumrvc','wmulwumrhi','wmulwumrls','wmulwumrge','wmulwumrlt','wmulwumrgt','wmulwumrle',
+ 'wmulwsmreq','wmulwsmrne','wmulwsmrcs','wmulwsmrhs','wmulwsmrcc','wmulwsmrlo','wmulwsmrmi','wmulwsmrpl','wmulwsmrvs','wmulwsmrvc','wmulwsmrhi','wmulwsmrls','wmulwsmrge','wmulwsmrlt','wmulwsmrgt','wmulwsmrle',
+ 'woreq','worne','worcs','worhs','worcc','worlo','wormi','worpl','worvs','worvc','worhi','worls','worge','worlt','worgt','worle',
+ 'wpackhsseq','wpackhssne','wpackhsscs','wpackhsshs','wpackhsscc','wpackhsslo','wpackhssmi','wpackhsspl','wpackhssvs','wpackhssvc','wpackhsshi','wpackhssls','wpackhssge','wpackhsslt','wpackhssgt','wpackhssle',
+ 'wpackwsseq','wpackwssne','wpackwsscs','wpackwsshs','wpackwsscc','wpackwsslo','wpackwssmi','wpackwsspl','wpackwssvs','wpackwssvc','wpackwsshi','wpackwssls','wpackwssge','wpackwsslt','wpackwssgt','wpackwssle',
+ 'wpackdsseq','wpackdssne','wpackdsscs','wpackdsshs','wpackdsscc','wpackdsslo','wpackdssmi','wpackdsspl','wpackdssvs','wpackdssvc','wpackdsshi','wpackdssls','wpackdssge','wpackdsslt','wpackdssgt','wpackdssle',
+ 'wpackhuseq','wpackhusne','wpackhuscs','wpackhushs','wpackhuscc','wpackhuslo','wpackhusmi','wpackhuspl','wpackhusvs','wpackhusvc','wpackhushi','wpackhusls','wpackhusge','wpackhuslt','wpackhusgt','wpackhusle',
+ 'wpackwuseq','wpackwusne','wpackwuscs','wpackwushs','wpackwuscc','wpackwuslo','wpackwusmi','wpackwuspl','wpackwusvs','wpackwusvc','wpackwushi','wpackwusls','wpackwusge','wpackwuslt','wpackwusgt','wpackwusle',
+ 'wpackduseq','wpackdusne','wpackduscs','wpackdushs','wpackduscc','wpackduslo','wpackdusmi','wpackduspl','wpackdusvs','wpackdusvc','wpackdushi','wpackdusls','wpackdusge','wpackduslt','wpackdusgt','wpackdusle',
+ 'wqmiabbeq','wqmiabbne','wqmiabbcs','wqmiabbhs','wqmiabbcc','wqmiabblo','wqmiabbmi','wqmiabbpl','wqmiabbvs','wqmiabbvc','wqmiabbhi','wqmiabbls','wqmiabbge','wqmiabblt','wqmiabbgt','wqmiabble',
+ 'wqmiabteq','wqmiabtne','wqmiabtcs','wqmiabths','wqmiabtcc','wqmiabtlo','wqmiabtmi','wqmiabtpl','wqmiabtvs','wqmiabtvc','wqmiabthi','wqmiabtls','wqmiabtge','wqmiabtlt','wqmiabtgt','wqmiabtle',
+ 'wqmiatbeq','wqmiatbne','wqmiatbcs','wqmiatbhs','wqmiatbcc','wqmiatblo','wqmiatbmi','wqmiatbpl','wqmiatbvs','wqmiatbvc','wqmiatbhi','wqmiatbls','wqmiatbge','wqmiatblt','wqmiatbgt','wqmiatble',
+ 'wqmiatteq','wqmiattne','wqmiattcs','wqmiatths','wqmiattcc','wqmiattlo','wqmiattmi','wqmiattpl','wqmiattvs','wqmiattvc','wqmiatthi','wqmiattls','wqmiattge','wqmiattlt','wqmiattgt','wqmiattle',
+ 'wqmiabbneq','wqmiabbnne','wqmiabbncs','wqmiabbnhs','wqmiabbncc','wqmiabbnlo','wqmiabbnmi','wqmiabbnpl','wqmiabbnvs','wqmiabbnvc','wqmiabbnhi','wqmiabbnls','wqmiabbnge','wqmiabbnlt','wqmiabbngt','wqmiabbnle',
+ 'wqmiabtneq','wqmiabtnne','wqmiabtncs','wqmiabtnhs','wqmiabtncc','wqmiabtnlo','wqmiabtnmi','wqmiabtnpl','wqmiabtnvs','wqmiabtnvc','wqmiabtnhi','wqmiabtnls','wqmiabtnge','wqmiabtnlt','wqmiabtngt','wqmiabtnle',
+ 'wqmiatbneq','wqmiatbnne','wqmiatbncs','wqmiatbnhs','wqmiatbncc','wqmiatbnlo','wqmiatbnmi','wqmiatbnpl','wqmiatbnvs','wqmiatbnvc','wqmiatbnhi','wqmiatbnls','wqmiatbnge','wqmiatbnlt','wqmiatbngt','wqmiatbnle',
+ 'wqmiattneq','wqmiattnne','wqmiattncs','wqmiattnhs','wqmiattncc','wqmiattnlo','wqmiattnmi','wqmiattnpl','wqmiattnvs','wqmiattnvc','wqmiattnhi','wqmiattnls','wqmiattnge','wqmiattnlt','wqmiattngt','wqmiattnle',
+ 'wqmulmeq','wqmulmne','wqmulmcs','wqmulmhs','wqmulmcc','wqmulmlo','wqmulmmi','wqmulmpl','wqmulmvs','wqmulmvc','wqmulmhi','wqmulmls','wqmulmge','wqmulmlt','wqmulmgt','wqmulmle',
+ 'wqmulmreq','wqmulmrne','wqmulmrcs','wqmulmrhs','wqmulmrcc','wqmulmrlo','wqmulmrmi','wqmulmrpl','wqmulmrvs','wqmulmrvc','wqmulmrhi','wqmulmrls','wqmulmrge','wqmulmrlt','wqmulmrgt','wqmulmrle',
+ 'wqmulwmeq','wqmulwmne','wqmulwmcs','wqmulwmhs','wqmulwmcc','wqmulwmlo','wqmulwmmi','wqmulwmpl','wqmulwmvs','wqmulwmvc','wqmulwmhi','wqmulwmls','wqmulwmge','wqmulwmlt','wqmulwmgt','wqmulwmle',
+ 'wqmulwmreq','wqmulwmrne','wqmulwmrcs','wqmulwmrhs','wqmulwmrcc','wqmulwmrlo','wqmulwmrmi','wqmulwmrpl','wqmulwmrvs','wqmulwmrvc','wqmulwmrhi','wqmulwmrls','wqmulwmrge','wqmulwmrlt','wqmulwmrgt','wqmulwmrle',
+ 'wrorheq','wrorhne','wrorhcs','wrorhhs','wrorhcc','wrorhlo','wrorhmi','wrorhpl','wrorhvs','wrorhvc','wrorhhi','wrorhls','wrorhge','wrorhlt','wrorhgt','wrorhle',
+ 'wrorweq','wrorwne','wrorwcs','wrorwhs','wrorwcc','wrorwlo','wrorwmi','wrorwpl','wrorwvs','wrorwvc','wrorwhi','wrorwls','wrorwge','wrorwlt','wrorwgt','wrorwle',
+ 'wrordeq','wrordne','wrordcs','wrordhs','wrordcc','wrordlo','wrordmi','wrordpl','wrordvs','wrordvc','wrordhi','wrordls','wrordge','wrordlt','wrordgt','wrordle',
+ 'wrorhgeq','wrorhgne','wrorhgcs','wrorhghs','wrorhgcc','wrorhglo','wrorhgmi','wrorhgpl','wrorhgvs','wrorhgvc','wrorhghi','wrorhgls','wrorhgge','wrorhglt','wrorhggt','wrorhgle',
+ 'wrorwgeq','wrorwgne','wrorwgcs','wrorwghs','wrorwgcc','wrorwglo','wrorwgmi','wrorwgpl','wrorwgvs','wrorwgvc','wrorwghi','wrorwgls','wrorwgge','wrorwglt','wrorwggt','wrorwgle',
+ 'wrordgeq','wrordgne','wrordgcs','wrordghs','wrordgcc','wrordglo','wrordgmi','wrordgpl','wrordgvs','wrordgvc','wrordghi','wrordgls','wrordgge','wrordglt','wrordggt','wrordgle',
+ 'wsadbeq','wsadbne','wsadbcs','wsadbhs','wsadbcc','wsadblo','wsadbmi','wsadbpl','wsadbvs','wsadbvc','wsadbhi','wsadbls','wsadbge','wsadblt','wsadbgt','wsadble',
+ 'wsadheq','wsadhne','wsadhcs','wsadhhs','wsadhcc','wsadhlo','wsadhmi','wsadhpl','wsadhvs','wsadhvc','wsadhhi','wsadhls','wsadhge','wsadhlt','wsadhgt','wsadhle',
+ 'wsadbzeq','wsadbzne','wsadbzcs','wsadbzhs','wsadbzcc','wsadbzlo','wsadbzmi','wsadbzpl','wsadbzvs','wsadbzvc','wsadbzhi','wsadbzls','wsadbzge','wsadbzlt','wsadbzgt','wsadbzle',
+ 'wsadhzeq','wsadhzne','wsadhzcs','wsadhzhs','wsadhzcc','wsadhzlo','wsadhzmi','wsadhzpl','wsadhzvs','wsadhzvc','wsadhzhi','wsadhzls','wsadhzge','wsadhzlt','wsadhzgt','wsadhzle',
+ 'wshufheq','wshufhne','wshufhcs','wshufhhs','wshufhcc','wshufhlo','wshufhmi','wshufhpl','wshufhvs','wshufhvc','wshufhhi','wshufhls','wshufhge','wshufhlt','wshufhgt','wshufhle',
+ 'wsllheq','wsllhne','wsllhcs','wsllhhs','wsllhcc','wsllhlo','wsllhmi','wsllhpl','wsllhvs','wsllhvc','wsllhhi','wsllhls','wsllhge','wsllhlt','wsllhgt','wsllhle',
+ 'wsllweq','wsllwne','wsllwcs','wsllwhs','wsllwcc','wsllwlo','wsllwmi','wsllwpl','wsllwvs','wsllwvc','wsllwhi','wsllwls','wsllwge','wsllwlt','wsllwgt','wsllwle',
+ 'wslldeq','wslldne','wslldcs','wslldhs','wslldcc','wslldlo','wslldmi','wslldpl','wslldvs','wslldvc','wslldhi','wslldls','wslldge','wslldlt','wslldgt','wslldle',
+ 'wsllhgeq','wsllhgne','wsllhgcs','wsllhghs','wsllhgcc','wsllhglo','wsllhgmi','wsllhgpl','wsllhgvs','wsllhgvc','wsllhghi','wsllhgls','wsllhgge','wsllhglt','wsllhggt','wsllhgle',
+ 'wsllwgeq','wsllwgne','wsllwgcs','wsllwghs','wsllwgcc','wsllwglo','wsllwgmi','wsllwgpl','wsllwgvs','wsllwgvc','wsllwghi','wsllwgls','wsllwgge','wsllwglt','wsllwggt','wsllwgle',
+ 'wslldgeq','wslldgne','wslldgcs','wslldghs','wslldgcc','wslldglo','wslldgmi','wslldgpl','wslldgvs','wslldgvc','wslldghi','wslldgls','wslldgge','wslldglt','wslldggt','wslldgle',
+ 'wsraheq','wsrahne','wsrahcs','wsrahhs','wsrahcc','wsrahlo','wsrahmi','wsrahpl','wsrahvs','wsrahvc','wsrahhi','wsrahls','wsrahge','wsrahlt','wsrahgt','wsrahle',
+ 'wsraweq','wsrawne','wsrawcs','wsrawhs','wsrawcc','wsrawlo','wsrawmi','wsrawpl','wsrawvs','wsrawvc','wsrawhi','wsrawls','wsrawge','wsrawlt','wsrawgt','wsrawle',
+ 'wsradeq','wsradne','wsradcs','wsradhs','wsradcc','wsradlo','wsradmi','wsradpl','wsradvs','wsradvc','wsradhi','wsradls','wsradge','wsradlt','wsradgt','wsradle',
+ 'wsrahgeq','wsrahgne','wsrahgcs','wsrahghs','wsrahgcc','wsrahglo','wsrahgmi','wsrahgpl','wsrahgvs','wsrahgvc','wsrahghi','wsrahgls','wsrahgge','wsrahglt','wsrahggt','wsrahgle',
+ 'wsrawgeq','wsrawgne','wsrawgcs','wsrawghs','wsrawgcc','wsrawglo','wsrawgmi','wsrawgpl','wsrawgvs','wsrawgvc','wsrawghi','wsrawgls','wsrawgge','wsrawglt','wsrawggt','wsrawgle',
+ 'wsradgeq','wsradgne','wsradgcs','wsradghs','wsradgcc','wsradglo','wsradgmi','wsradgpl','wsradgvs','wsradgvc','wsradghi','wsradgls','wsradgge','wsradglt','wsradggt','wsradgle',
+ 'wsrlheq','wsrlhne','wsrlhcs','wsrlhhs','wsrlhcc','wsrlhlo','wsrlhmi','wsrlhpl','wsrlhvs','wsrlhvc','wsrlhhi','wsrlhls','wsrlhge','wsrlhlt','wsrlhgt','wsrlhle',
+ 'wsrlweq','wsrlwne','wsrlwcs','wsrlwhs','wsrlwcc','wsrlwlo','wsrlwmi','wsrlwpl','wsrlwvs','wsrlwvc','wsrlwhi','wsrlwls','wsrlwge','wsrlwlt','wsrlwgt','wsrlwle',
+ 'wsrldeq','wsrldne','wsrldcs','wsrldhs','wsrldcc','wsrldlo','wsrldmi','wsrldpl','wsrldvs','wsrldvc','wsrldhi','wsrldls','wsrldge','wsrldlt','wsrldgt','wsrldle',
+ 'wsrlhgeq','wsrlhgne','wsrlhgcs','wsrlhghs','wsrlhgcc','wsrlhglo','wsrlhgmi','wsrlhgpl','wsrlhgvs','wsrlhgvc','wsrlhghi','wsrlhgls','wsrlhgge','wsrlhglt','wsrlhggt','wsrlhgle',
+ 'wsrlwgeq','wsrlwgne','wsrlwgcs','wsrlwghs','wsrlwgcc','wsrlwglo','wsrlwgmi','wsrlwgpl','wsrlwgvs','wsrlwgvc','wsrlwghi','wsrlwgls','wsrlwgge','wsrlwglt','wsrlwggt','wsrlwgle',
+ 'wsrldgeq','wsrldgne','wsrldgcs','wsrldghs','wsrldgcc','wsrldglo','wsrldgmi','wsrldgpl','wsrldgvs','wsrldgvc','wsrldghi','wsrldgls','wsrldgge','wsrldglt','wsrldggt','wsrldgle',
+ 'wstrbeq','wstrbne','wstrbcs','wstrbhs','wstrbcc','wstrblo','wstrbmi','wstrbpl','wstrbvs','wstrbvc','wstrbhi','wstrbls','wstrbge','wstrblt','wstrbgt','wstrble',
+ 'wstrheq','wstrhne','wstrhcs','wstrhhs','wstrhcc','wstrhlo','wstrhmi','wstrhpl','wstrhvs','wstrhvc','wstrhhi','wstrhls','wstrhge','wstrhlt','wstrhgt','wstrhle',
+ 'wstrweq','wstrwne','wstrwcs','wstrwhs','wstrwcc','wstrwlo','wstrwmi','wstrwpl','wstrwvs','wstrwvc','wstrwhi','wstrwls','wstrwge','wstrwlt','wstrwgt','wstrwle',
+ 'wstrdeq','wstrdne','wstrdcs','wstrdhs','wstrdcc','wstrdlo','wstrdmi','wstrdpl','wstrdvs','wstrdvc','wstrdhi','wstrdls','wstrdge','wstrdlt','wstrdgt','wstrdle',
+ 'wsubbeq','wsubbne','wsubbcs','wsubbhs','wsubbcc','wsubblo','wsubbmi','wsubbpl','wsubbvs','wsubbvc','wsubbhi','wsubbls','wsubbge','wsubblt','wsubbgt','wsubble',
+ 'wsubheq','wsubhne','wsubhcs','wsubhhs','wsubhcc','wsubhlo','wsubhmi','wsubhpl','wsubhvs','wsubhvc','wsubhhi','wsubhls','wsubhge','wsubhlt','wsubhgt','wsubhle',
+ 'wsubweq','wsubwne','wsubwcs','wsubwhs','wsubwcc','wsubwlo','wsubwmi','wsubwpl','wsubwvs','wsubwvc','wsubwhi','wsubwls','wsubwge','wsubwlt','wsubwgt','wsubwle',
+ 'wsubbsseq','wsubbssne','wsubbsscs','wsubbsshs','wsubbsscc','wsubbsslo','wsubbssmi','wsubbsspl','wsubbssvs','wsubbssvc','wsubbsshi','wsubbssls','wsubbssge','wsubbsslt','wsubbssgt','wsubbssle',
+ 'wsubhsseq','wsubhssne','wsubhsscs','wsubhsshs','wsubhsscc','wsubhsslo','wsubhssmi','wsubhsspl','wsubhssvs','wsubhssvc','wsubhsshi','wsubhssls','wsubhssge','wsubhsslt','wsubhssgt','wsubhssle',
+ 'wsubwsseq','wsubwssne','wsubwsscs','wsubwsshs','wsubwsscc','wsubwsslo','wsubwssmi','wsubwsspl','wsubwssvs','wsubwssvc','wsubwsshi','wsubwssls','wsubwssge','wsubwsslt','wsubwssgt','wsubwssle',
+ 'wsubbuseq','wsubbusne','wsubbuscs','wsubbushs','wsubbuscc','wsubbuslo','wsubbusmi','wsubbuspl','wsubbusvs','wsubbusvc','wsubbushi','wsubbusls','wsubbusge','wsubbuslt','wsubbusgt','wsubbusle',
+ 'wsubhuseq','wsubhusne','wsubhuscs','wsubhushs','wsubhuscc','wsubhuslo','wsubhusmi','wsubhuspl','wsubhusvs','wsubhusvc','wsubhushi','wsubhusls','wsubhusge','wsubhuslt','wsubhusgt','wsubhusle',
+ 'wsubwuseq','wsubwusne','wsubwuscs','wsubwushs','wsubwuscc','wsubwuslo','wsubwusmi','wsubwuspl','wsubwusvs','wsubwusvc','wsubwushi','wsubwusls','wsubwusge','wsubwuslt','wsubwusgt','wsubwusle',
+ 'wsubaddhxeq','wsubaddhxne','wsubaddhxcs','wsubaddhxhs','wsubaddhxcc','wsubaddhxlo','wsubaddhxmi','wsubaddhxpl','wsubaddhxvs','wsubaddhxvc','wsubaddhxhi','wsubaddhxls','wsubaddhxge','wsubaddhxlt','wsubaddhxgt','wsubaddhxle',
+ 'wunpckehsbeq','wunpckehsbne','wunpckehsbcs','wunpckehsbhs','wunpckehsbcc','wunpckehsblo','wunpckehsbmi','wunpckehsbpl','wunpckehsbvs','wunpckehsbvc','wunpckehsbhi','wunpckehsbls','wunpckehsbge','wunpckehsblt','wunpckehsbgt','wunpckehsble',
+ 'wunpckehsheq','wunpckehshne','wunpckehshcs','wunpckehshhs','wunpckehshcc','wunpckehshlo','wunpckehshmi','wunpckehshpl','wunpckehshvs','wunpckehshvc','wunpckehshhi','wunpckehshls','wunpckehshge','wunpckehshlt','wunpckehshgt','wunpckehshle',
+ 'wunpckehsweq','wunpckehswne','wunpckehswcs','wunpckehswhs','wunpckehswcc','wunpckehswlo','wunpckehswmi','wunpckehswpl','wunpckehswvs','wunpckehswvc','wunpckehswhi','wunpckehswls','wunpckehswge','wunpckehswlt','wunpckehswgt','wunpckehswle',
+ 'wunpckehubeq','wunpckehubne','wunpckehubcs','wunpckehubhs','wunpckehubcc','wunpckehublo','wunpckehubmi','wunpckehubpl','wunpckehubvs','wunpckehubvc','wunpckehubhi','wunpckehubls','wunpckehubge','wunpckehublt','wunpckehubgt','wunpckehuble',
+ 'wunpckehuheq','wunpckehuhne','wunpckehuhcs','wunpckehuhhs','wunpckehuhcc','wunpckehuhlo','wunpckehuhmi','wunpckehuhpl','wunpckehuhvs','wunpckehuhvc','wunpckehuhhi','wunpckehuhls','wunpckehuhge','wunpckehuhlt','wunpckehuhgt','wunpckehuhle',
+ 'wunpckehuweq','wunpckehuwne','wunpckehuwcs','wunpckehuwhs','wunpckehuwcc','wunpckehuwlo','wunpckehuwmi','wunpckehuwpl','wunpckehuwvs','wunpckehuwvc','wunpckehuwhi','wunpckehuwls','wunpckehuwge','wunpckehuwlt','wunpckehuwgt','wunpckehuwle',
+ 'wunpckihbeq','wunpckihbne','wunpckihbcs','wunpckihbhs','wunpckihbcc','wunpckihblo','wunpckihbmi','wunpckihbpl','wunpckihbvs','wunpckihbvc','wunpckihbhi','wunpckihbls','wunpckihbge','wunpckihblt','wunpckihbgt','wunpckihble',
+ 'wunpckihheq','wunpckihhne','wunpckihhcs','wunpckihhhs','wunpckihhcc','wunpckihhlo','wunpckihhmi','wunpckihhpl','wunpckihhvs','wunpckihhvc','wunpckihhhi','wunpckihhls','wunpckihhge','wunpckihhlt','wunpckihhgt','wunpckihhle',
+ 'wunpckihweq','wunpckihwne','wunpckihwcs','wunpckihwhs','wunpckihwcc','wunpckihwlo','wunpckihwmi','wunpckihwpl','wunpckihwvs','wunpckihwvc','wunpckihwhi','wunpckihwls','wunpckihwge','wunpckihwlt','wunpckihwgt','wunpckihwle',
+ 'wunpckelsbeq','wunpckelsbne','wunpckelsbcs','wunpckelsbhs','wunpckelsbcc','wunpckelsblo','wunpckelsbmi','wunpckelsbpl','wunpckelsbvs','wunpckelsbvc','wunpckelsbhi','wunpckelsbls','wunpckelsbge','wunpckelsblt','wunpckelsbgt','wunpckelsble',
+ 'wunpckelsheq','wunpckelshne','wunpckelshcs','wunpckelshhs','wunpckelshcc','wunpckelshlo','wunpckelshmi','wunpckelshpl','wunpckelshvs','wunpckelshvc','wunpckelshhi','wunpckelshls','wunpckelshge','wunpckelshlt','wunpckelshgt','wunpckelshle',
+ 'wunpckelsweq','wunpckelswne','wunpckelswcs','wunpckelswhs','wunpckelswcc','wunpckelswlo','wunpckelswmi','wunpckelswpl','wunpckelswvs','wunpckelswvc','wunpckelswhi','wunpckelswls','wunpckelswge','wunpckelswlt','wunpckelswgt','wunpckelswle',
+ 'wunpckelubeq','wunpckelubne','wunpckelubcs','wunpckelubhs','wunpckelubcc','wunpckelublo','wunpckelubmi','wunpckelubpl','wunpckelubvs','wunpckelubvc','wunpckelubhi','wunpckelubls','wunpckelubge','wunpckelublt','wunpckelubgt','wunpckeluble',
+ 'wunpckeluheq','wunpckeluhne','wunpckeluhcs','wunpckeluhhs','wunpckeluhcc','wunpckeluhlo','wunpckeluhmi','wunpckeluhpl','wunpckeluhvs','wunpckeluhvc','wunpckeluhhi','wunpckeluhls','wunpckeluhge','wunpckeluhlt','wunpckeluhgt','wunpckeluhle',
+ 'wunpckeluweq','wunpckeluwne','wunpckeluwcs','wunpckeluwhs','wunpckeluwcc','wunpckeluwlo','wunpckeluwmi','wunpckeluwpl','wunpckeluwvs','wunpckeluwvc','wunpckeluwhi','wunpckeluwls','wunpckeluwge','wunpckeluwlt','wunpckeluwgt','wunpckeluwle',
+ 'wunpckilbeq','wunpckilbne','wunpckilbcs','wunpckilbhs','wunpckilbcc','wunpckilblo','wunpckilbmi','wunpckilbpl','wunpckilbvs','wunpckilbvc','wunpckilbhi','wunpckilbls','wunpckilbge','wunpckilblt','wunpckilbgt','wunpckilble',
+ 'wunpckilheq','wunpckilhne','wunpckilhcs','wunpckilhhs','wunpckilhcc','wunpckilhlo','wunpckilhmi','wunpckilhpl','wunpckilhvs','wunpckilhvc','wunpckilhhi','wunpckilhls','wunpckilhge','wunpckilhlt','wunpckilhgt','wunpckilhle',
+ 'wunpckilweq','wunpckilwne','wunpckilwcs','wunpckilwhs','wunpckilwcc','wunpckilwlo','wunpckilwmi','wunpckilwpl','wunpckilwvs','wunpckilwvc','wunpckilwhi','wunpckilwls','wunpckilwge','wunpckilwlt','wunpckilwgt','wunpckilwle',
+ 'wxoreq','wxorne','wxorcs','wxorhs','wxorcc','wxorlo','wxormi','wxorpl','wxorvs','wxorvc','wxorhi','wxorls','wxorge','wxorlt','wxorgt','wxorle',
+ 'wzeroeq','wzerone','wzerocs','wzerohs','wzerocc','wzerolo','wzeromi','wzeropl','wzerovs','wzerovc','wzerohi','wzerols','wzeroge','wzerolt','wzerogt','wzerole'
+ ),
+ /* Unconditional VFPv3 & NEON SIMD Memory Access Instructions */
+ 19 => array(
+ /* Unconditional VFPv3 & NEON SIMD Memory Access: Loads */
+ 'vld.8','vldal.8',
+ 'vld.16','vldal.16',
+ 'vld.32','vldal.32',
+ 'vld.64','vldal.64',
+
+ 'vld1.8','vld1al.8',
+ 'vld1.16','vld1al.16',
+ 'vld1.32','vld1al.32',
+
+ 'vld2.8','vld2al.8',
+ 'vld2.16','vld2al.16',
+ 'vld2.32','vld2al.32',
+
+ 'vld3.8','vld3al.8',
+ 'vld3.16','vld3al.16',
+ 'vld3.32','vld3al.32',
+
+ 'vld4.8','vld4al.8',
+ 'vld4.16','vld4al.16',
+ 'vld4.32','vld4al.32',
+
+ 'vldm','vldmal',
+ 'vldm.32','vldmal.32',
+ 'vldm.64','vldmal.64',
+
+ 'vldmia','vldmiaal',
+ 'vldmia.32','vldmiaal.32',
+ 'vldmia.64','vldmiaal.64',
+
+ 'vldmdb','vldmdbal',
+ 'vldmdb.32','vldmdbal.32',
+ 'vldmdb.64','vldmdbal.64',
+
+ 'vldr','vldral',
+ 'vldr.32','vldral.32',
+ 'vldr.64','vldral.64',
+
+ 'vpop','vpopal',
+ 'vpop.32','vpopal.32',
+ 'vpop.64','vpopal.64',
+
+ /* Unconditional VFPv3 & NEON SIMD Memory Access: Stores */
+ 'vst1.8','vst1al.8',
+ 'vst1.16','vst1al.16',
+ 'vst1.32','vst1al.32',
+ 'vst1.64','vst1al.64',
+
+ 'vst2.8','vst2al.8',
+ 'vst2.16','vst2al.16',
+ 'vst2.32','vst2al.32',
+
+ 'vst3.8','vst3al.8',
+ 'vst3.16','vst3al.16',
+ 'vst3.32','vst3al.32',
+
+ 'vst4.8','vst4al.8',
+ 'vst4.16','vst4al.16',
+ 'vst4.32','vst4al.32',
+
+ 'vstm','vstmal',
+ 'vstm.32','vstmal.32',
+ 'vstm.64','vstmal.64',
+
+ 'vstmia','vstmiaal',
+ 'vstmia.32','vstmiaal.32',
+ 'vstmia.64','vstmiaal.64',
+
+ 'vstmdb','vstmdbal',
+ 'vstmdb.32','vstmdbal.32',
+ 'vstmdb.64','vstmdbal.64',
+
+ 'vstr','vstral',
+ 'vstr.32','vstral.32',
+ 'vstr.64','vstral.64',
+
+ 'vpush','vpushal',
+ 'vpush.32','vpushal.32',
+ 'vpush.64','vpushal.64'
+ ),
+ /* Unconditional NEON SIMD Logical Instructions */
+ 20 => array(
+ 'vand','vandal',
+ 'vand.i8','vandal.i8',
+ 'vand.i16','vandal.i16',
+ 'vand.i32','vandal.i32',
+ 'vand.i64','vandal.i64',
+ 'vand.s8','vandal.s8',
+ 'vand.s16','vandal.s16',
+ 'vand.s32','vandal.s32',
+ 'vand.s64','vandal.s64',
+ 'vand.u8','vandal.u8',
+ 'vand.u16','vandal.u16',
+ 'vand.u32','vandal.u32',
+ 'vand.u64','vandal.u64',
+ 'vand.f32','vandal.f32',
+ 'vand.f64','vandal.f64',
+
+ 'vbic','vbical',
+ 'vbic.i8','vbical.i8',
+ 'vbic.i16','vbical.i16',
+ 'vbic.i32','vbical.i32',
+ 'vbic.i64','vbical.i64',
+ 'vbic.s8','vbical.s8',
+ 'vbic.s16','vbical.s16',
+ 'vbic.s32','vbical.s32',
+ 'vbic.s64','vbical.s64',
+ 'vbic.u8','vbical.u8',
+ 'vbic.u16','vbical.u16',
+ 'vbic.u32','vbical.u32',
+ 'vbic.u64','vbical.u64',
+ 'vbic.f32','vbical.f32',
+ 'vbic.f64','vbical.f64',
+
+ 'vbif','vbifal',
+ 'vbif.i8','vbifal.i8',
+ 'vbif.i16','vbifal.i16',
+ 'vbif.i32','vbifal.i32',
+ 'vbif.i64','vbifal.i64',
+ 'vbif.s8','vbifal.s8',
+ 'vbif.s16','vbifal.s16',
+ 'vbif.s32','vbifal.s32',
+ 'vbif.s64','vbifal.s64',
+ 'vbif.u8','vbifal.u8',
+ 'vbif.u16','vbifal.u16',
+ 'vbif.u32','vbifal.u32',
+ 'vbif.u64','vbifal.u64',
+ 'vbif.f32','vbifal.f32',
+ 'vbif.f64','vbifal.f64',
+
+ 'vbit','vbital',
+ 'vbit.i8','vbital.i8',
+ 'vbit.i16','vbital.i16',
+ 'vbit.i32','vbital.i32',
+ 'vbit.i64','vbital.i64',
+ 'vbit.s8','vbital.s8',
+ 'vbit.s16','vbital.s16',
+ 'vbit.s32','vbital.s32',
+ 'vbit.s64','vbital.s64',
+ 'vbit.u8','vbital.u8',
+ 'vbit.u16','vbital.u16',
+ 'vbit.u32','vbital.u32',
+ 'vbit.u64','vbital.u64',
+ 'vbit.f32','vbital.f32',
+ 'vbit.f64','vbital.f64',
+
+ 'vbsl','vbslal',
+ 'vbsl.i8','vbslal.i8',
+ 'vbsl.i16','vbslal.i16',
+ 'vbsl.i32','vbslal.i32',
+ 'vbsl.i64','vbslal.i64',
+ 'vbsl.s8','vbslal.s8',
+ 'vbsl.s16','vbslal.s16',
+ 'vbsl.s32','vbslal.s32',
+ 'vbsl.s64','vbslal.s64',
+ 'vbsl.u8','vbslal.u8',
+ 'vbsl.u16','vbslal.u16',
+ 'vbsl.u32','vbslal.u32',
+ 'vbsl.u64','vbslal.u64',
+ 'vbsl.f32','vbslal.f32',
+ 'vbsl.f64','vbslal.f64',
+
+ 'veor','veoral',
+ 'veor.i8','veoral.i8',
+ 'veor.i16','veoral.i16',
+ 'veor.i32','veoral.i32',
+ 'veor.i64','veoral.i64',
+ 'veor.s8','veoral.s8',
+ 'veor.s16','veoral.s16',
+ 'veor.s32','veoral.s32',
+ 'veor.s64','veoral.s64',
+ 'veor.u8','veoral.u8',
+ 'veor.u16','veoral.u16',
+ 'veor.u32','veoral.u32',
+ 'veor.u64','veoral.u64',
+ 'veor.f32','veoral.f32',
+ 'veor.f64','veoral.f64',
+
+ 'vmov','vmoval',
+ 'vmov.8','vmoval.8',
+ 'vmov.16','vmoval.16',
+ 'vmov.32','vmoval.32',
+ 'vmov.i8','vmoval.i8',
+ 'vmov.i16','vmoval.i16',
+ 'vmov.i32','vmoval.i32',
+ 'vmov.i64','vmoval.i64',
+ 'vmov.f32','vmoval.f32',
+ 'vmov.f64','vmoval.f64',
+
+ 'vmvn','vmvnal',
+ 'vmvn.s8','vmvnal.s8',
+ 'vmvn.s16','vmvnal.s16',
+ 'vmvn.s32','vmvnal.s32',
+ 'vmvn.s64','vmvnal.s64',
+ 'vmvn.u8','vmvnal.u8',
+ 'vmvn.u16','vmvnal.u16',
+ 'vmvn.u32','vmvnal.u32',
+ 'vmvn.u64','vmvnal.u64',
+ 'vmvn.i8','vmvnal.i8',
+ 'vmvn.i16','vmvnal.i16',
+ 'vmvn.i32','vmvnal.i32',
+ 'vmvn.i64','vmvnal.i64',
+ 'vmvn.f32','vmvnal.f32',
+ 'vmvn.f64','vmvnal.f64',
+
+ 'vorn','vornal',
+ 'vorn.s8','vornal.s8',
+ 'vorn.s16','vornal.s16',
+ 'vorn.s32','vornal.s32',
+ 'vorn.s64','vornal.s64',
+ 'vorn.u8','vornal.u8',
+ 'vorn.u16','vornal.u16',
+ 'vorn.u32','vornal.u32',
+ 'vorn.u64','vornal.u64',
+ 'vorn.i8','vornal.i8',
+ 'vorn.i16','vornal.i16',
+ 'vorn.i32','vornal.i32',
+ 'vorn.i64','vornal.i64',
+ 'vorn.f32','vornal.f32',
+ 'vorn.f64','vornal.f64',
+
+ 'vorr','vorral',
+ 'vorr.s8','vorral.s8',
+ 'vorr.s16','vorral.s16',
+ 'vorr.s32','vorral.s32',
+ 'vorr.s64','vorral.s64',
+ 'vorr.u8','vorral.u8',
+ 'vorr.u16','vorral.u16',
+ 'vorr.u32','vorral.u32',
+ 'vorr.u64','vorral.u64',
+ 'vorr.i8','vorral.i8',
+ 'vorr.i16','vorral.i16',
+ 'vorr.i32','vorral.i32',
+ 'vorr.i64','vorral.i64',
+ 'vorr.f32','vorral.f32',
+ 'vorr.f64','vorral.f64',
+
+ 'vswp','vswpal',
+ 'vswp.s8','vswpal.s8',
+ 'vswp.s16','vswpal.s16',
+ 'vswp.s32','vswpal.s32',
+ 'vswp.s64','vswpal.s64',
+ 'vswp.u8','vswpal.u8',
+ 'vswp.u16','vswpal.u16',
+ 'vswp.u32','vswpal.u32',
+ 'vswp.u64','vswpal.u64',
+ 'vswp.i8','vswpal.i8',
+ 'vswp.i16','vswpal.i16',
+ 'vswp.i32','vswpal.i32',
+ 'vswp.i64','vswpal.i64',
+ 'vswp.f32','vswpal.f32',
+ 'vswp.f64','vswpal.f64'
+ ),
+ /* Unconditional NEON SIMD ARM Registers Interop Instructions */
+ 21 => array(
+ 'vmrs','vmrsal',
+ 'vmsr','vmsral'
+ ),
+ /* Unconditional NEON SIMD Bit/Byte-Level Instructions */
+ 22 => array(
+ 'vcnt.8','vcntal.8',
+ 'vdup.8','vdupal.8',
+
+ 'vdup.16','vdupal.16',
+ 'vdup.32','vdupal.32',
+
+ 'vext.8','vextal.8',
+ 'vext.16','vextal.16',
+
+ 'vext.32','vextal.32',
+ 'vext.64','vextal.64',
+
+ 'vrev16.8','vrev16al.8',
+ 'vrev32.8','vrev32al.8',
+ 'vrev32.16','vrev32al.16',
+ 'vrev64.8','vrev64al.8',
+ 'vrev64.16','vrev64al.16',
+ 'vrev64.32','vrev64al.32',
+
+ 'vsli.8','vslial.8',
+ 'vsli.16','vslial.16',
+ 'vsli.32','vslial.32',
+ 'vsli.64','vslial.64',
+
+ 'vsri.8','vsrial.8',
+ 'vsri.16','vsrial.16',
+ 'vsri.32','vsrial.32',
+ 'vsri.64','vsrial.64',
+
+ 'vtbl.8','vtblal.8',
+
+ 'vtbx','vtbxal',
+
+ 'vtrn.8','vtrnal.8',
+ 'vtrn.16','vtrnal.16',
+ 'vtrn.32','vtrnal.32',
+
+ 'vtst.8','vtstal.8',
+ 'vtst.16','vtstal.16',
+ 'vtst.32','vtstal.32',
+
+ 'vuzp.8','vuzpal.8',
+ 'vuzp.16','vuzpal.16',
+ 'vuzp.32','vuzpal.32',
+
+ 'vzip.8','vzipal.8',
+ 'vzip.16','vzipal.16',
+ 'vzip.32','vzipal.32',
+
+ 'vmull.p8','vmullal.p8'
+ ),
+ /* Unconditional NEON SIMD Universal Integer Instructions */
+ 23 => array(
+ 'vadd.i8','vaddal.i8',
+ 'vadd.i16','vaddal.i16',
+ 'vadd.i32','vaddal.i32',
+ 'vadd.i64','vaddal.i64',
+
+ 'vsub.i8','vsubal.i8',
+ 'vsub.i16','vsubal.i16',
+ 'vsub.i32','vsubal.i32',
+ 'vsub.i64','vsubal.i64',
+
+ 'vaddhn.i16','vaddhnal.i16',
+ 'vaddhn.i32','vaddhnal.i32',
+ 'vaddhn.i64','vaddhnal.i64',
+
+ 'vsubhn.i16','vsubhnal.i16',
+ 'vsubhn.i32','vsubhnal.i32',
+ 'vsubhn.i64','vsubhnal.i64',
+
+ 'vraddhn.i16','vraddhnal.i16',
+ 'vraddhn.i32','vraddhnal.i32',
+ 'vraddhn.i64','vraddhnal.i64',
+
+ 'vrsubhn.i16','vrsubhnal.i16',
+ 'vrsubhn.i32','vrsubhnal.i32',
+ 'vrsubhn.i64','vrsubhnal.i64',
+
+ 'vpadd.i8','vpaddal.i8',
+ 'vpadd.i16','vpaddal.i16',
+ 'vpadd.i32','vpaddal.i32',
+
+ 'vceq.i8','vceqal.i8',
+ 'vceq.i16','vceqal.i16',
+ 'vceq.i32','vceqal.i32',
+
+ 'vclz.i8','vclzal.i8',
+ 'vclz.i16','vclzal.i16',
+ 'vclz.i32','vclzal.i32',
+
+ 'vmovn.i16','vmovnal.i16',
+ 'vmovn.i32','vmovnal.i32',
+ 'vmovn.i64','vmovnal.i64',
+
+ 'vmla.s8','vmlaal.s8',
+ 'vmla.s16','vmlaal.s16',
+ 'vmla.s32','vmlaal.s32',
+ 'vmla.u8','vmlaal.u8',
+ 'vmla.u16','vmlaal.u16',
+ 'vmla.u32','vmlaal.u32',
+ 'vmla.i8','vmlaal.i8',
+ 'vmla.i16','vmlaal.i16',
+ 'vmla.i32','vmlaal.i32',
+
+ 'vmls.s8','vmlsal.s8',
+ 'vmls.s16','vmlsal.s16',
+ 'vmls.s32','vmlsal.s32',
+ 'vmls.u8','vmlsal.u8',
+ 'vmls.u16','vmlsal.u16',
+ 'vmls.u32','vmlsal.u32',
+ 'vmls.i8','vmlsal.i8',
+ 'vmls.i16','vmlsal.i16',
+ 'vmls.i32','vmlsal.i32',
+
+ 'vmul.s8','vmulal.s8',
+ 'vmul.s16','vmulal.s16',
+ 'vmul.s32','vmulal.s32',
+ 'vmul.u8','vmulal.u8',
+ 'vmul.u16','vmulal.u16',
+ 'vmul.u32','vmulal.u32',
+ 'vmul.i8','vmulal.i8',
+ 'vmul.i16','vmulal.i16',
+ 'vmul.i32','vmulal.i32',
+ 'vmul.p8','vmulal.p8',
+
+ 'vrshrn.i16','vrshrnal.i16',
+ 'vrshrn.i32','vrshrnal.i32',
+ 'vrshrn.i64','vrshrnal.i64',
+
+ 'vshrn.i16','vshrnal.i16',
+ 'vshrn.i32','vshrnal.i32',
+ 'vshrn.i64','vshrnal.i64',
+
+ 'vshl.i8','vshlal.i8',
+ 'vshl.i16','vshlal.i16',
+ 'vshl.i32','vshlal.i32',
+ 'vshl.i64','vshlal.i64',
+
+ 'vshll.i8','vshllal.i8',
+ 'vshll.i16','vshllal.i16',
+ 'vshll.i32','vshllal.i32'
+ ),
+ /* Unconditional NEON SIMD Signed Integer Instructions */
+ 24 => array(
+ 'vaba.s8','vabaal.s8',
+ 'vaba.s16','vabaal.s16',
+ 'vaba.s32','vabaal.s32',
+
+ 'vabal.s8','vabalal.s8',
+ 'vabal.s16','vabalal.s16',
+ 'vabal.s32','vabalal.s32',
+
+ 'vabd.s8','vabdal.s8',
+ 'vabd.s16','vabdal.s16',
+ 'vabd.s32','vabdal.s32',
+
+ 'vabs.s8','vabsal.s8',
+ 'vabs.s16','vabsal.s16',
+ 'vabs.s32','vabsal.s32',
+
+ 'vaddl.s8','vaddlal.s8',
+ 'vaddl.s16','vaddlal.s16',
+ 'vaddl.s32','vaddlal.s32',
+
+ 'vcge.s8','vcgeal.s8',
+ 'vcge.s16','vcgeal.s16',
+ 'vcge.s32','vcgeal.s32',
+
+ 'vcle.s8','vcleal.s8',
+ 'vcle.s16','vcleal.s16',
+ 'vcle.s32','vcleal.s32',
+
+ 'vcgt.s8','vcgtal.s8',
+ 'vcgt.s16','vcgtal.s16',
+ 'vcgt.s32','vcgtal.s32',
+
+ 'vclt.s8','vcltal.s8',
+ 'vclt.s16','vcltal.s16',
+ 'vclt.s32','vcltal.s32',
+
+ 'vcls.s8','vclsal.s8',
+ 'vcls.s16','vclsal.s16',
+ 'vcls.s32','vclsal.s32',
+
+ 'vaddw.s8','vaddwal.s8',
+ 'vaddw.s16','vaddwal.s16',
+ 'vaddw.s32','vaddwal.s32',
+
+ 'vhadd.s8','vhaddal.s8',
+ 'vhadd.s16','vhaddal.s16',
+ 'vhadd.s32','vhaddal.s32',
+
+ 'vhsub.s8','vhsubal.s8',
+ 'vhsub.s16','vhsubal.s16',
+ 'vhsub.s32','vhsubal.s32',
+
+ 'vmax.s8','vmaxal.s8',
+ 'vmax.s16','vmaxal.s16',
+ 'vmax.s32','vmaxal.s32',
+
+ 'vmin.s8','vminal.s8',
+ 'vmin.s16','vminal.s16',
+ 'vmin.s32','vminal.s32',
+
+ 'vmlal.s8','vmlalal.s8',
+ 'vmlal.s16','vmlalal.s16',
+ 'vmlal.s32','vmlalal.s32',
+
+ 'vmlsl.s8','vmlslal.s8',
+ 'vmlsl.s16','vmlslal.s16',
+ 'vmlsl.s32','vmlslal.s32',
+
+ 'vneg.s8','vnegal.s8',
+ 'vneg.s16','vnegal.s16',
+ 'vneg.s32','vnegal.s32',
+
+ 'vpadal.s8','vpadalal.s8',
+ 'vpadal.s16','vpadalal.s16',
+ 'vpadal.s32','vpadalal.s32',
+
+ 'vmovl.s8','vmovlal.s8',
+ 'vmovl.s16','vmovlal.s16',
+ 'vmovl.s32','vmovlal.s32',
+
+ 'vmull.s8','vmullal.s8',
+ 'vmull.s16','vmullal.s16',
+ 'vmull.s32','vmullal.s32',
+
+ 'vpaddl.s8','vpaddlal.s8',
+ 'vpaddl.s16','vpaddlal.s16',
+ 'vpaddl.s32','vpaddlal.s32',
+
+ 'vpmax.s8','vpmaxal.s8',
+ 'vpmax.s16','vpmaxal.s16',
+ 'vpmax.s32','vpmaxal.s32',
+
+ 'vpmin.s8','vpminal.s8',
+ 'vpmin.s16','vpminal.s16',
+ 'vpmin.s32','vpminal.s32',
+
+ 'vqabs.s8','vqabsal.s8',
+ 'vqabs.s16','vqabsal.s16',
+ 'vqabs.s32','vqabsal.s32',
+
+ 'vqadd.s8','vqaddal.s8',
+ 'vqadd.s16','vqaddal.s16',
+ 'vqadd.s32','vqaddal.s32',
+ 'vqadd.s64','vqaddal.s64',
+
+ 'vqdmlal.s16','vqdmlalal.s16',
+ 'vqdmlal.s32','vqdmlalal.s32',
+
+ 'vqdmlsl.s16','vqdmlslal.s16',
+ 'vqdmlsl.s32','vqdmlslal.s32',
+
+ 'vqdmulh.s16','vqdmulhal.s16',
+ 'vqdmulh.s32','vqdmulhal.s32',
+
+ 'vqdmull.s16','vqdmullal.s16',
+ 'vqdmull.s32','vqdmullal.s32',
+
+ 'vqmovn.s16','vqmovnal.s16',
+ 'vqmovn.s32','vqmovnal.s32',
+ 'vqmovn.s64','vqmovnal.s64',
+
+ 'vqmovun.s16','vqmovunal.s16',
+ 'vqmovun.s32','vqmovunal.s32',
+ 'vqmovun.s64','vqmovunal.s64',
+
+ 'vqneg.s8','vqnegal.s8',
+ 'vqneg.s16','vqnegal.s16',
+ 'vqneg.s32','vqnegal.s32',
+
+ 'vqrdmulh.s16','vqrdmulhal.s16',
+ 'vqrdmulh.s32','vqrdmulhal.s32',
+
+ 'vqrshl.s8','vqrshlal.s8',
+ 'vqrshl.s16','vqrshlal.s16',
+ 'vqrshl.s32','vqrshlal.s32',
+ 'vqrshl.s64','vqrshlal.s64',
+
+ 'vqrshrn.s16','vqrshrnal.s16',
+ 'vqrshrn.s32','vqrshrnal.s32',
+ 'vqrshrn.s64','vqrshrnal.s64',
+
+ 'vqrshrun.s16','vqrshrunal.s16',
+ 'vqrshrun.s32','vqrshrunal.s32',
+ 'vqrshrun.s64','vqrshrunal.s64',
+
+ 'vqshl.s8','vqshlal.s8',
+ 'vqshl.s16','vqshlal.s16',
+ 'vqshl.s32','vqshlal.s32',
+ 'vqshl.s64','vqshlal.s64',
+
+ 'vqshlu.s8','vqshlual.s8',
+ 'vqshlu.s16','vqshlual.s16',
+ 'vqshlu.s32','vqshlual.s32',
+ 'vqshlu.s64','vqshlual.s64',
+
+ 'vqshrn.s16','vqshrnal.s16',
+ 'vqshrn.s32','vqshrnal.s32',
+ 'vqshrn.s64','vqshrnal.s64',
+
+ 'vqshrun.s16','vqshrunal.s16',
+ 'vqshrun.s32','vqshrunal.s32',
+ 'vqshrun.s64','vqshrunal.s64',
+
+ 'vqsub.s8','vqsubal.s8',
+ 'vqsub.s16','vqsubal.s16',
+ 'vqsub.s32','vqsubal.s32',
+ 'vqsub.s64','vqsubal.s64',
+
+ 'vrhadd.s8','vrhaddal.s8',
+ 'vrhadd.s16','vrhaddal.s16',
+ 'vrhadd.s32','vrhaddal.s32',
+
+ 'vrshl.s8','vrshlal.s8',
+ 'vrshl.s16','vrshlal.s16',
+ 'vrshl.s32','vrshlal.s32',
+ 'vrshl.s64','vrshlal.s64',
+
+ 'vrshr.s8','vrshral.s8',
+ 'vrshr.s16','vrshral.s16',
+ 'vrshr.s32','vrshral.s32',
+ 'vrshr.s64','vrshral.s64',
+
+ 'vrsra.s8','vrsraal.s8',
+ 'vrsra.s16','vrsraal.s16',
+ 'vrsra.s32','vrsraal.s32',
+ 'vrsra.s64','vrsraal.s64',
+
+ 'vshl.s8','vshlal.s8',
+ 'vshl.s16','vshlal.s16',
+ 'vshl.s32','vshlal.s32',
+ 'vshl.s64','vshlal.s64',
+
+ 'vshll.s8','vshllal.s8',
+ 'vshll.s16','vshllal.s16',
+ 'vshll.s32','vshllal.s32',
+
+ 'vshr.s8','vshral.s8',
+ 'vshr.s16','vshral.s16',
+ 'vshr.s32','vshral.s32',
+ 'vshr.s64','vshral.s64',
+
+ 'vsra.s8','vsraal.s8',
+ 'vsra.s16','vsraal.s16',
+ 'vsra.s32','vsraal.s32',
+ 'vsra.s64','vsraal.s64',
+
+ 'vsubl.s8','vsublal.s8',
+ 'vsubl.s16','vsublal.s16',
+ 'vsubl.s32','vsublal.s32',
+
+ 'vsubh.s8','vsubhal.s8',
+ 'vsubh.s16','vsubhal.s16',
+ 'vsubh.s32','vsubhal.s32'
+ ),
+ /* Unconditional NEON SIMD Unsigned Integer Instructions */
+ 25 => array(
+ 'vaba.u8','vabaal.u8',
+ 'vaba.u16','vabaal.u16',
+ 'vaba.u32','vabaal.u32',
+
+ 'vabal.u8','vabalal.u8',
+ 'vabal.u16','vabalal.u16',
+ 'vabal.u32','vabalal.u32',
+
+ 'vabd.u8','vabdal.u8',
+ 'vabd.u16','vabdal.u16',
+ 'vabd.u32','vabdal.u32',
+
+ 'vaddl.u8','vaddlal.u8',
+ 'vaddl.u16','vaddlal.u16',
+ 'vaddl.u32','vaddlal.u32',
+
+ 'vsubl.u8','vsublal.u8',
+ 'vsubl.u16','vsublal.u16',
+ 'vsubl.u32','vsublal.u32',
+
+ 'vaddw.u8','vaddwal.u8',
+ 'vaddw.u16','vaddwal.u16',
+ 'vaddw.u32','vaddwal.u32',
+
+ 'vsubh.u8','vsubhal.u8',
+ 'vsubh.u16','vsubhal.u16',
+ 'vsubh.u32','vsubhal.u32',
+
+ 'vhadd.u8','vhaddal.u8',
+ 'vhadd.u16','vhaddal.u16',
+ 'vhadd.u32','vhaddal.u32',
+
+ 'vhsub.u8','vhsubal.u8',
+ 'vhsub.u16','vhsubal.u16',
+ 'vhsub.u32','vhsubal.u32',
+
+ 'vpadal.u8','vpadalal.u8',
+ 'vpadal.u16','vpadalal.u16',
+ 'vpadal.u32','vpadalal.u32',
+
+ 'vpaddl.u8','vpaddlal.u8',
+ 'vpaddl.u16','vpaddlal.u16',
+ 'vpaddl.u32','vpaddlal.u32',
+
+ 'vcge.u8','vcgeal.u8',
+ 'vcge.u16','vcgeal.u16',
+ 'vcge.u32','vcgeal.u32',
+
+ 'vcle.u8','vcleal.u8',
+ 'vcle.u16','vcleal.u16',
+ 'vcle.u32','vcleal.u32',
+
+ 'vcgt.u8','vcgtal.u8',
+ 'vcgt.u16','vcgtal.u16',
+ 'vcgt.u32','vcgtal.u32',
+
+ 'vclt.u8','vcltal.u8',
+ 'vclt.u16','vcltal.u16',
+ 'vclt.u32','vcltal.u32',
+
+ 'vmax.u8','vmaxal.u8',
+ 'vmax.u16','vmaxal.u16',
+ 'vmax.u32','vmaxal.u32',
+
+ 'vmin.u8','vminal.u8',
+ 'vmin.u16','vminal.u16',
+ 'vmin.u32','vminal.u32',
+
+ 'vmlal.u8','vmlalal.u8',
+ 'vmlal.u16','vmlalal.u16',
+ 'vmlal.u32','vmlalal.u32',
+
+ 'vmlsl.u8','vmlslal.u8',
+ 'vmlsl.u16','vmlslal.u16',
+ 'vmlsl.u32','vmlslal.u32',
+
+ 'vmull.u8','vmullal.u8',
+ 'vmull.u16','vmullal.u16',
+ 'vmull.u32','vmullal.u32',
+
+ 'vmovl.u8','vmovlal.u8',
+ 'vmovl.u16','vmovlal.u16',
+ 'vmovl.u32','vmovlal.u32',
+
+ 'vshl.u8','vshlal.u8',
+ 'vshl.u16','vshlal.u16',
+ 'vshl.u32','vshlal.u32',
+ 'vshl.u64','vshlal.u64',
+
+ 'vshll.u8','vshllal.u8',
+ 'vshll.u16','vshllal.u16',
+ 'vshll.u32','vshllal.u32',
+
+ 'vshr.u8','vshral.u8',
+ 'vshr.u16','vshral.u16',
+ 'vshr.u32','vshral.u32',
+ 'vshr.u64','vshral.u64',
+
+ 'vsra.u8','vsraal.u8',
+ 'vsra.u16','vsraal.u16',
+ 'vsra.u32','vsraal.u32',
+ 'vsra.u64','vsraal.u64',
+
+ 'vpmax.u8','vpmaxal.u8',
+ 'vpmax.u16','vpmaxal.u16',
+ 'vpmax.u32','vpmaxal.u32',
+
+ 'vpmin.u8','vpminal.u8',
+ 'vpmin.u16','vpminal.u16',
+ 'vpmin.u32','vpminal.u32',
+
+ 'vqadd.u8','vqaddal.u8',
+ 'vqadd.u16','vqaddal.u16',
+ 'vqadd.u32','vqaddal.u32',
+ 'vqadd.u64','vqaddal.u64',
+
+ 'vqsub.u8','vqsubal.u8',
+ 'vqsub.u16','vqsubal.u16',
+ 'vqsub.u32','vqsubal.u32',
+ 'vqsub.u64','vqsubal.u64',
+
+ 'vqmovn.u16','vqmovnal.u16',
+ 'vqmovn.u32','vqmovnal.u32',
+ 'vqmovn.u64','vqmovnal.u64',
+
+ 'vqshl.u8','vqshlal.u8',
+ 'vqshl.u16','vqshlal.u16',
+ 'vqshl.u32','vqshlal.u32',
+ 'vqshl.u64','vqshlal.u64',
+
+ 'vqshrn.u16','vqshrnal.u16',
+ 'vqshrn.u32','vqshrnal.u32',
+ 'vqshrn.u64','vqshrnal.u64',
+
+ 'vqrshl.u8','vqrshlal.u8',
+ 'vqrshl.u16','vqrshlal.u16',
+ 'vqrshl.u32','vqrshlal.u32',
+ 'vqrshl.u64','vqrshlal.u64',
+
+ 'vqrshrn.u16','vqrshrnal.u16',
+ 'vqrshrn.u32','vqrshrnal.u32',
+ 'vqrshrn.u64','vqrshrnal.u64',
+
+ 'vrhadd.u8','vrhaddal.u8',
+ 'vrhadd.u16','vrhaddal.u16',
+ 'vrhadd.u32','vrhaddal.u32',
+
+ 'vrshl.u8','vrshlal.u8',
+ 'vrshl.u16','vrshlal.u16',
+ 'vrshl.u32','vrshlal.u32',
+ 'vrshl.u64','vrshlal.u64',
+
+ 'vrshr.u8','vrshral.u8',
+ 'vrshr.u16','vrshral.u16',
+ 'vrshr.u32','vrshral.u32',
+ 'vrshr.u64','vrshral.u64',
+
+ 'vrsra.u8','vrsraal.u8',
+ 'vrsra.u16','vrsraal.u16',
+ 'vrsra.u32','vrsraal.u32',
+ 'vrsra.u64','vrsraal.u64'
+ ),
+ /* Unconditional VFPv3 & NEON SIMD Floating-Point Instructions */
+ 26 => array(
+ 'vabd.f32','vabdal.f32',
+
+ 'vabs.f32','vabsal.f32',
+ 'vabs.f64','vabsal.f64',
+
+ 'vacge.f32','vacgeal.f32',
+ 'vacgt.f32','vacgtal.f32',
+ 'vacle.f32','vacleal.f32',
+ 'vaclt.f32','vacltal.f32',
+
+ 'vadd.f32','vaddal.f32',
+ 'vadd.f64','vaddal.f64',
+
+ 'vceq.f32','vceqal.f32',
+ 'vcge.f32','vcgeal.f32',
+ 'vcle.f32','vcleal.f32',
+ 'vcgt.f32','vcgtal.f32',
+ 'vclt.f32','vcltal.f32',
+
+ 'vcmp.f32','vcmpal.f32',
+ 'vcmp.f64','vcmpal.f64',
+
+ 'vcmpe.f32','vcmpeal.f32',
+ 'vcmpe.f64','vcmpeal.f64',
+
+ 'vcvt.s16.f32','vcvtal.s16.f32',
+ 'vcvt.s16.f64','vcvtal.s16.f64',
+ 'vcvt.s32.f32','vcvtal.s32.f32',
+ 'vcvt.s32.f64','vcvtal.s32.f64',
+ 'vcvt.u16.f32','vcvtal.u16.f32',
+ 'vcvt.u16.f64','vcvtal.u16.f64',
+ 'vcvt.u32.f32','vcvtal.u32.f32',
+ 'vcvt.u32.f64','vcvtal.u32.f64',
+ 'vcvt.f16.f32','vcvtal.f16.f32',
+ 'vcvt.f32.s32','vcvtal.f32.s32',
+ 'vcvt.f32.u32','vcvtal.f32.u32',
+ 'vcvt.f32.f16','vcvtal.f32.f16',
+ 'vcvt.f32.f64','vcvtal.f32.f64',
+ 'vcvt.f64.s32','vcvtal.f64.s32',
+ 'vcvt.f64.u32','vcvtal.f64.u32',
+ 'vcvt.f64.f32','vcvtal.f64.f32',
+
+ 'vcvtr.s32.f32','vcvtral.s32.f32',
+ 'vcvtr.s32.f64','vcvtral.s32.f64',
+ 'vcvtr.u32.f32','vcvtral.u32.f32',
+ 'vcvtr.u32.f64','vcvtral.u32.f64',
+
+ 'vcvtb.f16.f32','vcvtbal.f16.f32',
+ 'vcvtb.f32.f16','vcvtbal.f32.f16',
+
+ 'vcvtt.f16.f32','vcvttal.f16.f32',
+ 'vcvtt.f32.f16','vcvttal.f32.f16',
+
+ 'vdiv.f32','vdival.f32',
+ 'vdiv.f64','vdival.f64',
+
+ 'vmax.f32','vmaxal.f32',
+ 'vmin.f32','vminal.f32',
+
+ 'vmla.f32','vmlaal.f32',
+ 'vmla.f64','vmlaal.f64',
+
+ 'vmls.f32','vmlsal.f32',
+ 'vmls.f64','vmlsal.f64',
+
+ 'vmul.f32','vmulal.f32',
+ 'vmul.f64','vmulal.f64',
+
+ 'vneg.f32','vnegal.f32',
+ 'vneg.f64','vnegal.f64',
+
+ 'vnmla.f32','vnmlaal.f32',
+ 'vnmla.f64','vnmlaal.f64',
+
+ 'vnmls.f32','vnmlsal.f32',
+ 'vnmls.f64','vnmlsal.f64',
+
+ 'vnmul.f64','vnmulal.f64',
+ 'vnmul.f32','vnmulal.f32',
+
+ 'vpadd.f32','vpaddal.f32',
+
+ 'vpmax.f32','vpmaxal.f32',
+ 'vpmin.f32','vpminal.f32',
+
+ 'vrecpe.u32','vrecpeal.u32',
+ 'vrecpe.f32','vrecpeal.f32',
+ 'vrecps.f32','vrecpsal.f32',
+
+ 'vrsqrte.u32','vrsqrteal.u32',
+ 'vrsqrte.f32','vrsqrteal.f32',
+ 'vrsqrts.f32','vrsqrtsal.f32',
+
+ 'vsqrt.f32','vsqrtal.f32',
+ 'vsqrt.f64','vsqrtal.f64',
+
+ 'vsub.f32','vsubal.f32',
+ 'vsub.f64','vsubal.f64'
+ ),
+ /* Conditional VFPv3 & NEON SIMD Memory Access Instructions */
+ 27 => array(
+ /* Conditional VFPv3 & NEON SIMD Memory Access: Loads */
+ 'vldeq.8','vldne.8','vldcs.8','vldhs.8','vldcc.8','vldlo.8','vldmi.8','vldpl.8','vldvs.8','vldvc.8','vldhi.8','vldls.8','vldge.8','vldlt.8','vldgt.8','vldle.8',
+ 'vldeq.16','vldne.16','vldcs.16','vldhs.16','vldcc.16','vldlo.16','vldmi.16','vldpl.16','vldvs.16','vldvc.16','vldhi.16','vldls.16','vldge.16','vldlt.16','vldgt.16','vldle.16',
+ 'vldeq.32','vldne.32','vldcs.32','vldhs.32','vldcc.32','vldlo.32','vldmi.32','vldpl.32','vldvs.32','vldvc.32','vldhi.32','vldls.32','vldge.32','vldlt.32','vldgt.32','vldle.32',
+ 'vldeq.64','vldne.64','vldcs.64','vldhs.64','vldcc.64','vldlo.64','vldmi.64','vldpl.64','vldvs.64','vldvc.64','vldhi.64','vldls.64','vldge.64','vldlt.64','vldgt.64','vldle.64',
+
+ 'vld1eq.8','vld1ne.8','vld1cs.8','vld1hs.8','vld1cc.8','vld1lo.8','vld1mi.8','vld1pl.8','vld1vs.8','vld1vc.8','vld1hi.8','vld1ls.8','vld1ge.8','vld1lt.8','vld1gt.8','vld1le.8',
+ 'vld1eq.16','vld1ne.16','vld1cs.16','vld1hs.16','vld1cc.16','vld1lo.16','vld1mi.16','vld1pl.16','vld1vs.16','vld1vc.16','vld1hi.16','vld1ls.16','vld1ge.16','vld1lt.16','vld1gt.16','vld1le.16',
+ 'vld1eq.32','vld1ne.32','vld1cs.32','vld1hs.32','vld1cc.32','vld1lo.32','vld1mi.32','vld1pl.32','vld1vs.32','vld1vc.32','vld1hi.32','vld1ls.32','vld1ge.32','vld1lt.32','vld1gt.32','vld1le.32',
+
+ 'vld2eq.8','vld2ne.8','vld2cs.8','vld2hs.8','vld2cc.8','vld2lo.8','vld2mi.8','vld2pl.8','vld2vs.8','vld2vc.8','vld2hi.8','vld2ls.8','vld2ge.8','vld2lt.8','vld2gt.8','vld2le.8',
+ 'vld2eq.16','vld2ne.16','vld2cs.16','vld2hs.16','vld2cc.16','vld2lo.16','vld2mi.16','vld2pl.16','vld2vs.16','vld2vc.16','vld2hi.16','vld2ls.16','vld2ge.16','vld2lt.16','vld2gt.16','vld2le.16',
+ 'vld2eq.32','vld2ne.32','vld2cs.32','vld2hs.32','vld2cc.32','vld2lo.32','vld2mi.32','vld2pl.32','vld2vs.32','vld2vc.32','vld2hi.32','vld2ls.32','vld2ge.32','vld2lt.32','vld2gt.32','vld2le.32',
+
+ 'vld3eq.8','vld3ne.8','vld3cs.8','vld3hs.8','vld3cc.8','vld3lo.8','vld3mi.8','vld3pl.8','vld3vs.8','vld3vc.8','vld3hi.8','vld3ls.8','vld3ge.8','vld3lt.8','vld3gt.8','vld3le.8',
+ 'vld3eq.16','vld3ne.16','vld3cs.16','vld3hs.16','vld3cc.16','vld3lo.16','vld3mi.16','vld3pl.16','vld3vs.16','vld3vc.16','vld3hi.16','vld3ls.16','vld3ge.16','vld3lt.16','vld3gt.16','vld3le.16',
+ 'vld3eq.32','vld3ne.32','vld3cs.32','vld3hs.32','vld3cc.32','vld3lo.32','vld3mi.32','vld3pl.32','vld3vs.32','vld3vc.32','vld3hi.32','vld3ls.32','vld3ge.32','vld3lt.32','vld3gt.32','vld3le.32',
+
+ 'vld4eq.8','vld4ne.8','vld4cs.8','vld4hs.8','vld4cc.8','vld4lo.8','vld4mi.8','vld4pl.8','vld4vs.8','vld4vc.8','vld4hi.8','vld4ls.8','vld4ge.8','vld4lt.8','vld4gt.8','vld4le.8',
+ 'vld4eq.16','vld4ne.16','vld4cs.16','vld4hs.16','vld4cc.16','vld4lo.16','vld4mi.16','vld4pl.16','vld4vs.16','vld4vc.16','vld4hi.16','vld4ls.16','vld4ge.16','vld4lt.16','vld4gt.16','vld4le.16',
+ 'vld4eq.32','vld4ne.32','vld4cs.32','vld4hs.32','vld4cc.32','vld4lo.32','vld4mi.32','vld4pl.32','vld4vs.32','vld4vc.32','vld4hi.32','vld4ls.32','vld4ge.32','vld4lt.32','vld4gt.32','vld4le.32',
+
+ 'vldmeq','vldmne','vldmcs','vldmhs','vldmcc','vldmlo','vldmmi','vldmpl','vldmvs','vldmvc','vldmhi','vldmls','vldmge','vldmlt','vldmgt','vldmle',
+ 'vldmeq.32','vldmne.32','vldmcs.32','vldmhs.32','vldmcc.32','vldmlo.32','vldmmi.32','vldmpl.32','vldmvs.32','vldmvc.32','vldmhi.32','vldmls.32','vldmge.32','vldmlt.32','vldmgt.32','vldmle.32',
+ 'vldmeq.64','vldmne.64','vldmcs.64','vldmhs.64','vldmcc.64','vldmlo.64','vldmmi.64','vldmpl.64','vldmvs.64','vldmvc.64','vldmhi.64','vldmls.64','vldmge.64','vldmlt.64','vldmgt.64','vldmle.64',
+
+ 'vldmiaeq','vldmiane','vldmiacs','vldmiahs','vldmiacc','vldmialo','vldmiami','vldmiapl','vldmiavs','vldmiavc','vldmiahi','vldmials','vldmiage','vldmialt','vldmiagt','vldmiale',
+ 'vldmiaeq.32','vldmiane.32','vldmiacs.32','vldmiahs.32','vldmiacc.32','vldmialo.32','vldmiami.32','vldmiapl.32','vldmiavs.32','vldmiavc.32','vldmiahi.32','vldmials.32','vldmiage.32','vldmialt.32','vldmiagt.32','vldmiale.32',
+ 'vldmiaeq.64','vldmiane.64','vldmiacs.64','vldmiahs.64','vldmiacc.64','vldmialo.64','vldmiami.64','vldmiapl.64','vldmiavs.64','vldmiavc.64','vldmiahi.64','vldmials.64','vldmiage.64','vldmialt.64','vldmiagt.64','vldmiale.64',
+
+ 'vldmdbeq','vldmdbne','vldmdbcs','vldmdbhs','vldmdbcc','vldmdblo','vldmdbmi','vldmdbpl','vldmdbvs','vldmdbvc','vldmdbhi','vldmdbls','vldmdbge','vldmdblt','vldmdbgt','vldmdble',
+ 'vldmdbeq.32','vldmdbne.32','vldmdbcs.32','vldmdbhs.32','vldmdbcc.32','vldmdblo.32','vldmdbmi.32','vldmdbpl.32','vldmdbvs.32','vldmdbvc.32','vldmdbhi.32','vldmdbls.32','vldmdbge.32','vldmdblt.32','vldmdbgt.32','vldmdble.32',
+ 'vldmdbeq.64','vldmdbne.64','vldmdbcs.64','vldmdbhs.64','vldmdbcc.64','vldmdblo.64','vldmdbmi.64','vldmdbpl.64','vldmdbvs.64','vldmdbvc.64','vldmdbhi.64','vldmdbls.64','vldmdbge.64','vldmdblt.64','vldmdbgt.64','vldmdble.64',
+
+ 'vldreq','vldrne','vldrcs','vldrhs','vldrcc','vldrlo','vldrmi','vldrpl','vldrvs','vldrvc','vldrhi','vldrls','vldrge','vldrlt','vldrgt','vldrle',
+ 'vldreq.32','vldrne.32','vldrcs.32','vldrhs.32','vldrcc.32','vldrlo.32','vldrmi.32','vldrpl.32','vldrvs.32','vldrvc.32','vldrhi.32','vldrls.32','vldrge.32','vldrlt.32','vldrgt.32','vldrle.32',
+ 'vldreq.64','vldrne.64','vldrcs.64','vldrhs.64','vldrcc.64','vldrlo.64','vldrmi.64','vldrpl.64','vldrvs.64','vldrvc.64','vldrhi.64','vldrls.64','vldrge.64','vldrlt.64','vldrgt.64','vldrle.64',
+
+ 'vpopeq','vpopne','vpopcs','vpophs','vpopcc','vpoplo','vpopmi','vpoppl','vpopvs','vpopvc','vpophi','vpopls','vpopge','vpoplt','vpopgt','vpople',
+ 'vpopeq.32','vpopne.32','vpopcs.32','vpophs.32','vpopcc.32','vpoplo.32','vpopmi.32','vpoppl.32','vpopvs.32','vpopvc.32','vpophi.32','vpopls.32','vpopge.32','vpoplt.32','vpopgt.32','vpople.32',
+ 'vpopeq.64','vpopne.64','vpopcs.64','vpophs.64','vpopcc.64','vpoplo.64','vpopmi.64','vpoppl.64','vpopvs.64','vpopvc.64','vpophi.64','vpopls.64','vpopge.64','vpoplt.64','vpopgt.64','vpople.64',
+
+ /* Conditional VFPv3 & NEON SIMD Memory Access: Stores */
+ 'vst1eq.8','vst1ne.8','vst1cs.8','vst1hs.8','vst1cc.8','vst1lo.8','vst1mi.8','vst1pl.8','vst1vs.8','vst1vc.8','vst1hi.8','vst1ls.8','vst1ge.8','vst1lt.8','vst1gt.8','vst1le.8',
+ 'vst1eq.16','vst1ne.16','vst1cs.16','vst1hs.16','vst1cc.16','vst1lo.16','vst1mi.16','vst1pl.16','vst1vs.16','vst1vc.16','vst1hi.16','vst1ls.16','vst1ge.16','vst1lt.16','vst1gt.16','vst1le.16',
+ 'vst1eq.32','vst1ne.32','vst1cs.32','vst1hs.32','vst1cc.32','vst1lo.32','vst1mi.32','vst1pl.32','vst1vs.32','vst1vc.32','vst1hi.32','vst1ls.32','vst1ge.32','vst1lt.32','vst1gt.32','vst1le.32',
+ 'vst1eq.64','vst1ne.64','vst1cs.64','vst1hs.64','vst1cc.64','vst1lo.64','vst1mi.64','vst1pl.64','vst1vs.64','vst1vc.64','vst1hi.64','vst1ls.64','vst1ge.64','vst1lt.64','vst1gt.64','vst1le.64',
+
+ 'vst2eq.8','vst2ne.8','vst2cs.8','vst2hs.8','vst2cc.8','vst2lo.8','vst2mi.8','vst2pl.8','vst2vs.8','vst2vc.8','vst2hi.8','vst2ls.8','vst2ge.8','vst2lt.8','vst2gt.8','vst2le.8',
+ 'vst2eq.16','vst2ne.16','vst2cs.16','vst2hs.16','vst2cc.16','vst2lo.16','vst2mi.16','vst2pl.16','vst2vs.16','vst2vc.16','vst2hi.16','vst2ls.16','vst2ge.16','vst2lt.16','vst2gt.16','vst2le.16',
+ 'vst2eq.32','vst2ne.32','vst2cs.32','vst2hs.32','vst2cc.32','vst2lo.32','vst2mi.32','vst2pl.32','vst2vs.32','vst2vc.32','vst2hi.32','vst2ls.32','vst2ge.32','vst2lt.32','vst2gt.32','vst2le.32',
+
+ 'vst3eq.8','vst3ne.8','vst3cs.8','vst3hs.8','vst3cc.8','vst3lo.8','vst3mi.8','vst3pl.8','vst3vs.8','vst3vc.8','vst3hi.8','vst3ls.8','vst3ge.8','vst3lt.8','vst3gt.8','vst3le.8',
+ 'vst3eq.16','vst3ne.16','vst3cs.16','vst3hs.16','vst3cc.16','vst3lo.16','vst3mi.16','vst3pl.16','vst3vs.16','vst3vc.16','vst3hi.16','vst3ls.16','vst3ge.16','vst3lt.16','vst3gt.16','vst3le.16',
+ 'vst3eq.32','vst3ne.32','vst3cs.32','vst3hs.32','vst3cc.32','vst3lo.32','vst3mi.32','vst3pl.32','vst3vs.32','vst3vc.32','vst3hi.32','vst3ls.32','vst3ge.32','vst3lt.32','vst3gt.32','vst3le.32',
+
+ 'vst4eq.8','vst4ne.8','vst4cs.8','vst4hs.8','vst4cc.8','vst4lo.8','vst4mi.8','vst4pl.8','vst4vs.8','vst4vc.8','vst4hi.8','vst4ls.8','vst4ge.8','vst4lt.8','vst4gt.8','vst4le.8',
+ 'vst4eq.16','vst4ne.16','vst4cs.16','vst4hs.16','vst4cc.16','vst4lo.16','vst4mi.16','vst4pl.16','vst4vs.16','vst4vc.16','vst4hi.16','vst4ls.16','vst4ge.16','vst4lt.16','vst4gt.16','vst4le.16',
+ 'vst4eq.32','vst4ne.32','vst4cs.32','vst4hs.32','vst4cc.32','vst4lo.32','vst4mi.32','vst4pl.32','vst4vs.32','vst4vc.32','vst4hi.32','vst4ls.32','vst4ge.32','vst4lt.32','vst4gt.32','vst4le.32',
+