Re: Request For Help: cobra2html via Pygments
Posted: Fri Apr 04, 2008 3:12 pm
The parsing problem with the ">=" you described above is now fixed.
Discussion about the Cobra programming language.
http://cobra-language.com/forums/
# vari is a keyword which can precede an argument type
# if it's easier to just assume it can precede any type, that's fine
# when running Pygments, we can assume the code is valid. we don't need error checking
# so if looser definitions help, by all means take the easy route
def optional(whatTypes as vari String) as IToken?
# a question mark can follow a generic type
var _leftStack as Stack<of Expr>?
# generic types can be nested.
# also true in C# and VB if you need to consult what they did.
# VB also uses "Of" but with parens instead of angle brackets
var _opStackStack as Stack<of Stack<of String>>?
# a typecast to non-nilable can use ! instead of restating the underlying type
return _globalNS to !
# types can be qualified. that's true in C# and VB too so you might see what they do
def makeList(t as System.Collections.IList, u as System.Collections.IList) as System.Collections.IList
# don't know why this errored. The arg list ends on a generic type, but that's not so strange.
def nameForDeclGenericParams(token as IToken, paramList as List<of GenericParam>) as String
# this line had problems at the comma
def commaSepExprs(terminators as IList<of String>, isSpaceAgnostic as bool) as List<of Expr>
$ hg pull
pulling from http://scm.themaniac.org/hg/pygments/
searching for changes
adding changesets
adding manifests
adding file changes
added 8 changesets with 11 changes to 2 files
(run 'hg update' to get a working copy)
$
$ hg update
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
<span class="k">def</span> -----> <span class="nf">init</span><span class="p">(</span><span class="nv">fileName</span> <span class="k">as</span> <span class="n">String</span><span class="p">,</span> <span class="nv">msg</span> <span class="k">as</span> <span class="n">String</span><span class="p">)</span>
<span class="k">base</span><span class="n">.init</span><span class="p">(</span><span class="n">msg</span><span class="p">)</span>
<span class="n">_fileName</span> <span class="o">=</span> <span class="n">fileName</span>
<span class="n">_lineNum</span> <span class="o">=</span> <span class="mi">1</span>
<span class="k">get</span> -----> <span class="py">hasSourceSite</span> <span class="k">as</span> <span class="kt">bool</span> <span class="kd">is</span> <span class="kd">override</span>
<span class="k">return</span> <span class="k">true</span>
./pygmentize -f html -O full,style=colorful -o CobraParser.cobra.html CobraParser.cobra
thousand = 1_0__0___0