<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress.com" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>

<channel>
	<title>syntaxhighlighting &amp;laquo; WordPress.com Tag Feed</title>
	<link>http://en.wordpress.com/tag/syntaxhighlighting/</link>
	<description>Feed of posts on WordPress.com tagged "syntaxhighlighting"</description>
	<pubDate>Wed, 10 Feb 2010 07:31:33 +0000</pubDate>

	<generator>http://en.wordpress.com/tags/</generator>
	<language>en</language>

<item>
<title><![CDATA[Syntax highlighting with MGrammar]]></title>
<link>http://larsw.wordpress.com/2009/03/31/syntax-highlighting-with-mgrammar/</link>
<pubDate>Tue, 31 Mar 2009 20:37:54 +0000</pubDate>
<dc:creator>larsw</dc:creator>
<guid>http://larsw.wordpress.com/2009/03/31/syntax-highlighting-with-mgrammar/</guid>
<description><![CDATA[Since I started exploring the possibilities of the various bits of codename “Oslo”, there has been o]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Since I started exploring the possibilities of the various bits of codename “Oslo”, there has been one thing that has really annoyed me (and this is not Oslo’s fault). The lack of a decent tool to do syntax highlighting of <em>M</em>, <em>MGrammar</em> &#38; custom DSLs is vital to be able to communicate the intentions of a bit of source code when you blog about it.</p>
<p>Since I’ve been using the bits in <em>System.Dataflow</em> in a couple of projects now, I knew of the existence of the <em>Lexer</em> etc. in the assembly. I started to investigate further with .NET Reflector and found one class that seemed quite relevant for the tool I wanted to write; <em>System.Dataflow.LexerReader</em>. You initialize the <em>LexerReader</em> with a <em>ParserContext</em> and a stream of input data (typically the source code) and iterate over the tokens that the <em>Lexer</em> discover.</p>
<p>So, the basic requirements for the utility I wanted to create were:</p>
<ul>
<li>Take a compiled <em>MGrammar</em> (<em>Mgx</em>) as input. </li>
<li>Take a piece of source code that complies to the MGrammar as input. </li>
<li>Output a HTML fragment with syntax highlighted source code. </li>
</ul>
<p>Since the <em>MGrammar</em> language has a notion of attributes, and more specific; supports the <em>@{Classification}</em> attribute that lets the language developer classify/group the different tokens into <strong>Keywords</strong>, <strong>Literals</strong>, <strong>Strings</strong>, <strong>Numerics</strong> etc., I started digging into the System.Dataflow to hopefully find a mechanism to retrieve the metadata during the Lexing phase.</p>
<p>After some hours of intensive searching with .NET Reflector and the Visual Studio debugger, I found the solution; when you iterate over the <em>LexerReader</em> instance, you end up with <em>ParseTokenReference</em> instances that both describes the token and its content. It doesn’t contain the classification information directly, and that was the big puzzle I had to solve. It turned out that the <em>DynamicParser</em> instance, that I used to load up the <em>Mgx</em> file and build the <em>ParseContext</em> had a <em>GetTokenInfo()</em> method that took an integer as the only parameter; <em>tokenTag</em> – and the <em>ParseTokenReference</em> instance had a .Tag property. Bingo!</p>
<p>So, I’ve put together a small spike that I’m intending to clean up – it’s located <a href="http://github.com/larsw/larsw.msyntaxhighlighter/tree/master" target="_blank">here</a> at the moment and will be licensed under the Apache License.</p>
<p>Below is a sample output&#160; from the utility – the input is a MGrammar that I wrote for a answer to a thread in the Oslo/MSDN forum.</p>
<p>For the first version it will probably be a command line tool – but it would probably be a good idea to create both a ASP.NET frontend and a Windows Live Writer addin for it.</p>
<div style="font-family:consolas, courier, monospace;"><span class="Keyword">module</span> LarsW.Languages     <br /><span class="Delimiter">{</span>     <br />&#160;&#160;&#160; <span class="Keyword">language</span> nnnAuthLang     <br />&#160;&#160;&#160; <span class="Delimiter">{</span>     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="Keyword">syntax</span> Main = ar:AuthRule* =&#62; Rules <span class="Delimiter">{</span>&#160;<span class="Keyword">valuesof</span><span class="Delimiter">(</span>ar<span class="Delimiter">)</span>&#160;<span class="Delimiter">}</span>;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="Keyword">syntax</span> AuthRule = ad:AllowDeny av:AuthVerb     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; tOpenParen rl:RoleList tCloseParen tSemiColon     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; =&#62; AuthRule <span class="Delimiter">{</span> Type <span class="Delimiter">{</span>ad<span class="Delimiter">}</span>, AuthType<span class="Delimiter">{</span>av<span class="Delimiter">}</span>, Roles    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="Delimiter">{</span> <span class="Keyword">valuesof</span><span class="Delimiter">(</span>rl<span class="Delimiter">)</span><span class="Delimiter">}</span>&#160;<span class="Delimiter">}</span>;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="Keyword">syntax</span> RoleList = ri:RoleItem&#160; =&#62; List <span class="Delimiter">{</span> ri <span class="Delimiter">}</span>     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#124; ri:RoleItem tComma rl:RoleList     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; =&#62; List <span class="Delimiter">{</span> ri, <span class="Keyword">valuesof</span><span class="Delimiter">(</span>rl<span class="Delimiter">)</span>&#160;<span class="Delimiter">}</span>;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="Keyword">syntax</span> RoleItem = tRoleName;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="Keyword">syntax</span> AllowDeny = a:tAllow =&#62; a     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#124; d:tDeny =&#62; d;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="Keyword">syntax</span> AuthVerb = tText;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="Keyword">token</span> tText = <span class="Delimiter">(</span><span class="Literal">&#34;a&#34;</span>..<span class="Literal">&#34;z&#34;</span>&#124;<span class="Literal">&#34;A&#34;</span>..<span class="Literal">&#34;Z&#34;</span><span class="Delimiter">)</span>+;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; @{Classification<span class="Delimiter">[</span><span class="Literal">&#34;Keyword&#34;</span><span class="Delimiter">]</span><span class="Delimiter">}</span><span class="Keyword">token</span> tAllow = <span class="Literal">&#34;Allow&#34;</span>;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; @{Classification<span class="Delimiter">[</span><span class="Literal">&#34;Keyword&#34;</span><span class="Delimiter">]</span><span class="Delimiter">}</span><span class="Keyword">token</span> tDeny = <span class="Literal">&#34;Deny&#34;</span>;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="Keyword">token</span> tOpenParen = <span class="Literal">&#34;(&#34;</span>;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="Keyword">token</span> tCloseParen = <span class="Literal">&#34;)&#34;</span>;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="Keyword">token</span> tSemiColon = <span class="Literal">&#34;;&#34;</span>;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="Keyword">token</span> tComma = <span class="Literal">&#34;,&#34;</span>;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="Keyword">token</span> Whitespace = <span class="Literal">&#34; &#34;</span>&#124;<span class="Literal">&#34;\t&#34;</span>&#124;<span class="Literal">&#34;\r&#34;</span>&#124;<span class="Literal">&#34;\n&#34;</span>;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="Keyword">token</span> tRoleName = Language.Grammar.TextLiteral;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="Keyword">interleave</span> Skippable = Whitespace;     <br />&#160;&#160;&#160; <span class="Delimiter">}</span>     <br /><span class="Delimiter">}</span></div>
<p><a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2flarswilhelmsen.com%2f2009%2f03%2f31%2fsyntax-highlighting-with-mgrammar%2f"><img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2flarswilhelmsen.com%2f2009%2f03%2f31%2fsyntax-highlighting-with-mgrammar%2f" border="0" alt="kick it on DotNetKicks.com" /></a></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Typo3 Extension: Quixplorer (t3quixplorer)]]></title>
<link>http://medianetix.wordpress.com/2008/05/31/typo3-extension-quixplorer/</link>
<pubDate>Fri, 30 May 2008 23:50:00 +0000</pubDate>
<dc:creator>kwasizabantu</dc:creator>
<guid>http://medianetix.wordpress.com/2008/05/31/typo3-extension-quixplorer/</guid>
<description><![CDATA[Was phpMyAdmin für die Datenbank ist, das ist der Quixplorer (t3quixplorer) für das Dateisystem. Mit]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Was phpMyAdmin für die Datenbank ist, das ist der Quixplorer (<em>t3quixplorer) </em>für das Dateisystem. Mit seiner Hilfe lassen sich Dateien und Verzeichnisse einsehen, anlegen und löschen. Die Extension ist dem Admin-User vorbehalten.</p>
<p><!--more--></p>
<p><a href="http://blog.medianetix.de/wp-content/uploads/2008/05/ext_t3quixplorer.gif"><img class="alignnone size-medium wp-image-11" src="http://blog.medianetix.de/wp-content/uploads/2008/05/ext_t3quixplorer-300x124.gif" alt="Quixplorer" width="300" height="124" /></a></p>
<p>Die obenstehende Grafik zeigt die verschiedenen Bereiche des Quixplorers:</p>
<p>1) Buttonleiste für Verzeichnisnavigation und Kurzbefehle (von links:)<br />
Verzeichnisebene hoch, Home, aktualisieren, suchen und Kopieren, Verschieben, Löschen, Hochladen, Archivieren.</p>
<p>2a) Verzeichnislisting (Verzeichnisse und Dateien)</p>
<p>2b) Befehle für Verzeichnisse/Dateien (bearbeiten, extrahieren, umbenennen, herunterladen)</p>
<p>3) Bereich zum Anlegen von neuen Dateien oder Verzeichnissen</p>
<p><a href="http://blog.medianetix.de/wp-content/uploads/2008/05/ext_t3quixplorer2.gif"><img class="alignnone size-medium wp-image-12" src="http://blog.medianetix.de/wp-content/uploads/2008/05/ext_t3quixplorer2-300x158.gif" alt="Syntaxhighlighting" width="300" height="158" /></a></p>
<p>Eine grosse Hilfe stellt das Syntaxhighlighting für wichtige Dateitypen dar (PHP, CSS, Smarty, Typoscript, XML, Javascript, HTML, ua.).</p>
</div>]]></content:encoded>
</item>

</channel>
</rss>
