diff options
-rw-r--r-- | doc/languages.rst | 1 | ||||
-rw-r--r-- | pygments/lexers/_mapping.py | 1 | ||||
-rw-r--r-- | pygments/lexers/berry.py | 97 | ||||
-rw-r--r-- | tests/examplefiles/berry/berry.be | 405 | ||||
-rw-r--r-- | tests/examplefiles/berry/berry.be.output | 2756 |
5 files changed, 3260 insertions, 0 deletions
diff --git a/doc/languages.rst b/doc/languages.rst index ce8dc1d3..f36d6fdc 100644 --- a/doc/languages.rst +++ b/doc/languages.rst @@ -24,6 +24,7 @@ Programming languages * `BARE <https://baremessages.org/>`_ * `BBC Basic <http://www.bbcbasic.co.uk/bbcbasic.html>`_ * `Befunge <https://github.com/catseye/Befunge-93>`_ +* `Berry <https://github.com/berry-lang/berry>`_ * `BlitzBasic <https://en.wikipedia.org/wiki/Blitz_BASIC>`_ * `Boa <https://boa.cs.iastate.edu/docs/>`_ * `Boo <https://boo-language.github.io/>`_ diff --git a/pygments/lexers/_mapping.py b/pygments/lexers/_mapping.py index 42e5667f..1aa2d146 100644 --- a/pygments/lexers/_mapping.py +++ b/pygments/lexers/_mapping.py @@ -59,6 +59,7 @@ LEXERS = { 'BatchLexer': ('pygments.lexers.shell', 'Batchfile', ('batch', 'bat', 'dosbatch', 'winbatch'), ('*.bat', '*.cmd'), ('application/x-dos-batch',)), 'BddLexer': ('pygments.lexers.bdd', 'Bdd', ('bdd',), ('*.feature',), ('text/x-bdd',)), 'BefungeLexer': ('pygments.lexers.esoteric', 'Befunge', ('befunge',), ('*.befunge',), ('application/x-befunge',)), + 'BerryLexer': ('pygments.lexers.berry', 'Berry', ('berry', 'be'), ('*.be',), ('text/x-berry', 'application/x-berry')), 'BibTeXLexer': ('pygments.lexers.bibtex', 'BibTeX', ('bibtex', 'bib'), ('*.bib',), ('text/x-bibtex',)), 'BlitzBasicLexer': ('pygments.lexers.basic', 'BlitzBasic', ('blitzbasic', 'b3d', 'bplus'), ('*.bb', '*.decls'), ('text/x-bb',)), 'BlitzMaxLexer': ('pygments.lexers.basic', 'BlitzMax', ('blitzmax', 'bmax'), ('*.bmx',), ('text/x-bmx',)), diff --git a/pygments/lexers/berry.py b/pygments/lexers/berry.py new file mode 100644 index 00000000..d7525e98 --- /dev/null +++ b/pygments/lexers/berry.py @@ -0,0 +1,97 @@ +""" + pygments.lexers.berry + ~~~~~~~~~~~~~~~~~~~~~ + + Lexer for Berry. + + :copyright: Copyright 2006-2022 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +import re +from pygments.lexer import RegexLexer, words, default, include, bygroups +from pygments.token import Text, Comment, Whitespace, Operator, Keyword, Name, String, Number, Punctuation + +__all__ = ['BerryLexer'] + +line_re = re.compile('.*?\n') + +class BerryLexer(RegexLexer): + """ + For `berry <http://github.com/berry-lang/berry>`_ source code. + + .. versionadded:: 2.12.0 + """ + name = 'Berry' + aliases = ['berry', 'be'] + filenames = ['*.be'] + mimetypes = ['text/x-berry', 'application/x-berry'] + + _name = r'\b[^\W\d]\w*' + + tokens = { + 'root': [ + include('whitespace'), + include('numbers'), + include('keywords'), + (rf'(def)(\s+)({_name})', bygroups(Keyword.Declaration, Whitespace, Name.Function)), + (rf'\b(class)(\s+)({_name})', bygroups(Keyword.Declaration, Whitespace, Name.Class)), + (rf'\b(import)(\s+)({_name})', bygroups(Keyword.Namespace, Whitespace, Name.Namespace)), + include('expr') + ], + 'expr': [ + (r'[^\S\n]+', Whitespace), + (r'\.\.|[~!%^&*+=|?:<>/-]', Operator), + (r'[(){}\[\],.;]', Punctuation), + include('controls'), + include('builtins'), + include('funccall'), + include('member'), + include('name'), + include('strings') + ], + 'whitespace': [ + (r'\s+', Whitespace), + (r'#-(.|\n)*?-#', Comment.Multiline), + (r'#.*?$', Comment.Single) + ], + 'keywords': [ + (words(( + 'as', 'break', 'continue', 'import', 'static', 'self', 'super'), + suffix=r'\b'), Keyword.Reserved), + (r'(true|false|nil)\b', Keyword.Constant), + (r'(var|def)\b', Keyword.Declaration) + ], + 'controls': [ + (words(( + 'if', 'elif', 'else', 'for', 'while', 'do', 'end', 'break', + 'continue', 'return', 'try', 'except', 'raise'), + suffix=r'\b'), Keyword) + ], + 'builtins': [ + (words(( + 'assert', 'bool', 'input', 'classname', 'classof', 'number', 'real', + 'bytes', 'compile', 'map', 'list', 'int', 'isinstance', 'print', + 'range', 'str', 'super', 'module', 'size', 'issubclass', 'open', + 'file', 'type', 'call'), + suffix=r'\b'), Name.Builtin) + ], + 'numbers': [ + (r'0[xX][a-fA-F0-9]+', Number.Hex), + (r'-?\d+', Number.Integer), + (r'(-?\d+\.?|\.\d)\d*([eE][+-]?\d+)?', Number.Float) + ], + 'name': [ + (_name, Name) + ], + 'funccall': [ + (rf'{_name}(?=\s*\()', Name.Function, '#pop') + ], + 'member': [ + (rf'(?<=\.){_name}\b(?!\()', Name.Attribute, '#pop') + ], + 'strings': [ + (r'"([^\\]|\\.)*?"', String.Double, '#pop'), + (r'\'([^\\]|\\.)*?\'', String.Single, '#pop') + ] + } diff --git a/tests/examplefiles/berry/berry.be b/tests/examplefiles/berry/berry.be new file mode 100644 index 00000000..88225785 --- /dev/null +++ b/tests/examplefiles/berry/berry.be @@ -0,0 +1,405 @@ +# +# single line comment +var a = "test" # inline comment + # single line comment +#- multi line comment on single line -# +#- + comment line 1 + comment line 2 +-# +#-------------------- + comment line 1 + comment line 2 +--------------------# +#-------------------- +# comment line 1 +# comment line 2 +#--------------------# + +var hex_num = 0xFF +var int_num = 30, neg_integer = -23 +var real_num = 3.1e-3 + +import string as mystring + +class my_parent_class end + +class my_static_class: my_parent_class + var param1, param2 + static param = nil + static param3 = "string" + static param4 = 'string\n' + static def func1(s) + print(mystring.format("hello %s", str(s))) + print(s) + end + def init(param) + assert(param != nil) + var temp1 = isinstance(param, map) + var temp2 = type(param) == 'string' ? true : false + super(self).init() + self.param1 = param + self.param2 = / a b c d e-> [ + int(a), + bool(b), + real(c), + range(3,6), + (3..6), + map(), + {d: e}, + size(e) + ] + end +end + +# anonymous function and closure +def count(x) + var arr = [] + for i : 0 .. x + arr.push( + def (n) # loop variable cannot be used directly as free variable + return def () + return n * n + end + end (i) # define and call anonymous function + ) + end + return arr +end + +def definitive(s) + return s +end + +print(definitive ('test')) + +for xx : count(6) + print(xx()) # 0, 1, 4 ... n * n +end + +return count + + +import time + +c = time.clock() +do + i = 0 + while i < 100000000 + i += 1 + end +end +print('while iteration 100000000 times', time.clock() - c, 's') + +c = time.clock() +for i : 1 .. 100000000 +end +print('for iteration 100000000 times', time.clock() - c, 's') + +class node + var v, l, r + def init(v, l, r) + self.v = v + self.l = l + self.r = r + end + def insert(v) + if v < self.v + if self.l + self.l.insert(v) + else + self.l = node(v) + end + else + if self.r + self.r.insert(v) + else + self.r = node (v) + end + end + end + def sort(l) + if (self.l) self.l.sort(l) end + l.push(self.v) + if (self.r) self.r.sort(l) end + end +end + +class btree + var root + def insert(v) + if self.root + self.root.insert(v) + else + self.root = node(v) + end + end + def sort() + var l = [] + if self.root + self.root.sort(l) + end + return l + end +end + +var tree = btree() +tree.insert(-100) +tree.insert(5); +tree.insert(3); +tree.insert(9); +tree.insert(10); +tree.insert(10000000); +tree.insert(1); +tree.insert(-1); +tree.insert(-10); +print(tree.sort()); + +def cpi(n) + i = 2 + pi = 3 + while i <= n + term = 4.0 / (i * (i + 1) * (i + 2)) + if i % 4 + pi = pi + term + else + pi = pi - term + end + i = i + 2 + end + return pi +end + +print("pi =", cpi(100)) + +import debug + +def test_func() + try + compile('def +() end')() + except .. as e, v + print('catch execption:', str(e) + ' >>>\n ' + str(v)) + debug.traceback() + end +end + +test_func() + +import time + +def fib(x) + if x <= 2 + return 1 + end + return fib(x - 1) + fib(x - 2) +end + +c = time.clock() +print("fib:", fib(38)) # minimum stack size: 78!! +print("time:", time.clock() - c, 's') + +import time +import math + +math.srand(time.time()) +res = math.rand() % 100 +max_test = 7 +test = -1 +idx = 1 +print('Guess a number between 0 and 99. You have', max_test, 'chances.') +while test != res && idx <= max_test + test = number(input(str(idx) + ': enter the number you guessed: ')) + if type(test) != 'int' + print('This is not an integer. Continue!') + continue + elif test > res + print('This number is too large.') + elif test < res + print('This number is too small.') + end + idx = idx + 1 +end +if test == res + print('You win!') +else + print('You failed, the correct answer is', res) +end + +import json +print(json.load('{"key": "value"}')) +print(json.dump({'test key': nil})) +print(json.dump({'key1': nil, 45: true}, 'format')) + +# simple lambda example +print((/a b c-> a * b + c)(2, 3, 4)) + +# Y-Combinator and factorial functions +Y = /f-> (/x-> f(/n-> x(x)(n)))(/x-> f(/n-> x(x)(n))) +F = /f-> /x-> x ? f(x - 1) * x : 1 +fact = Y(F) +print('fact(10) == ' .. fact(10)) + +import os + +def scandir(path) + print('path: ' + path) + for name : os.listdir(path) + var fullname = os.path.join(path, name) + if os.path.isfile(fullname) + print('file: ' + fullname) + else + print('path: ' + fullname) + scandir(fullname) + end + end +end + +scandir('.') + +def qsort(data) + # do once sort + def once(left, right) + var pivot = data[left] # use the 0th value as the pivot + while left < right # check if sort is complete + # put the value less than the pivot to the left + while left < right && data[right] >= pivot + right -= 1 # skip values greater than pivot + end + data[left] = data[right] + # put the value greater than the pivot on the right + while left < right && data[left] <= pivot + left += 1 # skip values less than pivot + end + data[right] = data[left] + end + # now we have the index of the pivot, store it + data[left] = pivot + return left # return the index of the pivot + end + # recursive quick sort algorithm + def _sort(left, right) + if left < right # executed when the array is not empty + var index = once(left, right) # get index of pivot for divide and conquer + _sort(left, index - 1) # sort the data on the left + _sort(index + 1, right) # sort the data on the right + end + end + # start quick sort + _sort(0, data.size() - 1) + return data +end + +import time, math +math.srand(time.time()) # sse system time as a random seed +data = [] +# put 20 random numbers into the array +for i : 1 .. 20 + data.push(math.rand() % 100) +end +# sort and print +print(qsort(data)) + +do + def ismult(msg) + import string + return string.split(msg, -5)[1] == '\'EOS\'' + end + + def multline(src, msg) + if !ismult(msg) + print('syntax_error: ' + msg) + return + end + while true + try + src += '\n' + input('>> ') + return compile(src) + except 'syntax_error' as e, m + if !ismult(m) + print('syntax_error: ' + m) + return + end + end + end + end + + def parse() + var fun, src = input('> ') + try + fun = compile('return (' + src + ')') + except 'syntax_error' as e, m + try + fun = compile(src) + except 'syntax_error' as e, m + fun = multline(src, m) + end + end + return fun + end + + def run(fun) + try + var res = fun() + if res print(res) end + except .. as e, m + import debug + print(e .. ': ' .. m) + debug.traceback() + end + end + + def repl() + while true + var fun = parse() + if fun != nil + run(fun) + end + end + end + + print("Berry Berry REPL!") + repl() +end + +s = "This is a long string test. 0123456789 abcdefg ABCDEFG" +print(s) + +a = .5 +print(a) + +import string as s + +print(s.hex(0x45678ABCD, 16)) + +def bin(x, num) + assert(type(x) == 'int', 'the type of \'x\' must be integer') + # test the 'x' bits + var bits = 1 + for i : 0 .. 62 + if x & (1 << 63 - i) + bits = 64 - i + break + end + end + if type(num) == 'int' && num > 0 && num <= 64 + bits = bits < num ? num : bits + end + var result = '' + bits -= 1 + for i : 0 .. bits + result += x & (1 << (bits - i)) ? '1' : '0' + end + return result +end + +print(bin(33)) + +import string + +print(string.format('%.3d', 12)) +print(string.format('%.3f', 12)) +print(string.format('%20.7f', 14.5)) +print(string.format('-- %-40s ---', 'this is a string format test')) +print(string.format('-- %40s ---', 'this is a string format test')) + +#
\ No newline at end of file diff --git a/tests/examplefiles/berry/berry.be.output b/tests/examplefiles/berry/berry.be.output new file mode 100644 index 00000000..d7dc7b1f --- /dev/null +++ b/tests/examplefiles/berry/berry.be.output @@ -0,0 +1,2756 @@ +'#' Comment.Single +'\n' Text.Whitespace + +'# single line comment' Comment.Single +'\n' Text.Whitespace + +'var' Keyword.Declaration +' ' Text.Whitespace +'a' Name +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'"test"' Literal.String.Double +' ' Text.Whitespace +'# inline comment' Comment.Single +'\n ' Text.Whitespace +'# single line comment' Comment.Single +'\n' Text.Whitespace + +'#- multi line comment on single line -#' Comment.Multiline +'\n' Text.Whitespace + +'#- \n comment line 1\n comment line 2\n-#' Comment.Multiline +'\n' Text.Whitespace + +'#--------------------\n comment line 1\n comment line 2\n--------------------#' Comment.Multiline +'\n' Text.Whitespace + +'#--------------------\n# comment line 1\n# comment line 2\n#--------------------#' Comment.Multiline +'\n\n' Text.Whitespace + +'var' Keyword.Declaration +' ' Text.Whitespace +'hex_num' Name +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'0xFF' Literal.Number.Hex +'\n' Text.Whitespace + +'var' Keyword.Declaration +' ' Text.Whitespace +'int_num' Name +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'30' Literal.Number.Integer +',' Punctuation +' ' Text.Whitespace +'neg_integer' Name +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'-23' Literal.Number.Integer +'\n' Text.Whitespace + +'var' Keyword.Declaration +' ' Text.Whitespace +'real_num' Name +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'3' Literal.Number.Integer +'.1e-3' Literal.Number.Float +'\n\n' Text.Whitespace + +'import' Keyword.Reserved +' ' Text.Whitespace +'string' Name +' ' Text.Whitespace +'as' Keyword.Reserved +' ' Text.Whitespace +'mystring' Name +'\n\n' Text.Whitespace + +'class' Keyword.Declaration +' ' Text.Whitespace +'my_parent_class' Name.Class +' ' Text.Whitespace +'end' Keyword +'\n\n' Text.Whitespace + +'class' Keyword.Declaration +' ' Text.Whitespace +'my_static_class' Name.Class +':' Operator +' ' Text.Whitespace +'my_parent_class' Name +'\n ' Text.Whitespace +'var' Keyword.Declaration +' ' Text.Whitespace +'param1' Name +',' Punctuation +' ' Text.Whitespace +'param2' Name +'\n ' Text.Whitespace +'static' Keyword.Reserved +' ' Text.Whitespace +'param' Name +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'nil' Keyword.Constant +'\n ' Text.Whitespace +'static' Keyword.Reserved +' ' Text.Whitespace +'param3' Name +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'"string"' Literal.String.Double +'\n ' Text.Whitespace +'static' Keyword.Reserved +' ' Text.Whitespace +'param4' Name +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +"'string\\n'" Literal.String.Single +'\n ' Text.Whitespace +'static' Keyword.Reserved +' ' Text.Whitespace +'def' Keyword.Declaration +' ' Text.Whitespace +'func1' Name.Function +'(' Punctuation +'s' Name +')' Punctuation +'\n ' Text.Whitespace +'print' Name.Builtin +'(' Punctuation +'mystring' Name +'.' Punctuation +'format' Name.Function +'(' Punctuation +'"hello %s"' Literal.String.Double +',' Punctuation +' ' Text.Whitespace +'str' Name.Builtin +'(' Punctuation +'s' Name +')' Punctuation +')' Punctuation +')' Punctuation +'\n ' Text.Whitespace +'print' Name.Builtin +'(' Punctuation +'s' Name +')' Punctuation +'\n ' Text.Whitespace +'end' Keyword +'\n ' Text.Whitespace +'def' Keyword.Declaration +' ' Text.Whitespace +'init' Name.Function +'(' Punctuation +'param' Name +')' Punctuation +'\n ' Text.Whitespace +'assert' Name.Builtin +'(' Punctuation +'param' Name +' ' Text.Whitespace +'!' Operator +'=' Operator +' ' Text.Whitespace +'nil' Keyword.Constant +')' Punctuation +'\n ' Text.Whitespace +'var' Keyword.Declaration +' ' Text.Whitespace +'temp1' Name +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'isinstance' Name.Builtin +'(' Punctuation +'param' Name +',' Punctuation +' ' Text.Whitespace +'map' Name.Builtin +')' Punctuation +'\n ' Text.Whitespace +'var' Keyword.Declaration +' ' Text.Whitespace +'temp2' Name +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'type' Name.Builtin +'(' Punctuation +'param' Name +')' Punctuation +' ' Text.Whitespace +'=' Operator +'=' Operator +' ' Text.Whitespace +"'string'" Literal.String.Single +' ' Text.Whitespace +'?' Operator +' ' Text.Whitespace +'true' Keyword.Constant +' ' Text.Whitespace +':' Operator +' ' Text.Whitespace +'false' Keyword.Constant +'\n ' Text.Whitespace +'super' Keyword.Reserved +'(' Punctuation +'self' Keyword.Reserved +')' Punctuation +'.' Punctuation +'init' Name.Function +'(' Punctuation +')' Punctuation +'\n ' Text.Whitespace +'self' Keyword.Reserved +'.' Punctuation +'param1' Name.Attribute +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'param' Name +'\n ' Text.Whitespace +'self' Keyword.Reserved +'.' Punctuation +'param2' Name.Attribute +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'/' Operator +' ' Text.Whitespace +'a' Name +' ' Text.Whitespace +'b' Name +' ' Text.Whitespace +'c' Name +' ' Text.Whitespace +'d' Name +' ' Text.Whitespace +'e' Name +'-' Operator +'>' Operator +' ' Text.Whitespace +'[' Punctuation +'\n ' Text.Whitespace +'int' Name.Builtin +'(' Punctuation +'a' Name +')' Punctuation +',' Punctuation +' \n ' Text.Whitespace +'bool' Name.Builtin +'(' Punctuation +'b' Name +')' Punctuation +',' Punctuation +' \n ' Text.Whitespace +'real' Name.Builtin +'(' Punctuation +'c' Name +')' Punctuation +',' Punctuation +' \n ' Text.Whitespace +'range' Name.Builtin +'(' Punctuation +'3' Literal.Number.Integer +',' Punctuation +'6' Literal.Number.Integer +')' Punctuation +',' Punctuation +'\n ' Text.Whitespace +'(' Punctuation +'3' Literal.Number.Integer +'..' Operator +'6' Literal.Number.Integer +')' Punctuation +',' Punctuation +'\n ' Text.Whitespace +'map' Name.Builtin +'(' Punctuation +')' Punctuation +',' Punctuation +'\n ' Text.Whitespace +'{' Punctuation +'d' Name +':' Operator +' ' Text.Whitespace +'e' Name +'}' Punctuation +',' Punctuation +'\n ' Text.Whitespace +'size' Name.Builtin +'(' Punctuation +'e' Name +')' Punctuation +'\n ' Text.Whitespace +']' Punctuation +'\n ' Text.Whitespace +'end' Keyword +'\n' Text.Whitespace + +'end' Keyword +'\n\n' Text.Whitespace + +'# anonymous function and closure' Comment.Single +'\n' Text.Whitespace + +'def' Keyword.Declaration +' ' Text.Whitespace +'count' Name.Function +'(' Punctuation +'x' Name +')' Punctuation +'\n ' Text.Whitespace +'var' Keyword.Declaration +' ' Text.Whitespace +'arr' Name +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'[' Punctuation +']' Punctuation +'\n ' Text.Whitespace +'for' Keyword +' ' Text.Whitespace +'i' Name +' ' Text.Whitespace +':' Operator +' ' Text.Whitespace +'0' Literal.Number.Integer +' ' Text.Whitespace +'..' Operator +' ' Text.Whitespace +'x' Name +'\n ' Text.Whitespace +'arr' Name +'.' Punctuation +'push' Name.Function +'(' Punctuation +'\n ' Text.Whitespace +'def' Keyword.Declaration +' ' Text.Whitespace +'(' Punctuation +'n' Name +')' Punctuation +' ' Text.Whitespace +'# loop variable cannot be used directly as free variable' Comment.Single +'\n ' Text.Whitespace +'return' Keyword +' ' Text.Whitespace +'def' Keyword.Declaration +' ' Text.Whitespace +'(' Punctuation +')' Punctuation +'\n ' Text.Whitespace +'return' Keyword +' ' Text.Whitespace +'n' Name +' ' Text.Whitespace +'*' Operator +' ' Text.Whitespace +'n' Name +'\n ' Text.Whitespace +'end' Keyword +'\n ' Text.Whitespace +'end' Keyword +' ' Text.Whitespace +'(' Punctuation +'i' Name +')' Punctuation +' ' Text.Whitespace +'# define and call anonymous function' Comment.Single +'\n ' Text.Whitespace +')' Punctuation +'\n ' Text.Whitespace +'end' Keyword +'\n ' Text.Whitespace +'return' Keyword +' ' Text.Whitespace +'arr' Name +'\n' Text.Whitespace + +'end' Keyword +'\n\n' Text.Whitespace + +'def' Keyword.Declaration +' ' Text.Whitespace +'definitive' Name.Function +'(' Punctuation +'s' Name +')' Punctuation +'\n ' Text.Whitespace +'return' Keyword +' ' Text.Whitespace +'s' Name +'\n' Text.Whitespace + +'end' Keyword +'\n\n' Text.Whitespace + +'print' Name.Builtin +'(' Punctuation +'definitive' Name.Function +' ' Text.Whitespace +'(' Punctuation +"'test'" Literal.String.Single +')' Punctuation +')' Punctuation +'\n\n' Text.Whitespace + +'for' Keyword +' ' Text.Whitespace +'xx' Name +' ' Text.Whitespace +':' Operator +' ' Text.Whitespace +'count' Name.Function +'(' Punctuation +'6' Literal.Number.Integer +')' Punctuation +'\n ' Text.Whitespace +'print' Name.Builtin +'(' Punctuation +'xx' Name.Function +'(' Punctuation +')' Punctuation +')' Punctuation +' ' Text.Whitespace +'# 0, 1, 4 ... n * n' Comment.Single +'\n' Text.Whitespace + +'end' Keyword +'\n\n' Text.Whitespace + +'return' Keyword +' ' Text.Whitespace +'count' Name +'\n\n\n' Text.Whitespace + +'import' Keyword.Reserved +' ' Text.Whitespace +'time' Name +'\n\n' Text.Whitespace + +'c' Name +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'time' Name +'.' Punctuation +'clock' Name.Function +'(' Punctuation +')' Punctuation +'\n' Text.Whitespace + +'do' Keyword +'\n ' Text.Whitespace +'i' Name +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'0' Literal.Number.Integer +'\n ' Text.Whitespace +'while' Keyword +' ' Text.Whitespace +'i' Name +' ' Text.Whitespace +'<' Operator +' ' Text.Whitespace +'100000000' Literal.Number.Integer +'\n ' Text.Whitespace +'i' Name +' ' Text.Whitespace +'+' Operator +'=' Operator +' ' Text.Whitespace +'1' Literal.Number.Integer +'\n ' Text.Whitespace +'end' Keyword +'\n' Text.Whitespace + +'end' Keyword +'\n' Text.Whitespace + +'print' Name.Builtin +'(' Punctuation +"'while iteration 100000000 times'" Literal.String.Single +',' Punctuation +' ' Text.Whitespace +'time' Name +'.' Punctuation +'clock' Name.Function +'(' Punctuation +')' Punctuation +' ' Text.Whitespace +'-' Operator +' ' Text.Whitespace +'c' Name +',' Punctuation +' ' Text.Whitespace +"'s'" Literal.String.Single +')' Punctuation +'\n\n' Text.Whitespace + +'c' Name +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'time' Name +'.' Punctuation +'clock' Name.Function +'(' Punctuation +')' Punctuation +'\n' Text.Whitespace + +'for' Keyword +' ' Text.Whitespace +'i' Name +' ' Text.Whitespace +':' Operator +' ' Text.Whitespace +'1' Literal.Number.Integer +' ' Text.Whitespace +'..' Operator +' ' Text.Whitespace +'100000000' Literal.Number.Integer +'\n' Text.Whitespace + +'end' Keyword +'\n' Text.Whitespace + +'print' Name.Builtin +'(' Punctuation +"'for iteration 100000000 times'" Literal.String.Single +',' Punctuation +' ' Text.Whitespace +'time' Name +'.' Punctuation +'clock' Name.Function +'(' Punctuation +')' Punctuation +' ' Text.Whitespace +'-' Operator +' ' Text.Whitespace +'c' Name +',' Punctuation +' ' Text.Whitespace +"'s'" Literal.String.Single +')' Punctuation +'\n\n' Text.Whitespace + +'class' Keyword.Declaration +' ' Text.Whitespace +'node' Name.Class +'\n ' Text.Whitespace +'var' Keyword.Declaration +' ' Text.Whitespace +'v' Name +',' Punctuation +' ' Text.Whitespace +'l' Name +',' Punctuation +' ' Text.Whitespace +'r' Name +'\n ' Text.Whitespace +'def' Keyword.Declaration +' ' Text.Whitespace +'init' Name.Function +'(' Punctuation +'v' Name +',' Punctuation +' ' Text.Whitespace +'l' Name +',' Punctuation +' ' Text.Whitespace +'r' Name +')' Punctuation +'\n ' Text.Whitespace +'self' Keyword.Reserved +'.' Punctuation +'v' Name.Attribute +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'v' Name +'\n ' Text.Whitespace +'self' Keyword.Reserved +'.' Punctuation +'l' Name.Attribute +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'l' Name +'\n ' Text.Whitespace +'self' Keyword.Reserved +'.' Punctuation +'r' Name.Attribute +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'r' Name +'\n ' Text.Whitespace +'end' Keyword +'\n ' Text.Whitespace +'def' Keyword.Declaration +' ' Text.Whitespace +'insert' Name.Function +'(' Punctuation +'v' Name +')' Punctuation +'\n ' Text.Whitespace +'if' Keyword +' ' Text.Whitespace +'v' Name +' ' Text.Whitespace +'<' Operator +' ' Text.Whitespace +'self' Keyword.Reserved +'.' Punctuation +'v' Name.Attribute +'\n ' Text.Whitespace +'if' Keyword +' ' Text.Whitespace +'self' Keyword.Reserved +'.' Punctuation +'l' Name.Attribute +'\n ' Text.Whitespace +'self' Keyword.Reserved +'.' Punctuation +'l' Name.Attribute +'.' Punctuation +'insert' Name.Function +'(' Punctuation +'v' Name +')' Punctuation +'\n ' Text.Whitespace +'else' Keyword +'\n ' Text.Whitespace +'self' Keyword.Reserved +'.' Punctuation +'l' Name.Attribute +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'node' Name.Function +'(' Punctuation +'v' Name +')' Punctuation +'\n ' Text.Whitespace +'end' Keyword +'\n ' Text.Whitespace +'else' Keyword +'\n ' Text.Whitespace +'if' Keyword +' ' Text.Whitespace +'self' Keyword.Reserved +'.' Punctuation +'r' Name.Attribute +'\n ' Text.Whitespace +'self' Keyword.Reserved +'.' Punctuation +'r' Name.Attribute +'.' Punctuation +'insert' Name.Function +'(' Punctuation +'v' Name +')' Punctuation +'\n ' Text.Whitespace +'else' Keyword +'\n ' Text.Whitespace +'self' Keyword.Reserved +'.' Punctuation +'r' Name.Attribute +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'node' Name.Function +' ' Text.Whitespace +'(' Punctuation +'v' Name +')' Punctuation +'\n ' Text.Whitespace +'end' Keyword +'\n ' Text.Whitespace +'end' Keyword +'\n ' Text.Whitespace +'end' Keyword +'\n ' Text.Whitespace +'def' Keyword.Declaration +' ' Text.Whitespace +'sort' Name.Function +'(' Punctuation +'l' Name +')' Punctuation +'\n ' Text.Whitespace +'if' Keyword +' ' Text.Whitespace +'(' Punctuation +'self' Keyword.Reserved +'.' Punctuation +'l' Name.Attribute +')' Punctuation +' ' Text.Whitespace +'self' Keyword.Reserved +'.' Punctuation +'l' Name.Attribute +'.' Punctuation +'sort' Name.Function +'(' Punctuation +'l' Name +')' Punctuation +' ' Text.Whitespace +'end' Keyword +'\n ' Text.Whitespace +'l' Name +'.' Punctuation +'push' Name.Function +'(' Punctuation +'self' Keyword.Reserved +'.' Punctuation +'v' Name.Attribute +')' Punctuation +'\n ' Text.Whitespace +'if' Keyword +' ' Text.Whitespace +'(' Punctuation +'self' Keyword.Reserved +'.' Punctuation +'r' Name.Attribute +')' Punctuation +' ' Text.Whitespace +'self' Keyword.Reserved +'.' Punctuation +'r' Name.Attribute +'.' Punctuation +'sort' Name.Function +'(' Punctuation +'l' Name +')' Punctuation +' ' Text.Whitespace +'end' Keyword +'\n ' Text.Whitespace +'end' Keyword +'\n' Text.Whitespace + +'end' Keyword +'\n\n' Text.Whitespace + +'class' Keyword.Declaration +' ' Text.Whitespace +'btree' Name.Class +'\n ' Text.Whitespace +'var' Keyword.Declaration +' ' Text.Whitespace +'root' Name +'\n ' Text.Whitespace +'def' Keyword.Declaration +' ' Text.Whitespace +'insert' Name.Function +'(' Punctuation +'v' Name +')' Punctuation +'\n ' Text.Whitespace +'if' Keyword +' ' Text.Whitespace +'self' Keyword.Reserved +'.' Punctuation +'root' Name.Attribute +'\n ' Text.Whitespace +'self' Keyword.Reserved +'.' Punctuation +'root' Name.Attribute +'.' Punctuation +'insert' Name.Function +'(' Punctuation +'v' Name +')' Punctuation +'\n ' Text.Whitespace +'else' Keyword +'\n ' Text.Whitespace +'self' Keyword.Reserved +'.' Punctuation +'root' Name.Attribute +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'node' Name.Function +'(' Punctuation +'v' Name +')' Punctuation +'\n ' Text.Whitespace +'end' Keyword +'\n ' Text.Whitespace +'end' Keyword +'\n ' Text.Whitespace +'def' Keyword.Declaration +' ' Text.Whitespace +'sort' Name.Function +'(' Punctuation +')' Punctuation +'\n ' Text.Whitespace +'var' Keyword.Declaration +' ' Text.Whitespace +'l' Name +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'[' Punctuation +']' Punctuation +'\n ' Text.Whitespace +'if' Keyword +' ' Text.Whitespace +'self' Keyword.Reserved +'.' Punctuation +'root' Name.Attribute +'\n ' Text.Whitespace +'self' Keyword.Reserved +'.' Punctuation +'root' Name.Attribute +'.' Punctuation +'sort' Name.Function +'(' Punctuation +'l' Name +')' Punctuation +'\n ' Text.Whitespace +'end' Keyword +'\n ' Text.Whitespace +'return' Keyword +' ' Text.Whitespace +'l' Name +'\n ' Text.Whitespace +'end' Keyword +'\n' Text.Whitespace + +'end' Keyword +'\n\n' Text.Whitespace + +'var' Keyword.Declaration +' ' Text.Whitespace +'tree' Name +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'btree' Name.Function +'(' Punctuation +')' Punctuation +'\n' Text.Whitespace + +'tree' Name +'.' Punctuation +'insert' Name.Function +'(' Punctuation +'-100' Literal.Number.Integer +')' Punctuation +'\n' Text.Whitespace + +'tree' Name +'.' Punctuation +'insert' Name.Function +'(' Punctuation +'5' Literal.Number.Integer +')' Punctuation +';' Punctuation +'\n' Text.Whitespace + +'tree' Name +'.' Punctuation +'insert' Name.Function +'(' Punctuation +'3' Literal.Number.Integer +')' Punctuation +';' Punctuation +'\n' Text.Whitespace + +'tree' Name +'.' Punctuation +'insert' Name.Function +'(' Punctuation +'9' Literal.Number.Integer +')' Punctuation +';' Punctuation +'\n' Text.Whitespace + +'tree' Name +'.' Punctuation +'insert' Name.Function +'(' Punctuation +'10' Literal.Number.Integer +')' Punctuation +';' Punctuation +'\n' Text.Whitespace + +'tree' Name +'.' Punctuation +'insert' Name.Function +'(' Punctuation +'10000000' Literal.Number.Integer +')' Punctuation +';' Punctuation +'\n' Text.Whitespace + +'tree' Name +'.' Punctuation +'insert' Name.Function +'(' Punctuation +'1' Literal.Number.Integer +')' Punctuation +';' Punctuation +'\n' Text.Whitespace + +'tree' Name +'.' Punctuation +'insert' Name.Function +'(' Punctuation +'-1' Literal.Number.Integer +')' Punctuation +';' Punctuation +'\n' Text.Whitespace + +'tree' Name +'.' Punctuation +'insert' Name.Function +'(' Punctuation +'-10' Literal.Number.Integer +')' Punctuation +';' Punctuation +'\n' Text.Whitespace + +'print' Name.Builtin +'(' Punctuation +'tree' Name +'.' Punctuation +'sort' Name.Function +'(' Punctuation +')' Punctuation +')' Punctuation +';' Punctuation +'\n\n' Text.Whitespace + +'def' Keyword.Declaration +' ' Text.Whitespace +'cpi' Name.Function +'(' Punctuation +'n' Name +')' Punctuation +'\n ' Text.Whitespace +'i' Name +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'2' Literal.Number.Integer +'\n ' Text.Whitespace +'pi' Name +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'3' Literal.Number.Integer +'\n ' Text.Whitespace +'while' Keyword +' ' Text.Whitespace +'i' Name +' ' Text.Whitespace +'<' Operator +'=' Operator +' ' Text.Whitespace +'n' Name +'\n ' Text.Whitespace +'term' Name +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'4' Literal.Number.Integer +'.0' Literal.Number.Float +' ' Text.Whitespace +'/' Operator +' ' Text.Whitespace +'(' Punctuation +'i' Name +' ' Text.Whitespace +'*' Operator +' ' Text.Whitespace +'(' Punctuation +'i' Name +' ' Text.Whitespace +'+' Operator +' ' Text.Whitespace +'1' Literal.Number.Integer +')' Punctuation +' ' Text.Whitespace +'*' Operator +' ' Text.Whitespace +'(' Punctuation +'i' Name +' ' Text.Whitespace +'+' Operator +' ' Text.Whitespace +'2' Literal.Number.Integer +')' Punctuation +')' Punctuation +'\n ' Text.Whitespace +'if' Keyword +' ' Text.Whitespace +'i' Name +' ' Text.Whitespace +'%' Operator +' ' Text.Whitespace +'4' Literal.Number.Integer +'\n ' Text.Whitespace +'pi' Name +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'pi' Name +' ' Text.Whitespace +'+' Operator +' ' Text.Whitespace +'term' Name +'\n ' Text.Whitespace +'else' Keyword +'\n ' Text.Whitespace +'pi' Name +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'pi' Name +' ' Text.Whitespace +'-' Operator +' ' Text.Whitespace +'term' Name +'\n ' Text.Whitespace +'end' Keyword +'\n ' Text.Whitespace +'i' Name +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'i' Name +' ' Text.Whitespace +'+' Operator +' ' Text.Whitespace +'2' Literal.Number.Integer +'\n ' Text.Whitespace +'end' Keyword +'\n ' Text.Whitespace +'return' Keyword +' ' Text.Whitespace +'pi' Name +'\n' Text.Whitespace + +'end' Keyword +'\n\n' Text.Whitespace + +'print' Name.Builtin +'(' Punctuation +'"pi ="' Literal.String.Double +',' Punctuation +' ' Text.Whitespace +'cpi' Name.Function +'(' Punctuation +'100' Literal.Number.Integer +')' Punctuation +')' Punctuation +'\n\n' Text.Whitespace + +'import' Keyword.Reserved +' ' Text.Whitespace +'debug' Name +'\n\n' Text.Whitespace + +'def' Keyword.Declaration +' ' Text.Whitespace +'test_func' Name.Function +'(' Punctuation +')' Punctuation +'\n ' Text.Whitespace +'try' Keyword +'\n ' Text.Whitespace +'compile' Name.Builtin +'(' Punctuation +"'def +() end'" Literal.String.Single +')' Punctuation +'(' Punctuation +')' Punctuation +'\n ' Text.Whitespace +'except' Keyword +' ' Text.Whitespace +'..' Operator +' ' Text.Whitespace +'as' Keyword.Reserved +' ' Text.Whitespace +'e' Name +',' Punctuation +' ' Text.Whitespace +'v' Name +'\n ' Text.Whitespace +'print' Name.Builtin +'(' Punctuation +"'catch execption:'" Literal.String.Single +',' Punctuation +' ' Text.Whitespace +'str' Name.Builtin +'(' Punctuation +'e' Name +')' Punctuation +' ' Text.Whitespace +'+' Operator +' ' Text.Whitespace +"' >>>\\n '" Literal.String.Single +' ' Text.Whitespace +'+' Operator +' ' Text.Whitespace +'str' Name.Builtin +'(' Punctuation +'v' Name +')' Punctuation +')' Punctuation +'\n ' Text.Whitespace +'debug' Name +'.' Punctuation +'traceback' Name.Function +'(' Punctuation +')' Punctuation +'\n ' Text.Whitespace +'end' Keyword +'\n' Text.Whitespace + +'end' Keyword +'\n\n' Text.Whitespace + +'test_func' Name.Function +'(' Punctuation +')' Punctuation +'\n\n' Text.Whitespace + +'import' Keyword.Reserved +' ' Text.Whitespace +'time' Name +'\n\n' Text.Whitespace + +'def' Keyword.Declaration +' ' Text.Whitespace +'fib' Name.Function +'(' Punctuation +'x' Name +')' Punctuation +'\n ' Text.Whitespace +'if' Keyword +' ' Text.Whitespace +'x' Name +' ' Text.Whitespace +'<' Operator +'=' Operator +' ' Text.Whitespace +'2' Literal.Number.Integer +'\n ' Text.Whitespace +'return' Keyword +' ' Text.Whitespace +'1' Literal.Number.Integer +'\n ' Text.Whitespace +'end' Keyword +'\n ' Text.Whitespace +'return' Keyword +' ' Text.Whitespace +'fib' Name.Function +'(' Punctuation +'x' Name +' ' Text.Whitespace +'-' Operator +' ' Text.Whitespace +'1' Literal.Number.Integer +')' Punctuation +' ' Text.Whitespace +'+' Operator +' ' Text.Whitespace +'fib' Name.Function +'(' Punctuation +'x' Name +' ' Text.Whitespace +'-' Operator +' ' Text.Whitespace +'2' Literal.Number.Integer +')' Punctuation +'\n' Text.Whitespace + +'end' Keyword +'\n\n' Text.Whitespace + +'c' Name +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'time' Name +'.' Punctuation +'clock' Name.Function +'(' Punctuation +')' Punctuation +'\n' Text.Whitespace + +'print' Name.Builtin +'(' Punctuation +'"fib:"' Literal.String.Double +',' Punctuation +' ' Text.Whitespace +'fib' Name.Function +'(' Punctuation +'38' Literal.Number.Integer +')' Punctuation +')' Punctuation +' ' Text.Whitespace +'# minimum stack size: 78!!' Comment.Single +'\n' Text.Whitespace + +'print' Name.Builtin +'(' Punctuation +'"time:"' Literal.String.Double +',' Punctuation +' ' Text.Whitespace +'time' Name +'.' Punctuation +'clock' Name.Function +'(' Punctuation +')' Punctuation +' ' Text.Whitespace +'-' Operator +' ' Text.Whitespace +'c' Name +',' Punctuation +' ' Text.Whitespace +"'s'" Literal.String.Single +')' Punctuation +'\n\n' Text.Whitespace + +'import' Keyword.Reserved +' ' Text.Whitespace +'time' Name +'\n' Text.Whitespace + +'import' Keyword.Reserved +' ' Text.Whitespace +'math' Name +'\n\n' Text.Whitespace + +'math' Name +'.' Punctuation +'srand' Name.Function +'(' Punctuation +'time' Name +'.' Punctuation +'time' Name.Function +'(' Punctuation +')' Punctuation +')' Punctuation +'\n' Text.Whitespace + +'res' Name +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'math' Name +'.' Punctuation +'rand' Name.Function +'(' Punctuation +')' Punctuation +' ' Text.Whitespace +'%' Operator +' ' Text.Whitespace +'100' Literal.Number.Integer +'\n' Text.Whitespace + +'max_test' Name +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'7' Literal.Number.Integer +'\n' Text.Whitespace + +'test' Name +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'-1' Literal.Number.Integer +'\n' Text.Whitespace + +'idx' Name +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'1' Literal.Number.Integer +'\n' Text.Whitespace + +'print' Name.Builtin +'(' Punctuation +"'Guess a number between 0 and 99. You have'" Literal.String.Single +',' Punctuation +' ' Text.Whitespace +'max_test' Name +',' Punctuation +' ' Text.Whitespace +"'chances.'" Literal.String.Single +')' Punctuation +'\n' Text.Whitespace + +'while' Keyword +' ' Text.Whitespace +'test' Name +' ' Text.Whitespace +'!' Operator +'=' Operator +' ' Text.Whitespace +'res' Name +' ' Text.Whitespace +'&' Operator +'&' Operator +' ' Text.Whitespace +'idx' Name +' ' Text.Whitespace +'<' Operator +'=' Operator +' ' Text.Whitespace +'max_test' Name +'\n ' Text.Whitespace +'test' Name +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'number' Name.Builtin +'(' Punctuation +'input' Name.Builtin +'(' Punctuation +'str' Name.Builtin +'(' Punctuation +'idx' Name +')' Punctuation +' ' Text.Whitespace +'+' Operator +' ' Text.Whitespace +"': enter the number you guessed: '" Literal.String.Single +')' Punctuation +')' Punctuation +'\n ' Text.Whitespace +'if' Keyword +' ' Text.Whitespace +'type' Name.Builtin +'(' Punctuation +'test' Name +')' Punctuation +' ' Text.Whitespace +'!' Operator +'=' Operator +' ' Text.Whitespace +"'int'" Literal.String.Single +'\n ' Text.Whitespace +'print' Name.Builtin +'(' Punctuation +"'This is not an integer. Continue!'" Literal.String.Single +')' Punctuation +'\n ' Text.Whitespace +'continue' Keyword.Reserved +'\n ' Text.Whitespace +'elif' Keyword +' ' Text.Whitespace +'test' Name +' ' Text.Whitespace +'>' Operator +' ' Text.Whitespace +'res' Name +'\n ' Text.Whitespace +'print' Name.Builtin +'(' Punctuation +"'This number is too large.'" Literal.String.Single +')' Punctuation +'\n ' Text.Whitespace +'elif' Keyword +' ' Text.Whitespace +'test' Name +' ' Text.Whitespace +'<' Operator +' ' Text.Whitespace +'res' Name +'\n ' Text.Whitespace +'print' Name.Builtin +'(' Punctuation +"'This number is too small.'" Literal.String.Single +')' Punctuation +'\n ' Text.Whitespace +'end' Keyword +'\n ' Text.Whitespace +'idx' Name +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'idx' Name +' ' Text.Whitespace +'+' Operator +' ' Text.Whitespace +'1' Literal.Number.Integer +'\n' Text.Whitespace + +'end' Keyword +'\n' Text.Whitespace + +'if' Keyword +' ' Text.Whitespace +'test' Name +' ' Text.Whitespace +'=' Operator +'=' Operator +' ' Text.Whitespace +'res' Name +'\n ' Text.Whitespace +'print' Name.Builtin +'(' Punctuation +"'You win!'" Literal.String.Single +')' Punctuation +'\n' Text.Whitespace + +'else' Keyword +'\n ' Text.Whitespace +'print' Name.Builtin +'(' Punctuation +"'You failed, the correct answer is'" Literal.String.Single +',' Punctuation +' ' Text.Whitespace +'res' Name +')' Punctuation +'\n' Text.Whitespace + +'end' Keyword +'\n\n' Text.Whitespace + +'import' Keyword.Reserved +' ' Text.Whitespace +'json' Name +'\n' Text.Whitespace + +'print' Name.Builtin +'(' Punctuation +'json' Name +'.' Punctuation +'load' Name.Function +'(' Punctuation +'\'{"key": "value"}\'' Literal.String.Single +')' Punctuation +')' Punctuation +'\n' Text.Whitespace + +'print' Name.Builtin +'(' Punctuation +'json' Name +'.' Punctuation +'dump' Name.Function +'(' Punctuation +'{' Punctuation +"'test key'" Literal.String.Single +':' Operator +' ' Text.Whitespace +'nil' Keyword.Constant +'}' Punctuation +')' Punctuation +')' Punctuation +'\n' Text.Whitespace + +'print' Name.Builtin +'(' Punctuation +'json' Name +'.' Punctuation +'dump' Name.Function +'(' Punctuation +'{' Punctuation +"'key1'" Literal.String.Single +':' Operator +' ' Text.Whitespace +'nil' Keyword.Constant +',' Punctuation +' ' Text.Whitespace +'45' Literal.Number.Integer +':' Operator +' ' Text.Whitespace +'true' Keyword.Constant +'}' Punctuation +',' Punctuation +' ' Text.Whitespace +"'format'" Literal.String.Single +')' Punctuation +')' Punctuation +'\n\n' Text.Whitespace + +'# simple lambda example' Comment.Single +'\n' Text.Whitespace + +'print' Name.Builtin +'(' Punctuation +'(' Punctuation +'/' Operator +'a' Name +' ' Text.Whitespace +'b' Name +' ' Text.Whitespace +'c' Name +'-' Operator +'>' Operator +' ' Text.Whitespace +'a' Name +' ' Text.Whitespace +'*' Operator +' ' Text.Whitespace +'b' Name +' ' Text.Whitespace +'+' Operator +' ' Text.Whitespace +'c' Name +')' Punctuation +'(' Punctuation +'2' Literal.Number.Integer +',' Punctuation +' ' Text.Whitespace +'3' Literal.Number.Integer +',' Punctuation +' ' Text.Whitespace +'4' Literal.Number.Integer +')' Punctuation +')' Punctuation +'\n\n' Text.Whitespace + +'# Y-Combinator and factorial functions' Comment.Single +'\n' Text.Whitespace + +'Y' Name +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'/' Operator +'f' Name +'-' Operator +'>' Operator +' ' Text.Whitespace +'(' Punctuation +'/' Operator +'x' Name +'-' Operator +'>' Operator +' ' Text.Whitespace +'f' Name.Function +'(' Punctuation +'/' Operator +'n' Name +'-' Operator +'>' Operator +' ' Text.Whitespace +'x' Name.Function +'(' Punctuation +'x' Name +')' Punctuation +'(' Punctuation +'n' Name +')' Punctuation +')' Punctuation +')' Punctuation +'(' Punctuation +'/' Operator +'x' Name +'-' Operator +'>' Operator +' ' Text.Whitespace +'f' Name.Function +'(' Punctuation +'/' Operator +'n' Name +'-' Operator +'>' Operator +' ' Text.Whitespace +'x' Name.Function +'(' Punctuation +'x' Name +')' Punctuation +'(' Punctuation +'n' Name +')' Punctuation +')' Punctuation +')' Punctuation +'\n' Text.Whitespace + +'F' Name +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'/' Operator +'f' Name +'-' Operator +'>' Operator +' ' Text.Whitespace +'/' Operator +'x' Name +'-' Operator +'>' Operator +' ' Text.Whitespace +'x' Name +' ' Text.Whitespace +'?' Operator +' ' Text.Whitespace +'f' Name.Function +'(' Punctuation +'x' Name +' ' Text.Whitespace +'-' Operator +' ' Text.Whitespace +'1' Literal.Number.Integer +')' Punctuation +' ' Text.Whitespace +'*' Operator +' ' Text.Whitespace +'x' Name +' ' Text.Whitespace +':' Operator +' ' Text.Whitespace +'1' Literal.Number.Integer +'\n' Text.Whitespace + +'fact' Name +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'Y' Name.Function +'(' Punctuation +'F' Name +')' Punctuation +'\n' Text.Whitespace + +'print' Name.Builtin +'(' Punctuation +"'fact(10) == '" Literal.String.Single +' ' Text.Whitespace +'..' Operator +' ' Text.Whitespace +'fact' Name.Function +'(' Punctuation +'10' Literal.Number.Integer +')' Punctuation +')' Punctuation +'\n\n' Text.Whitespace + +'import' Keyword.Reserved +' ' Text.Whitespace +'os' Name +'\n\n' Text.Whitespace + +'def' Keyword.Declaration +' ' Text.Whitespace +'scandir' Name.Function +'(' Punctuation +'path' Name +')' Punctuation +'\n ' Text.Whitespace +'print' Name.Builtin +'(' Punctuation +"'path: '" Literal.String.Single +' ' Text.Whitespace +'+' Operator +' ' Text.Whitespace +'path' Name +')' Punctuation +'\n ' Text.Whitespace +'for' Keyword +' ' Text.Whitespace +'name' Name +' ' Text.Whitespace +':' Operator +' ' Text.Whitespace +'os' Name +'.' Punctuation +'listdir' Name.Function +'(' Punctuation +'path' Name +')' Punctuation +'\n ' Text.Whitespace +'var' Keyword.Declaration +' ' Text.Whitespace +'fullname' Name +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'os' Name +'.' Punctuation +'path' Name.Attribute +'.' Punctuation +'join' Name.Function +'(' Punctuation +'path' Name +',' Punctuation +' ' Text.Whitespace +'name' Name +')' Punctuation +'\n ' Text.Whitespace +'if' Keyword +' ' Text.Whitespace +'os' Name +'.' Punctuation +'path' Name.Attribute +'.' Punctuation +'isfile' Name.Function +'(' Punctuation +'fullname' Name +')' Punctuation +'\n ' Text.Whitespace +'print' Name.Builtin +'(' Punctuation +"'file: '" Literal.String.Single +' ' Text.Whitespace +'+' Operator +' ' Text.Whitespace +'fullname' Name +')' Punctuation +'\n ' Text.Whitespace +'else' Keyword +'\n ' Text.Whitespace +'print' Name.Builtin +'(' Punctuation +"'path: '" Literal.String.Single +' ' Text.Whitespace +'+' Operator +' ' Text.Whitespace +'fullname' Name +')' Punctuation +'\n ' Text.Whitespace +'scandir' Name.Function +'(' Punctuation +'fullname' Name +')' Punctuation +'\n ' Text.Whitespace +'end' Keyword +'\n ' Text.Whitespace +'end' Keyword +'\n' Text.Whitespace + +'end' Keyword +'\n\n' Text.Whitespace + +'scandir' Name.Function +'(' Punctuation +"'.'" Literal.String.Single +')' Punctuation +'\n\n' Text.Whitespace + +'def' Keyword.Declaration +' ' Text.Whitespace +'qsort' Name.Function +'(' Punctuation +'data' Name +')' Punctuation +'\n ' Text.Whitespace +'# do once sort' Comment.Single +'\n ' Text.Whitespace +'def' Keyword.Declaration +' ' Text.Whitespace +'once' Name.Function +'(' Punctuation +'left' Name +',' Punctuation +' ' Text.Whitespace +'right' Name +')' Punctuation +'\n ' Text.Whitespace +'var' Keyword.Declaration +' ' Text.Whitespace +'pivot' Name +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'data' Name +'[' Punctuation +'left' Name +']' Punctuation +' ' Text.Whitespace +'# use the 0th value as the pivot' Comment.Single +'\n ' Text.Whitespace +'while' Keyword +' ' Text.Whitespace +'left' Name +' ' Text.Whitespace +'<' Operator +' ' Text.Whitespace +'right' Name +' ' Text.Whitespace +'# check if sort is complete' Comment.Single +'\n ' Text.Whitespace +'# put the value less than the pivot to the left' Comment.Single +'\n ' Text.Whitespace +'while' Keyword +' ' Text.Whitespace +'left' Name +' ' Text.Whitespace +'<' Operator +' ' Text.Whitespace +'right' Name +' ' Text.Whitespace +'&' Operator +'&' Operator +' ' Text.Whitespace +'data' Name +'[' Punctuation +'right' Name +']' Punctuation +' ' Text.Whitespace +'>' Operator +'=' Operator +' ' Text.Whitespace +'pivot' Name +'\n ' Text.Whitespace +'right' Name +' ' Text.Whitespace +'-' Operator +'=' Operator +' ' Text.Whitespace +'1' Literal.Number.Integer +' ' Text.Whitespace +'# skip values greater than pivot' Comment.Single +'\n ' Text.Whitespace +'end' Keyword +'\n ' Text.Whitespace +'data' Name +'[' Punctuation +'left' Name +']' Punctuation +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'data' Name +'[' Punctuation +'right' Name +']' Punctuation +'\n ' Text.Whitespace +'# put the value greater than the pivot on the right' Comment.Single +'\n ' Text.Whitespace +'while' Keyword +' ' Text.Whitespace +'left' Name +' ' Text.Whitespace +'<' Operator +' ' Text.Whitespace +'right' Name +' ' Text.Whitespace +'&' Operator +'&' Operator +' ' Text.Whitespace +'data' Name +'[' Punctuation +'left' Name +']' Punctuation +' ' Text.Whitespace +'<' Operator +'=' Operator +' ' Text.Whitespace +'pivot' Name +'\n ' Text.Whitespace +'left' Name +' ' Text.Whitespace +'+' Operator +'=' Operator +' ' Text.Whitespace +'1' Literal.Number.Integer +' ' Text.Whitespace +'# skip values less than pivot' Comment.Single +'\n ' Text.Whitespace +'end' Keyword +'\n ' Text.Whitespace +'data' Name +'[' Punctuation +'right' Name +']' Punctuation +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'data' Name +'[' Punctuation +'left' Name +']' Punctuation +'\n ' Text.Whitespace +'end' Keyword +'\n ' Text.Whitespace +'# now we have the index of the pivot, store it' Comment.Single +'\n ' Text.Whitespace +'data' Name +'[' Punctuation +'left' Name +']' Punctuation +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'pivot' Name +'\n ' Text.Whitespace +'return' Keyword +' ' Text.Whitespace +'left' Name +' ' Text.Whitespace +'# return the index of the pivot' Comment.Single +'\n ' Text.Whitespace +'end' Keyword +'\n ' Text.Whitespace +'# recursive quick sort algorithm' Comment.Single +'\n ' Text.Whitespace +'def' Keyword.Declaration +' ' Text.Whitespace +'_sort' Name.Function +'(' Punctuation +'left' Name +',' Punctuation +' ' Text.Whitespace +'right' Name +')' Punctuation +'\n ' Text.Whitespace +'if' Keyword +' ' Text.Whitespace +'left' Name +' ' Text.Whitespace +'<' Operator +' ' Text.Whitespace +'right' Name +' ' Text.Whitespace +'# executed when the array is not empty' Comment.Single +'\n ' Text.Whitespace +'var' Keyword.Declaration +' ' Text.Whitespace +'index' Name +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'once' Name.Function +'(' Punctuation +'left' Name +',' Punctuation +' ' Text.Whitespace +'right' Name +')' Punctuation +' ' Text.Whitespace +'# get index of pivot for divide and conquer' Comment.Single +'\n ' Text.Whitespace +'_sort' Name.Function +'(' Punctuation +'left' Name +',' Punctuation +' ' Text.Whitespace +'index' Name +' ' Text.Whitespace +'-' Operator +' ' Text.Whitespace +'1' Literal.Number.Integer +')' Punctuation +' ' Text.Whitespace +'# sort the data on the left' Comment.Single +'\n ' Text.Whitespace +'_sort' Name.Function +'(' Punctuation +'index' Name +' ' Text.Whitespace +'+' Operator +' ' Text.Whitespace +'1' Literal.Number.Integer +',' Punctuation +' ' Text.Whitespace +'right' Name +')' Punctuation +' ' Text.Whitespace +'# sort the data on the right' Comment.Single +'\n ' Text.Whitespace +'end' Keyword +'\n ' Text.Whitespace +'end' Keyword +'\n ' Text.Whitespace +'# start quick sort' Comment.Single +'\n ' Text.Whitespace +'_sort' Name.Function +'(' Punctuation +'0' Literal.Number.Integer +',' Punctuation +' ' Text.Whitespace +'data' Name +'.' Punctuation +'size' Name.Builtin +'(' Punctuation +')' Punctuation +' ' Text.Whitespace +'-' Operator +' ' Text.Whitespace +'1' Literal.Number.Integer +')' Punctuation +'\n ' Text.Whitespace +'return' Keyword +' ' Text.Whitespace +'data' Name +'\n' Text.Whitespace + +'end' Keyword +'\n\n' Text.Whitespace + +'import' Keyword.Reserved +' ' Text.Whitespace +'time' Name +',' Punctuation +' ' Text.Whitespace +'math' Name +'\n' Text.Whitespace + +'math' Name +'.' Punctuation +'srand' Name.Function +'(' Punctuation +'time' Name +'.' Punctuation +'time' Name.Function +'(' Punctuation +')' Punctuation +')' Punctuation +' ' Text.Whitespace +'# sse system time as a random seed' Comment.Single +'\n' Text.Whitespace + +'data' Name +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'[' Punctuation +']' Punctuation +'\n' Text.Whitespace + +'# put 20 random numbers into the array' Comment.Single +'\n' Text.Whitespace + +'for' Keyword +' ' Text.Whitespace +'i' Name +' ' Text.Whitespace +':' Operator +' ' Text.Whitespace +'1' Literal.Number.Integer +' ' Text.Whitespace +'..' Operator +' ' Text.Whitespace +'20' Literal.Number.Integer +'\n ' Text.Whitespace +'data' Name +'.' Punctuation +'push' Name.Function +'(' Punctuation +'math' Name +'.' Punctuation +'rand' Name.Function +'(' Punctuation +')' Punctuation +' ' Text.Whitespace +'%' Operator +' ' Text.Whitespace +'100' Literal.Number.Integer +')' Punctuation +'\n' Text.Whitespace + +'end' Keyword +'\n' Text.Whitespace + +'# sort and print' Comment.Single +'\n' Text.Whitespace + +'print' Name.Builtin +'(' Punctuation +'qsort' Name.Function +'(' Punctuation +'data' Name +')' Punctuation +')' Punctuation +'\n\n' Text.Whitespace + +'do' Keyword +'\n ' Text.Whitespace +'def' Keyword.Declaration +' ' Text.Whitespace +'ismult' Name.Function +'(' Punctuation +'msg' Name +')' Punctuation +'\n ' Text.Whitespace +'import' Keyword.Reserved +' ' Text.Whitespace +'string' Name +'\n ' Text.Whitespace +'return' Keyword +' ' Text.Whitespace +'string' Name +'.' Punctuation +'split' Name.Function +'(' Punctuation +'msg' Name +',' Punctuation +' ' Text.Whitespace +'-5' Literal.Number.Integer +')' Punctuation +'[' Punctuation +'1' Literal.Number.Integer +']' Punctuation +' ' Text.Whitespace +'=' Operator +'=' Operator +' ' Text.Whitespace +"'\\'EOS\\''" Literal.String.Single +'\n ' Text.Whitespace +'end' Keyword +'\n\n ' Text.Whitespace +'def' Keyword.Declaration +' ' Text.Whitespace +'multline' Name.Function +'(' Punctuation +'src' Name +',' Punctuation +' ' Text.Whitespace +'msg' Name +')' Punctuation +'\n ' Text.Whitespace +'if' Keyword +' ' Text.Whitespace +'!' Operator +'ismult' Name.Function +'(' Punctuation +'msg' Name +')' Punctuation +'\n ' Text.Whitespace +'print' Name.Builtin +'(' Punctuation +"'syntax_error: '" Literal.String.Single +' ' Text.Whitespace +'+' Operator +' ' Text.Whitespace +'msg' Name +')' Punctuation +'\n ' Text.Whitespace +'return' Keyword +'\n ' Text.Whitespace +'end' Keyword +'\n ' Text.Whitespace +'while' Keyword +' ' Text.Whitespace +'true' Keyword.Constant +'\n ' Text.Whitespace +'try' Keyword +'\n ' Text.Whitespace +'src' Name +' ' Text.Whitespace +'+' Operator +'=' Operator +' ' Text.Whitespace +"'\\n'" Literal.String.Single +' ' Text.Whitespace +'+' Operator +' ' Text.Whitespace +'input' Name.Builtin +'(' Punctuation +"'>> '" Literal.String.Single +')' Punctuation +'\n ' Text.Whitespace +'return' Keyword +' ' Text.Whitespace +'compile' Name.Builtin +'(' Punctuation +'src' Name +')' Punctuation +'\n ' Text.Whitespace +'except' Keyword +' ' Text.Whitespace +"'syntax_error'" Literal.String.Single +' ' Text.Whitespace +'as' Keyword.Reserved +' ' Text.Whitespace +'e' Name +',' Punctuation +' ' Text.Whitespace +'m' Name +'\n ' Text.Whitespace +'if' Keyword +' ' Text.Whitespace +'!' Operator +'ismult' Name.Function +'(' Punctuation +'m' Name +')' Punctuation +'\n ' Text.Whitespace +'print' Name.Builtin +'(' Punctuation +"'syntax_error: '" Literal.String.Single +' ' Text.Whitespace +'+' Operator +' ' Text.Whitespace +'m' Name +')' Punctuation +'\n ' Text.Whitespace +'return' Keyword +'\n ' Text.Whitespace +'end' Keyword +'\n ' Text.Whitespace +'end' Keyword +'\n ' Text.Whitespace +'end' Keyword +'\n ' Text.Whitespace +'end' Keyword +'\n\n ' Text.Whitespace +'def' Keyword.Declaration +' ' Text.Whitespace +'parse' Name.Function +'(' Punctuation +')' Punctuation +'\n ' Text.Whitespace +'var' Keyword.Declaration +' ' Text.Whitespace +'fun' Name +',' Punctuation +' ' Text.Whitespace +'src' Name +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'input' Name.Builtin +'(' Punctuation +"'> '" Literal.String.Single +')' Punctuation +'\n ' Text.Whitespace +'try' Keyword +'\n ' Text.Whitespace +'fun' Name +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'compile' Name.Builtin +'(' Punctuation +"'return ('" Literal.String.Single +' ' Text.Whitespace +'+' Operator +' ' Text.Whitespace +'src' Name +' ' Text.Whitespace +'+' Operator +' ' Text.Whitespace +"')'" Literal.String.Single +')' Punctuation +'\n ' Text.Whitespace +'except' Keyword +' ' Text.Whitespace +"'syntax_error'" Literal.String.Single +' ' Text.Whitespace +'as' Keyword.Reserved +' ' Text.Whitespace +'e' Name +',' Punctuation +' ' Text.Whitespace +'m' Name +'\n ' Text.Whitespace +'try' Keyword +'\n ' Text.Whitespace +'fun' Name +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'compile' Name.Builtin +'(' Punctuation +'src' Name +')' Punctuation +'\n ' Text.Whitespace +'except' Keyword +' ' Text.Whitespace +"'syntax_error'" Literal.String.Single +' ' Text.Whitespace +'as' Keyword.Reserved +' ' Text.Whitespace +'e' Name +',' Punctuation +' ' Text.Whitespace +'m' Name +'\n ' Text.Whitespace +'fun' Name +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'multline' Name.Function +'(' Punctuation +'src' Name +',' Punctuation +' ' Text.Whitespace +'m' Name +')' Punctuation +'\n ' Text.Whitespace +'end' Keyword +'\n ' Text.Whitespace +'end' Keyword +'\n ' Text.Whitespace +'return' Keyword +' ' Text.Whitespace +'fun' Name +'\n ' Text.Whitespace +'end' Keyword +'\n\n ' Text.Whitespace +'def' Keyword.Declaration +' ' Text.Whitespace +'run' Name.Function +'(' Punctuation +'fun' Name +')' Punctuation +'\n ' Text.Whitespace +'try' Keyword +'\n ' Text.Whitespace +'var' Keyword.Declaration +' ' Text.Whitespace +'res' Name +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'fun' Name.Function +'(' Punctuation +')' Punctuation +'\n ' Text.Whitespace +'if' Keyword +' ' Text.Whitespace +'res' Name +' ' Text.Whitespace +'print' Name.Builtin +'(' Punctuation +'res' Name +')' Punctuation +' ' Text.Whitespace +'end' Keyword +'\n ' Text.Whitespace +'except' Keyword +' ' Text.Whitespace +'..' Operator +' ' Text.Whitespace +'as' Keyword.Reserved +' ' Text.Whitespace +'e' Name +',' Punctuation +' ' Text.Whitespace +'m' Name +'\n ' Text.Whitespace +'import' Keyword.Reserved +' ' Text.Whitespace +'debug' Name +'\n ' Text.Whitespace +'print' Name.Builtin +'(' Punctuation +'e' Name +' ' Text.Whitespace +'..' Operator +' ' Text.Whitespace +"': '" Literal.String.Single +' ' Text.Whitespace +'..' Operator +' ' Text.Whitespace +'m' Name +')' Punctuation +'\n ' Text.Whitespace +'debug' Name +'.' Punctuation +'traceback' Name.Function +'(' Punctuation +')' Punctuation +'\n ' Text.Whitespace +'end' Keyword +'\n ' Text.Whitespace +'end' Keyword +'\n\n ' Text.Whitespace +'def' Keyword.Declaration +' ' Text.Whitespace +'repl' Name.Function +'(' Punctuation +')' Punctuation +' \n ' Text.Whitespace +'while' Keyword +' ' Text.Whitespace +'true' Keyword.Constant +'\n ' Text.Whitespace +'var' Keyword.Declaration +' ' Text.Whitespace +'fun' Name +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'parse' Name.Function +'(' Punctuation +')' Punctuation +'\n ' Text.Whitespace +'if' Keyword +' ' Text.Whitespace +'fun' Name +' ' Text.Whitespace +'!' Operator +'=' Operator +' ' Text.Whitespace +'nil' Keyword.Constant +'\n ' Text.Whitespace +'run' Name.Function +'(' Punctuation +'fun' Name +')' Punctuation +'\n ' Text.Whitespace +'end' Keyword +'\n ' Text.Whitespace +'end' Keyword +'\n ' Text.Whitespace +'end' Keyword +'\n\n ' Text.Whitespace +'print' Name.Builtin +'(' Punctuation +'"Berry Berry REPL!"' Literal.String.Double +')' Punctuation +'\n ' Text.Whitespace +'repl' Name.Function +'(' Punctuation +')' Punctuation +'\n' Text.Whitespace + +'end' Keyword +'\n\n' Text.Whitespace + +'s' Name +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'"This is a long string test. 0123456789 abcdefg ABCDEFG"' Literal.String.Double +'\n' Text.Whitespace + +'print' Name.Builtin +'(' Punctuation +'s' Name +')' Punctuation +'\n\n' Text.Whitespace + +'a' Name +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'.5' Literal.Number.Float +'\n' Text.Whitespace + +'print' Name.Builtin +'(' Punctuation +'a' Name +')' Punctuation +'\n\n' Text.Whitespace + +'import' Keyword.Reserved +' ' Text.Whitespace +'string' Name +' ' Text.Whitespace +'as' Keyword.Reserved +' ' Text.Whitespace +'s' Name +'\n\n' Text.Whitespace + +'print' Name.Builtin +'(' Punctuation +'s' Name +'.' Punctuation +'hex' Name.Function +'(' Punctuation +'0x45678ABCD' Literal.Number.Hex +',' Punctuation +' ' Text.Whitespace +'16' Literal.Number.Integer +')' Punctuation +')' Punctuation +'\n\n' Text.Whitespace + +'def' Keyword.Declaration +' ' Text.Whitespace +'bin' Name.Function +'(' Punctuation +'x' Name +',' Punctuation +' ' Text.Whitespace +'num' Name +')' Punctuation +'\n ' Text.Whitespace +'assert' Name.Builtin +'(' Punctuation +'type' Name.Builtin +'(' Punctuation +'x' Name +')' Punctuation +' ' Text.Whitespace +'=' Operator +'=' Operator +' ' Text.Whitespace +"'int'" Literal.String.Single +',' Punctuation +' ' Text.Whitespace +"'the type of \\'x\\' must be integer'" Literal.String.Single +')' Punctuation +'\n ' Text.Whitespace +"# test the 'x' bits" Comment.Single +'\n ' Text.Whitespace +'var' Keyword.Declaration +' ' Text.Whitespace +'bits' Name +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'1' Literal.Number.Integer +'\n ' Text.Whitespace +'for' Keyword +' ' Text.Whitespace +'i' Name +' ' Text.Whitespace +':' Operator +' ' Text.Whitespace +'0' Literal.Number.Integer +' ' Text.Whitespace +'..' Operator +' ' Text.Whitespace +'62' Literal.Number.Integer +'\n ' Text.Whitespace +'if' Keyword +' ' Text.Whitespace +'x' Name +' ' Text.Whitespace +'&' Operator +' ' Text.Whitespace +'(' Punctuation +'1' Literal.Number.Integer +' ' Text.Whitespace +'<' Operator +'<' Operator +' ' Text.Whitespace +'63' Literal.Number.Integer +' ' Text.Whitespace +'-' Operator +' ' Text.Whitespace +'i' Name +')' Punctuation +'\n ' Text.Whitespace +'bits' Name +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'64' Literal.Number.Integer +' ' Text.Whitespace +'-' Operator +' ' Text.Whitespace +'i' Name +'\n ' Text.Whitespace +'break' Keyword.Reserved +'\n ' Text.Whitespace +'end' Keyword +'\n ' Text.Whitespace +'end' Keyword +'\n ' Text.Whitespace +'if' Keyword +' ' Text.Whitespace +'type' Name.Builtin +'(' Punctuation +'num' Name +')' Punctuation +' ' Text.Whitespace +'=' Operator +'=' Operator +' ' Text.Whitespace +"'int'" Literal.String.Single +' ' Text.Whitespace +'&' Operator +'&' Operator +' ' Text.Whitespace +'num' Name +' ' Text.Whitespace +'>' Operator +' ' Text.Whitespace +'0' Literal.Number.Integer +' ' Text.Whitespace +'&' Operator +'&' Operator +' ' Text.Whitespace +'num' Name +' ' Text.Whitespace +'<' Operator +'=' Operator +' ' Text.Whitespace +'64' Literal.Number.Integer +'\n ' Text.Whitespace +'bits' Name +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'bits' Name +' ' Text.Whitespace +'<' Operator +' ' Text.Whitespace +'num' Name +' ' Text.Whitespace +'?' Operator +' ' Text.Whitespace +'num' Name +' ' Text.Whitespace +':' Operator +' ' Text.Whitespace +'bits' Name +'\n ' Text.Whitespace +'end' Keyword +'\n ' Text.Whitespace +'var' Keyword.Declaration +' ' Text.Whitespace +'result' Name +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +"''" Literal.String.Single +'\n ' Text.Whitespace +'bits' Name +' ' Text.Whitespace +'-' Operator +'=' Operator +' ' Text.Whitespace +'1' Literal.Number.Integer +'\n ' Text.Whitespace +'for' Keyword +' ' Text.Whitespace +'i' Name +' ' Text.Whitespace +':' Operator +' ' Text.Whitespace +'0' Literal.Number.Integer +' ' Text.Whitespace +'..' Operator +' ' Text.Whitespace +'bits' Name +'\n ' Text.Whitespace +'result' Name +' ' Text.Whitespace +'+' Operator +'=' Operator +' ' Text.Whitespace +'x' Name +' ' Text.Whitespace +'&' Operator +' ' Text.Whitespace +'(' Punctuation +'1' Literal.Number.Integer +' ' Text.Whitespace +'<' Operator +'<' Operator +' ' Text.Whitespace +'(' Punctuation +'bits' Name +' ' Text.Whitespace +'-' Operator +' ' Text.Whitespace +'i' Name +')' Punctuation +')' Punctuation +' ' Text.Whitespace +'?' Operator +' ' Text.Whitespace +"'1'" Literal.String.Single +' ' Text.Whitespace +':' Operator +' ' Text.Whitespace +"'0'" Literal.String.Single +'\n ' Text.Whitespace +'end' Keyword +'\n ' Text.Whitespace +'return' Keyword +' ' Text.Whitespace +'result' Name +'\n' Text.Whitespace + +'end' Keyword +'\n\n' Text.Whitespace + +'print' Name.Builtin +'(' Punctuation +'bin' Name.Function +'(' Punctuation +'33' Literal.Number.Integer +')' Punctuation +')' Punctuation +'\n\n' Text.Whitespace + +'import' Keyword.Reserved +' ' Text.Whitespace +'string' Name +'\n\n' Text.Whitespace + +'print' Name.Builtin +'(' Punctuation +'string' Name +'.' Punctuation +'format' Name.Function +'(' Punctuation +"'%.3d'" Literal.String.Single +',' Punctuation +' ' Text.Whitespace +'12' Literal.Number.Integer +')' Punctuation +')' Punctuation +'\n' Text.Whitespace + +'print' Name.Builtin +'(' Punctuation +'string' Name +'.' Punctuation +'format' Name.Function +'(' Punctuation +"'%.3f'" Literal.String.Single +',' Punctuation +' ' Text.Whitespace +'12' Literal.Number.Integer +')' Punctuation +')' Punctuation +'\n' Text.Whitespace + +'print' Name.Builtin +'(' Punctuation +'string' Name +'.' Punctuation +'format' Name.Function +'(' Punctuation +"'%20.7f'" Literal.String.Single +',' Punctuation +' ' Text.Whitespace +'14' Literal.Number.Integer +'.5' Literal.Number.Float +')' Punctuation +')' Punctuation +'\n' Text.Whitespace + +'print' Name.Builtin +'(' Punctuation +'string' Name +'.' Punctuation +'format' Name.Function +'(' Punctuation +"'-- %-40s ---'" Literal.String.Single +',' Punctuation +' ' Text.Whitespace +"'this is a string format test'" Literal.String.Single +')' Punctuation +')' Punctuation +'\n' Text.Whitespace + +'print' Name.Builtin +'(' Punctuation +'string' Name +'.' Punctuation +'format' Name.Function +'(' Punctuation +"'-- %40s ---'" Literal.String.Single +',' Punctuation +' ' Text.Whitespace +"'this is a string format test'" Literal.String.Single +')' Punctuation +')' Punctuation +'\n\n' Text.Whitespace + +'#' Comment.Single +'\n' Text.Whitespace |