 # Syntax printing to HTML
 
 toHtml = (highlighted) ->
-  crawl highlighted, (word, token, parent) ->
-    (word.ws or '') + colorize(theme[labelOf word, parent], token)
+  crawl highlighted, (word, symbol, parent) ->
+    (word.ws or '') + colorize(theme[labelOf word, parent], symbol)
 
 labelOf = (word, parent) ->
-  if (_isCollectionDelim word) and parent
+  if (isCollectionDelim word) and parent
     parent.label
   else
     word.label or 'normal'

  current = []
  stack = [[]]
  for token in tokens
    if token.token in leftDelims
      stack.push [token]
    else if token.token in rightDelims
      closed = stack.pop()
      if token.token isnt delims[closed[0].token]
        throw "Wrong closing delimiter #{token.token} for opening delimiter #{closed[0].token}"
      closed.push token
      if not stack[stack.length - 1]
        throw "Missing opening delimeter matching #{token.token}"
      stack[stack.length - 1].push closed
    else
      stack[stack.length - 1].push token
  ast = stack[0][0]
  if not ast
    throw "Missing closing delimeter matching #{stack[stack.length - 1][0].token}"
  else
    ast


  {type, translation, pattern} =
    switch label
      when 'numerical'
        numericalCompile ctx, symbol
      when 'regex'
        regexCompile ctx, symbol
      when 'char'
        type: typeConstant 'Char'
        translation: symbol
        pattern: literalPattern ctx, symbol
      when 'string'
        type: typeConstant 'String'
        translation: symbol
        pattern: literalPattern ctx, symbol
      else
        nameCompile ctx, atom, symbol
  atom.tea = type if type
  if ctx.isOperator()
    # TODO: maybe don't use label here, it's getting confusing what is its purpose
