---input---
import glib2, gtk2, gdk2, gtksourceview, dialogs, os, pango, osproc, strutils
import pegs, streams
import settings, types, cfg, search

{.push callConv:cdecl.}

const
  NimrodProjectExt = ".nimprj"

var win: types.MainWin
win.Tabs = @[]

search.win = addr(win)

var lastSession: seq[string] = @[]

var confParseFail = False # This gets set to true
                          # When there is an error parsing the config

# Load the settings
try:
  win.settings = cfg.load(lastSession)
except ECFGParse:
  # TODO: Make the dialog show the exception
  confParseFail = True
  win.settings = cfg.defaultSettings()
except EIO:
  win.settings = cfg.defaultSettings()

proc getProjectTab(): int = 
  for i in 0..high(win.tabs): 
    if win.tabs[i].filename.endswith(NimrodProjectExt): return i

proc saveTab(tabNr: int, startpath: string) =
  if tabNr < 0: return
  if win.Tabs[tabNr].saved: return
  var path = ""
  if win.Tabs[tabNr].filename == "":
    path = ChooseFileToSave(win.w, startpath) 
    # dialogs.nim STOCK_OPEN instead of STOCK_SAVE
  else: 
    path = win.Tabs[tabNr].filename
  
  if path != "":
    var buffer = PTextBuffer(win.Tabs[tabNr].buffer)
    # Get the text from the TextView
    var startIter: TTextIter
    buffer.getStartIter(addr(startIter))
    
    var endIter: TTextIter
    buffer.getEndIter(addr(endIter))
    
    var text = buffer.getText(addr(startIter), addr(endIter), False)
    # Save it to a file
    var f: TFile
    if open(f, path, fmWrite):
      f.write(text)
      f.close()
      
      win.tempStuff.lastSaveDir = splitFile(path).dir
      
      # Change the tab name and .Tabs.filename etc.
      win.Tabs[tabNr].filename = path
      win.Tabs[tabNr].saved = True
      var name = extractFilename(path)
      
      var cTab = win.Tabs[tabNr]
      cTab.label.setText(name)
    else:
      error(win.w, "Unable to write to file")  

proc saveAllTabs() =
  for i in 0..high(win.tabs): 
    saveTab(i, os.splitFile(win.tabs[i].filename).dir)

# GTK Events
# -- w(PWindow)
proc destroy(widget: PWidget, data: pgpointer) {.cdecl.} =
  # gather some settings
  win.settings.VPanedPos = PPaned(win.sourceViewTabs.getParent()).getPosition()
  win.settings.winWidth = win.w.allocation.width
  win.settings.winHeight = win.w.allocation.height

  # save the settings
  win.save()
  # then quit
  main_quit()

proc delete_event(widget: PWidget, event: PEvent, user_data: pgpointer): bool =
  var quit = True
  for i in low(win.Tabs)..len(win.Tabs)-1:
    if not win.Tabs[i].saved:
      var askSave = dialogNewWithButtons("", win.w, 0,
                            STOCK_SAVE, RESPONSE_ACCEPT, STOCK_CANCEL, 
                            RESPONSE_CANCEL,
                            "Close without saving", RESPONSE_REJECT, nil)
      askSave.setTransientFor(win.w)
      # TODO: Make this dialog look better
      var label = labelNew(win.Tabs[i].filename & 
          " is unsaved, would you like to save it ?")
      PBox(askSave.vbox).pack_start(label, False, False, 0)
      label.show()

      var resp = askSave.run()
      gtk2.destroy(PWidget(askSave))
      case resp
      of RESPONSE_ACCEPT:
        saveTab(i, os.splitFile(win.tabs[i].filename).dir)
        quit = True
      of RESPONSE_CANCEL:
        quit = False
        break
      of RESPONSE_REJECT:
        quit = True
      else:
        quit = False
        break

  # If False is returned the window will close
  return not quit

proc windowState_Changed(widget: PWidget, event: PEventWindowState, 
                         user_data: pgpointer) =
  win.settings.winMaximized = (event.newWindowState and 
                               WINDOW_STATE_MAXIMIZED) != 0

# -- SourceView(PSourceView) & SourceBuffer
proc updateStatusBar(buffer: PTextBuffer){.cdecl.} =
  # Incase this event gets fired before
  # bottomBar is initialized
  if win.bottomBar != nil and not win.tempStuff.stopSBUpdates:  
    var iter: TTextIter
    
    win.bottomBar.pop(0)
    buffer.getIterAtMark(addr(iter), buffer.getInsert())
    var row = getLine(addr(iter)) + 1
    var col = getLineOffset(addr(iter))
    discard win.bottomBar.push(0, "Line: " & $row & " Column: " & $col)
  
proc cursorMoved(buffer: PTextBuffer, location: PTextIter, 
                 mark: PTextMark, user_data: pgpointer){.cdecl.} =
  updateStatusBar(buffer)

proc onCloseTab(btn: PButton, user_data: PWidget) =
  if win.sourceViewTabs.getNPages() > 1:
    var tab = win.sourceViewTabs.pageNum(user_data)
    win.sourceViewTabs.removePage(tab)

    win.Tabs.delete(tab)

proc onSwitchTab(notebook: PNotebook, page: PNotebookPage, pageNum: guint, 
                 user_data: pgpointer) =
  if win.Tabs.len()-1 >= pageNum:
    win.w.setTitle("Aporia IDE - " & win.Tabs[pageNum].filename)

proc createTabLabel(name: string, t_child: PWidget): tuple[box: PWidget,
                    label: PLabel] =
  var box = hboxNew(False, 0)
  var label = labelNew(name)
  var closebtn = buttonNew()
  closeBtn.setLabel(nil)
  var iconSize = iconSizeFromName("tabIconSize")
  if iconSize == 0:
     iconSize = iconSizeRegister("tabIconSize", 10, 10)
  var image = imageNewFromStock(STOCK_CLOSE, iconSize)
  discard gSignalConnect(closebtn, "clicked", G_Callback(onCloseTab), t_child)
  closebtn.setImage(image)
  gtk2.setRelief(closebtn, RELIEF_NONE)
  box.packStart(label, True, True, 0)
  box.packEnd(closebtn, False, False, 0)
  box.showAll()
  return (box, label)

proc changed(buffer: PTextBuffer, user_data: pgpointer) =
  # Update the 'Line & Column'
  #updateStatusBar(buffer)

  # Change the tabs state to 'unsaved'
  # and add '*' to the Tab Name
  var current = win.SourceViewTabs.getCurrentPage()
  var name = ""
  if win.Tabs[current].filename == "":
    win.Tabs[current].saved = False
    name = "Untitled *"
  else:
    win.Tabs[current].saved = False
    name = extractFilename(win.Tabs[current].filename) & " *"
  
  var cTab = win.Tabs[current]
  cTab.label.setText(name)

# Other(Helper) functions

proc initSourceView(SourceView: var PWidget, scrollWindow: var PScrolledWindow,
                    buffer: var PSourceBuffer) =
  # This gets called by addTab
  # Each tabs creates a new SourceView
  # SourceScrolledWindow(ScrolledWindow)
  scrollWindow = scrolledWindowNew(nil, nil)
  scrollWindow.setPolicy(POLICY_AUTOMATIC, POLICY_AUTOMATIC)
  scrollWindow.show()
  
  # SourceView(gtkSourceView)
  SourceView = sourceViewNew(buffer)
  PSourceView(SourceView).setInsertSpacesInsteadOfTabs(True)
  PSourceView(SourceView).setIndentWidth(win.settings.indentWidth)
  PSourceView(SourceView).setShowLineNumbers(win.settings.showLineNumbers)
  PSourceView(SourceView).setHighlightCurrentLine(
               win.settings.highlightCurrentLine)
  PSourceView(SourceView).setShowRightMargin(win.settings.rightMargin)
  PSourceView(SourceView).setAutoIndent(win.settings.autoIndent)

  var font = font_description_from_string(win.settings.font)
  SourceView.modifyFont(font)
  
  scrollWindow.add(SourceView)
  SourceView.show()

  buffer.setHighlightMatchingBrackets(
      win.settings.highlightMatchingBrackets)
  
  # UGLY workaround for yet another compiler bug:
  discard gsignalConnect(buffer, "mark-set", 
                         GCallback(aporia.cursorMoved), nil)
  discard gsignalConnect(buffer, "changed", GCallback(aporia.changed), nil)

  # -- Set the syntax highlighter scheme
  buffer.setScheme(win.scheme)

proc addTab(name, filename: string) =
  ## Adds a tab, if filename is not "" reads the file. And sets
  ## the tabs SourceViews text to that files contents.
  assert(win.nimLang != nil)
  var buffer: PSourceBuffer = sourceBufferNew(win.nimLang)

  if filename != nil and filename != "":
    var lang = win.langMan.guessLanguage(filename, nil)
    if lang != nil:
      buffer.setLanguage(lang)
    else:
      buffer.setHighlightSyntax(False)

  var nam = name
  if nam == "": nam = "Untitled"
  if filename == "": nam.add(" *")
  elif filename != "" and name == "":
    # Disable the undo/redo manager.
    buffer.begin_not_undoable_action()
  
    # Load the file.
    var file: string = readFile(filename)
    if file != nil:
      buffer.set_text(file, len(file))
      
    # Enable the undo/redo manager.
    buffer.end_not_undoable_action()
      
    # Get the name.ext of the filename, for the tabs title
    nam = extractFilename(filename)
  
  # Init the sourceview
  var sourceView: PWidget
  var scrollWindow: PScrolledWindow
  initSourceView(sourceView, scrollWindow, buffer)

  var (TabLabel, labelText) = createTabLabel(nam, scrollWindow)
  # Add a tab
  discard win.SourceViewTabs.appendPage(scrollWindow, TabLabel)

  var nTab: Tab
  nTab.buffer = buffer
  nTab.sourceView = sourceView
  nTab.label = labelText
  nTab.saved = (filename != "")
  nTab.filename = filename
  win.Tabs.add(nTab)

  PTextView(SourceView).setBuffer(nTab.buffer)

# GTK Events Contd.
# -- TopMenu & TopBar

proc newFile(menuItem: PMenuItem, user_data: pgpointer) =
  addTab("", "")
  win.sourceViewTabs.setCurrentPage(win.Tabs.len()-1)
  
proc openFile(menuItem: PMenuItem, user_data: pgpointer) =
  var startpath = ""
  var currPage = win.SourceViewTabs.getCurrentPage()
  if currPage <% win.tabs.len: 
    startpath = os.splitFile(win.tabs[currPage].filename).dir

  if startpath.len == 0:
    # Use lastSavePath as the startpath
    startpath = win.tempStuff.lastSaveDir
    if startpath.len == 0:
      startpath = os.getHomeDir()

  var files = ChooseFilesToOpen(win.w, startpath)
  if files.len() > 0:
    for f in items(files):
      try:
        addTab("", f)
      except EIO:
        error(win.w, "Unable to read from file")
    # Switch to the newly created tab
    win.sourceViewTabs.setCurrentPage(win.Tabs.len()-1)
  
proc saveFile_Activate(menuItem: PMenuItem, user_data: pgpointer) =
  var current = win.SourceViewTabs.getCurrentPage()
  saveTab(current, os.splitFile(win.tabs[current].filename).dir)

proc saveFileAs_Activate(menuItem: PMenuItem, user_data: pgpointer) =
  var current = win.SourceViewTabs.getCurrentPage()
  var (filename, saved) = (win.Tabs[current].filename, win.Tabs[current].saved)

  win.Tabs[current].saved = False
  win.Tabs[current].filename = ""
  saveTab(current, os.splitFile(filename).dir)
  # If the user cancels the save file dialog. Restore the previous filename
  # and saved state
  if win.Tabs[current].filename == "":
    win.Tabs[current].filename = filename
    win.Tabs[current].saved = saved

proc undo(menuItem: PMenuItem, user_data: pgpointer) = 
  var current = win.SourceViewTabs.getCurrentPage()
  if win.Tabs[current].buffer.canUndo():
    win.Tabs[current].buffer.undo()
  
proc redo(menuItem: PMenuItem, user_data: pgpointer) =
  var current = win.SourceViewTabs.getCurrentPage()
  if win.Tabs[current].buffer.canRedo():
    win.Tabs[current].buffer.redo()
    
proc find_Activate(menuItem: PMenuItem, user_data: pgpointer) = 
  # Get the selected text, and set the findEntry to it.
  var currentTab = win.SourceViewTabs.getCurrentPage()
  var insertIter: TTextIter
  win.Tabs[currentTab].buffer.getIterAtMark(addr(insertIter), 
                                      win.Tabs[currentTab].buffer.getInsert())
  var insertOffset = addr(insertIter).getOffset()
  
  var selectIter: TTextIter
  win.Tabs[currentTab].buffer.getIterAtMark(addr(selectIter), 
                win.Tabs[currentTab].buffer.getSelectionBound())
  var selectOffset = addr(selectIter).getOffset()
  
  if insertOffset != selectOffset:
    var text = win.Tabs[currentTab].buffer.getText(addr(insertIter), 
                                                   addr(selectIter), false)
    win.findEntry.setText(text)

  win.findBar.show()
  win.findEntry.grabFocus()
  win.replaceEntry.hide()
  win.replaceLabel.hide()
  win.replaceBtn.hide()
  win.replaceAllBtn.hide()

proc replace_Activate(menuitem: PMenuItem, user_data: pgpointer) =
  win.findBar.show()
  win.findEntry.grabFocus()
  win.replaceEntry.show()
  win.replaceLabel.show()
  win.replaceBtn.show()
  win.replaceAllBtn.show()
  
proc settings_Activate(menuitem: PMenuItem, user_data: pgpointer) =
  settings.showSettings(win)
  
proc viewBottomPanel_Toggled(menuitem: PCheckMenuItem, user_data: pgpointer) =
  win.settings.bottomPanelVisible = menuitem.itemGetActive()
  if win.settings.bottomPanelVisible:
    win.bottomPanelTabs.show()
  else:
    win.bottomPanelTabs.hide()

var
  pegLineError = peg"{[^(]*} '(' {\d+} ', ' \d+ ') Error:' \s* {.*}"
  pegLineWarning = peg"{[^(]*} '(' {\d+} ', ' \d+ ') ' ('Warning:'/'Hint:') \s* {.*}"
  pegOtherError = peg"'Error:' \s* {.*}"
  pegSuccess = peg"'Hint: operation successful'.*"

proc addText(textView: PTextView, text: string, colorTag: PTextTag = nil) =
  if text != nil:
    var iter: TTextIter
    textView.getBuffer().getEndIter(addr(iter))

    if colorTag == nil:
      textView.getBuffer().insert(addr(iter), text, len(text))
    else:
      textView.getBuffer().insertWithTags(addr(iter), text, len(text), colorTag,
                                          nil)

proc createColor(textView: PTextView, name, color: string): PTextTag =
  var tagTable = textView.getBuffer().getTagTable()
  result = tagTable.tableLookup(name)
  if result == nil:
    result = textView.getBuffer().createTag(name, "foreground", color, nil)

when not defined(os.findExe): 
  proc findExe(exe: string): string = 
    ## returns "" if the exe cannot be found
    result = addFileExt(exe, os.exeExt)
    if ExistsFile(result): return
    var path = os.getEnv("PATH")
    for candidate in split(path, pathSep): 
      var x = candidate / result
      if ExistsFile(x): return x
    result = ""

proc GetCmd(cmd, filename: string): string = 
  var f = quoteIfContainsWhite(filename)
  if cmd =~ peg"\s* '$' y'findExe' '(' {[^)]+} ')' {.*}":
    var exe = quoteIfContainsWhite(findExe(matches[0]))
    if exe.len == 0: exe = matches[0]
    result = exe & " " & matches[1] % f
  else:
    result = cmd % f

proc showBottomPanel() =
  if not win.settings.bottomPanelVisible:
    win.bottomPanelTabs.show()
    win.settings.bottomPanelVisible = true
    PCheckMenuItem(win.viewBottomPanelMenuItem).itemSetActive(true)
  # Scroll to the end of the TextView
  # This is stupid, it works sometimes... it's random
  var endIter: TTextIter
  win.outputTextView.getBuffer().getEndIter(addr(endIter))
  discard win.outputTextView.scrollToIter(
    addr(endIter), 0.25, False, 0.0, 0.0)

proc compileRun(currentTab: int, shouldRun: bool) =
  if win.Tabs[currentTab].filename.len == 0: return
  # Clear the outputTextView
  win.outputTextView.getBuffer().setText("", 0)

  var outp = osProc.execProcess(GetCmd(win.settings.nimrodCmd,
                                win.Tabs[currentTab].filename))
  # Colors
  var normalTag = createColor(win.outputTextView, "normalTag", "#3d3d3d")
  var errorTag = createColor(win.outputTextView, "errorTag", "red")
  var warningTag = createColor(win.outputTextView, "warningTag", "darkorange")
  var successTag = createColor(win.outputTextView, "successTag", "darkgreen")
  for x in outp.splitLines():
    if x =~ pegLineError / pegOtherError:
      win.outputTextView.addText("\n" & x, errorTag)
    elif x=~ pegSuccess:
      win.outputTextView.addText("\n" & x, successTag)
      
      # Launch the process
      if shouldRun:
        var filename = changeFileExt(win.Tabs[currentTab].filename, os.ExeExt)
        var output = "\n" & osProc.execProcess(filename)
        win.outputTextView.addText(output)
    elif x =~ pegLineWarning:
      win.outputTextView.addText("\n" & x, warningTag)
    else:
      win.outputTextView.addText("\n" & x, normalTag)
  showBottomPanel()

proc CompileCurrent_Activate(menuitem: PMenuItem, user_data: pgpointer) =
  saveFile_Activate(nil, nil)
  compileRun(win.SourceViewTabs.getCurrentPage(), false)
  
proc CompileRunCurrent_Activate(menuitem: PMenuItem, user_data: pgpointer) =
  saveFile_Activate(nil, nil)
  compileRun(win.SourceViewTabs.getCurrentPage(), true)

proc CompileProject_Activate(menuitem: PMenuItem, user_data: pgpointer) =
  saveAllTabs()
  compileRun(getProjectTab(), false)
  
proc CompileRunProject_Activate(menuitem: PMenuItem, user_data: pgpointer) =
  saveAllTabs()
  compileRun(getProjectTab(), true)

proc RunCustomCommand(cmd: string) = 
  saveFile_Activate(nil, nil)
  var currentTab = win.SourceViewTabs.getCurrentPage()
  if win.Tabs[currentTab].filename.len == 0 or cmd.len == 0: return
  # Clear the outputTextView
  win.outputTextView.getBuffer().setText("", 0)
  var outp = osProc.execProcess(GetCmd(cmd, win.Tabs[currentTab].filename))
  var normalTag = createColor(win.outputTextView, "normalTag", "#3d3d3d")
  for x in outp.splitLines():
    win.outputTextView.addText("\n" & x, normalTag)
  showBottomPanel()

proc RunCustomCommand1(menuitem: PMenuItem, user_data: pgpointer) =
  RunCustomCommand(win.settings.customCmd1)

proc RunCustomCommand2(menuitem: PMenuItem, user_data: pgpointer) =
  RunCustomCommand(win.settings.customCmd2)

proc RunCustomCommand3(menuitem: PMenuItem, user_data: pgpointer) =
  RunCustomCommand(win.settings.customCmd3)

# -- FindBar

proc nextBtn_Clicked(button: PButton, user_data: pgpointer) = findText(True)
proc prevBtn_Clicked(button: PButton, user_data: pgpointer) = findText(False)

proc replaceBtn_Clicked(button: PButton, user_data: pgpointer) =
  var currentTab = win.SourceViewTabs.getCurrentPage()
  var start, theEnd: TTextIter
  if not win.Tabs[currentTab].buffer.getSelectionBounds(
        addr(start), addr(theEnd)):
    # If no text is selected, try finding a match.
    findText(True)
    if not win.Tabs[currentTab].buffer.getSelectionBounds(
          addr(start), addr(theEnd)):
      # No match
      return
  
  # Remove the text
  win.Tabs[currentTab].buffer.delete(addr(start), addr(theEnd))
  # Insert the replacement
  var text = getText(win.replaceEntry)
  win.Tabs[currentTab].buffer.insert(addr(start), text, len(text))
  
proc replaceAllBtn_Clicked(button: PButton, user_data: pgpointer) =
  var find = getText(win.findEntry)
  var replace = getText(win.replaceEntry)
  discard replaceAll(find, replace)
  
proc closeBtn_Clicked(button: PButton, user_data: pgpointer) = 
  win.findBar.hide()

proc caseSens_Changed(radiomenuitem: PRadioMenuitem, user_data: pgpointer) =
  win.settings.search = "casesens"
proc caseInSens_Changed(radiomenuitem: PRadioMenuitem, user_data: pgpointer) =
  win.settings.search = "caseinsens"
proc style_Changed(radiomenuitem: PRadioMenuitem, user_data: pgpointer) =
  win.settings.search = "style"
proc regex_Changed(radiomenuitem: PRadioMenuitem, user_data: pgpointer) =
  win.settings.search = "regex"
proc peg_Changed(radiomenuitem: PRadioMenuitem, user_data: pgpointer) =
  win.settings.search = "peg"

proc extraBtn_Clicked(button: PButton, user_data: pgpointer) =
  var extraMenu = menuNew()
  var group: PGSList

  var caseSensMenuItem = radio_menu_item_new(group, "Case sensitive")
  extraMenu.append(caseSensMenuItem)
  discard signal_connect(caseSensMenuItem, "toggled", 
                          SIGNAL_FUNC(caseSens_Changed), nil)
  caseSensMenuItem.show()
  group = caseSensMenuItem.ItemGetGroup()
  
  var caseInSensMenuItem = radio_menu_item_new(group, "Case insensitive")
  extraMenu.append(caseInSensMenuItem)
  discard signal_connect(caseInSensMenuItem, "toggled", 
                          SIGNAL_FUNC(caseInSens_Changed), nil)
  caseInSensMenuItem.show()
  group = caseInSensMenuItem.ItemGetGroup()
  
  var styleMenuItem = radio_menu_item_new(group, "Style insensitive")
  extraMenu.append(styleMenuItem)
  discard signal_connect(styleMenuItem, "toggled", 
                          SIGNAL_FUNC(style_Changed), nil)
  styleMenuItem.show()
  group = styleMenuItem.ItemGetGroup()
  
  var regexMenuItem = radio_menu_item_new(group, "Regex")
  extraMenu.append(regexMenuItem)
  discard signal_connect(regexMenuItem, "toggled", 
                          SIGNAL_FUNC(regex_Changed), nil)
  regexMenuItem.show()
  group = regexMenuItem.ItemGetGroup()
  
  var pegMenuItem = radio_menu_item_new(group, "Pegs")
  extraMenu.append(pegMenuItem)
  discard signal_connect(pegMenuItem, "toggled", 
                          SIGNAL_FUNC(peg_Changed), nil)
  pegMenuItem.show()
  
  # Make the correct radio button active
  case win.settings.search
  of "casesens":
    PCheckMenuItem(caseSensMenuItem).ItemSetActive(True)
  of "caseinsens":
    PCheckMenuItem(caseInSensMenuItem).ItemSetActive(True)
  of "style":
    PCheckMenuItem(styleMenuItem).ItemSetActive(True)
  of "regex":
    PCheckMenuItem(regexMenuItem).ItemSetActive(True)
  of "peg":
    PCheckMenuItem(pegMenuItem).ItemSetActive(True)

  extraMenu.popup(nil, nil, nil, nil, 0, get_current_event_time())

# GUI Initialization

proc createAccelMenuItem(toolsMenu: PMenu, accGroup: PAccelGroup, 
                         label: string, acc: gint,
                         action: proc (i: PMenuItem, p: pgpointer)) = 
  var result = menu_item_new(label)
  result.addAccelerator("activate", accGroup, acc, 0, ACCEL_VISIBLE)
  ToolsMenu.append(result)
  show(result)
  discard signal_connect(result, "activate", SIGNAL_FUNC(action), nil)

proc createSeparator(menu: PMenu) =
  var sep = separator_menu_item_new()
  menu.append(sep)
  sep.show()

proc initTopMenu(MainBox: PBox) =
  # Create a accelerator group, used for shortcuts
  # like CTRL + S in SaveMenuItem
  var accGroup = accel_group_new()
  add_accel_group(win.w, accGroup)

  # TopMenu(MenuBar)
  var TopMenu = menuBarNew()
  
  # FileMenu
  var FileMenu = menuNew()

  var NewMenuItem = menu_item_new("New") # New
  FileMenu.append(NewMenuItem)
  show(NewMenuItem)
  discard signal_connect(NewMenuItem, "activate", 
                          SIGNAL_FUNC(newFile), nil)

  createSeparator(FileMenu)

  var OpenMenuItem = menu_item_new("Open...") # Open...
  # CTRL + O
  OpenMenuItem.add_accelerator("activate", accGroup, 
                  KEY_o, CONTROL_MASK, ACCEL_VISIBLE) 
  FileMenu.append(OpenMenuItem)
  show(OpenMenuItem)
  discard signal_connect(OpenMenuItem, "activate", 
                          SIGNAL_FUNC(aporia.openFile), nil)
  
  var SaveMenuItem = menu_item_new("Save") # Save
  # CTRL + S
  SaveMenuItem.add_accelerator("activate", accGroup, 
                  KEY_s, CONTROL_MASK, ACCEL_VISIBLE) 
  FileMenu.append(SaveMenuItem)
  show(SaveMenuItem)
  discard signal_connect(SaveMenuItem, "activate", 
                          SIGNAL_FUNC(saveFile_activate), nil)

  var SaveAsMenuItem = menu_item_new("Save As...") # Save as...

  SaveAsMenuItem.add_accelerator("activate", accGroup, 
                  KEY_s, CONTROL_MASK or gdk2.SHIFT_MASK, ACCEL_VISIBLE) 
  FileMenu.append(SaveAsMenuItem)
  show(SaveAsMenuItem)
  discard signal_connect(SaveAsMenuItem, "activate", 
                          SIGNAL_FUNC(saveFileAs_Activate), nil)
  
  var FileMenuItem = menuItemNewWithMnemonic("_File")

  FileMenuItem.setSubMenu(FileMenu)
  FileMenuItem.show()
  TopMenu.append(FileMenuItem)
  
  # Edit menu
  var EditMenu = menuNew()

  var UndoMenuItem = menu_item_new("Undo") # Undo
  EditMenu.append(UndoMenuItem)
  show(UndoMenuItem)
  discard signal_connect(UndoMenuItem, "activate", 
                          SIGNAL_FUNC(aporia.undo), nil)
  
  var RedoMenuItem = menu_item_new("Redo") # Undo
  EditMenu.append(RedoMenuItem)
  show(RedoMenuItem)
  discard signal_connect(RedoMenuItem, "activate", 
                          SIGNAL_FUNC(aporia.redo), nil)

  createSeparator(EditMenu)
  
  var FindMenuItem = menu_item_new("Find") # Find
  FindMenuItem.add_accelerator("activate", accGroup, 
                  KEY_f, CONTROL_MASK, ACCEL_VISIBLE) 
  EditMenu.append(FindMenuItem)
  show(FindMenuItem)
  discard signal_connect(FindMenuItem, "activate", 
                          SIGNAL_FUNC(aporia.find_Activate), nil)

  var ReplaceMenuItem = menu_item_new("Replace") # Replace
  ReplaceMenuItem.add_accelerator("activate", accGroup, 
                  KEY_h, CONTROL_MASK, ACCEL_VISIBLE) 
  EditMenu.append(ReplaceMenuItem)
  show(ReplaceMenuItem)
  discard signal_connect(ReplaceMenuItem, "activate", 
                          SIGNAL_FUNC(aporia.replace_Activate), nil)

  createSeparator(EditMenu)
  
  var SettingsMenuItem = menu_item_new("Settings...") # Settings
  EditMenu.append(SettingsMenuItem)
  show(SettingsMenuItem)
  discard signal_connect(SettingsMenuItem, "activate", 
                          SIGNAL_FUNC(aporia.Settings_Activate), nil)

  var EditMenuItem = menuItemNewWithMnemonic("_Edit")

  EditMenuItem.setSubMenu(EditMenu)
  EditMenuItem.show()
  TopMenu.append(EditMenuItem)
  
  # View menu
  var ViewMenu = menuNew()
  
  win.viewBottomPanelMenuItem = check_menu_item_new("Bottom Panel")
  PCheckMenuItem(win.viewBottomPanelMenuItem).itemSetActive(
         win.settings.bottomPanelVisible)
  win.viewBottomPanelMenuItem.add_accelerator("activate", accGroup, 
                  KEY_f9, CONTROL_MASK, ACCEL_VISIBLE) 
  ViewMenu.append(win.viewBottomPanelMenuItem)
  show(win.viewBottomPanelMenuItem)
  discard signal_connect(win.viewBottomPanelMenuItem, "toggled", 
                          SIGNAL_FUNC(aporia.viewBottomPanel_Toggled), nil)
  
  var ViewMenuItem = menuItemNewWithMnemonic("_View")

  ViewMenuItem.setSubMenu(ViewMenu)
  ViewMenuItem.show()
  TopMenu.append(ViewMenuItem)       
  
  
  # Tools menu
  var ToolsMenu = menuNew()

  createAccelMenuItem(ToolsMenu, accGroup, "Compile current file", 
                      KEY_F4, aporia.CompileCurrent_Activate)
  createAccelMenuItem(ToolsMenu, accGroup, "Compile & run current file", 
                      KEY_F5, aporia.CompileRunCurrent_Activate)
  createSeparator(ToolsMenu)
  createAccelMenuItem(ToolsMenu, accGroup, "Compile project", 
                      KEY_F8, aporia.CompileProject_Activate)
  createAccelMenuItem(ToolsMenu, accGroup, "Compile & run project", 
                      KEY_F9, aporia.CompileRunProject_Activate)
  createSeparator(ToolsMenu)
  createAccelMenuItem(ToolsMenu, accGroup, "Run custom command 1", 
                      KEY_F1, aporia.RunCustomCommand1)
  createAccelMenuItem(ToolsMenu, accGroup, "Run custom command 2", 
                      KEY_F2, aporia.RunCustomCommand2)
  createAccelMenuItem(ToolsMenu, accGroup, "Run custom command 3", 
                      KEY_F3, aporia.RunCustomCommand3)
  
  var ToolsMenuItem = menuItemNewWithMnemonic("_Tools")
  
  ToolsMenuItem.setSubMenu(ToolsMenu)
  ToolsMenuItem.show()
  TopMenu.append(ToolsMenuItem)
  
  # Help menu
  MainBox.packStart(TopMenu, False, False, 0)
  TopMenu.show()

proc initToolBar(MainBox: PBox) =
  # TopBar(ToolBar)
  var TopBar = toolbarNew()
  TopBar.setStyle(TOOLBAR_ICONS)
  
  var NewFileItem = TopBar.insertStock(STOCK_NEW, "New File",
                      "New File", SIGNAL_FUNC(aporia.newFile), nil, 0)
  TopBar.appendSpace()
  var OpenItem = TopBar.insertStock(STOCK_OPEN, "Open",
                      "Open", SIGNAL_FUNC(aporia.openFile), nil, -1)
  var SaveItem = TopBar.insertStock(STOCK_SAVE, "Save",
                      "Save", SIGNAL_FUNC(saveFile_Activate), nil, -1)
  TopBar.appendSpace()
  var UndoItem = TopBar.insertStock(STOCK_UNDO, "Undo", 
                      "Undo", SIGNAL_FUNC(aporia.undo), nil, -1)
  var RedoItem = TopBar.insertStock(STOCK_REDO, "Redo",
                      "Redo", SIGNAL_FUNC(aporia.redo), nil, -1)
  
  MainBox.packStart(TopBar, False, False, 0)
  TopBar.show()
  
proc initSourceViewTabs() =
  win.SourceViewTabs = notebookNew()
  #win.sourceViewTabs.dragDestSet(DEST_DEFAULT_DROP, nil, 0, ACTION_MOVE)
  discard win.SourceViewTabs.signalConnect(
          "switch-page", SIGNAL_FUNC(onSwitchTab), nil)
  #discard win.SourceViewTabs.signalConnect(
  #        "drag-drop", SIGNAL_FUNC(svTabs_DragDrop), nil)
  #discard win.SourceViewTabs.signalConnect(
  #        "drag-data-received", SIGNAL_FUNC(svTabs_DragDataRecv), nil)
  #discard win.SourceViewTabs.signalConnect(
  #        "drag-motion", SIGNAL_FUNC(svTabs_DragMotion), nil)
  win.SourceViewTabs.set_scrollable(True)
  
  win.SourceViewTabs.show()
  if lastSession.len != 0:
    for i in 0 .. len(lastSession)-1:
      var splitUp = lastSession[i].split('|')
      var (filename, offset) = (splitUp[0], splitUp[1])
      addTab("", filename)
      
      var iter: TTextIter
      win.Tabs[i].buffer.getIterAtOffset(addr(iter), offset.parseInt())
      win.Tabs[i].buffer.moveMarkByName("insert", addr(iter))
      win.Tabs[i].buffer.moveMarkByName("selection_bound", addr(iter))
      
      # TODO: Fix this..... :(
      discard PTextView(win.Tabs[i].sourceView).
          scrollToIter(addr(iter), 0.25, true, 0.0, 0.0)
  else:
    addTab("", "")
  
  # This doesn't work :\
  win.Tabs[0].sourceView.grabFocus()

  
proc initBottomTabs() =
  win.bottomPanelTabs = notebookNew()
  if win.settings.bottomPanelVisible:
    win.bottomPanelTabs.show()
  
  # output tab
  var tabLabel = labelNew("Output")
  var outputTab = vboxNew(False, 0)
  discard win.bottomPanelTabs.appendPage(outputTab, tabLabel)
  # Compiler tabs, gtktextview
  var outputScrolledWindow = scrolledwindowNew(nil, nil)
  outputScrolledWindow.setPolicy(POLICY_AUTOMATIC, POLICY_AUTOMATIC)
  outputTab.packStart(outputScrolledWindow, true, true, 0)
  outputScrolledWindow.show()
  
  win.outputTextView = textviewNew()
  outputScrolledWindow.add(win.outputTextView)
  win.outputTextView.show()
  
  outputTab.show()

proc initTAndBP(MainBox: PBox) =
  # This init's the HPaned, which splits the sourceViewTabs
  # and the BottomPanelTabs
  initSourceViewTabs()
  initBottomTabs()
  
  var TAndBPVPaned = vpanedNew()
  tandbpVPaned.pack1(win.sourceViewTabs, resize=True, shrink=False)
  tandbpVPaned.pack2(win.bottomPanelTabs, resize=False, shrink=False)
  MainBox.packStart(TAndBPVPaned, True, True, 0)
  tandbpVPaned.setPosition(win.settings.VPanedPos)
  TAndBPVPaned.show()

proc initFindBar(MainBox: PBox) =
  # Create a fixed container
  win.findBar = HBoxNew(False, 0)
  win.findBar.setSpacing(4)

  # Add a Label 'Find'
  var findLabel = labelNew("Find:")
  win.findBar.packStart(findLabel, False, False, 0)
  findLabel.show()

  # Add a (find) text entry
  win.findEntry = entryNew()
  win.findBar.packStart(win.findEntry, False, False, 0)
  discard win.findEntry.signalConnect("activate", SIGNAL_FUNC(
                                      aporia.nextBtn_Clicked), nil)
  win.findEntry.show()
  var rq: TRequisition 
  win.findEntry.sizeRequest(addr(rq))

  # Make the (find) text entry longer
  win.findEntry.set_size_request(190, rq.height)
  
  # Add a Label 'Replace' 
  # - This Is only shown, when the 'Search & Replace'(CTRL + H) is shown
  win.replaceLabel = labelNew("Replace:")
  win.findBar.packStart(win.replaceLabel, False, False, 0)
  #replaceLabel.show()
  
  # Add a (replace) text entry 
  # - This Is only shown, when the 'Search & Replace'(CTRL + H) is shown
  win.replaceEntry = entryNew()
  win.findBar.packStart(win.replaceEntry, False, False, 0)
  #win.replaceEntry.show()
  var rq1: TRequisition 
  win.replaceEntry.sizeRequest(addr(rq1))

  # Make the (replace) text entry longer
  win.replaceEntry.set_size_request(100, rq1.height)
  
  # Find next button
  var nextBtn = buttonNew("Next")
  win.findBar.packStart(nextBtn, false, false, 0)
  discard nextBtn.signalConnect("clicked", 
             SIGNAL_FUNC(aporia.nextBtn_Clicked), nil)
  nextBtn.show()
  var nxtBtnRq: TRequisition
  nextBtn.sizeRequest(addr(nxtBtnRq))
  
  # Find previous button
  var prevBtn = buttonNew("Previous")
  win.findBar.packStart(prevBtn, false, false, 0)
  discard prevBtn.signalConnect("clicked", 
             SIGNAL_FUNC(aporia.prevBtn_Clicked), nil)
  prevBtn.show()
  
  # Replace button
  # - This Is only shown, when the 'Search & Replace'(CTRL + H) is shown
  win.replaceBtn = buttonNew("Replace")
  win.findBar.packStart(win.replaceBtn, false, false, 0)
  discard win.replaceBtn.signalConnect("clicked", 
             SIGNAL_FUNC(aporia.replaceBtn_Clicked), nil)
  #replaceBtn.show()

  # Replace all button
  # - this Is only shown, when the 'Search & Replace'(CTRL + H) is shown
  win.replaceAllBtn = buttonNew("Replace All")
  win.findBar.packStart(win.replaceAllBtn, false, false, 0)
  discard win.replaceAllBtn.signalConnect("clicked", 
             SIGNAL_FUNC(aporia.replaceAllBtn_Clicked), nil)
  #replaceAllBtn.show()
  
  # Right side ...
  
  # Close button - With a close stock image
  var closeBtn = buttonNew()
  var closeImage = imageNewFromStock(STOCK_CLOSE, ICON_SIZE_SMALL_TOOLBAR)
  var closeBox = hboxNew(False, 0)
  closeBtn.add(closeBox)
  closeBox.show()
  closeBox.add(closeImage)
  closeImage.show()
  discard closeBtn.signalConnect("clicked", 
             SIGNAL_FUNC(aporia.closeBtn_Clicked), nil)
  win.findBar.packEnd(closeBtn, False, False, 2)
  closeBtn.show()
  
  # Extra button - When clicked shows a menu with options like 'Use regex'
  var extraBtn = buttonNew()
  var extraImage = imageNewFromStock(STOCK_PROPERTIES, ICON_SIZE_SMALL_TOOLBAR)

  var extraBox = hboxNew(False, 0)
  extraBtn.add(extraBox)
  extraBox.show()
  extraBox.add(extraImage)
  extraImage.show()
  discard extraBtn.signalConnect("clicked", 
             SIGNAL_FUNC(aporia.extraBtn_Clicked), nil)
  win.findBar.packEnd(extraBtn, False, False, 0)
  extraBtn.show()
  
  MainBox.packStart(win.findBar, False, False, 0)
  win.findBar.show()

proc initStatusBar(MainBox: PBox) =
  win.bottomBar = statusbarNew()
  MainBox.packStart(win.bottomBar, False, False, 0)
  win.bottomBar.show()
  
  discard win.bottomBar.push(0, "Line: 0 Column: 0")
  
proc initControls() =
  # Load up the language style
  win.langMan = languageManagerGetDefault()
  var langpaths: array[0..1, cstring] = 
          [cstring(os.getApplicationDir() / langSpecs), nil]
  win.langMan.setSearchPath(addr(langpaths))
  var nimLang = win.langMan.getLanguage("nimrod")
  win.nimLang = nimLang
  
  # Load the scheme
  var schemeMan = schemeManagerGetDefault()
  var schemepaths: array[0..1, cstring] =
          [cstring(os.getApplicationDir() / styles), nil]
  schemeMan.setSearchPath(addr(schemepaths))
  win.scheme = schemeMan.getScheme(win.settings.colorSchemeID)
  
  # Window
  win.w = windowNew(gtk2.WINDOW_TOPLEVEL)
  win.w.setDefaultSize(win.settings.winWidth, win.settings.winHeight)
  win.w.setTitle("Aporia IDE")
  if win.settings.winMaximized: win.w.maximize()
  
  win.w.show() # The window has to be shown before
               # setting the position of the VPaned so that
               # it gets set correctly, when the window is maximized.
    
  discard win.w.signalConnect("destroy", SIGNAL_FUNC(aporia.destroy), nil)
  discard win.w.signalConnect("delete_event", 
    SIGNAL_FUNC(aporia.delete_event), nil)
  discard win.w.signalConnect("window-state-event", 
    SIGNAL_FUNC(aporia.windowState_Changed), nil)
  
  # MainBox (vbox)
  var MainBox = vboxNew(False, 0)
  win.w.add(MainBox)
  
  initTopMenu(MainBox)
  initToolBar(MainBox)
  initTAndBP(MainBox)
  initFindBar(MainBox)
  initStatusBar(MainBox)
  
  MainBox.show()
  if confParseFail:
    dialogs.warning(win.w, "Error parsing config file, using default settings.")
 
nimrod_init()
initControls()
main()


---tokens---
'import'      Keyword.Namespace
' '           Text
'glib2'       Name
','           Punctuation
' '           Text
'gtk2'        Name
','           Punctuation
' '           Text
'gdk2'        Name
','           Punctuation
' '           Text
'gtksourceview' Name
','           Punctuation
' '           Text
'dialogs'     Name
','           Punctuation
' '           Text
'os'          Name
','           Punctuation
' '           Text
'pango'       Name
','           Punctuation
' '           Text
'osproc'      Name
','           Punctuation
' '           Text
'strutils'    Name
'\n'          Text

'import'      Keyword.Namespace
' '           Text
'pegs'        Name
','           Punctuation
' '           Text
'streams'     Name
'\n'          Text

'import'      Keyword.Namespace
' '           Text
'settings'    Name
','           Punctuation
' '           Text
'types'       Name
','           Punctuation
' '           Text
'cfg'         Name
','           Punctuation
' '           Text
'search'      Name
'\n\n'        Text

'{.'          Punctuation
'push'        Name
' '           Text
'callConv'    Name
':'           Punctuation
'cdecl'       Name
'.'           Punctuation
'}'           Punctuation
'\n\n'        Text

'const'       Keyword
'\n  '        Text
'NimrodProjectExt' Name
' '           Text
'='           Operator
' '           Text
'"'           Literal.String
'.nimprj'     Literal.String
'"'           Literal.String
'\n\n'        Text

'var'         Keyword.Declaration
' '           Text
'win'         Name
':'           Punctuation
' '           Text
'types'       Name
'.'           Punctuation
'MainWin'     Name
'\n'          Text

'win'         Name
'.'           Punctuation
'Tabs'        Name
' '           Text
'='           Operator
' '           Text
'@'           Operator
'['           Operator
']'           Operator
'\n\n'        Text

'search'      Name
'.'           Punctuation
'win'         Name
' '           Text
'='           Operator
' '           Text
'addr'        Keyword
'('           Punctuation
'win'         Name
')'           Punctuation
'\n\n'        Text

'var'         Keyword.Declaration
' '           Text
'lastSession' Name
':'           Punctuation
' '           Text
'seq'         Keyword.Type
'['           Operator
'string'      Keyword.Type
']'           Operator
' '           Text
'='           Operator
' '           Text
'@'           Operator
'['           Operator
']'           Operator
'\n\n'        Text

'var'         Keyword.Declaration
' '           Text
'confParseFail' Name
' '           Text
'='           Operator
' '           Text
'False'       Keyword.Pseudo
' '           Text
'# This gets set to true' Comment
'\n                          ' Text
'# When there is an error parsing the config' Comment
'\n\n'        Text

'# Load the settings' Comment
'\n'          Text

'try'         Keyword
':'           Punctuation
'\n  '        Text
'win'         Name
'.'           Punctuation
'settings'    Name
' '           Text
'='           Operator
' '           Text
'cfg'         Name
'.'           Punctuation
'load'        Name
'('           Punctuation
'lastSession' Name
')'           Punctuation
'\n'          Text

'except'      Keyword
' '           Text
'ECFGParse'   Name
':'           Punctuation
'\n  '        Text
'# TODO: Make the dialog show the exception' Comment
'\n  '        Text
'confParseFail' Name
' '           Text
'='           Operator
' '           Text
'True'        Keyword.Pseudo
'\n  '        Text
'win'         Name
'.'           Punctuation
'settings'    Name
' '           Text
'='           Operator
' '           Text
'cfg'         Name
'.'           Punctuation
'defaultSettings' Name
'('           Punctuation
')'           Punctuation
'\n'          Text

'except'      Keyword
' '           Text
'EIO'         Name
':'           Punctuation
'\n  '        Text
'win'         Name
'.'           Punctuation
'settings'    Name
' '           Text
'='           Operator
' '           Text
'cfg'         Name
'.'           Punctuation
'defaultSettings' Name
'('           Punctuation
')'           Punctuation
'\n\n'        Text

'proc '       Keyword
'getProjectTab' Name.Function
'('           Punctuation
')'           Punctuation
':'           Punctuation
' '           Text
'int'         Keyword.Type
' '           Text
'='           Operator
' \n  '       Text
'for'         Keyword
' '           Text
'i'           Name
' '           Text
'in'          Operator.Word
' '           Text
'0'           Literal.Number.Float
'..'          Punctuation
'high'        Name
'('           Punctuation
'win'         Name
'.'           Punctuation
'tabs'        Name
')'           Punctuation
':'           Punctuation
' \n    '     Text
'if'          Keyword
' '           Text
'win'         Name
'.'           Punctuation
'tabs'        Name
'['           Operator
'i'           Name
']'           Operator
'.'           Punctuation
'filename'    Name
'.'           Punctuation
'endswith'    Name
'('           Punctuation
'NimrodProjectExt' Name
')'           Punctuation
':'           Punctuation
' '           Text
'return'      Keyword
' '           Text
'i'           Name
'\n\n'        Text

'proc '       Keyword
'saveTab'     Name.Function
'('           Punctuation
'tabNr'       Name
':'           Punctuation
' '           Text
'int'         Keyword.Type
','           Punctuation
' '           Text
'startpath'   Name
':'           Punctuation
' '           Text
'string'      Keyword.Type
')'           Punctuation
' '           Text
'='           Operator
'\n  '        Text
'if'          Keyword
' '           Text
'tabNr'       Name
' '           Text
'<'           Operator
' '           Text
'0'           Literal.Number.Integer
':'           Punctuation
' '           Text
'return'      Keyword
'\n  '        Text
'if'          Keyword
' '           Text
'win'         Name
'.'           Punctuation
'Tabs'        Name
'['           Operator
'tabNr'       Name
']'           Operator
'.'           Punctuation
'saved'       Name
':'           Punctuation
' '           Text
'return'      Keyword
'\n  '        Text
'var'         Keyword.Declaration
' '           Text
'path'        Name
' '           Text
'='           Operator
' '           Text
'"'           Literal.String
'"'           Literal.String
'\n  '        Text
'if'          Keyword
' '           Text
'win'         Name
'.'           Punctuation
'Tabs'        Name
'['           Operator
'tabNr'       Name
']'           Operator
'.'           Punctuation
'filename'    Name
' '           Text
'='           Operator
'='           Operator
' '           Text
'"'           Literal.String
'"'           Literal.String
':'           Punctuation
'\n    '      Text
'path'        Name
' '           Text
'='           Operator
' '           Text
'ChooseFileToSave' Name
'('           Punctuation
'win'         Name
'.'           Punctuation
'w'           Name
','           Punctuation
' '           Text
'startpath'   Name
')'           Punctuation
' \n    '     Text
'# dialogs.nim STOCK_OPEN instead of STOCK_SAVE' Comment
'\n  '        Text
'else'        Keyword
':'           Punctuation
' \n    '     Text
'path'        Name
' '           Text
'='           Operator
' '           Text
'win'         Name
'.'           Punctuation
'Tabs'        Name
'['           Operator
'tabNr'       Name
']'           Operator
'.'           Punctuation
'filename'    Name
'\n  \n  '    Text
'if'          Keyword
' '           Text
'path'        Name
' '           Text
'!'           Operator
'='           Operator
' '           Text
'"'           Literal.String
'"'           Literal.String
':'           Punctuation
'\n    '      Text
'var'         Keyword.Declaration
' '           Text
'buffer'      Name
' '           Text
'='           Operator
' '           Text
'PTextBuffer' Name
'('           Punctuation
'win'         Name
'.'           Punctuation
'Tabs'        Name
'['           Operator
'tabNr'       Name
']'           Operator
'.'           Punctuation
'buffer'      Name
')'           Punctuation
'\n    '      Text
'# Get the text from the TextView' Comment
'\n    '      Text
'var'         Keyword.Declaration
' '           Text
'startIter'   Name
':'           Punctuation
' '           Text
'TTextIter'   Name
'\n    '      Text
'buffer'      Name
'.'           Punctuation
'getStartIter' Name
'('           Punctuation
'addr'        Keyword
'('           Punctuation
'startIter'   Name
')'           Punctuation
')'           Punctuation
'\n    \n    ' Text
'var'         Keyword.Declaration
' '           Text
'endIter'     Name
':'           Punctuation
' '           Text
'TTextIter'   Name
'\n    '      Text
'buffer'      Name
'.'           Punctuation
'getEndIter'  Name
'('           Punctuation
'addr'        Keyword
'('           Punctuation
'endIter'     Name
')'           Punctuation
')'           Punctuation
'\n    \n    ' Text
'var'         Keyword.Declaration
' '           Text
'text'        Name
' '           Text
'='           Operator
' '           Text
'buffer'      Name
'.'           Punctuation
'getText'     Name
'('           Punctuation
'addr'        Keyword
'('           Punctuation
'startIter'   Name
')'           Punctuation
','           Punctuation
' '           Text
'addr'        Keyword
'('           Punctuation
'endIter'     Name
')'           Punctuation
','           Punctuation
' '           Text
'False'       Keyword.Pseudo
')'           Punctuation
'\n    '      Text
'# Save it to a file' Comment
'\n    '      Text
'var'         Keyword.Declaration
' '           Text
'f'           Name
':'           Punctuation
' '           Text
'TFile'       Name
'\n    '      Text
'if'          Keyword
' '           Text
'open'        Name
'('           Punctuation
'f'           Name
','           Punctuation
' '           Text
'path'        Name
','           Punctuation
' '           Text
'fmWrite'     Name
')'           Punctuation
':'           Punctuation
'\n      '    Text
'f'           Name
'.'           Punctuation
'write'       Name
'('           Punctuation
'text'        Name
')'           Punctuation
'\n      '    Text
'f'           Name
'.'           Punctuation
'close'       Name
'('           Punctuation
')'           Punctuation
'\n      \n      ' Text
'win'         Name
'.'           Punctuation
'tempStuff'   Name
'.'           Punctuation
'lastSaveDir' Name
' '           Text
'='           Operator
' '           Text
'splitFile'   Name
'('           Punctuation
'path'        Name
')'           Punctuation
'.'           Punctuation
'dir'         Name
'\n      \n      ' Text
'# Change the tab name and .Tabs.filename etc.' Comment
'\n      '    Text
'win'         Name
'.'           Punctuation
'Tabs'        Name
'['           Operator
'tabNr'       Name
']'           Operator
'.'           Punctuation
'filename'    Name
' '           Text
'='           Operator
' '           Text
'path'        Name
'\n      '    Text
'win'         Name
'.'           Punctuation
'Tabs'        Name
'['           Operator
'tabNr'       Name
']'           Operator
'.'           Punctuation
'saved'       Name
' '           Text
'='           Operator
' '           Text
'True'        Keyword.Pseudo
'\n      '    Text
'var'         Keyword.Declaration
' '           Text
'name'        Name
' '           Text
'='           Operator
' '           Text
'extractFilename' Name
'('           Punctuation
'path'        Name
')'           Punctuation
'\n      \n      ' Text
'var'         Keyword.Declaration
' '           Text
'cTab'        Name
' '           Text
'='           Operator
' '           Text
'win'         Name
'.'           Punctuation
'Tabs'        Name
'['           Operator
'tabNr'       Name
']'           Operator
'\n      '    Text
'cTab'        Name
'.'           Punctuation
'label'       Name
'.'           Punctuation
'setText'     Name
'('           Punctuation
'name'        Name
')'           Punctuation
'\n    '      Text
'else'        Keyword
':'           Punctuation
'\n      '    Text
'error'       Name
'('           Punctuation
'win'         Name
'.'           Punctuation
'w'           Name
','           Punctuation
' '           Text
'"'           Literal.String
'Unable to write to file' Literal.String
'"'           Literal.String
')'           Punctuation
'  \n\n'      Text

'proc '       Keyword
'saveAllTabs' Name.Function
'('           Punctuation
')'           Punctuation
' '           Text
'='           Operator
'\n  '        Text
'for'         Keyword
' '           Text
'i'           Name
' '           Text
'in'          Operator.Word
' '           Text
'0'           Literal.Number.Float
'..'          Punctuation
'high'        Name
'('           Punctuation
'win'         Name
'.'           Punctuation
'tabs'        Name
')'           Punctuation
':'           Punctuation
' \n    '     Text
'saveTab'     Name
'('           Punctuation
'i'           Name
','           Punctuation
' '           Text
'os'          Name
'.'           Punctuation
'splitFile'   Name
'('           Punctuation
'win'         Name
'.'           Punctuation
'tabs'        Name
'['           Operator
'i'           Name
']'           Operator
'.'           Punctuation
'filename'    Name
')'           Punctuation
'.'           Punctuation
'dir'         Name
')'           Punctuation
'\n\n'        Text

'# GTK Events' Comment
'\n'          Text

'# -- w(PWindow)' Comment
'\n'          Text

'proc '       Keyword
'destroy'     Name.Function
'('           Punctuation
'widget'      Name
':'           Punctuation
' '           Text
'PWidget'     Name
','           Punctuation
' '           Text
'data'        Name
':'           Punctuation
' '           Text
'pgpointer'   Name
')'           Punctuation
' '           Text
'{.'          Punctuation
'cdecl'       Name
'.'           Punctuation
'}'           Punctuation
' '           Text
'='           Operator
'\n  '        Text
'# gather some settings' Comment
'\n  '        Text
'win'         Name
'.'           Punctuation
'settings'    Name
'.'           Punctuation
'VPanedPos'   Name
' '           Text
'='           Operator
' '           Text
'PPaned'      Name
'('           Punctuation
'win'         Name
'.'           Punctuation
'sourceViewTabs' Name
'.'           Punctuation
'getParent'   Name
'('           Punctuation
')'           Punctuation
')'           Punctuation
'.'           Punctuation
'getPosition' Name
'('           Punctuation
')'           Punctuation
'\n  '        Text
'win'         Name
'.'           Punctuation
'settings'    Name
'.'           Punctuation
'winWidth'    Name
' '           Text
'='           Operator
' '           Text
'win'         Name
'.'           Punctuation
'w'           Name
'.'           Punctuation
'allocation'  Name
'.'           Punctuation
'width'       Name
'\n  '        Text
'win'         Name
'.'           Punctuation
'settings'    Name
'.'           Punctuation
'winHeight'   Name
' '           Text
'='           Operator
' '           Text
'win'         Name
'.'           Punctuation
'w'           Name
'.'           Punctuation
'allocation'  Name
'.'           Punctuation
'height'      Name
'\n\n  '      Text
'# save the settings' Comment
'\n  '        Text
'win'         Name
'.'           Punctuation
'save'        Name
'('           Punctuation
')'           Punctuation
'\n  '        Text
'# then quit' Comment
'\n  '        Text
'main_quit'   Name
'('           Punctuation
')'           Punctuation
'\n\n'        Text

'proc '       Keyword
'delete_event' Name.Function
'('           Punctuation
'widget'      Name
':'           Punctuation
' '           Text
'PWidget'     Name
','           Punctuation
' '           Text
'event'       Name
':'           Punctuation
' '           Text
'PEvent'      Name
','           Punctuation
' '           Text
'user_data'   Name
':'           Punctuation
' '           Text
'pgpointer'   Name
')'           Punctuation
':'           Punctuation
' '           Text
'bool'        Keyword.Type
' '           Text
'='           Operator
'\n  '        Text
'var'         Keyword.Declaration
' '           Text
'quit'        Name
' '           Text
'='           Operator
' '           Text
'True'        Keyword.Pseudo
'\n  '        Text
'for'         Keyword
' '           Text
'i'           Name
' '           Text
'in'          Operator.Word
' '           Text
'low'         Name
'('           Punctuation
'win'         Name
'.'           Punctuation
'Tabs'        Name
')'           Punctuation
'..'          Punctuation
'len'         Name
'('           Punctuation
'win'         Name
'.'           Punctuation
'Tabs'        Name
')'           Punctuation
'-'           Operator
'1'           Literal.Number.Integer
':'           Punctuation
'\n    '      Text
'if'          Keyword
' '           Text
'not'         Operator.Word
' '           Text
'win'         Name
'.'           Punctuation
'Tabs'        Name
'['           Operator
'i'           Name
']'           Operator
'.'           Punctuation
'saved'       Name
':'           Punctuation
'\n      '    Text
'var'         Keyword.Declaration
' '           Text
'askSave'     Name
' '           Text
'='           Operator
' '           Text
'dialogNewWithButtons' Name
'('           Punctuation
'"'           Literal.String
'"'           Literal.String
','           Punctuation
' '           Text
'win'         Name
'.'           Punctuation
'w'           Name
','           Punctuation
' '           Text
'0'           Literal.Number.Integer
','           Punctuation
'\n                            ' Text
'STOCK_SAVE'  Name
','           Punctuation
' '           Text
'RESPONSE_ACCEPT' Name
','           Punctuation
' '           Text
'STOCK_CANCEL' Name
','           Punctuation
' \n                            ' Text
'RESPONSE_CANCEL' Name
','           Punctuation
'\n                            ' Text
'"'           Literal.String
'Close without saving' Literal.String
'"'           Literal.String
','           Punctuation
' '           Text
'RESPONSE_REJECT' Name
','           Punctuation
' '           Text
'nil'         Keyword.Pseudo
')'           Punctuation
'\n      '    Text
'askSave'     Name
'.'           Punctuation
'setTransientFor' Name
'('           Punctuation
'win'         Name
'.'           Punctuation
'w'           Name
')'           Punctuation
'\n      '    Text
'# TODO: Make this dialog look better' Comment
'\n      '    Text
'var'         Keyword.Declaration
' '           Text
'label'       Name
' '           Text
'='           Operator
' '           Text
'labelNew'    Name
'('           Punctuation
'win'         Name
'.'           Punctuation
'Tabs'        Name
'['           Operator
'i'           Name
']'           Operator
'.'           Punctuation
'filename'    Name
' '           Text
'&'           Operator
' \n          ' Text
'"'           Literal.String
' is unsaved, would you like to save it ?' Literal.String
'"'           Literal.String
')'           Punctuation
'\n      '    Text
'PBox'        Name
'('           Punctuation
'askSave'     Name
'.'           Punctuation
'vbox'        Name
')'           Punctuation
'.'           Punctuation
'pack_start'  Name
'('           Punctuation
'label'       Name
','           Punctuation
' '           Text
'False'       Keyword.Pseudo
','           Punctuation
' '           Text
'False'       Keyword.Pseudo
','           Punctuation
' '           Text
'0'           Literal.Number.Integer
')'           Punctuation
'\n      '    Text
'label'       Name
'.'           Punctuation
'show'        Name
'('           Punctuation
')'           Punctuation
'\n\n      '  Text
'var'         Keyword.Declaration
' '           Text
'resp'        Name
' '           Text
'='           Operator
' '           Text
'askSave'     Name
'.'           Punctuation
'run'         Name
'('           Punctuation
')'           Punctuation
'\n      '    Text
'gtk2'        Name
'.'           Punctuation
'destroy'     Name
'('           Punctuation
'PWidget'     Name
'('           Punctuation
'askSave'     Name
')'           Punctuation
')'           Punctuation
'\n      '    Text
'case'        Keyword
' '           Text
'resp'        Name
'\n      '    Text
'of'          Keyword
' '           Text
'RESPONSE_ACCEPT' Name
':'           Punctuation
'\n        '  Text
'saveTab'     Name
'('           Punctuation
'i'           Name
','           Punctuation
' '           Text
'os'          Name
'.'           Punctuation
'splitFile'   Name
'('           Punctuation
'win'         Name
'.'           Punctuation
'tabs'        Name
'['           Operator
'i'           Name
']'           Operator
'.'           Punctuation
'filename'    Name
')'           Punctuation
'.'           Punctuation
'dir'         Name
')'           Punctuation
'\n        '  Text
'quit'        Name
' '           Text
'='           Operator
' '           Text
'True'        Keyword.Pseudo
'\n      '    Text
'of'          Keyword
' '           Text
'RESPONSE_CANCEL' Name
':'           Punctuation
'\n        '  Text
'quit'        Name
' '           Text
'='           Operator
' '           Text
'False'       Keyword.Pseudo
'\n        '  Text
'break'       Keyword
'\n      '    Text
'of'          Keyword
' '           Text
'RESPONSE_REJECT' Name
':'           Punctuation
'\n        '  Text
'quit'        Name
' '           Text
'='           Operator
' '           Text
'True'        Keyword.Pseudo
'\n      '    Text
'else'        Keyword
':'           Punctuation
'\n        '  Text
'quit'        Name
' '           Text
'='           Operator
' '           Text
'False'       Keyword.Pseudo
'\n        '  Text
'break'       Keyword
'\n\n  '      Text
'# If False is returned the window will close' Comment
'\n  '        Text
'return'      Keyword
' '           Text
'not'         Operator.Word
' '           Text
'quit'        Name
'\n\n'        Text

'proc '       Keyword
'windowState_Changed' Name.Function
'('           Punctuation
'widget'      Name
':'           Punctuation
' '           Text
'PWidget'     Name
','           Punctuation
' '           Text
'event'       Name
':'           Punctuation
' '           Text
'PEventWindowState' Name
','           Punctuation
' \n                         ' Text
'user_data'   Name
':'           Punctuation
' '           Text
'pgpointer'   Name
')'           Punctuation
' '           Text
'='           Operator
'\n  '        Text
'win'         Name
'.'           Punctuation
'settings'    Name
'.'           Punctuation
'winMaximized' Name
' '           Text
'='           Operator
' '           Text
'('           Punctuation
'event'       Name
'.'           Punctuation
'newWindowState' Name
' '           Text
'and'         Operator.Word
' \n                               ' Text
'WINDOW_STATE_MAXIMIZED' Name
')'           Punctuation
' '           Text
'!'           Operator
'='           Operator
' '           Text
'0'           Literal.Number.Integer
'\n\n'        Text

'# -- SourceView(PSourceView) & SourceBuffer' Comment
'\n'          Text

'proc '       Keyword
'updateStatusBar' Name.Function
'('           Punctuation
'buffer'      Name
':'           Punctuation
' '           Text
'PTextBuffer' Name
')'           Punctuation
'{.'          Punctuation
'cdecl'       Name
'.'           Punctuation
'}'           Punctuation
' '           Text
'='           Operator
'\n  '        Text
'# Incase this event gets fired before' Comment
'\n  '        Text
'# bottomBar is initialized' Comment
'\n  '        Text
'if'          Keyword
' '           Text
'win'         Name
'.'           Punctuation
'bottomBar'   Name
' '           Text
'!'           Operator
'='           Operator
' '           Text
'nil'         Keyword.Pseudo
' '           Text
'and'         Operator.Word
' '           Text
'not'         Operator.Word
' '           Text
'win'         Name
'.'           Punctuation
'tempStuff'   Name
'.'           Punctuation
'stopSBUpdates' Name
':'           Punctuation
'  \n    '    Text
'var'         Keyword.Declaration
' '           Text
'iter'        Name
':'           Punctuation
' '           Text
'TTextIter'   Name
'\n    \n    ' Text
'win'         Name
'.'           Punctuation
'bottomBar'   Name
'.'           Punctuation
'pop'         Name
'('           Punctuation
'0'           Literal.Number.Integer
')'           Punctuation
'\n    '      Text
'buffer'      Name
'.'           Punctuation
'getIterAtMark' Name
'('           Punctuation
'addr'        Keyword
'('           Punctuation
'iter'        Name
')'           Punctuation
','           Punctuation
' '           Text
'buffer'      Name
'.'           Punctuation
'getInsert'   Name
'('           Punctuation
')'           Punctuation
')'           Punctuation
'\n    '      Text
'var'         Keyword.Declaration
' '           Text
'row'         Name
' '           Text
'='           Operator
' '           Text
'getLine'     Name
'('           Punctuation
'addr'        Keyword
'('           Punctuation
'iter'        Name
')'           Punctuation
')'           Punctuation
' '           Text
'+'           Operator
' '           Text
'1'           Literal.Number.Integer
'\n    '      Text
'var'         Keyword.Declaration
' '           Text
'col'         Name
' '           Text
'='           Operator
' '           Text
'getLineOffset' Name
'('           Punctuation
'addr'        Keyword
'('           Punctuation
'iter'        Name
')'           Punctuation
')'           Punctuation
'\n    '      Text
'discard'     Keyword
' '           Text
'win'         Name
'.'           Punctuation
'bottomBar'   Name
'.'           Punctuation
'push'        Name
'('           Punctuation
'0'           Literal.Number.Integer
','           Punctuation
' '           Text
'"'           Literal.String
'Line: '      Literal.String
'"'           Literal.String
' '           Text
'&'           Operator
' '           Text
'$'           Operator
'row'         Name
' '           Text
'&'           Operator
' '           Text
'"'           Literal.String
' Column: '   Literal.String
'"'           Literal.String
' '           Text
'&'           Operator
' '           Text
'$'           Operator
'col'         Name
')'           Punctuation
'\n  \n'      Text

'proc '       Keyword
'cursorMoved' Name.Function
'('           Punctuation
'buffer'      Name
':'           Punctuation
' '           Text
'PTextBuffer' Name
','           Punctuation
' '           Text
'location'    Name
':'           Punctuation
' '           Text
'PTextIter'   Name
','           Punctuation
' \n                 ' Text
'mark'        Name
':'           Punctuation
' '           Text
'PTextMark'   Name
','           Punctuation
' '           Text
'user_data'   Name
':'           Punctuation
' '           Text
'pgpointer'   Name
')'           Punctuation
'{.'          Punctuation
'cdecl'       Name
'.'           Punctuation
'}'           Punctuation
' '           Text
'='           Operator
'\n  '        Text
'updateStatusBar' Name
'('           Punctuation
'buffer'      Name
')'           Punctuation
'\n\n'        Text

'proc '       Keyword
'onCloseTab'  Name.Function
'('           Punctuation
'btn'         Name
':'           Punctuation
' '           Text
'PButton'     Name
','           Punctuation
' '           Text
'user_data'   Name
':'           Punctuation
' '           Text
'PWidget'     Name
')'           Punctuation
' '           Text
'='           Operator
'\n  '        Text
'if'          Keyword
' '           Text
'win'         Name
'.'           Punctuation
'sourceViewTabs' Name
'.'           Punctuation
'getNPages'   Name
'('           Punctuation
')'           Punctuation
' '           Text
'>'           Operator
' '           Text
'1'           Literal.Number.Integer
':'           Punctuation
'\n    '      Text
'var'         Keyword.Declaration
' '           Text
'tab'         Name
' '           Text
'='           Operator
' '           Text
'win'         Name
'.'           Punctuation
'sourceViewTabs' Name
'.'           Punctuation
'pageNum'     Name
'('           Punctuation
'user_data'   Name
')'           Punctuation
'\n    '      Text
'win'         Name
'.'           Punctuation
'sourceViewTabs' Name
'.'           Punctuation
'removePage'  Name
'('           Punctuation
'tab'         Name
')'           Punctuation
'\n\n    '    Text
'win'         Name
'.'           Punctuation
'Tabs'        Name
'.'           Punctuation
'delete'      Name
'('           Punctuation
'tab'         Name
')'           Punctuation
'\n\n'        Text

'proc '       Keyword
'onSwitchTab' Name.Function
'('           Punctuation
'notebook'    Name
':'           Punctuation
' '           Text
'PNotebook'   Name
','           Punctuation
' '           Text
'page'        Name
':'           Punctuation
' '           Text
'PNotebookPage' Name
','           Punctuation
' '           Text
'pageNum'     Name
':'           Punctuation
' '           Text
'guint'       Name
','           Punctuation
' \n                 ' Text
'user_data'   Name
':'           Punctuation
' '           Text
'pgpointer'   Name
')'           Punctuation
' '           Text
'='           Operator
'\n  '        Text
'if'          Keyword
' '           Text
'win'         Name
'.'           Punctuation
'Tabs'        Name
'.'           Punctuation
'len'         Name
'('           Punctuation
')'           Punctuation
'-'           Operator
'1'           Literal.Number.Integer
' '           Text
'>'           Operator
'='           Operator
' '           Text
'pageNum'     Name
':'           Punctuation
'\n    '      Text
'win'         Name
'.'           Punctuation
'w'           Name
'.'           Punctuation
'setTitle'    Name
'('           Punctuation
'"'           Literal.String
'Aporia IDE - ' Literal.String
'"'           Literal.String
' '           Text
'&'           Operator
' '           Text
'win'         Name
'.'           Punctuation
'Tabs'        Name
'['           Operator
'pageNum'     Name
']'           Operator
'.'           Punctuation
'filename'    Name
')'           Punctuation
'\n\n'        Text

'proc '       Keyword
'createTabLabel' Name.Function
'('           Punctuation
'name'        Name
':'           Punctuation
' '           Text
'string'      Keyword.Type
','           Punctuation
' '           Text
't_child'     Name
':'           Punctuation
' '           Text
'PWidget'     Name
')'           Punctuation
':'           Punctuation
' '           Text
'tuple'       Keyword
'['           Operator
'box'         Name
':'           Punctuation
' '           Text
'PWidget'     Name
','           Punctuation
'\n                    ' Text
'label'       Name
':'           Punctuation
' '           Text
'PLabel'      Name
']'           Operator
' '           Text
'='           Operator
'\n  '        Text
'var'         Keyword.Declaration
' '           Text
'box'         Name
' '           Text
'='           Operator
' '           Text
'hboxNew'     Name
'('           Punctuation
'False'       Keyword.Pseudo
','           Punctuation
' '           Text
'0'           Literal.Number.Integer
')'           Punctuation
'\n  '        Text
'var'         Keyword.Declaration
' '           Text
'label'       Name
' '           Text
'='           Operator
' '           Text
'labelNew'    Name
'('           Punctuation
'name'        Name
')'           Punctuation
'\n  '        Text
'var'         Keyword.Declaration
' '           Text
'closebtn'    Name
' '           Text
'='           Operator
' '           Text
'buttonNew'   Name
'('           Punctuation
')'           Punctuation
'\n  '        Text
'closeBtn'    Name
'.'           Punctuation
'setLabel'    Name
'('           Punctuation
'nil'         Keyword.Pseudo
')'           Punctuation
'\n  '        Text
'var'         Keyword.Declaration
' '           Text
'iconSize'    Name
' '           Text
'='           Operator
' '           Text
'iconSizeFromName' Name
'('           Punctuation
'"'           Literal.String
'tabIconSize' Literal.String
'"'           Literal.String
')'           Punctuation
'\n  '        Text
'if'          Keyword
' '           Text
'iconSize'    Name
' '           Text
'='           Operator
'='           Operator
' '           Text
'0'           Literal.Number.Integer
':'           Punctuation
'\n     '     Text
'iconSize'    Name
' '           Text
'='           Operator
' '           Text
'iconSizeRegister' Name
'('           Punctuation
'"'           Literal.String
'tabIconSize' Literal.String
'"'           Literal.String
','           Punctuation
' '           Text
'10'          Literal.Number.Integer
','           Punctuation
' '           Text
'10'          Literal.Number.Integer
')'           Punctuation
'\n  '        Text
'var'         Keyword.Declaration
' '           Text
'image'       Name
' '           Text
'='           Operator
' '           Text
'imageNewFromStock' Name
'('           Punctuation
'STOCK_CLOSE' Name
','           Punctuation
' '           Text
'iconSize'    Name
')'           Punctuation
'\n  '        Text
'discard'     Keyword
' '           Text
'gSignalConnect' Name
'('           Punctuation
'closebtn'    Name
','           Punctuation
' '           Text
'"'           Literal.String
'clicked'     Literal.String
'"'           Literal.String
','           Punctuation
' '           Text
'G_Callback'  Name
'('           Punctuation
'onCloseTab'  Name
')'           Punctuation
','           Punctuation
' '           Text
't_child'     Name
')'           Punctuation
'\n  '        Text
'closebtn'    Name
'.'           Punctuation
'setImage'    Name
'('           Punctuation
'image'       Name
')'           Punctuation
'\n  '        Text
'gtk2'        Name
'.'           Punctuation
'setRelief'   Name
'('           Punctuation
'closebtn'    Name
','           Punctuation
' '           Text
'RELIEF_NONE' Name
')'           Punctuation
'\n  '        Text
'box'         Name
'.'           Punctuation
'packStart'   Name
'('           Punctuation
'label'       Name
','           Punctuation
' '           Text
'True'        Keyword.Pseudo
','           Punctuation
' '           Text
'True'        Keyword.Pseudo
','           Punctuation
' '           Text
'0'           Literal.Number.Integer
')'           Punctuation
'\n  '        Text
'box'         Name
'.'           Punctuation
'packEnd'     Name
'('           Punctuation
'closebtn'    Name
','           Punctuation
' '           Text
'False'       Keyword.Pseudo
','           Punctuation
' '           Text
'False'       Keyword.Pseudo
','           Punctuation
' '           Text
'0'           Literal.Number.Integer
')'           Punctuation
'\n  '        Text
'box'         Name
'.'           Punctuation
'showAll'     Name
'('           Punctuation
')'           Punctuation
'\n  '        Text
'return'      Keyword
' '           Text
'('           Punctuation
'box'         Name
','           Punctuation
' '           Text
'label'       Name
')'           Punctuation
'\n\n'        Text

'proc '       Keyword
'changed'     Name.Function
'('           Punctuation
'buffer'      Name
':'           Punctuation
' '           Text
'PTextBuffer' Name
','           Punctuation
' '           Text
'user_data'   Name
':'           Punctuation
' '           Text
'pgpointer'   Name
')'           Punctuation
' '           Text
'='           Operator
'\n  '        Text
"# Update the 'Line & Column'" Comment
'\n  '        Text
'#updateStatusBar(buffer)' Comment
'\n\n  '      Text
"# Change the tabs state to 'unsaved'" Comment
'\n  '        Text
"# and add '*' to the Tab Name" Comment
'\n  '        Text
'var'         Keyword.Declaration
' '           Text
'current'     Name
' '           Text
'='           Operator
' '           Text
'win'         Name
'.'           Punctuation
'SourceViewTabs' Name
'.'           Punctuation
'getCurrentPage' Name
'('           Punctuation
')'           Punctuation
'\n  '        Text
'var'         Keyword.Declaration
' '           Text
'name'        Name
' '           Text
'='           Operator
' '           Text
'"'           Literal.String
'"'           Literal.String
'\n  '        Text
'if'          Keyword
' '           Text
'win'         Name
'.'           Punctuation
'Tabs'        Name
'['           Operator
'current'     Name
']'           Operator
'.'           Punctuation
'filename'    Name
' '           Text
'='           Operator
'='           Operator
' '           Text
'"'           Literal.String
'"'           Literal.String
':'           Punctuation
'\n    '      Text
'win'         Name
'.'           Punctuation
'Tabs'        Name
'['           Operator
'current'     Name
']'           Operator
'.'           Punctuation
'saved'       Name
' '           Text
'='           Operator
' '           Text
'False'       Keyword.Pseudo
'\n    '      Text
'name'        Name
' '           Text
'='           Operator
' '           Text
'"'           Literal.String
'Untitled *'  Literal.String
'"'           Literal.String
'\n  '        Text
'else'        Keyword
':'           Punctuation
'\n    '      Text
'win'         Name
'.'           Punctuation
'Tabs'        Name
'['           Operator
'current'     Name
']'           Operator
'.'           Punctuation
'saved'       Name
' '           Text
'='           Operator
' '           Text
'False'       Keyword.Pseudo
'\n    '      Text
'name'        Name
' '           Text
'='           Operator
' '           Text
'extractFilename' Name
'('           Punctuation
'win'         Name
'.'           Punctuation
'Tabs'        Name
'['           Operator
'current'     Name
']'           Operator
'.'           Punctuation
'filename'    Name
')'           Punctuation
' '           Text
'&'           Operator
' '           Text
'"'           Literal.String
' *'          Literal.String
'"'           Literal.String
'\n  \n  '    Text
'var'         Keyword.Declaration
' '           Text
'cTab'        Name
' '           Text
'='           Operator
' '           Text
'win'         Name
'.'           Punctuation
'Tabs'        Name
'['           Operator
'current'     Name
']'           Operator
'\n  '        Text
'cTab'        Name
'.'           Punctuation
'label'       Name
'.'           Punctuation
'setText'     Name
'('           Punctuation
'name'        Name
')'           Punctuation
'\n\n'        Text

'# Other(Helper) functions' Comment
'\n\n'        Text

'proc '       Keyword
'initSourceView' Name.Function
'('           Punctuation
'SourceView'  Name
':'           Punctuation
' '           Text
'var'         Keyword.Declaration
' '           Text
'PWidget'     Name
','           Punctuation
' '           Text
'scrollWindow' Name
':'           Punctuation
' '           Text
'var'         Keyword.Declaration
' '           Text
'PScrolledWindow' Name
','           Punctuation
'\n                    ' Text
'buffer'      Name
':'           Punctuation
' '           Text
'var'         Keyword.Declaration
' '           Text
'PSourceBuffer' Name
')'           Punctuation
' '           Text
'='           Operator
'\n  '        Text
'# This gets called by addTab' Comment
'\n  '        Text
'# Each tabs creates a new SourceView' Comment
'\n  '        Text
'# SourceScrolledWindow(ScrolledWindow)' Comment
'\n  '        Text
'scrollWindow' Name
' '           Text
'='           Operator
' '           Text
'scrolledWindowNew' Name
'('           Punctuation
'nil'         Keyword.Pseudo
','           Punctuation
' '           Text
'nil'         Keyword.Pseudo
')'           Punctuation
'\n  '        Text
'scrollWindow' Name
'.'           Punctuation
'setPolicy'   Name
'('           Punctuation
'POLICY_AUTOMATIC' Name
','           Punctuation
' '           Text
'POLICY_AUTOMATIC' Name
')'           Punctuation
'\n  '        Text
'scrollWindow' Name
'.'           Punctuation
'show'        Name
'('           Punctuation
')'           Punctuation
'\n  \n  '    Text
'# SourceView(gtkSourceView)' Comment
'\n  '        Text
'SourceView'  Name
' '           Text
'='           Operator
' '           Text
'sourceViewNew' Name
'('           Punctuation
'buffer'      Name
')'           Punctuation
'\n  '        Text
'PSourceView' Name
'('           Punctuation
'SourceView'  Name
')'           Punctuation
'.'           Punctuation
'setInsertSpacesInsteadOfTabs' Name
'('           Punctuation
'True'        Keyword.Pseudo
')'           Punctuation
'\n  '        Text
'PSourceView' Name
'('           Punctuation
'SourceView'  Name
')'           Punctuation
'.'           Punctuation
'setIndentWidth' Name
'('           Punctuation
'win'         Name
'.'           Punctuation
'settings'    Name
'.'           Punctuation
'indentWidth' Name
')'           Punctuation
'\n  '        Text
'PSourceView' Name
'('           Punctuation
'SourceView'  Name
')'           Punctuation
'.'           Punctuation
'setShowLineNumbers' Name
'('           Punctuation
'win'         Name
'.'           Punctuation
'settings'    Name
'.'           Punctuation
'showLineNumbers' Name
')'           Punctuation
'\n  '        Text
'PSourceView' Name
'('           Punctuation
'SourceView'  Name
')'           Punctuation
'.'           Punctuation
'setHighlightCurrentLine' Name
'('           Punctuation
'\n               ' Text
'win'         Name
'.'           Punctuation
'settings'    Name
'.'           Punctuation
'highlightCurrentLine' Name
')'           Punctuation
'\n  '        Text
'PSourceView' Name
'('           Punctuation
'SourceView'  Name
')'           Punctuation
'.'           Punctuation
'setShowRightMargin' Name
'('           Punctuation
'win'         Name
'.'           Punctuation
'settings'    Name
'.'           Punctuation
'rightMargin' Name
')'           Punctuation
'\n  '        Text
'PSourceView' Name
'('           Punctuation
'SourceView'  Name
')'           Punctuation
'.'           Punctuation
'setAutoIndent' Name
'('           Punctuation
'win'         Name
'.'           Punctuation
'settings'    Name
'.'           Punctuation
'autoIndent'  Name
')'           Punctuation
'\n\n  '      Text
'var'         Keyword.Declaration
' '           Text
'font'        Name
' '           Text
'='           Operator
' '           Text
'font_description_from_string' Name
'('           Punctuation
'win'         Name
'.'           Punctuation
'settings'    Name
'.'           Punctuation
'font'        Name
')'           Punctuation
'\n  '        Text
'SourceView'  Name
'.'           Punctuation
'modifyFont'  Name
'('           Punctuation
'font'        Name
')'           Punctuation
'\n  \n  '    Text
'scrollWindow' Name
'.'           Punctuation
'add'         Name
'('           Punctuation
'SourceView'  Name
')'           Punctuation
'\n  '        Text
'SourceView'  Name
'.'           Punctuation
'show'        Name
'('           Punctuation
')'           Punctuation
'\n\n  '      Text
'buffer'      Name
'.'           Punctuation
'setHighlightMatchingBrackets' Name
'('           Punctuation
'\n      '    Text
'win'         Name
'.'           Punctuation
'settings'    Name
'.'           Punctuation
'highlightMatchingBrackets' Name
')'           Punctuation
'\n  \n  '    Text
'# UGLY workaround for yet another compiler bug:' Comment
'\n  '        Text
'discard'     Keyword
' '           Text
'gsignalConnect' Name
'('           Punctuation
'buffer'      Name
','           Punctuation
' '           Text
'"'           Literal.String
'mark-set'    Literal.String
'"'           Literal.String
','           Punctuation
' \n                         ' Text
'GCallback'   Name
'('           Punctuation
'aporia'      Name
'.'           Punctuation
'cursorMoved' Name
')'           Punctuation
','           Punctuation
' '           Text
'nil'         Keyword.Pseudo
')'           Punctuation
'\n  '        Text
'discard'     Keyword
' '           Text
'gsignalConnect' Name
'('           Punctuation
'buffer'      Name
','           Punctuation
' '           Text
'"'           Literal.String
'changed'     Literal.String
'"'           Literal.String
','           Punctuation
' '           Text
'GCallback'   Name
'('           Punctuation
'aporia'      Name
'.'           Punctuation
'changed'     Name
')'           Punctuation
','           Punctuation
' '           Text
'nil'         Keyword.Pseudo
')'           Punctuation
'\n\n  '      Text
'# -- Set the syntax highlighter scheme' Comment
'\n  '        Text
'buffer'      Name
'.'           Punctuation
'setScheme'   Name
'('           Punctuation
'win'         Name
'.'           Punctuation
'scheme'      Name
')'           Punctuation
'\n\n'        Text

'proc '       Keyword
'addTab'      Name.Function
'('           Punctuation
'name'        Name
','           Punctuation
' '           Text
'filename'    Name
':'           Punctuation
' '           Text
'string'      Keyword.Type
')'           Punctuation
' '           Text
'='           Operator
'\n  '        Text
'## Adds a tab, if filename is not "" reads the file. And sets' Literal.String.Doc
'\n  '        Text
'## the tabs SourceViews text to that files contents.' Literal.String.Doc
'\n  '        Text
'assert'      Name
'('           Punctuation
'win'         Name
'.'           Punctuation
'nimLang'     Name
' '           Text
'!'           Operator
'='           Operator
' '           Text
'nil'         Keyword.Pseudo
')'           Punctuation
'\n  '        Text
'var'         Keyword.Declaration
' '           Text
'buffer'      Name
':'           Punctuation
' '           Text
'PSourceBuffer' Name
' '           Text
'='           Operator
' '           Text
'sourceBufferNew' Name
'('           Punctuation
'win'         Name
'.'           Punctuation
'nimLang'     Name
')'           Punctuation
'\n\n  '      Text
'if'          Keyword
' '           Text
'filename'    Name
' '           Text
'!'           Operator
'='           Operator
' '           Text
'nil'         Keyword.Pseudo
' '           Text
'and'         Operator.Word
' '           Text
'filename'    Name
' '           Text
'!'           Operator
'='           Operator
' '           Text
'"'           Literal.String
'"'           Literal.String
':'           Punctuation
'\n    '      Text
'var'         Keyword.Declaration
' '           Text
'lang'        Name
' '           Text
'='           Operator
' '           Text
'win'         Name
'.'           Punctuation
'langMan'     Name
'.'           Punctuation
'guessLanguage' Name
'('           Punctuation
'filename'    Name
','           Punctuation
' '           Text
'nil'         Keyword.Pseudo
')'           Punctuation
'\n    '      Text
'if'          Keyword
' '           Text
'lang'        Name
' '           Text
'!'           Operator
'='           Operator
' '           Text
'nil'         Keyword.Pseudo
':'           Punctuation
'\n      '    Text
'buffer'      Name
'.'           Punctuation
'setLanguage' Name
'('           Punctuation
'lang'        Name
')'           Punctuation
'\n    '      Text
'else'        Keyword
':'           Punctuation
'\n      '    Text
'buffer'      Name
'.'           Punctuation
'setHighlightSyntax' Name
'('           Punctuation
'False'       Keyword.Pseudo
')'           Punctuation
'\n\n  '      Text
'var'         Keyword.Declaration
' '           Text
'nam'         Name
' '           Text
'='           Operator
' '           Text
'name'        Name
'\n  '        Text
'if'          Keyword
' '           Text
'nam'         Name
' '           Text
'='           Operator
'='           Operator
' '           Text
'"'           Literal.String
'"'           Literal.String
':'           Punctuation
' '           Text
'nam'         Name
' '           Text
'='           Operator
' '           Text
'"'           Literal.String
'Untitled'    Literal.String
'"'           Literal.String
'\n  '        Text
'if'          Keyword
' '           Text
'filename'    Name
' '           Text
'='           Operator
'='           Operator
' '           Text
'"'           Literal.String
'"'           Literal.String
':'           Punctuation
' '           Text
'nam'         Name
'.'           Punctuation
'add'         Name
'('           Punctuation
'"'           Literal.String
' *'          Literal.String
'"'           Literal.String
')'           Punctuation
'\n  '        Text
'elif'        Keyword
' '           Text
'filename'    Name
' '           Text
'!'           Operator
'='           Operator
' '           Text
'"'           Literal.String
'"'           Literal.String
' '           Text
'and'         Operator.Word
' '           Text
'name'        Name
' '           Text
'='           Operator
'='           Operator
' '           Text
'"'           Literal.String
'"'           Literal.String
':'           Punctuation
'\n    '      Text
'# Disable the undo/redo manager.' Comment
'\n    '      Text
'buffer'      Name
'.'           Punctuation
'begin_not_undoable_action' Name
'('           Punctuation
')'           Punctuation
'\n  \n    '  Text
'# Load the file.' Comment
'\n    '      Text
'var'         Keyword.Declaration
' '           Text
'file'        Name
':'           Punctuation
' '           Text
'string'      Keyword.Type
' '           Text
'='           Operator
' '           Text
'readFile'    Name
'('           Punctuation
'filename'    Name
')'           Punctuation
'\n    '      Text
'if'          Keyword
' '           Text
'file'        Name
' '           Text
'!'           Operator
'='           Operator
' '           Text
'nil'         Keyword.Pseudo
':'           Punctuation
'\n      '    Text
'buffer'      Name
'.'           Punctuation
'set_text'    Name
'('           Punctuation
'file'        Name
','           Punctuation
' '           Text
'len'         Name
'('           Punctuation
'file'        Name
')'           Punctuation
')'           Punctuation
'\n      \n    ' Text
'# Enable the undo/redo manager.' Comment
'\n    '      Text
'buffer'      Name
'.'           Punctuation
'end_not_undoable_action' Name
'('           Punctuation
')'           Punctuation
'\n      \n    ' Text
'# Get the name.ext of the filename, for the tabs title' Comment
'\n    '      Text
'nam'         Name
' '           Text
'='           Operator
' '           Text
'extractFilename' Name
'('           Punctuation
'filename'    Name
')'           Punctuation
'\n  \n  '    Text
'# Init the sourceview' Comment
'\n  '        Text
'var'         Keyword.Declaration
' '           Text
'sourceView'  Name
':'           Punctuation
' '           Text
'PWidget'     Name
'\n  '        Text
'var'         Keyword.Declaration
' '           Text
'scrollWindow' Name
':'           Punctuation
' '           Text
'PScrolledWindow' Name
'\n  '        Text
'initSourceView' Name
'('           Punctuation
'sourceView'  Name
','           Punctuation
' '           Text
'scrollWindow' Name
','           Punctuation
' '           Text
'buffer'      Name
')'           Punctuation
'\n\n  '      Text
'var'         Keyword.Declaration
' '           Text
'('           Punctuation
'TabLabel'    Name
','           Punctuation
' '           Text
'labelText'   Name
')'           Punctuation
' '           Text
'='           Operator
' '           Text
'createTabLabel' Name
'('           Punctuation
'nam'         Name
','           Punctuation
' '           Text
'scrollWindow' Name
')'           Punctuation
'\n  '        Text
'# Add a tab' Comment
'\n  '        Text
'discard'     Keyword
' '           Text
'win'         Name
'.'           Punctuation
'SourceViewTabs' Name
'.'           Punctuation
'appendPage'  Name
'('           Punctuation
'scrollWindow' Name
','           Punctuation
' '           Text
'TabLabel'    Name
')'           Punctuation
'\n\n  '      Text
'var'         Keyword.Declaration
' '           Text
'nTab'        Name
':'           Punctuation
' '           Text
'Tab'         Name
'\n  '        Text
'nTab'        Name
'.'           Punctuation
'buffer'      Name
' '           Text
'='           Operator
' '           Text
'buffer'      Name
'\n  '        Text
'nTab'        Name
'.'           Punctuation
'sourceView'  Name
' '           Text
'='           Operator
' '           Text
'sourceView'  Name
'\n  '        Text
'nTab'        Name
'.'           Punctuation
'label'       Name
' '           Text
'='           Operator
' '           Text
'labelText'   Name
'\n  '        Text
'nTab'        Name
'.'           Punctuation
'saved'       Name
' '           Text
'='           Operator
' '           Text
'('           Punctuation
'filename'    Name
' '           Text
'!'           Operator
'='           Operator
' '           Text
'"'           Literal.String
'"'           Literal.String
')'           Punctuation
'\n  '        Text
'nTab'        Name
'.'           Punctuation
'filename'    Name
' '           Text
'='           Operator
' '           Text
'filename'    Name
'\n  '        Text
'win'         Name
'.'           Punctuation
'Tabs'        Name
'.'           Punctuation
'add'         Name
'('           Punctuation
'nTab'        Name
')'           Punctuation
'\n\n  '      Text
'PTextView'   Name
'('           Punctuation
'SourceView'  Name
')'           Punctuation
'.'           Punctuation
'setBuffer'   Name
'('           Punctuation
'nTab'        Name
'.'           Punctuation
'buffer'      Name
')'           Punctuation
'\n\n'        Text

'# GTK Events Contd.' Comment
'\n'          Text

'# -- TopMenu & TopBar' Comment
'\n\n'        Text

'proc '       Keyword
'newFile'     Name.Function
'('           Punctuation
'menuItem'    Name
':'           Punctuation
' '           Text
'PMenuItem'   Name
','           Punctuation
' '           Text
'user_data'   Name
':'           Punctuation
' '           Text
'pgpointer'   Name
')'           Punctuation
' '           Text
'='           Operator
'\n  '        Text
'addTab'      Name
'('           Punctuation
'"'           Literal.String
'"'           Literal.String
','           Punctuation
' '           Text
'"'           Literal.String
'"'           Literal.String
')'           Punctuation
'\n  '        Text
'win'         Name
'.'           Punctuation
'sourceViewTabs' Name
'.'           Punctuation
'setCurrentPage' Name
'('           Punctuation
'win'         Name
'.'           Punctuation
'Tabs'        Name
'.'           Punctuation
'len'         Name
'('           Punctuation
')'           Punctuation
'-'           Operator
'1'           Literal.Number.Integer
')'           Punctuation
'\n  \n'      Text

'proc '       Keyword
'openFile'    Name.Function
'('           Punctuation
'menuItem'    Name
':'           Punctuation
' '           Text
'PMenuItem'   Name
','           Punctuation
' '           Text
'user_data'   Name
':'           Punctuation
' '           Text
'pgpointer'   Name
')'           Punctuation
' '           Text
'='           Operator
'\n  '        Text
'var'         Keyword.Declaration
' '           Text
'startpath'   Name
' '           Text
'='           Operator
' '           Text
'"'           Literal.String
'"'           Literal.String
'\n  '        Text
'var'         Keyword.Declaration
' '           Text
'currPage'    Name
' '           Text
'='           Operator
' '           Text
'win'         Name
'.'           Punctuation
'SourceViewTabs' Name
'.'           Punctuation
'getCurrentPage' Name
'('           Punctuation
')'           Punctuation
'\n  '        Text
'if'          Keyword
' '           Text
'currPage'    Name
' '           Text
'<'           Operator
'%'           Operator
' '           Text
'win'         Name
'.'           Punctuation
'tabs'        Name
'.'           Punctuation
'len'         Name
':'           Punctuation
' \n    '     Text
'startpath'   Name
' '           Text
'='           Operator
' '           Text
'os'          Name
'.'           Punctuation
'splitFile'   Name
'('           Punctuation
'win'         Name
'.'           Punctuation
'tabs'        Name
'['           Operator
'currPage'    Name
']'           Operator
'.'           Punctuation
'filename'    Name
')'           Punctuation
'.'           Punctuation
'dir'         Name
'\n\n  '      Text
'if'          Keyword
' '           Text
'startpath'   Name
'.'           Punctuation
'len'         Name
' '           Text
'='           Operator
'='           Operator
' '           Text
'0'           Literal.Number.Integer
':'           Punctuation
'\n    '      Text
'# Use lastSavePath as the startpath' Comment
'\n    '      Text
'startpath'   Name
' '           Text
'='           Operator
' '           Text
'win'         Name
'.'           Punctuation
'tempStuff'   Name
'.'           Punctuation
'lastSaveDir' Name
'\n    '      Text
'if'          Keyword
' '           Text
'startpath'   Name
'.'           Punctuation
'len'         Name
' '           Text
'='           Operator
'='           Operator
' '           Text
'0'           Literal.Number.Integer
':'           Punctuation
'\n      '    Text
'startpath'   Name
' '           Text
'='           Operator
' '           Text
'os'          Name
'.'           Punctuation
'getHomeDir'  Name
'('           Punctuation
')'           Punctuation
'\n\n  '      Text
'var'         Keyword.Declaration
' '           Text
'files'       Name
' '           Text
'='           Operator
' '           Text
'ChooseFilesToOpen' Name
'('           Punctuation
'win'         Name
'.'           Punctuation
'w'           Name
','           Punctuation
' '           Text
'startpath'   Name
')'           Punctuation
'\n  '        Text
'if'          Keyword
' '           Text
'files'       Name
'.'           Punctuation
'len'         Name
'('           Punctuation
')'           Punctuation
' '           Text
'>'           Operator
' '           Text
'0'           Literal.Number.Integer
':'           Punctuation
'\n    '      Text
'for'         Keyword
' '           Text
'f'           Name
' '           Text
'in'          Operator.Word
' '           Text
'items'       Name
'('           Punctuation
'files'       Name
')'           Punctuation
':'           Punctuation
'\n      '    Text
'try'         Keyword
':'           Punctuation
'\n        '  Text
'addTab'      Name
'('           Punctuation
'"'           Literal.String
'"'           Literal.String
','           Punctuation
' '           Text
'f'           Name
')'           Punctuation
'\n      '    Text
'except'      Keyword
' '           Text
'EIO'         Name
':'           Punctuation
'\n        '  Text
'error'       Name
'('           Punctuation
'win'         Name
'.'           Punctuation
'w'           Name
','           Punctuation
' '           Text
'"'           Literal.String
'Unable to read from file' Literal.String
'"'           Literal.String
')'           Punctuation
'\n    '      Text
'# Switch to the newly created tab' Comment
'\n    '      Text
'win'         Name
'.'           Punctuation
'sourceViewTabs' Name
'.'           Punctuation
'setCurrentPage' Name
'('           Punctuation
'win'         Name
'.'           Punctuation
'Tabs'        Name
'.'           Punctuation
'len'         Name
'('           Punctuation
')'           Punctuation
'-'           Operator
'1'           Literal.Number.Integer
')'           Punctuation
'\n  \n'      Text

'proc '       Keyword
'saveFile_Activate' Name.Function
'('           Punctuation
'menuItem'    Name
':'           Punctuation
' '           Text
'PMenuItem'   Name
','           Punctuation
' '           Text
'user_data'   Name
':'           Punctuation
' '           Text
'pgpointer'   Name
')'           Punctuation
' '           Text
'='           Operator
'\n  '        Text
'var'         Keyword.Declaration
' '           Text
'current'     Name
' '           Text
'='           Operator
' '           Text
'win'         Name
'.'           Punctuation
'SourceViewTabs' Name
'.'           Punctuation
'getCurrentPage' Name
'('           Punctuation
')'           Punctuation
'\n  '        Text
'saveTab'     Name
'('           Punctuation
'current'     Name
','           Punctuation
' '           Text
'os'          Name
'.'           Punctuation
'splitFile'   Name
'('           Punctuation
'win'         Name
'.'           Punctuation
'tabs'        Name
'['           Operator
'current'     Name
']'           Operator
'.'           Punctuation
'filename'    Name
')'           Punctuation
'.'           Punctuation
'dir'         Name
')'           Punctuation
'\n\n'        Text

'proc '       Keyword
'saveFileAs_Activate' Name.Function
'('           Punctuation
'menuItem'    Name
':'           Punctuation
' '           Text
'PMenuItem'   Name
','           Punctuation
' '           Text
'user_data'   Name
':'           Punctuation
' '           Text
'pgpointer'   Name
')'           Punctuation
' '           Text
'='           Operator
'\n  '        Text
'var'         Keyword.Declaration
' '           Text
'current'     Name
' '           Text
'='           Operator
' '           Text
'win'         Name
'.'           Punctuation
'SourceViewTabs' Name
'.'           Punctuation
'getCurrentPage' Name
'('           Punctuation
')'           Punctuation
'\n  '        Text
'var'         Keyword.Declaration
' '           Text
'('           Punctuation
'filename'    Name
','           Punctuation
' '           Text
'saved'       Name
')'           Punctuation
' '           Text
'='           Operator
' '           Text
'('           Punctuation
'win'         Name
'.'           Punctuation
'Tabs'        Name
'['           Operator
'current'     Name
']'           Operator
'.'           Punctuation
'filename'    Name
','           Punctuation
' '           Text
'win'         Name
'.'           Punctuation
'Tabs'        Name
'['           Operator
'current'     Name
']'           Operator
'.'           Punctuation
'saved'       Name
')'           Punctuation
'\n\n  '      Text
'win'         Name
'.'           Punctuation
'Tabs'        Name
'['           Operator
'current'     Name
']'           Operator
'.'           Punctuation
'saved'       Name
' '           Text
'='           Operator
' '           Text
'False'       Keyword.Pseudo
'\n  '        Text
'win'         Name
'.'           Punctuation
'Tabs'        Name
'['           Operator
'current'     Name
']'           Operator
'.'           Punctuation
'filename'    Name
' '           Text
'='           Operator
' '           Text
'"'           Literal.String
'"'           Literal.String
'\n  '        Text
'saveTab'     Name
'('           Punctuation
'current'     Name
','           Punctuation
' '           Text
'os'          Name
'.'           Punctuation
'splitFile'   Name
'('           Punctuation
'filename'    Name
')'           Punctuation
'.'           Punctuation
'dir'         Name
')'           Punctuation
'\n  '        Text
'# If the user cancels the save file dialog. Restore the previous filename' Comment
'\n  '        Text
'# and saved state' Comment
'\n  '        Text
'if'          Keyword
' '           Text
'win'         Name
'.'           Punctuation
'Tabs'        Name
'['           Operator
'current'     Name
']'           Operator
'.'           Punctuation
'filename'    Name
' '           Text
'='           Operator
'='           Operator
' '           Text
'"'           Literal.String
'"'           Literal.String
':'           Punctuation
'\n    '      Text
'win'         Name
'.'           Punctuation
'Tabs'        Name
'['           Operator
'current'     Name
']'           Operator
'.'           Punctuation
'filename'    Name
' '           Text
'='           Operator
' '           Text
'filename'    Name
'\n    '      Text
'win'         Name
'.'           Punctuation
'Tabs'        Name
'['           Operator
'current'     Name
']'           Operator
'.'           Punctuation
'saved'       Name
' '           Text
'='           Operator
' '           Text
'saved'       Name
'\n\n'        Text

'proc '       Keyword
'undo'        Name.Function
'('           Punctuation
'menuItem'    Name
':'           Punctuation
' '           Text
'PMenuItem'   Name
','           Punctuation
' '           Text
'user_data'   Name
':'           Punctuation
' '           Text
'pgpointer'   Name
')'           Punctuation
' '           Text
'='           Operator
' \n  '       Text
'var'         Keyword.Declaration
' '           Text
'current'     Name
' '           Text
'='           Operator
' '           Text
'win'         Name
'.'           Punctuation
'SourceViewTabs' Name
'.'           Punctuation
'getCurrentPage' Name
'('           Punctuation
')'           Punctuation
'\n  '        Text
'if'          Keyword
' '           Text
'win'         Name
'.'           Punctuation
'Tabs'        Name
'['           Operator
'current'     Name
']'           Operator
'.'           Punctuation
'buffer'      Name
'.'           Punctuation
'canUndo'     Name
'('           Punctuation
')'           Punctuation
':'           Punctuation
'\n    '      Text
'win'         Name
'.'           Punctuation
'Tabs'        Name
'['           Operator
'current'     Name
']'           Operator
'.'           Punctuation
'buffer'      Name
'.'           Punctuation
'undo'        Name
'('           Punctuation
')'           Punctuation
'\n  \n'      Text

'proc '       Keyword
'redo'        Name.Function
'('           Punctuation
'menuItem'    Name
':'           Punctuation
' '           Text
'PMenuItem'   Name
','           Punctuation
' '           Text
'user_data'   Name
':'           Punctuation
' '           Text
'pgpointer'   Name
')'           Punctuation
' '           Text
'='           Operator
'\n  '        Text
'var'         Keyword.Declaration
' '           Text
'current'     Name
' '           Text
'='           Operator
' '           Text
'win'         Name
'.'           Punctuation
'SourceViewTabs' Name
'.'           Punctuation
'getCurrentPage' Name
'('           Punctuation
')'           Punctuation
'\n  '        Text
'if'          Keyword
' '           Text
'win'         Name
'.'           Punctuation
'Tabs'        Name
'['           Operator
'current'     Name
']'           Operator
'.'           Punctuation
'buffer'      Name
'.'           Punctuation
'canRedo'     Name
'('           Punctuation
')'           Punctuation
':'           Punctuation
'\n    '      Text
'win'         Name
'.'           Punctuation
'Tabs'        Name
'['           Operator
'current'     Name
']'           Operator
'.'           Punctuation
'buffer'      Name
'.'           Punctuation
'redo'        Name
'('           Punctuation
')'           Punctuation
'\n    \n'    Text

'proc '       Keyword
'find_Activate' Name.Function
'('           Punctuation
'menuItem'    Name
':'           Punctuation
' '           Text
'PMenuItem'   Name
','           Punctuation
' '           Text
'user_data'   Name
':'           Punctuation
' '           Text
'pgpointer'   Name
')'           Punctuation
' '           Text
'='           Operator
' \n  '       Text
'# Get the selected text, and set the findEntry to it.' Comment
'\n  '        Text
'var'         Keyword.Declaration
' '           Text
'currentTab'  Name
' '           Text
'='           Operator
' '           Text
'win'         Name
'.'           Punctuation
'SourceViewTabs' Name
'.'           Punctuation
'getCurrentPage' Name
'('           Punctuation
')'           Punctuation
'\n  '        Text
'var'         Keyword.Declaration
' '           Text
'insertIter'  Name
':'           Punctuation
' '           Text
'TTextIter'   Name
'\n  '        Text
'win'         Name
'.'           Punctuation
'Tabs'        Name
'['           Operator
'currentTab'  Name
']'           Operator
'.'           Punctuation
'buffer'      Name
'.'           Punctuation
'getIterAtMark' Name
'('           Punctuation
'addr'        Keyword
'('           Punctuation
'insertIter'  Name
')'           Punctuation
','           Punctuation
' \n                                      ' Text
'win'         Name
'.'           Punctuation
'Tabs'        Name
'['           Operator
'currentTab'  Name
']'           Operator
'.'           Punctuation
'buffer'      Name
'.'           Punctuation
'getInsert'   Name
'('           Punctuation
')'           Punctuation
')'           Punctuation
'\n  '        Text
'var'         Keyword.Declaration
' '           Text
'insertOffset' Name
' '           Text
'='           Operator
' '           Text
'addr'        Keyword
'('           Punctuation
'insertIter'  Name
')'           Punctuation
'.'           Punctuation
'getOffset'   Name
'('           Punctuation
')'           Punctuation
'\n  \n  '    Text
'var'         Keyword.Declaration
' '           Text
'selectIter'  Name
':'           Punctuation
' '           Text
'TTextIter'   Name
'\n  '        Text
'win'         Name
'.'           Punctuation
'Tabs'        Name
'['           Operator
'currentTab'  Name
']'           Operator
'.'           Punctuation
'buffer'      Name
'.'           Punctuation
'getIterAtMark' Name
'('           Punctuation
'addr'        Keyword
'('           Punctuation
'selectIter'  Name
')'           Punctuation
','           Punctuation
' \n                ' Text
'win'         Name
'.'           Punctuation
'Tabs'        Name
'['           Operator
'currentTab'  Name
']'           Operator
'.'           Punctuation
'buffer'      Name
'.'           Punctuation
'getSelectionBound' Name
'('           Punctuation
')'           Punctuation
')'           Punctuation
'\n  '        Text
'var'         Keyword.Declaration
' '           Text
'selectOffset' Name
' '           Text
'='           Operator
' '           Text
'addr'        Keyword
'('           Punctuation
'selectIter'  Name
')'           Punctuation
'.'           Punctuation
'getOffset'   Name
'('           Punctuation
')'           Punctuation
'\n  \n  '    Text
'if'          Keyword
' '           Text
'insertOffset' Name
' '           Text
'!'           Operator
'='           Operator
' '           Text
'selectOffset' Name
':'           Punctuation
'\n    '      Text
'var'         Keyword.Declaration
' '           Text
'text'        Name
' '           Text
'='           Operator
' '           Text
'win'         Name
'.'           Punctuation
'Tabs'        Name
'['           Operator
'currentTab'  Name
']'           Operator
'.'           Punctuation
'buffer'      Name
'.'           Punctuation
'getText'     Name
'('           Punctuation
'addr'        Keyword
'('           Punctuation
'insertIter'  Name
')'           Punctuation
','           Punctuation
' \n                                                   ' Text
'addr'        Keyword
'('           Punctuation
'selectIter'  Name
')'           Punctuation
','           Punctuation
' '           Text
'false'       Keyword.Pseudo
')'           Punctuation
'\n    '      Text
'win'         Name
'.'           Punctuation
'findEntry'   Name
'.'           Punctuation
'setText'     Name
'('           Punctuation
'text'        Name
')'           Punctuation
'\n\n  '      Text
'win'         Name
'.'           Punctuation
'findBar'     Name
'.'           Punctuation
'show'        Name
'('           Punctuation
')'           Punctuation
'\n  '        Text
'win'         Name
'.'           Punctuation
'findEntry'   Name
'.'           Punctuation
'grabFocus'   Name
'('           Punctuation
')'           Punctuation
'\n  '        Text
'win'         Name
'.'           Punctuation
'replaceEntry' Name
'.'           Punctuation
'hide'        Name
'('           Punctuation
')'           Punctuation
'\n  '        Text
'win'         Name
'.'           Punctuation
'replaceLabel' Name
'.'           Punctuation
'hide'        Name
'('           Punctuation
')'           Punctuation
'\n  '        Text
'win'         Name
'.'           Punctuation
'replaceBtn'  Name
'.'           Punctuation
'hide'        Name
'('           Punctuation
')'           Punctuation
'\n  '        Text
'win'         Name
'.'           Punctuation
'replaceAllBtn' Name
'.'           Punctuation
'hide'        Name
'('           Punctuation
')'           Punctuation
'\n\n'        Text

'proc '       Keyword
'replace_Activate' Name.Function
'('           Punctuation
'menuitem'    Name
':'           Punctuation
' '           Text
'PMenuItem'   Name
','           Punctuation
' '           Text
'user_data'   Name
':'           Punctuation
' '           Text
'pgpointer'   Name
')'           Punctuation
' '           Text
'='           Operator
'\n  '        Text
'win'         Name
'.'           Punctuation
'findBar'     Name
'.'           Punctuation
'show'        Name
'('           Punctuation
')'           Punctuation
'\n  '        Text
'win'         Name
'.'           Punctuation
'findEntry'   Name
'.'           Punctuation
'grabFocus'   Name
'('           Punctuation
')'           Punctuation
'\n  '        Text
'win'         Name
'.'           Punctuation
'replaceEntry' Name
'.'           Punctuation
'show'        Name
'('           Punctuation
')'           Punctuation
'\n  '        Text
'win'         Name
'.'           Punctuation
'replaceLabel' Name
'.'           Punctuation
'show'        Name
'('           Punctuation
')'           Punctuation
'\n  '        Text
'win'         Name
'.'           Punctuation
'replaceBtn'  Name
'.'           Punctuation
'show'        Name
'('           Punctuation
')'           Punctuation
'\n  '        Text
'win'         Name
'.'           Punctuation
'replaceAllBtn' Name
'.'           Punctuation
'show'        Name
'('           Punctuation
')'           Punctuation
'\n  \n'      Text

'proc '       Keyword
'settings_Activate' Name.Function
'('           Punctuation
'menuitem'    Name
':'           Punctuation
' '           Text
'PMenuItem'   Name
','           Punctuation
' '           Text
'user_data'   Name
':'           Punctuation
' '           Text
'pgpointer'   Name
')'           Punctuation
' '           Text
'='           Operator
'\n  '        Text
'settings'    Name
'.'           Punctuation
'showSettings' Name
'('           Punctuation
'win'         Name
')'           Punctuation
'\n  \n'      Text

'proc '       Keyword
'viewBottomPanel_Toggled' Name.Function
'('           Punctuation
'menuitem'    Name
':'           Punctuation
' '           Text
'PCheckMenuItem' Name
','           Punctuation
' '           Text
'user_data'   Name
':'           Punctuation
' '           Text
'pgpointer'   Name
')'           Punctuation
' '           Text
'='           Operator
'\n  '        Text
'win'         Name
'.'           Punctuation
'settings'    Name
'.'           Punctuation
'bottomPanelVisible' Name
' '           Text
'='           Operator
' '           Text
'menuitem'    Name
'.'           Punctuation
'itemGetActive' Name
'('           Punctuation
')'           Punctuation
'\n  '        Text
'if'          Keyword
' '           Text
'win'         Name
'.'           Punctuation
'settings'    Name
'.'           Punctuation
'bottomPanelVisible' Name
':'           Punctuation
'\n    '      Text
'win'         Name
'.'           Punctuation
'bottomPanelTabs' Name
'.'           Punctuation
'show'        Name
'('           Punctuation
')'           Punctuation
'\n  '        Text
'else'        Keyword
':'           Punctuation
'\n    '      Text
'win'         Name
'.'           Punctuation
'bottomPanelTabs' Name
'.'           Punctuation
'hide'        Name
'('           Punctuation
')'           Punctuation
'\n\n'        Text

'var'         Keyword.Declaration
'\n  '        Text
'pegLineError' Name
' '           Text
'='           Operator
' '           Text
'peg"'        Literal.String
'{[^(]*} '    Literal.String
"'"           Literal.String
'('           Literal.String
"'"           Literal.String
' {'          Literal.String
'\\'          Literal.String
'd+} '        Literal.String
"'"           Literal.String
', '          Literal.String
"'"           Literal.String
' '           Literal.String
'\\'          Literal.String
'd+ '         Literal.String
"'"           Literal.String
') Error:'    Literal.String
"'"           Literal.String
' '           Literal.String
'\\'          Literal.String
's* {.*}'     Literal.String
'"'           Literal.String
'\n  '        Text
'pegLineWarning' Name
' '           Text
'='           Operator
' '           Text
'peg"'        Literal.String
'{[^(]*} '    Literal.String
"'"           Literal.String
'('           Literal.String
"'"           Literal.String
' {'          Literal.String
'\\'          Literal.String
'd+} '        Literal.String
"'"           Literal.String
', '          Literal.String
"'"           Literal.String
' '           Literal.String
'\\'          Literal.String
'd+ '         Literal.String
"'"           Literal.String
') '          Literal.String
"'"           Literal.String
' ('          Literal.String
"'"           Literal.String
'Warning:'    Literal.String
"'"           Literal.String
'/'           Literal.String
"'"           Literal.String
'Hint:'       Literal.String
"'"           Literal.String
') '          Literal.String
'\\'          Literal.String
's* {.*}'     Literal.String
'"'           Literal.String
'\n  '        Text
'pegOtherError' Name
' '           Text
'='           Operator
' '           Text
'peg"'        Literal.String
"'"           Literal.String
'Error:'      Literal.String
"'"           Literal.String
' '           Literal.String
'\\'          Literal.String
's* {.*}'     Literal.String
'"'           Literal.String
'\n  '        Text
'pegSuccess'  Name
' '           Text
'='           Operator
' '           Text
'peg"'        Literal.String
"'"           Literal.String
'Hint: operation successful' Literal.String
"'"           Literal.String
'.*'          Literal.String
'"'           Literal.String
'\n\n'        Text

'proc '       Keyword
'addText'     Name.Function
'('           Punctuation
'textView'    Name
':'           Punctuation
' '           Text
'PTextView'   Name
','           Punctuation
' '           Text
'text'        Name
':'           Punctuation
' '           Text
'string'      Keyword.Type
','           Punctuation
' '           Text
'colorTag'    Name
':'           Punctuation
' '           Text
'PTextTag'    Name
' '           Text
'='           Operator
' '           Text
'nil'         Keyword.Pseudo
')'           Punctuation
' '           Text
'='           Operator
'\n  '        Text
'if'          Keyword
' '           Text
'text'        Name
' '           Text
'!'           Operator
'='           Operator
' '           Text
'nil'         Keyword.Pseudo
':'           Punctuation
'\n    '      Text
'var'         Keyword.Declaration
' '           Text
'iter'        Name
':'           Punctuation
' '           Text
'TTextIter'   Name
'\n    '      Text
'textView'    Name
'.'           Punctuation
'getBuffer'   Name
'('           Punctuation
')'           Punctuation
'.'           Punctuation
'getEndIter'  Name
'('           Punctuation
'addr'        Keyword
'('           Punctuation
'iter'        Name
')'           Punctuation
')'           Punctuation
'\n\n    '    Text
'if'          Keyword
' '           Text
'colorTag'    Name
' '           Text
'='           Operator
'='           Operator
' '           Text
'nil'         Keyword.Pseudo
':'           Punctuation
'\n      '    Text
'textView'    Name
'.'           Punctuation
'getBuffer'   Name
'('           Punctuation
')'           Punctuation
'.'           Punctuation
'insert'      Name
'('           Punctuation
'addr'        Keyword
'('           Punctuation
'iter'        Name
')'           Punctuation
','           Punctuation
' '           Text
'text'        Name
','           Punctuation
' '           Text
'len'         Name
'('           Punctuation
'text'        Name
')'           Punctuation
')'           Punctuation
'\n    '      Text
'else'        Keyword
':'           Punctuation
'\n      '    Text
'textView'    Name
'.'           Punctuation
'getBuffer'   Name
'('           Punctuation
')'           Punctuation
'.'           Punctuation
'insertWithTags' Name
'('           Punctuation
'addr'        Keyword
'('           Punctuation
'iter'        Name
')'           Punctuation
','           Punctuation
' '           Text
'text'        Name
','           Punctuation
' '           Text
'len'         Name
'('           Punctuation
'text'        Name
')'           Punctuation
','           Punctuation
' '           Text
'colorTag'    Name
','           Punctuation
'\n                                          ' Text
'nil'         Keyword.Pseudo
')'           Punctuation
'\n\n'        Text

'proc '       Keyword
'createColor' Name.Function
'('           Punctuation
'textView'    Name
':'           Punctuation
' '           Text
'PTextView'   Name
','           Punctuation
' '           Text
'name'        Name
','           Punctuation
' '           Text
'color'       Name
':'           Punctuation
' '           Text
'string'      Keyword.Type
')'           Punctuation
':'           Punctuation
' '           Text
'PTextTag'    Name
' '           Text
'='           Operator
'\n  '        Text
'var'         Keyword.Declaration
' '           Text
'tagTable'    Name
' '           Text
'='           Operator
' '           Text
'textView'    Name
'.'           Punctuation
'getBuffer'   Name
'('           Punctuation
')'           Punctuation
'.'           Punctuation
'getTagTable' Name
'('           Punctuation
')'           Punctuation
'\n  '        Text
'result'      Name
' '           Text
'='           Operator
' '           Text
'tagTable'    Name
'.'           Punctuation
'tableLookup' Name
'('           Punctuation
'name'        Name
')'           Punctuation
'\n  '        Text
'if'          Keyword
' '           Text
'result'      Name
' '           Text
'='           Operator
'='           Operator
' '           Text
'nil'         Keyword.Pseudo
':'           Punctuation
'\n    '      Text
'result'      Name
' '           Text
'='           Operator
' '           Text
'textView'    Name
'.'           Punctuation
'getBuffer'   Name
'('           Punctuation
')'           Punctuation
'.'           Punctuation
'createTag'   Name
'('           Punctuation
'name'        Name
','           Punctuation
' '           Text
'"'           Literal.String
'foreground'  Literal.String
'"'           Literal.String
','           Punctuation
' '           Text
'color'       Name
','           Punctuation
' '           Text
'nil'         Keyword.Pseudo
')'           Punctuation
'\n\n'        Text

'when'        Keyword
' '           Text
'not'         Operator.Word
' '           Text
'defined'     Name
'('           Punctuation
'os'          Name
'.'           Punctuation
'findExe'     Name
')'           Punctuation
':'           Punctuation
' \n  '       Text
'proc '       Keyword
'findExe'     Name.Function
'('           Punctuation
'exe'         Name
':'           Punctuation
' '           Text
'string'      Keyword.Type
')'           Punctuation
':'           Punctuation
' '           Text
'string'      Keyword.Type
' '           Text
'='           Operator
' \n    '     Text
'## returns "" if the exe cannot be found' Literal.String.Doc
'\n    '      Text
'result'      Name
' '           Text
'='           Operator
' '           Text
'addFileExt'  Name
'('           Punctuation
'exe'         Name
','           Punctuation
' '           Text
'os'          Name
'.'           Punctuation
'exeExt'      Name
')'           Punctuation
'\n    '      Text
'if'          Keyword
' '           Text
'ExistsFile'  Name
'('           Punctuation
'result'      Name
')'           Punctuation
':'           Punctuation
' '           Text
'return'      Keyword
'\n    '      Text
'var'         Keyword.Declaration
' '           Text
'path'        Name
' '           Text
'='           Operator
' '           Text
'os'          Name
'.'           Punctuation
'getEnv'      Name
'('           Punctuation
'"'           Literal.String
'PATH'        Literal.String
'"'           Literal.String
')'           Punctuation
'\n    '      Text
'for'         Keyword
' '           Text
'candidate'   Name
' '           Text
'in'          Operator.Word
' '           Text
'split'       Name
'('           Punctuation
'path'        Name
','           Punctuation
' '           Text
'pathSep'     Name
')'           Punctuation
':'           Punctuation
' \n      '   Text
'var'         Keyword.Declaration
' '           Text
'x'           Name
' '           Text
'='           Operator
' '           Text
'candidate'   Name
' '           Text
'/'           Operator
' '           Text
'result'      Name
'\n      '    Text
'if'          Keyword
' '           Text
'ExistsFile'  Name
'('           Punctuation
'x'           Name
')'           Punctuation
':'           Punctuation
' '           Text
'return'      Keyword
' '           Text
'x'           Name
'\n    '      Text
'result'      Name
' '           Text
'='           Operator
' '           Text
'"'           Literal.String
'"'           Literal.String
'\n\n'        Text

'proc '       Keyword
'GetCmd'      Name.Function
'('           Punctuation
'cmd'         Name
','           Punctuation
' '           Text
'filename'    Name
':'           Punctuation
' '           Text
'string'      Keyword.Type
')'           Punctuation
':'           Punctuation
' '           Text
'string'      Keyword.Type
' '           Text
'='           Operator
' \n  '       Text
'var'         Keyword.Declaration
' '           Text
'f'           Name
' '           Text
'='           Operator
' '           Text
'quoteIfContainsWhite' Name
'('           Punctuation
'filename'    Name
')'           Punctuation
'\n  '        Text
'if'          Keyword
' '           Text
'cmd'         Name
' '           Text
'='           Operator
'~'           Operator
' '           Text
'peg"'        Literal.String
'\\'          Literal.String
's* '         Literal.String
"'"           Literal.String
'$'           Literal.String
"'"           Literal.String
' y'          Literal.String
"'"           Literal.String
'findExe'     Literal.String
"'"           Literal.String
' '           Literal.String
"'"           Literal.String
'('           Literal.String
"'"           Literal.String
' {[^)]+} '   Literal.String
"'"           Literal.String
')'           Literal.String
"'"           Literal.String
' {.*}'       Literal.String
'"'           Literal.String
':'           Punctuation
'\n    '      Text
'var'         Keyword.Declaration
' '           Text
'exe'         Name
' '           Text
'='           Operator
' '           Text
'quoteIfContainsWhite' Name
'('           Punctuation
'findExe'     Name
'('           Punctuation
'matches'     Name
'['           Operator
'0'           Literal.Number.Integer
']'           Operator
')'           Punctuation
')'           Punctuation
'\n    '      Text
'if'          Keyword
' '           Text
'exe'         Name
'.'           Punctuation
'len'         Name
' '           Text
'='           Operator
'='           Operator
' '           Text
'0'           Literal.Number.Integer
':'           Punctuation
' '           Text
'exe'         Name
' '           Text
'='           Operator
' '           Text
'matches'     Name
'['           Operator
'0'           Literal.Number.Integer
']'           Operator
'\n    '      Text
'result'      Name
' '           Text
'='           Operator
' '           Text
'exe'         Name
' '           Text
'&'           Operator
' '           Text
'"'           Literal.String
' '           Literal.String
'"'           Literal.String
' '           Text
'&'           Operator
' '           Text
'matches'     Name
'['           Operator
'1'           Literal.Number.Integer
']'           Operator
' '           Text
'%'           Operator
' '           Text
'f'           Name
'\n  '        Text
'else'        Keyword
':'           Punctuation
'\n    '      Text
'result'      Name
' '           Text
'='           Operator
' '           Text
'cmd'         Name
' '           Text
'%'           Operator
' '           Text
'f'           Name
'\n\n'        Text

'proc '       Keyword
'showBottomPanel' Name.Function
'('           Punctuation
')'           Punctuation
' '           Text
'='           Operator
'\n  '        Text
'if'          Keyword
' '           Text
'not'         Operator.Word
' '           Text
'win'         Name
'.'           Punctuation
'settings'    Name
'.'           Punctuation
'bottomPanelVisible' Name
':'           Punctuation
'\n    '      Text
'win'         Name
'.'           Punctuation
'bottomPanelTabs' Name
'.'           Punctuation
'show'        Name
'('           Punctuation
')'           Punctuation
'\n    '      Text
'win'         Name
'.'           Punctuation
'settings'    Name
'.'           Punctuation
'bottomPanelVisible' Name
' '           Text
'='           Operator
' '           Text
'true'        Keyword.Pseudo
'\n    '      Text
'PCheckMenuItem' Name
'('           Punctuation
'win'         Name
'.'           Punctuation
'viewBottomPanelMenuItem' Name
')'           Punctuation
'.'           Punctuation
'itemSetActive' Name
'('           Punctuation
'true'        Keyword.Pseudo
')'           Punctuation
'\n  '        Text
'# Scroll to the end of the TextView' Comment
'\n  '        Text
"# This is stupid, it works sometimes... it's random" Comment
'\n  '        Text
'var'         Keyword.Declaration
' '           Text
'endIter'     Name
':'           Punctuation
' '           Text
'TTextIter'   Name
'\n  '        Text
'win'         Name
'.'           Punctuation
'outputTextView' Name
'.'           Punctuation
'getBuffer'   Name
'('           Punctuation
')'           Punctuation
'.'           Punctuation
'getEndIter'  Name
'('           Punctuation
'addr'        Keyword
'('           Punctuation
'endIter'     Name
')'           Punctuation
')'           Punctuation
'\n  '        Text
'discard'     Keyword
' '           Text
'win'         Name
'.'           Punctuation
'outputTextView' Name
'.'           Punctuation
'scrollToIter' Name
'('           Punctuation
'\n    '      Text
'addr'        Keyword
'('           Punctuation
'endIter'     Name
')'           Punctuation
','           Punctuation
' '           Text
'0'           Literal.Number.Float
'.25'         Literal.Number.Float
','           Punctuation
' '           Text
'False'       Keyword.Pseudo
','           Punctuation
' '           Text
'0'           Literal.Number.Float
'.0'          Literal.Number.Float
','           Punctuation
' '           Text
'0'           Literal.Number.Float
'.0'          Literal.Number.Float
')'           Punctuation
'\n\n'        Text

'proc '       Keyword
'compileRun'  Name.Function
'('           Punctuation
'currentTab'  Name
':'           Punctuation
' '           Text
'int'         Keyword.Type
','           Punctuation
' '           Text
'shouldRun'   Name
':'           Punctuation
' '           Text
'bool'        Keyword.Type
')'           Punctuation
' '           Text
'='           Operator
'\n  '        Text
'if'          Keyword
' '           Text
'win'         Name
'.'           Punctuation
'Tabs'        Name
'['           Operator
'currentTab'  Name
']'           Operator
'.'           Punctuation
'filename'    Name
'.'           Punctuation
'len'         Name
' '           Text
'='           Operator
'='           Operator
' '           Text
'0'           Literal.Number.Integer
':'           Punctuation
' '           Text
'return'      Keyword
'\n  '        Text
'# Clear the outputTextView' Comment
'\n  '        Text
'win'         Name
'.'           Punctuation
'outputTextView' Name
'.'           Punctuation
'getBuffer'   Name
'('           Punctuation
')'           Punctuation
'.'           Punctuation
'setText'     Name
'('           Punctuation
'"'           Literal.String
'"'           Literal.String
','           Punctuation
' '           Text
'0'           Literal.Number.Integer
')'           Punctuation
'\n\n  '      Text
'var'         Keyword.Declaration
' '           Text
'outp'        Name
' '           Text
'='           Operator
' '           Text
'osProc'      Name
'.'           Punctuation
'execProcess' Name
'('           Punctuation
'GetCmd'      Name
'('           Punctuation
'win'         Name
'.'           Punctuation
'settings'    Name
'.'           Punctuation
'nimrodCmd'   Name
','           Punctuation
'\n                                ' Text
'win'         Name
'.'           Punctuation
'Tabs'        Name
'['           Operator
'currentTab'  Name
']'           Operator
'.'           Punctuation
'filename'    Name
')'           Punctuation
')'           Punctuation
'\n  '        Text
'# Colors'    Comment
'\n  '        Text
'var'         Keyword.Declaration
' '           Text
'normalTag'   Name
' '           Text
'='           Operator
' '           Text
'createColor' Name
'('           Punctuation
'win'         Name
'.'           Punctuation
'outputTextView' Name
','           Punctuation
' '           Text
'"'           Literal.String
'normalTag'   Literal.String
'"'           Literal.String
','           Punctuation
' '           Text
'"'           Literal.String
'#3d3d3d'     Literal.String
'"'           Literal.String
')'           Punctuation
'\n  '        Text
'var'         Keyword.Declaration
' '           Text
'errorTag'    Name
' '           Text
'='           Operator
' '           Text
'createColor' Name
'('           Punctuation
'win'         Name
'.'           Punctuation
'outputTextView' Name
','           Punctuation
' '           Text
'"'           Literal.String
'errorTag'    Literal.String
'"'           Literal.String
','           Punctuation
' '           Text
'"'           Literal.String
'red'         Literal.String
'"'           Literal.String
')'           Punctuation
'\n  '        Text
'var'         Keyword.Declaration
' '           Text
'warningTag'  Name
' '           Text
'='           Operator
' '           Text
'createColor' Name
'('           Punctuation
'win'         Name
'.'           Punctuation
'outputTextView' Name
','           Punctuation
' '           Text
'"'           Literal.String
'warningTag'  Literal.String
'"'           Literal.String
','           Punctuation
' '           Text
'"'           Literal.String
'darkorange'  Literal.String
'"'           Literal.String
')'           Punctuation
'\n  '        Text
'var'         Keyword.Declaration
' '           Text
'successTag'  Name
' '           Text
'='           Operator
' '           Text
'createColor' Name
'('           Punctuation
'win'         Name
'.'           Punctuation
'outputTextView' Name
','           Punctuation
' '           Text
'"'           Literal.String
'successTag'  Literal.String
'"'           Literal.String
','           Punctuation
' '           Text
'"'           Literal.String
'darkgreen'   Literal.String
'"'           Literal.String
')'           Punctuation
'\n  '        Text
'for'         Keyword
' '           Text
'x'           Name
' '           Text
'in'          Operator.Word
' '           Text
'outp'        Name
'.'           Punctuation
'splitLines'  Name
'('           Punctuation
')'           Punctuation
':'           Punctuation
'\n    '      Text
'if'          Keyword
' '           Text
'x'           Name
' '           Text
'='           Operator
'~'           Operator
' '           Text
'pegLineError' Name
' '           Text
'/'           Operator
' '           Text
'pegOtherError' Name
':'           Punctuation
'\n      '    Text
'win'         Name
'.'           Punctuation
'outputTextView' Name
'.'           Punctuation
'addText'     Name
'('           Punctuation
'"'           Literal.String
'\\n'         Literal.String.Escape
'"'           Literal.String
' '           Text
'&'           Operator
' '           Text
'x'           Name
','           Punctuation
' '           Text
'errorTag'    Name
')'           Punctuation
'\n    '      Text
'elif'        Keyword
' '           Text
'x'           Name
'='           Operator
'~'           Operator
' '           Text
'pegSuccess'  Name
':'           Punctuation
'\n      '    Text
'win'         Name
'.'           Punctuation
'outputTextView' Name
'.'           Punctuation
'addText'     Name
'('           Punctuation
'"'           Literal.String
'\\n'         Literal.String.Escape
'"'           Literal.String
' '           Text
'&'           Operator
' '           Text
'x'           Name
','           Punctuation
' '           Text
'successTag'  Name
')'           Punctuation
'\n      \n      ' Text
'# Launch the process' Comment
'\n      '    Text
'if'          Keyword
' '           Text
'shouldRun'   Name
':'           Punctuation
'\n        '  Text
'var'         Keyword.Declaration
' '           Text
'filename'    Name
' '           Text
'='           Operator
' '           Text
'changeFileExt' Name
'('           Punctuation
'win'         Name
'.'           Punctuation
'Tabs'        Name
'['           Operator
'currentTab'  Name
']'           Operator
'.'           Punctuation
'filename'    Name
','           Punctuation
' '           Text
'os'          Name
'.'           Punctuation
'ExeExt'      Name
')'           Punctuation
'\n        '  Text
'var'         Keyword.Declaration
' '           Text
'output'      Name
' '           Text
'='           Operator
' '           Text
'"'           Literal.String
'\\n'         Literal.String.Escape
'"'           Literal.String
' '           Text
'&'           Operator
' '           Text
'osProc'      Name
'.'           Punctuation
'execProcess' Name
'('           Punctuation
'filename'    Name
')'           Punctuation
'\n        '  Text
'win'         Name
'.'           Punctuation
'outputTextView' Name
'.'           Punctuation
'addText'     Name
'('           Punctuation
'output'      Name
')'           Punctuation
'\n    '      Text
'elif'        Keyword
' '           Text
'x'           Name
' '           Text
'='           Operator
'~'           Operator
' '           Text
'pegLineWarning' Name
':'           Punctuation
'\n      '    Text
'win'         Name
'.'           Punctuation
'outputTextView' Name
'.'           Punctuation
'addText'     Name
'('           Punctuation
'"'           Literal.String
'\\n'         Literal.String.Escape
'"'           Literal.String
' '           Text
'&'           Operator
' '           Text
'x'           Name
','           Punctuation
' '           Text
'warningTag'  Name
')'           Punctuation
'\n    '      Text
'else'        Keyword
':'           Punctuation
'\n      '    Text
'win'         Name
'.'           Punctuation
'outputTextView' Name
'.'           Punctuation
'addText'     Name
'('           Punctuation
'"'           Literal.String
'\\n'         Literal.String.Escape
'"'           Literal.String
' '           Text
'&'           Operator
' '           Text
'x'           Name
','           Punctuation
' '           Text
'normalTag'   Name
')'           Punctuation
'\n  '        Text
'showBottomPanel' Name
'('           Punctuation
')'           Punctuation
'\n\n'        Text

'proc '       Keyword
'CompileCurrent_Activate' Name.Function
'('           Punctuation
'menuitem'    Name
':'           Punctuation
' '           Text
'PMenuItem'   Name
','           Punctuation
' '           Text
'user_data'   Name
':'           Punctuation
' '           Text
'pgpointer'   Name
')'           Punctuation
' '           Text
'='           Operator
'\n  '        Text
'saveFile_Activate' Name
'('           Punctuation
'nil'         Keyword.Pseudo
','           Punctuation
' '           Text
'nil'         Keyword.Pseudo
')'           Punctuation
'\n  '        Text
'compileRun'  Name
'('           Punctuation
'win'         Name
'.'           Punctuation
'SourceViewTabs' Name
'.'           Punctuation
'getCurrentPage' Name
'('           Punctuation
')'           Punctuation
','           Punctuation
' '           Text
'false'       Keyword.Pseudo
')'           Punctuation
'\n  \n'      Text

'proc '       Keyword
'CompileRunCurrent_Activate' Name.Function
'('           Punctuation
'menuitem'    Name
':'           Punctuation
' '           Text
'PMenuItem'   Name
','           Punctuation
' '           Text
'user_data'   Name
':'           Punctuation
' '           Text
'pgpointer'   Name
')'           Punctuation
' '           Text
'='           Operator
'\n  '        Text
'saveFile_Activate' Name
'('           Punctuation
'nil'         Keyword.Pseudo
','           Punctuation
' '           Text
'nil'         Keyword.Pseudo
')'           Punctuation
'\n  '        Text
'compileRun'  Name
'('           Punctuation
'win'         Name
'.'           Punctuation
'SourceViewTabs' Name
'.'           Punctuation
'getCurrentPage' Name
'('           Punctuation
')'           Punctuation
','           Punctuation
' '           Text
'true'        Keyword.Pseudo
')'           Punctuation
'\n\n'        Text

'proc '       Keyword
'CompileProject_Activate' Name.Function
'('           Punctuation
'menuitem'    Name
':'           Punctuation
' '           Text
'PMenuItem'   Name
','           Punctuation
' '           Text
'user_data'   Name
':'           Punctuation
' '           Text
'pgpointer'   Name
')'           Punctuation
' '           Text
'='           Operator
'\n  '        Text
'saveAllTabs' Name
'('           Punctuation
')'           Punctuation
'\n  '        Text
'compileRun'  Name
'('           Punctuation
'getProjectTab' Name
'('           Punctuation
')'           Punctuation
','           Punctuation
' '           Text
'false'       Keyword.Pseudo
')'           Punctuation
'\n  \n'      Text

'proc '       Keyword
'CompileRunProject_Activate' Name.Function
'('           Punctuation
'menuitem'    Name
':'           Punctuation
' '           Text
'PMenuItem'   Name
','           Punctuation
' '           Text
'user_data'   Name
':'           Punctuation
' '           Text
'pgpointer'   Name
')'           Punctuation
' '           Text
'='           Operator
'\n  '        Text
'saveAllTabs' Name
'('           Punctuation
')'           Punctuation
'\n  '        Text
'compileRun'  Name
'('           Punctuation
'getProjectTab' Name
'('           Punctuation
')'           Punctuation
','           Punctuation
' '           Text
'true'        Keyword.Pseudo
')'           Punctuation
'\n\n'        Text

'proc '       Keyword
'RunCustomCommand' Name.Function
'('           Punctuation
'cmd'         Name
':'           Punctuation
' '           Text
'string'      Keyword.Type
')'           Punctuation
' '           Text
'='           Operator
' \n  '       Text
'saveFile_Activate' Name
'('           Punctuation
'nil'         Keyword.Pseudo
','           Punctuation
' '           Text
'nil'         Keyword.Pseudo
')'           Punctuation
'\n  '        Text
'var'         Keyword.Declaration
' '           Text
'currentTab'  Name
' '           Text
'='           Operator
' '           Text
'win'         Name
'.'           Punctuation
'SourceViewTabs' Name
'.'           Punctuation
'getCurrentPage' Name
'('           Punctuation
')'           Punctuation
'\n  '        Text
'if'          Keyword
' '           Text
'win'         Name
'.'           Punctuation
'Tabs'        Name
'['           Operator
'currentTab'  Name
']'           Operator
'.'           Punctuation
'filename'    Name
'.'           Punctuation
'len'         Name
' '           Text
'='           Operator
'='           Operator
' '           Text
'0'           Literal.Number.Integer
' '           Text
'or'          Operator.Word
' '           Text
'cmd'         Name
'.'           Punctuation
'len'         Name
' '           Text
'='           Operator
'='           Operator
' '           Text
'0'           Literal.Number.Integer
':'           Punctuation
' '           Text
'return'      Keyword
'\n  '        Text
'# Clear the outputTextView' Comment
'\n  '        Text
'win'         Name
'.'           Punctuation
'outputTextView' Name
'.'           Punctuation
'getBuffer'   Name
'('           Punctuation
')'           Punctuation
'.'           Punctuation
'setText'     Name
'('           Punctuation
'"'           Literal.String
'"'           Literal.String
','           Punctuation
' '           Text
'0'           Literal.Number.Integer
')'           Punctuation
'\n  '        Text
'var'         Keyword.Declaration
' '           Text
'outp'        Name
' '           Text
'='           Operator
' '           Text
'osProc'      Name
'.'           Punctuation
'execProcess' Name
'('           Punctuation
'GetCmd'      Name
'('           Punctuation
'cmd'         Name
','           Punctuation
' '           Text
'win'         Name
'.'           Punctuation
'Tabs'        Name
'['           Operator
'currentTab'  Name
']'           Operator
'.'           Punctuation
'filename'    Name
')'           Punctuation
')'           Punctuation
'\n  '        Text
'var'         Keyword.Declaration
' '           Text
'normalTag'   Name
' '           Text
'='           Operator
' '           Text
'createColor' Name
'('           Punctuation
'win'         Name
'.'           Punctuation
'outputTextView' Name
','           Punctuation
' '           Text
'"'           Literal.String
'normalTag'   Literal.String
'"'           Literal.String
','           Punctuation
' '           Text
'"'           Literal.String
'#3d3d3d'     Literal.String
'"'           Literal.String
')'           Punctuation
'\n  '        Text
'for'         Keyword
' '           Text
'x'           Name
' '           Text
'in'          Operator.Word
' '           Text
'outp'        Name
'.'           Punctuation
'splitLines'  Name
'('           Punctuation
')'           Punctuation
':'           Punctuation
'\n    '      Text
'win'         Name
'.'           Punctuation
'outputTextView' Name
'.'           Punctuation
'addText'     Name
'('           Punctuation
'"'           Literal.String
'\\n'         Literal.String.Escape
'"'           Literal.String
' '           Text
'&'           Operator
' '           Text
'x'           Name
','           Punctuation
' '           Text
'normalTag'   Name
')'           Punctuation
'\n  '        Text
'showBottomPanel' Name
'('           Punctuation
')'           Punctuation
'\n\n'        Text

'proc '       Keyword
'RunCustomCommand1' Name.Function
'('           Punctuation
'menuitem'    Name
':'           Punctuation
' '           Text
'PMenuItem'   Name
','           Punctuation
' '           Text
'user_data'   Name
':'           Punctuation
' '           Text
'pgpointer'   Name
')'           Punctuation
' '           Text
'='           Operator
'\n  '        Text
'RunCustomCommand' Name
'('           Punctuation
'win'         Name
'.'           Punctuation
'settings'    Name
'.'           Punctuation
'customCmd1'  Name
')'           Punctuation
'\n\n'        Text

'proc '       Keyword
'RunCustomCommand2' Name.Function
'('           Punctuation
'menuitem'    Name
':'           Punctuation
' '           Text
'PMenuItem'   Name
','           Punctuation
' '           Text
'user_data'   Name
':'           Punctuation
' '           Text
'pgpointer'   Name
')'           Punctuation
' '           Text
'='           Operator
'\n  '        Text
'RunCustomCommand' Name
'('           Punctuation
'win'         Name
'.'           Punctuation
'settings'    Name
'.'           Punctuation
'customCmd2'  Name
')'           Punctuation
'\n\n'        Text

'proc '       Keyword
'RunCustomCommand3' Name.Function
'('           Punctuation
'menuitem'    Name
':'           Punctuation
' '           Text
'PMenuItem'   Name
','           Punctuation
' '           Text
'user_data'   Name
':'           Punctuation
' '           Text
'pgpointer'   Name
')'           Punctuation
' '           Text
'='           Operator
'\n  '        Text
'RunCustomCommand' Name
'('           Punctuation
'win'         Name
'.'           Punctuation
'settings'    Name
'.'           Punctuation
'customCmd3'  Name
')'           Punctuation
'\n\n'        Text

'# -- FindBar' Comment
'\n\n'        Text

'proc '       Keyword
'nextBtn_Clicked' Name.Function
'('           Punctuation
'button'      Name
':'           Punctuation
' '           Text
'PButton'     Name
','           Punctuation
' '           Text
'user_data'   Name
':'           Punctuation
' '           Text
'pgpointer'   Name
')'           Punctuation
' '           Text
'='           Operator
' '           Text
'findText'    Name
'('           Punctuation
'True'        Keyword.Pseudo
')'           Punctuation
'\n'          Text

'proc '       Keyword
'prevBtn_Clicked' Name.Function
'('           Punctuation
'button'      Name
':'           Punctuation
' '           Text
'PButton'     Name
','           Punctuation
' '           Text
'user_data'   Name
':'           Punctuation
' '           Text
'pgpointer'   Name
')'           Punctuation
' '           Text
'='           Operator
' '           Text
'findText'    Name
'('           Punctuation
'False'       Keyword.Pseudo
')'           Punctuation
'\n\n'        Text

'proc '       Keyword
'replaceBtn_Clicked' Name.Function
'('           Punctuation
'button'      Name
':'           Punctuation
' '           Text
'PButton'     Name
','           Punctuation
' '           Text
'user_data'   Name
':'           Punctuation
' '           Text
'pgpointer'   Name
')'           Punctuation
' '           Text
'='           Operator
'\n  '        Text
'var'         Keyword.Declaration
' '           Text
'currentTab'  Name
' '           Text
'='           Operator
' '           Text
'win'         Name
'.'           Punctuation
'SourceViewTabs' Name
'.'           Punctuation
'getCurrentPage' Name
'('           Punctuation
')'           Punctuation
'\n  '        Text
'var'         Keyword.Declaration
' '           Text
'start'       Name
','           Punctuation
' '           Text
'theEnd'      Name
':'           Punctuation
' '           Text
'TTextIter'   Name
'\n  '        Text
'if'          Keyword
' '           Text
'not'         Operator.Word
' '           Text
'win'         Name
'.'           Punctuation
'Tabs'        Name
'['           Operator
'currentTab'  Name
']'           Operator
'.'           Punctuation
'buffer'      Name
'.'           Punctuation
'getSelectionBounds' Name
'('           Punctuation
'\n        '  Text
'addr'        Keyword
'('           Punctuation
'start'       Name
')'           Punctuation
','           Punctuation
' '           Text
'addr'        Keyword
'('           Punctuation
'theEnd'      Name
')'           Punctuation
')'           Punctuation
':'           Punctuation
'\n    '      Text
'# If no text is selected, try finding a match.' Comment
'\n    '      Text
'findText'    Name
'('           Punctuation
'True'        Keyword.Pseudo
')'           Punctuation
'\n    '      Text
'if'          Keyword
' '           Text
'not'         Operator.Word
' '           Text
'win'         Name
'.'           Punctuation
'Tabs'        Name
'['           Operator
'currentTab'  Name
']'           Operator
'.'           Punctuation
'buffer'      Name
'.'           Punctuation
'getSelectionBounds' Name
'('           Punctuation
'\n          ' Text
'addr'        Keyword
'('           Punctuation
'start'       Name
')'           Punctuation
','           Punctuation
' '           Text
'addr'        Keyword
'('           Punctuation
'theEnd'      Name
')'           Punctuation
')'           Punctuation
':'           Punctuation
'\n      '    Text
'# No match'  Comment
'\n      '    Text
'return'      Keyword
'\n  \n  '    Text
'# Remove the text' Comment
'\n  '        Text
'win'         Name
'.'           Punctuation
'Tabs'        Name
'['           Operator
'currentTab'  Name
']'           Operator
'.'           Punctuation
'buffer'      Name
'.'           Punctuation
'delete'      Name
'('           Punctuation
'addr'        Keyword
'('           Punctuation
'start'       Name
')'           Punctuation
','           Punctuation
' '           Text
'addr'        Keyword
'('           Punctuation
'theEnd'      Name
')'           Punctuation
')'           Punctuation
'\n  '        Text
'# Insert the replacement' Comment
'\n  '        Text
'var'         Keyword.Declaration
' '           Text
'text'        Name
' '           Text
'='           Operator
' '           Text
'getText'     Name
'('           Punctuation
'win'         Name
'.'           Punctuation
'replaceEntry' Name
')'           Punctuation
'\n  '        Text
'win'         Name
'.'           Punctuation
'Tabs'        Name
'['           Operator
'currentTab'  Name
']'           Operator
'.'           Punctuation
'buffer'      Name
'.'           Punctuation
'insert'      Name
'('           Punctuation
'addr'        Keyword
'('           Punctuation
'start'       Name
')'           Punctuation
','           Punctuation
' '           Text
'text'        Name
','           Punctuation
' '           Text
'len'         Name
'('           Punctuation
'text'        Name
')'           Punctuation
')'           Punctuation
'\n  \n'      Text

'proc '       Keyword
'replaceAllBtn_Clicked' Name.Function
'('           Punctuation
'button'      Name
':'           Punctuation
' '           Text
'PButton'     Name
','           Punctuation
' '           Text
'user_data'   Name
':'           Punctuation
' '           Text
'pgpointer'   Name
')'           Punctuation
' '           Text
'='           Operator
'\n  '        Text
'var'         Keyword.Declaration
' '           Text
'find'        Name
' '           Text
'='           Operator
' '           Text
'getText'     Name
'('           Punctuation
'win'         Name
'.'           Punctuation
'findEntry'   Name
')'           Punctuation
'\n  '        Text
'var'         Keyword.Declaration
' '           Text
'replace'     Name
' '           Text
'='           Operator
' '           Text
'getText'     Name
'('           Punctuation
'win'         Name
'.'           Punctuation
'replaceEntry' Name
')'           Punctuation
'\n  '        Text
'discard'     Keyword
' '           Text
'replaceAll'  Name
'('           Punctuation
'find'        Name
','           Punctuation
' '           Text
'replace'     Name
')'           Punctuation
'\n  \n'      Text

'proc '       Keyword
'closeBtn_Clicked' Name.Function
'('           Punctuation
'button'      Name
':'           Punctuation
' '           Text
'PButton'     Name
','           Punctuation
' '           Text
'user_data'   Name
':'           Punctuation
' '           Text
'pgpointer'   Name
')'           Punctuation
' '           Text
'='           Operator
' \n  '       Text
'win'         Name
'.'           Punctuation
'findBar'     Name
'.'           Punctuation
'hide'        Name
'('           Punctuation
')'           Punctuation
'\n\n'        Text

'proc '       Keyword
'caseSens_Changed' Name.Function
'('           Punctuation
'radiomenuitem' Name
':'           Punctuation
' '           Text
'PRadioMenuitem' Name
','           Punctuation
' '           Text
'user_data'   Name
':'           Punctuation
' '           Text
'pgpointer'   Name
')'           Punctuation
' '           Text
'='           Operator
'\n  '        Text
'win'         Name
'.'           Punctuation
'settings'    Name
'.'           Punctuation
'search'      Name
' '           Text
'='           Operator
' '           Text
'"'           Literal.String
'casesens'    Literal.String
'"'           Literal.String
'\n'          Text

'proc '       Keyword
'caseInSens_Changed' Name.Function
'('           Punctuation
'radiomenuitem' Name
':'           Punctuation
' '           Text
'PRadioMenuitem' Name
','           Punctuation
' '           Text
'user_data'   Name
':'           Punctuation
' '           Text
'pgpointer'   Name
')'           Punctuation
' '           Text
'='           Operator
'\n  '        Text
'win'         Name
'.'           Punctuation
'settings'    Name
'.'           Punctuation
'search'      Name
' '           Text
'='           Operator
' '           Text
'"'           Literal.String
'caseinsens'  Literal.String
'"'           Literal.String
'\n'          Text

'proc '       Keyword
'style_Changed' Name.Function
'('           Punctuation
'radiomenuitem' Name
':'           Punctuation
' '           Text
'PRadioMenuitem' Name
','           Punctuation
' '           Text
'user_data'   Name
':'           Punctuation
' '           Text
'pgpointer'   Name
')'           Punctuation
' '           Text
'='           Operator
'\n  '        Text
'win'         Name
'.'           Punctuation
'settings'    Name
'.'           Punctuation
'search'      Name
' '           Text
'='           Operator
' '           Text
'"'           Literal.String
'style'       Literal.String
'"'           Literal.String
'\n'          Text

'proc '       Keyword
'regex_Changed' Name.Function
'('           Punctuation
'radiomenuitem' Name
':'           Punctuation
' '           Text
'PRadioMenuitem' Name
','           Punctuation
' '           Text
'user_data'   Name
':'           Punctuation
' '           Text
'pgpointer'   Name
')'           Punctuation
' '           Text
'='           Operator
'\n  '        Text
'win'         Name
'.'           Punctuation
'settings'    Name
'.'           Punctuation
'search'      Name
' '           Text
'='           Operator
' '           Text
'"'           Literal.String
'regex'       Literal.String
'"'           Literal.String
'\n'          Text

'proc '       Keyword
'peg_Changed' Name.Function
'('           Punctuation
'radiomenuitem' Name
':'           Punctuation
' '           Text
'PRadioMenuitem' Name
','           Punctuation
' '           Text
'user_data'   Name
':'           Punctuation
' '           Text
'pgpointer'   Name
')'           Punctuation
' '           Text
'='           Operator
'\n  '        Text
'win'         Name
'.'           Punctuation
'settings'    Name
'.'           Punctuation
'search'      Name
' '           Text
'='           Operator
' '           Text
'"'           Literal.String
'peg'         Literal.String
'"'           Literal.String
'\n\n'        Text

'proc '       Keyword
'extraBtn_Clicked' Name.Function
'('           Punctuation
'button'      Name
':'           Punctuation
' '           Text
'PButton'     Name
','           Punctuation
' '           Text
'user_data'   Name
':'           Punctuation
' '           Text
'pgpointer'   Name
')'           Punctuation
' '           Text
'='           Operator
'\n  '        Text
'var'         Keyword.Declaration
' '           Text
'extraMenu'   Name
' '           Text
'='           Operator
' '           Text
'menuNew'     Name
'('           Punctuation
')'           Punctuation
'\n  '        Text
'var'         Keyword.Declaration
' '           Text
'group'       Name
':'           Punctuation
' '           Text
'PGSList'     Name
'\n\n  '      Text
'var'         Keyword.Declaration
' '           Text
'caseSensMenuItem' Name
' '           Text
'='           Operator
' '           Text
'radio_menu_item_new' Name
'('           Punctuation
'group'       Name
','           Punctuation
' '           Text
'"'           Literal.String
'Case sensitive' Literal.String
'"'           Literal.String
')'           Punctuation
'\n  '        Text
'extraMenu'   Name
'.'           Punctuation
'append'      Name
'('           Punctuation
'caseSensMenuItem' Name
')'           Punctuation
'\n  '        Text
'discard'     Keyword
' '           Text
'signal_connect' Name
'('           Punctuation
'caseSensMenuItem' Name
','           Punctuation
' '           Text
'"'           Literal.String
'toggled'     Literal.String
'"'           Literal.String
','           Punctuation
' \n                          ' Text
'SIGNAL_FUNC' Name
'('           Punctuation
'caseSens_Changed' Name
')'           Punctuation
','           Punctuation
' '           Text
'nil'         Keyword.Pseudo
')'           Punctuation
'\n  '        Text
'caseSensMenuItem' Name
'.'           Punctuation
'show'        Name
'('           Punctuation
')'           Punctuation
'\n  '        Text
'group'       Name
' '           Text
'='           Operator
' '           Text
'caseSensMenuItem' Name
'.'           Punctuation
'ItemGetGroup' Name
'('           Punctuation
')'           Punctuation
'\n  \n  '    Text
'var'         Keyword.Declaration
' '           Text
'caseInSensMenuItem' Name
' '           Text
'='           Operator
' '           Text
'radio_menu_item_new' Name
'('           Punctuation
'group'       Name
','           Punctuation
' '           Text
'"'           Literal.String
'Case insensitive' Literal.String
'"'           Literal.String
')'           Punctuation
'\n  '        Text
'extraMenu'   Name
'.'           Punctuation
'append'      Name
'('           Punctuation
'caseInSensMenuItem' Name
')'           Punctuation
'\n  '        Text
'discard'     Keyword
' '           Text
'signal_connect' Name
'('           Punctuation
'caseInSensMenuItem' Name
','           Punctuation
' '           Text
'"'           Literal.String
'toggled'     Literal.String
'"'           Literal.String
','           Punctuation
' \n                          ' Text
'SIGNAL_FUNC' Name
'('           Punctuation
'caseInSens_Changed' Name
')'           Punctuation
','           Punctuation
' '           Text
'nil'         Keyword.Pseudo
')'           Punctuation
'\n  '        Text
'caseInSensMenuItem' Name
'.'           Punctuation
'show'        Name
'('           Punctuation
')'           Punctuation
'\n  '        Text
'group'       Name
' '           Text
'='           Operator
' '           Text
'caseInSensMenuItem' Name
'.'           Punctuation
'ItemGetGroup' Name
'('           Punctuation
')'           Punctuation
'\n  \n  '    Text
'var'         Keyword.Declaration
' '           Text
'styleMenuItem' Name
' '           Text
'='           Operator
' '           Text
'radio_menu_item_new' Name
'('           Punctuation
'group'       Name
','           Punctuation
' '           Text
'"'           Literal.String
'Style insensitive' Literal.String
'"'           Literal.String
')'           Punctuation
'\n  '        Text
'extraMenu'   Name
'.'           Punctuation
'append'      Name
'('           Punctuation
'styleMenuItem' Name
')'           Punctuation
'\n  '        Text
'discard'     Keyword
' '           Text
'signal_connect' Name
'('           Punctuation
'styleMenuItem' Name
','           Punctuation
' '           Text
'"'           Literal.String
'toggled'     Literal.String
'"'           Literal.String
','           Punctuation
' \n                          ' Text
'SIGNAL_FUNC' Name
'('           Punctuation
'style_Changed' Name
')'           Punctuation
','           Punctuation
' '           Text
'nil'         Keyword.Pseudo
')'           Punctuation
'\n  '        Text
'styleMenuItem' Name
'.'           Punctuation
'show'        Name
'('           Punctuation
')'           Punctuation
'\n  '        Text
'group'       Name
' '           Text
'='           Operator
' '           Text
'styleMenuItem' Name
'.'           Punctuation
'ItemGetGroup' Name
'('           Punctuation
')'           Punctuation
'\n  \n  '    Text
'var'         Keyword.Declaration
' '           Text
'regexMenuItem' Name
' '           Text
'='           Operator
' '           Text
'radio_menu_item_new' Name
'('           Punctuation
'group'       Name
','           Punctuation
' '           Text
'"'           Literal.String
'Regex'       Literal.String
'"'           Literal.String
')'           Punctuation
'\n  '        Text
'extraMenu'   Name
'.'           Punctuation
'append'      Name
'('           Punctuation
'regexMenuItem' Name
')'           Punctuation
'\n  '        Text
'discard'     Keyword
' '           Text
'signal_connect' Name
'('           Punctuation
'regexMenuItem' Name
','           Punctuation
' '           Text
'"'           Literal.String
'toggled'     Literal.String
'"'           Literal.String
','           Punctuation
' \n                          ' Text
'SIGNAL_FUNC' Name
'('           Punctuation
'regex_Changed' Name
')'           Punctuation
','           Punctuation
' '           Text
'nil'         Keyword.Pseudo
')'           Punctuation
'\n  '        Text
'regexMenuItem' Name
'.'           Punctuation
'show'        Name
'('           Punctuation
')'           Punctuation
'\n  '        Text
'group'       Name
' '           Text
'='           Operator
' '           Text
'regexMenuItem' Name
'.'           Punctuation
'ItemGetGroup' Name
'('           Punctuation
')'           Punctuation
'\n  \n  '    Text
'var'         Keyword.Declaration
' '           Text
'pegMenuItem' Name
' '           Text
'='           Operator
' '           Text
'radio_menu_item_new' Name
'('           Punctuation
'group'       Name
','           Punctuation
' '           Text
'"'           Literal.String
'Pegs'        Literal.String
'"'           Literal.String
')'           Punctuation
'\n  '        Text
'extraMenu'   Name
'.'           Punctuation
'append'      Name
'('           Punctuation
'pegMenuItem' Name
')'           Punctuation
'\n  '        Text
'discard'     Keyword
' '           Text
'signal_connect' Name
'('           Punctuation
'pegMenuItem' Name
','           Punctuation
' '           Text
'"'           Literal.String
'toggled'     Literal.String
'"'           Literal.String
','           Punctuation
' \n                          ' Text
'SIGNAL_FUNC' Name
'('           Punctuation
'peg_Changed' Name
')'           Punctuation
','           Punctuation
' '           Text
'nil'         Keyword.Pseudo
')'           Punctuation
'\n  '        Text
'pegMenuItem' Name
'.'           Punctuation
'show'        Name
'('           Punctuation
')'           Punctuation
'\n  \n  '    Text
'# Make the correct radio button active' Comment
'\n  '        Text
'case'        Keyword
' '           Text
'win'         Name
'.'           Punctuation
'settings'    Name
'.'           Punctuation
'search'      Name
'\n  '        Text
'of'          Keyword
' '           Text
'"'           Literal.String
'casesens'    Literal.String
'"'           Literal.String
':'           Punctuation
'\n    '      Text
'PCheckMenuItem' Name
'('           Punctuation
'caseSensMenuItem' Name
')'           Punctuation
'.'           Punctuation
'ItemSetActive' Name
'('           Punctuation
'True'        Keyword.Pseudo
')'           Punctuation
'\n  '        Text
'of'          Keyword
' '           Text
'"'           Literal.String
'caseinsens'  Literal.String
'"'           Literal.String
':'           Punctuation
'\n    '      Text
'PCheckMenuItem' Name
'('           Punctuation
'caseInSensMenuItem' Name
')'           Punctuation
'.'           Punctuation
'ItemSetActive' Name
'('           Punctuation
'True'        Keyword.Pseudo
')'           Punctuation
'\n  '        Text
'of'          Keyword
' '           Text
'"'           Literal.String
'style'       Literal.String
'"'           Literal.String
':'           Punctuation
'\n    '      Text
'PCheckMenuItem' Name
'('           Punctuation
'styleMenuItem' Name
')'           Punctuation
'.'           Punctuation
'ItemSetActive' Name
'('           Punctuation
'True'        Keyword.Pseudo
')'           Punctuation
'\n  '        Text
'of'          Keyword
' '           Text
'"'           Literal.String
'regex'       Literal.String
'"'           Literal.String
':'           Punctuation
'\n    '      Text
'PCheckMenuItem' Name
'('           Punctuation
'regexMenuItem' Name
')'           Punctuation
'.'           Punctuation
'ItemSetActive' Name
'('           Punctuation
'True'        Keyword.Pseudo
')'           Punctuation
'\n  '        Text
'of'          Keyword
' '           Text
'"'           Literal.String
'peg'         Literal.String
'"'           Literal.String
':'           Punctuation
'\n    '      Text
'PCheckMenuItem' Name
'('           Punctuation
'pegMenuItem' Name
')'           Punctuation
'.'           Punctuation
'ItemSetActive' Name
'('           Punctuation
'True'        Keyword.Pseudo
')'           Punctuation
'\n\n  '      Text
'extraMenu'   Name
'.'           Punctuation
'popup'       Name
'('           Punctuation
'nil'         Keyword.Pseudo
','           Punctuation
' '           Text
'nil'         Keyword.Pseudo
','           Punctuation
' '           Text
'nil'         Keyword.Pseudo
','           Punctuation
' '           Text
'nil'         Keyword.Pseudo
','           Punctuation
' '           Text
'0'           Literal.Number.Integer
','           Punctuation
' '           Text
'get_current_event_time' Name
'('           Punctuation
')'           Punctuation
')'           Punctuation
'\n\n'        Text

'# GUI Initialization' Comment
'\n\n'        Text

'proc '       Keyword
'createAccelMenuItem' Name.Function
'('           Punctuation
'toolsMenu'   Name
':'           Punctuation
' '           Text
'PMenu'       Name
','           Punctuation
' '           Text
'accGroup'    Name
':'           Punctuation
' '           Text
'PAccelGroup' Name
','           Punctuation
' \n                         ' Text
'label'       Name
':'           Punctuation
' '           Text
'string'      Keyword.Type
','           Punctuation
' '           Text
'acc'         Name
':'           Punctuation
' '           Text
'gint'        Name
','           Punctuation
'\n                         ' Text
'action'      Name
':'           Punctuation
' '           Text
'proc'        Keyword
' '           Text
'('           Punctuation
'i'           Name
':'           Punctuation
' '           Text
'PMenuItem'   Name
','           Punctuation
' '           Text
'p'           Name
':'           Punctuation
' '           Text
'pgpointer'   Name
')'           Punctuation
')'           Punctuation
' '           Text
'='           Operator
' \n  '       Text
'var'         Keyword.Declaration
' '           Text
'result'      Name
' '           Text
'='           Operator
' '           Text
'menu_item_new' Name
'('           Punctuation
'label'       Name
')'           Punctuation
'\n  '        Text
'result'      Name
'.'           Punctuation
'addAccelerator' Name
'('           Punctuation
'"'           Literal.String
'activate'    Literal.String
'"'           Literal.String
','           Punctuation
' '           Text
'accGroup'    Name
','           Punctuation
' '           Text
'acc'         Name
','           Punctuation
' '           Text
'0'           Literal.Number.Integer
','           Punctuation
' '           Text
'ACCEL_VISIBLE' Name
')'           Punctuation
'\n  '        Text
'ToolsMenu'   Name
'.'           Punctuation
'append'      Name
'('           Punctuation
'result'      Name
')'           Punctuation
'\n  '        Text
'show'        Name
'('           Punctuation
'result'      Name
')'           Punctuation
'\n  '        Text
'discard'     Keyword
' '           Text
'signal_connect' Name
'('           Punctuation
'result'      Name
','           Punctuation
' '           Text
'"'           Literal.String
'activate'    Literal.String
'"'           Literal.String
','           Punctuation
' '           Text
'SIGNAL_FUNC' Name
'('           Punctuation
'action'      Name
')'           Punctuation
','           Punctuation
' '           Text
'nil'         Keyword.Pseudo
')'           Punctuation
'\n\n'        Text

'proc '       Keyword
'createSeparator' Name.Function
'('           Punctuation
'menu'        Name
':'           Punctuation
' '           Text
'PMenu'       Name
')'           Punctuation
' '           Text
'='           Operator
'\n  '        Text
'var'         Keyword.Declaration
' '           Text
'sep'         Name
' '           Text
'='           Operator
' '           Text
'separator_menu_item_new' Name
'('           Punctuation
')'           Punctuation
'\n  '        Text
'menu'        Name
'.'           Punctuation
'append'      Name
'('           Punctuation
'sep'         Name
')'           Punctuation
'\n  '        Text
'sep'         Name
'.'           Punctuation
'show'        Name
'('           Punctuation
')'           Punctuation
'\n\n'        Text

'proc '       Keyword
'initTopMenu' Name.Function
'('           Punctuation
'MainBox'     Name
':'           Punctuation
' '           Text
'PBox'        Name
')'           Punctuation
' '           Text
'='           Operator
'\n  '        Text
'# Create a accelerator group, used for shortcuts' Comment
'\n  '        Text
'# like CTRL + S in SaveMenuItem' Comment
'\n  '        Text
'var'         Keyword.Declaration
' '           Text
'accGroup'    Name
' '           Text
'='           Operator
' '           Text
'accel_group_new' Name
'('           Punctuation
')'           Punctuation
'\n  '        Text
'add_accel_group' Name
'('           Punctuation
'win'         Name
'.'           Punctuation
'w'           Name
','           Punctuation
' '           Text
'accGroup'    Name
')'           Punctuation
'\n\n  '      Text
'# TopMenu(MenuBar)' Comment
'\n  '        Text
'var'         Keyword.Declaration
' '           Text
'TopMenu'     Name
' '           Text
'='           Operator
' '           Text
'menuBarNew'  Name
'('           Punctuation
')'           Punctuation
'\n  \n  '    Text
'# FileMenu'  Comment
'\n  '        Text
'var'         Keyword.Declaration
' '           Text
'FileMenu'    Name
' '           Text
'='           Operator
' '           Text
'menuNew'     Name
'('           Punctuation
')'           Punctuation
'\n\n  '      Text
'var'         Keyword.Declaration
' '           Text
'NewMenuItem' Name
' '           Text
'='           Operator
' '           Text
'menu_item_new' Name
'('           Punctuation
'"'           Literal.String
'New'         Literal.String
'"'           Literal.String
')'           Punctuation
' '           Text
'# New'       Comment
'\n  '        Text
'FileMenu'    Name
'.'           Punctuation
'append'      Name
'('           Punctuation
'NewMenuItem' Name
')'           Punctuation
'\n  '        Text
'show'        Name
'('           Punctuation
'NewMenuItem' Name
')'           Punctuation
'\n  '        Text
'discard'     Keyword
' '           Text
'signal_connect' Name
'('           Punctuation
'NewMenuItem' Name
','           Punctuation
' '           Text
'"'           Literal.String
'activate'    Literal.String
'"'           Literal.String
','           Punctuation
' \n                          ' Text
'SIGNAL_FUNC' Name
'('           Punctuation
'newFile'     Name
')'           Punctuation
','           Punctuation
' '           Text
'nil'         Keyword.Pseudo
')'           Punctuation
'\n\n  '      Text
'createSeparator' Name
'('           Punctuation
'FileMenu'    Name
')'           Punctuation
'\n\n  '      Text
'var'         Keyword.Declaration
' '           Text
'OpenMenuItem' Name
' '           Text
'='           Operator
' '           Text
'menu_item_new' Name
'('           Punctuation
'"'           Literal.String
'Open...'     Literal.String
'"'           Literal.String
')'           Punctuation
' '           Text
'# Open...'   Comment
'\n  '        Text
'# CTRL + O'  Comment
'\n  '        Text
'OpenMenuItem' Name
'.'           Punctuation
'add_accelerator' Name
'('           Punctuation
'"'           Literal.String
'activate'    Literal.String
'"'           Literal.String
','           Punctuation
' '           Text
'accGroup'    Name
','           Punctuation
' \n                  ' Text
'KEY_o'       Name
','           Punctuation
' '           Text
'CONTROL_MASK' Name
','           Punctuation
' '           Text
'ACCEL_VISIBLE' Name
')'           Punctuation
' \n  '       Text
'FileMenu'    Name
'.'           Punctuation
'append'      Name
'('           Punctuation
'OpenMenuItem' Name
')'           Punctuation
'\n  '        Text
'show'        Name
'('           Punctuation
'OpenMenuItem' Name
')'           Punctuation
'\n  '        Text
'discard'     Keyword
' '           Text
'signal_connect' Name
'('           Punctuation
'OpenMenuItem' Name
','           Punctuation
' '           Text
'"'           Literal.String
'activate'    Literal.String
'"'           Literal.String
','           Punctuation
' \n                          ' Text
'SIGNAL_FUNC' Name
'('           Punctuation
'aporia'      Name
'.'           Punctuation
'openFile'    Name
')'           Punctuation
','           Punctuation
' '           Text
'nil'         Keyword.Pseudo
')'           Punctuation
'\n  \n  '    Text
'var'         Keyword.Declaration
' '           Text
'SaveMenuItem' Name
' '           Text
'='           Operator
' '           Text
'menu_item_new' Name
'('           Punctuation
'"'           Literal.String
'Save'        Literal.String
'"'           Literal.String
')'           Punctuation
' '           Text
'# Save'      Comment
'\n  '        Text
'# CTRL + S'  Comment
'\n  '        Text
'SaveMenuItem' Name
'.'           Punctuation
'add_accelerator' Name
'('           Punctuation
'"'           Literal.String
'activate'    Literal.String
'"'           Literal.String
','           Punctuation
' '           Text
'accGroup'    Name
','           Punctuation
' \n                  ' Text
'KEY_s'       Name
','           Punctuation
' '           Text
'CONTROL_MASK' Name
','           Punctuation
' '           Text
'ACCEL_VISIBLE' Name
')'           Punctuation
' \n  '       Text
'FileMenu'    Name
'.'           Punctuation
'append'      Name
'('           Punctuation
'SaveMenuItem' Name
')'           Punctuation
'\n  '        Text
'show'        Name
'('           Punctuation
'SaveMenuItem' Name
')'           Punctuation
'\n  '        Text
'discard'     Keyword
' '           Text
'signal_connect' Name
'('           Punctuation
'SaveMenuItem' Name
','           Punctuation
' '           Text
'"'           Literal.String
'activate'    Literal.String
'"'           Literal.String
','           Punctuation
' \n                          ' Text
'SIGNAL_FUNC' Name
'('           Punctuation
'saveFile_activate' Name
')'           Punctuation
','           Punctuation
' '           Text
'nil'         Keyword.Pseudo
')'           Punctuation
'\n\n  '      Text
'var'         Keyword.Declaration
' '           Text
'SaveAsMenuItem' Name
' '           Text
'='           Operator
' '           Text
'menu_item_new' Name
'('           Punctuation
'"'           Literal.String
'Save As...'  Literal.String
'"'           Literal.String
')'           Punctuation
' '           Text
'# Save as...' Comment
'\n\n  '      Text
'SaveAsMenuItem' Name
'.'           Punctuation
'add_accelerator' Name
'('           Punctuation
'"'           Literal.String
'activate'    Literal.String
'"'           Literal.String
','           Punctuation
' '           Text
'accGroup'    Name
','           Punctuation
' \n                  ' Text
'KEY_s'       Name
','           Punctuation
' '           Text
'CONTROL_MASK' Name
' '           Text
'or'          Operator.Word
' '           Text
'gdk2'        Name
'.'           Punctuation
'SHIFT_MASK'  Name
','           Punctuation
' '           Text
'ACCEL_VISIBLE' Name
')'           Punctuation
' \n  '       Text
'FileMenu'    Name
'.'           Punctuation
'append'      Name
'('           Punctuation
'SaveAsMenuItem' Name
')'           Punctuation
'\n  '        Text
'show'        Name
'('           Punctuation
'SaveAsMenuItem' Name
')'           Punctuation
'\n  '        Text
'discard'     Keyword
' '           Text
'signal_connect' Name
'('           Punctuation
'SaveAsMenuItem' Name
','           Punctuation
' '           Text
'"'           Literal.String
'activate'    Literal.String
'"'           Literal.String
','           Punctuation
' \n                          ' Text
'SIGNAL_FUNC' Name
'('           Punctuation
'saveFileAs_Activate' Name
')'           Punctuation
','           Punctuation
' '           Text
'nil'         Keyword.Pseudo
')'           Punctuation
'\n  \n  '    Text
'var'         Keyword.Declaration
' '           Text
'FileMenuItem' Name
' '           Text
'='           Operator
' '           Text
'menuItemNewWithMnemonic' Name
'('           Punctuation
'"'           Literal.String
'_File'       Literal.String
'"'           Literal.String
')'           Punctuation
'\n\n  '      Text
'FileMenuItem' Name
'.'           Punctuation
'setSubMenu'  Name
'('           Punctuation
'FileMenu'    Name
')'           Punctuation
'\n  '        Text
'FileMenuItem' Name
'.'           Punctuation
'show'        Name
'('           Punctuation
')'           Punctuation
'\n  '        Text
'TopMenu'     Name
'.'           Punctuation
'append'      Name
'('           Punctuation
'FileMenuItem' Name
')'           Punctuation
'\n  \n  '    Text
'# Edit menu' Comment
'\n  '        Text
'var'         Keyword.Declaration
' '           Text
'EditMenu'    Name
' '           Text
'='           Operator
' '           Text
'menuNew'     Name
'('           Punctuation
')'           Punctuation
'\n\n  '      Text
'var'         Keyword.Declaration
' '           Text
'UndoMenuItem' Name
' '           Text
'='           Operator
' '           Text
'menu_item_new' Name
'('           Punctuation
'"'           Literal.String
'Undo'        Literal.String
'"'           Literal.String
')'           Punctuation
' '           Text
'# Undo'      Comment
'\n  '        Text
'EditMenu'    Name
'.'           Punctuation
'append'      Name
'('           Punctuation
'UndoMenuItem' Name
')'           Punctuation
'\n  '        Text
'show'        Name
'('           Punctuation
'UndoMenuItem' Name
')'           Punctuation
'\n  '        Text
'discard'     Keyword
' '           Text
'signal_connect' Name
'('           Punctuation
'UndoMenuItem' Name
','           Punctuation
' '           Text
'"'           Literal.String
'activate'    Literal.String
'"'           Literal.String
','           Punctuation
' \n                          ' Text
'SIGNAL_FUNC' Name
'('           Punctuation
'aporia'      Name
'.'           Punctuation
'undo'        Name
')'           Punctuation
','           Punctuation
' '           Text
'nil'         Keyword.Pseudo
')'           Punctuation
'\n  \n  '    Text
'var'         Keyword.Declaration
' '           Text
'RedoMenuItem' Name
' '           Text
'='           Operator
' '           Text
'menu_item_new' Name
'('           Punctuation
'"'           Literal.String
'Redo'        Literal.String
'"'           Literal.String
')'           Punctuation
' '           Text
'# Undo'      Comment
'\n  '        Text
'EditMenu'    Name
'.'           Punctuation
'append'      Name
'('           Punctuation
'RedoMenuItem' Name
')'           Punctuation
'\n  '        Text
'show'        Name
'('           Punctuation
'RedoMenuItem' Name
')'           Punctuation
'\n  '        Text
'discard'     Keyword
' '           Text
'signal_connect' Name
'('           Punctuation
'RedoMenuItem' Name
','           Punctuation
' '           Text
'"'           Literal.String
'activate'    Literal.String
'"'           Literal.String
','           Punctuation
' \n                          ' Text
'SIGNAL_FUNC' Name
'('           Punctuation
'aporia'      Name
'.'           Punctuation
'redo'        Name
')'           Punctuation
','           Punctuation
' '           Text
'nil'         Keyword.Pseudo
')'           Punctuation
'\n\n  '      Text
'createSeparator' Name
'('           Punctuation
'EditMenu'    Name
')'           Punctuation
'\n  \n  '    Text
'var'         Keyword.Declaration
' '           Text
'FindMenuItem' Name
' '           Text
'='           Operator
' '           Text
'menu_item_new' Name
'('           Punctuation
'"'           Literal.String
'Find'        Literal.String
'"'           Literal.String
')'           Punctuation
' '           Text
'# Find'      Comment
'\n  '        Text
'FindMenuItem' Name
'.'           Punctuation
'add_accelerator' Name
'('           Punctuation
'"'           Literal.String
'activate'    Literal.String
'"'           Literal.String
','           Punctuation
' '           Text
'accGroup'    Name
','           Punctuation
' \n                  ' Text
'KEY_f'       Name
','           Punctuation
' '           Text
'CONTROL_MASK' Name
','           Punctuation
' '           Text
'ACCEL_VISIBLE' Name
')'           Punctuation
' \n  '       Text
'EditMenu'    Name
'.'           Punctuation
'append'      Name
'('           Punctuation
'FindMenuItem' Name
')'           Punctuation
'\n  '        Text
'show'        Name
'('           Punctuation
'FindMenuItem' Name
')'           Punctuation
'\n  '        Text
'discard'     Keyword
' '           Text
'signal_connect' Name
'('           Punctuation
'FindMenuItem' Name
','           Punctuation
' '           Text
'"'           Literal.String
'activate'    Literal.String
'"'           Literal.String
','           Punctuation
' \n                          ' Text
'SIGNAL_FUNC' Name
'('           Punctuation
'aporia'      Name
'.'           Punctuation
'find_Activate' Name
')'           Punctuation
','           Punctuation
' '           Text
'nil'         Keyword.Pseudo
')'           Punctuation
'\n\n  '      Text
'var'         Keyword.Declaration
' '           Text
'ReplaceMenuItem' Name
' '           Text
'='           Operator
' '           Text
'menu_item_new' Name
'('           Punctuation
'"'           Literal.String
'Replace'     Literal.String
'"'           Literal.String
')'           Punctuation
' '           Text
'# Replace'   Comment
'\n  '        Text
'ReplaceMenuItem' Name
'.'           Punctuation
'add_accelerator' Name
'('           Punctuation
'"'           Literal.String
'activate'    Literal.String
'"'           Literal.String
','           Punctuation
' '           Text
'accGroup'    Name
','           Punctuation
' \n                  ' Text
'KEY_h'       Name
','           Punctuation
' '           Text
'CONTROL_MASK' Name
','           Punctuation
' '           Text
'ACCEL_VISIBLE' Name
')'           Punctuation
' \n  '       Text
'EditMenu'    Name
'.'           Punctuation
'append'      Name
'('           Punctuation
'ReplaceMenuItem' Name
')'           Punctuation
'\n  '        Text
'show'        Name
'('           Punctuation
'ReplaceMenuItem' Name
')'           Punctuation
'\n  '        Text
'discard'     Keyword
' '           Text
'signal_connect' Name
'('           Punctuation
'ReplaceMenuItem' Name
','           Punctuation
' '           Text
'"'           Literal.String
'activate'    Literal.String
'"'           Literal.String
','           Punctuation
' \n                          ' Text
'SIGNAL_FUNC' Name
'('           Punctuation
'aporia'      Name
'.'           Punctuation
'replace_Activate' Name
')'           Punctuation
','           Punctuation
' '           Text
'nil'         Keyword.Pseudo
')'           Punctuation
'\n\n  '      Text
'createSeparator' Name
'('           Punctuation
'EditMenu'    Name
')'           Punctuation
'\n  \n  '    Text
'var'         Keyword.Declaration
' '           Text
'SettingsMenuItem' Name
' '           Text
'='           Operator
' '           Text
'menu_item_new' Name
'('           Punctuation
'"'           Literal.String
'Settings...' Literal.String
'"'           Literal.String
')'           Punctuation
' '           Text
'# Settings'  Comment
'\n  '        Text
'EditMenu'    Name
'.'           Punctuation
'append'      Name
'('           Punctuation
'SettingsMenuItem' Name
')'           Punctuation
'\n  '        Text
'show'        Name
'('           Punctuation
'SettingsMenuItem' Name
')'           Punctuation
'\n  '        Text
'discard'     Keyword
' '           Text
'signal_connect' Name
'('           Punctuation
'SettingsMenuItem' Name
','           Punctuation
' '           Text
'"'           Literal.String
'activate'    Literal.String
'"'           Literal.String
','           Punctuation
' \n                          ' Text
'SIGNAL_FUNC' Name
'('           Punctuation
'aporia'      Name
'.'           Punctuation
'Settings_Activate' Name
')'           Punctuation
','           Punctuation
' '           Text
'nil'         Keyword.Pseudo
')'           Punctuation
'\n\n  '      Text
'var'         Keyword.Declaration
' '           Text
'EditMenuItem' Name
' '           Text
'='           Operator
' '           Text
'menuItemNewWithMnemonic' Name
'('           Punctuation
'"'           Literal.String
'_Edit'       Literal.String
'"'           Literal.String
')'           Punctuation
'\n\n  '      Text
'EditMenuItem' Name
'.'           Punctuation
'setSubMenu'  Name
'('           Punctuation
'EditMenu'    Name
')'           Punctuation
'\n  '        Text
'EditMenuItem' Name
'.'           Punctuation
'show'        Name
'('           Punctuation
')'           Punctuation
'\n  '        Text
'TopMenu'     Name
'.'           Punctuation
'append'      Name
'('           Punctuation
'EditMenuItem' Name
')'           Punctuation
'\n  \n  '    Text
'# View menu' Comment
'\n  '        Text
'var'         Keyword.Declaration
' '           Text
'ViewMenu'    Name
' '           Text
'='           Operator
' '           Text
'menuNew'     Name
'('           Punctuation
')'           Punctuation
'\n  \n  '    Text
'win'         Name
'.'           Punctuation
'viewBottomPanelMenuItem' Name
' '           Text
'='           Operator
' '           Text
'check_menu_item_new' Name
'('           Punctuation
'"'           Literal.String
'Bottom Panel' Literal.String
'"'           Literal.String
')'           Punctuation
'\n  '        Text
'PCheckMenuItem' Name
'('           Punctuation
'win'         Name
'.'           Punctuation
'viewBottomPanelMenuItem' Name
')'           Punctuation
'.'           Punctuation
'itemSetActive' Name
'('           Punctuation
'\n         ' Text
'win'         Name
'.'           Punctuation
'settings'    Name
'.'           Punctuation
'bottomPanelVisible' Name
')'           Punctuation
'\n  '        Text
'win'         Name
'.'           Punctuation
'viewBottomPanelMenuItem' Name
'.'           Punctuation
'add_accelerator' Name
'('           Punctuation
'"'           Literal.String
'activate'    Literal.String
'"'           Literal.String
','           Punctuation
' '           Text
'accGroup'    Name
','           Punctuation
' \n                  ' Text
'KEY_f9'      Name
','           Punctuation
' '           Text
'CONTROL_MASK' Name
','           Punctuation
' '           Text
'ACCEL_VISIBLE' Name
')'           Punctuation
' \n  '       Text
'ViewMenu'    Name
'.'           Punctuation
'append'      Name
'('           Punctuation
'win'         Name
'.'           Punctuation
'viewBottomPanelMenuItem' Name
')'           Punctuation
'\n  '        Text
'show'        Name
'('           Punctuation
'win'         Name
'.'           Punctuation
'viewBottomPanelMenuItem' Name
')'           Punctuation
'\n  '        Text
'discard'     Keyword
' '           Text
'signal_connect' Name
'('           Punctuation
'win'         Name
'.'           Punctuation
'viewBottomPanelMenuItem' Name
','           Punctuation
' '           Text
'"'           Literal.String
'toggled'     Literal.String
'"'           Literal.String
','           Punctuation
' \n                          ' Text
'SIGNAL_FUNC' Name
'('           Punctuation
'aporia'      Name
'.'           Punctuation
'viewBottomPanel_Toggled' Name
')'           Punctuation
','           Punctuation
' '           Text
'nil'         Keyword.Pseudo
')'           Punctuation
'\n  \n  '    Text
'var'         Keyword.Declaration
' '           Text
'ViewMenuItem' Name
' '           Text
'='           Operator
' '           Text
'menuItemNewWithMnemonic' Name
'('           Punctuation
'"'           Literal.String
'_View'       Literal.String
'"'           Literal.String
')'           Punctuation
'\n\n  '      Text
'ViewMenuItem' Name
'.'           Punctuation
'setSubMenu'  Name
'('           Punctuation
'ViewMenu'    Name
')'           Punctuation
'\n  '        Text
'ViewMenuItem' Name
'.'           Punctuation
'show'        Name
'('           Punctuation
')'           Punctuation
'\n  '        Text
'TopMenu'     Name
'.'           Punctuation
'append'      Name
'('           Punctuation
'ViewMenuItem' Name
')'           Punctuation
'       \n  \n  \n  ' Text
'# Tools menu' Comment
'\n  '        Text
'var'         Keyword.Declaration
' '           Text
'ToolsMenu'   Name
' '           Text
'='           Operator
' '           Text
'menuNew'     Name
'('           Punctuation
')'           Punctuation
'\n\n  '      Text
'createAccelMenuItem' Name
'('           Punctuation
'ToolsMenu'   Name
','           Punctuation
' '           Text
'accGroup'    Name
','           Punctuation
' '           Text
'"'           Literal.String
'Compile current file' Literal.String
'"'           Literal.String
','           Punctuation
' \n                      ' Text
'KEY_F4'      Name
','           Punctuation
' '           Text
'aporia'      Name
'.'           Punctuation
'CompileCurrent_Activate' Name
')'           Punctuation
'\n  '        Text
'createAccelMenuItem' Name
'('           Punctuation
'ToolsMenu'   Name
','           Punctuation
' '           Text
'accGroup'    Name
','           Punctuation
' '           Text
'"'           Literal.String
'Compile & run current file' Literal.String
'"'           Literal.String
','           Punctuation
' \n                      ' Text
'KEY_F5'      Name
','           Punctuation
' '           Text
'aporia'      Name
'.'           Punctuation
'CompileRunCurrent_Activate' Name
')'           Punctuation
'\n  '        Text
'createSeparator' Name
'('           Punctuation
'ToolsMenu'   Name
')'           Punctuation
'\n  '        Text
'createAccelMenuItem' Name
'('           Punctuation
'ToolsMenu'   Name
','           Punctuation
' '           Text
'accGroup'    Name
','           Punctuation
' '           Text
'"'           Literal.String
'Compile project' Literal.String
'"'           Literal.String
','           Punctuation
' \n                      ' Text
'KEY_F8'      Name
','           Punctuation
' '           Text
'aporia'      Name
'.'           Punctuation
'CompileProject_Activate' Name
')'           Punctuation
'\n  '        Text
'createAccelMenuItem' Name
'('           Punctuation
'ToolsMenu'   Name
','           Punctuation
' '           Text
'accGroup'    Name
','           Punctuation
' '           Text
'"'           Literal.String
'Compile & run project' Literal.String
'"'           Literal.String
','           Punctuation
' \n                      ' Text
'KEY_F9'      Name
','           Punctuation
' '           Text
'aporia'      Name
'.'           Punctuation
'CompileRunProject_Activate' Name
')'           Punctuation
'\n  '        Text
'createSeparator' Name
'('           Punctuation
'ToolsMenu'   Name
')'           Punctuation
'\n  '        Text
'createAccelMenuItem' Name
'('           Punctuation
'ToolsMenu'   Name
','           Punctuation
' '           Text
'accGroup'    Name
','           Punctuation
' '           Text
'"'           Literal.String
'Run custom command 1' Literal.String
'"'           Literal.String
','           Punctuation
' \n                      ' Text
'KEY_F1'      Name
','           Punctuation
' '           Text
'aporia'      Name
'.'           Punctuation
'RunCustomCommand1' Name
')'           Punctuation
'\n  '        Text
'createAccelMenuItem' Name
'('           Punctuation
'ToolsMenu'   Name
','           Punctuation
' '           Text
'accGroup'    Name
','           Punctuation
' '           Text
'"'           Literal.String
'Run custom command 2' Literal.String
'"'           Literal.String
','           Punctuation
' \n                      ' Text
'KEY_F2'      Name
','           Punctuation
' '           Text
'aporia'      Name
'.'           Punctuation
'RunCustomCommand2' Name
')'           Punctuation
'\n  '        Text
'createAccelMenuItem' Name
'('           Punctuation
'ToolsMenu'   Name
','           Punctuation
' '           Text
'accGroup'    Name
','           Punctuation
' '           Text
'"'           Literal.String
'Run custom command 3' Literal.String
'"'           Literal.String
','           Punctuation
' \n                      ' Text
'KEY_F3'      Name
','           Punctuation
' '           Text
'aporia'      Name
'.'           Punctuation
'RunCustomCommand3' Name
')'           Punctuation
'\n  \n  '    Text
'var'         Keyword.Declaration
' '           Text
'ToolsMenuItem' Name
' '           Text
'='           Operator
' '           Text
'menuItemNewWithMnemonic' Name
'('           Punctuation
'"'           Literal.String
'_Tools'      Literal.String
'"'           Literal.String
')'           Punctuation
'\n  \n  '    Text
'ToolsMenuItem' Name
'.'           Punctuation
'setSubMenu'  Name
'('           Punctuation
'ToolsMenu'   Name
')'           Punctuation
'\n  '        Text
'ToolsMenuItem' Name
'.'           Punctuation
'show'        Name
'('           Punctuation
')'           Punctuation
'\n  '        Text
'TopMenu'     Name
'.'           Punctuation
'append'      Name
'('           Punctuation
'ToolsMenuItem' Name
')'           Punctuation
'\n  \n  '    Text
'# Help menu' Comment
'\n  '        Text
'MainBox'     Name
'.'           Punctuation
'packStart'   Name
'('           Punctuation
'TopMenu'     Name
','           Punctuation
' '           Text
'False'       Keyword.Pseudo
','           Punctuation
' '           Text
'False'       Keyword.Pseudo
','           Punctuation
' '           Text
'0'           Literal.Number.Integer
')'           Punctuation
'\n  '        Text
'TopMenu'     Name
'.'           Punctuation
'show'        Name
'('           Punctuation
')'           Punctuation
'\n\n'        Text

'proc '       Keyword
'initToolBar' Name.Function
'('           Punctuation
'MainBox'     Name
':'           Punctuation
' '           Text
'PBox'        Name
')'           Punctuation
' '           Text
'='           Operator
'\n  '        Text
'# TopBar(ToolBar)' Comment
'\n  '        Text
'var'         Keyword.Declaration
' '           Text
'TopBar'      Name
' '           Text
'='           Operator
' '           Text
'toolbarNew'  Name
'('           Punctuation
')'           Punctuation
'\n  '        Text
'TopBar'      Name
'.'           Punctuation
'setStyle'    Name
'('           Punctuation
'TOOLBAR_ICONS' Name
')'           Punctuation
'\n  \n  '    Text
'var'         Keyword.Declaration
' '           Text
'NewFileItem' Name
' '           Text
'='           Operator
' '           Text
'TopBar'      Name
'.'           Punctuation
'insertStock' Name
'('           Punctuation
'STOCK_NEW'   Name
','           Punctuation
' '           Text
'"'           Literal.String
'New File'    Literal.String
'"'           Literal.String
','           Punctuation
'\n                      ' Text
'"'           Literal.String
'New File'    Literal.String
'"'           Literal.String
','           Punctuation
' '           Text
'SIGNAL_FUNC' Name
'('           Punctuation
'aporia'      Name
'.'           Punctuation
'newFile'     Name
')'           Punctuation
','           Punctuation
' '           Text
'nil'         Keyword.Pseudo
','           Punctuation
' '           Text
'0'           Literal.Number.Integer
')'           Punctuation
'\n  '        Text
'TopBar'      Name
'.'           Punctuation
'appendSpace' Name
'('           Punctuation
')'           Punctuation
'\n  '        Text
'var'         Keyword.Declaration
' '           Text
'OpenItem'    Name
' '           Text
'='           Operator
' '           Text
'TopBar'      Name
'.'           Punctuation
'insertStock' Name
'('           Punctuation
'STOCK_OPEN'  Name
','           Punctuation
' '           Text
'"'           Literal.String
'Open'        Literal.String
'"'           Literal.String
','           Punctuation
'\n                      ' Text
'"'           Literal.String
'Open'        Literal.String
'"'           Literal.String
','           Punctuation
' '           Text
'SIGNAL_FUNC' Name
'('           Punctuation
'aporia'      Name
'.'           Punctuation
'openFile'    Name
')'           Punctuation
','           Punctuation
' '           Text
'nil'         Keyword.Pseudo
','           Punctuation
' '           Text
'-'           Operator
'1'           Literal.Number.Integer
')'           Punctuation
'\n  '        Text
'var'         Keyword.Declaration
' '           Text
'SaveItem'    Name
' '           Text
'='           Operator
' '           Text
'TopBar'      Name
'.'           Punctuation
'insertStock' Name
'('           Punctuation
'STOCK_SAVE'  Name
','           Punctuation
' '           Text
'"'           Literal.String
'Save'        Literal.String
'"'           Literal.String
','           Punctuation
'\n                      ' Text
'"'           Literal.String
'Save'        Literal.String
'"'           Literal.String
','           Punctuation
' '           Text
'SIGNAL_FUNC' Name
'('           Punctuation
'saveFile_Activate' Name
')'           Punctuation
','           Punctuation
' '           Text
'nil'         Keyword.Pseudo
','           Punctuation
' '           Text
'-'           Operator
'1'           Literal.Number.Integer
')'           Punctuation
'\n  '        Text
'TopBar'      Name
'.'           Punctuation
'appendSpace' Name
'('           Punctuation
')'           Punctuation
'\n  '        Text
'var'         Keyword.Declaration
' '           Text
'UndoItem'    Name
' '           Text
'='           Operator
' '           Text
'TopBar'      Name
'.'           Punctuation
'insertStock' Name
'('           Punctuation
'STOCK_UNDO'  Name
','           Punctuation
' '           Text
'"'           Literal.String
'Undo'        Literal.String
'"'           Literal.String
','           Punctuation
' \n                      ' Text
'"'           Literal.String
'Undo'        Literal.String
'"'           Literal.String
','           Punctuation
' '           Text
'SIGNAL_FUNC' Name
'('           Punctuation
'aporia'      Name
'.'           Punctuation
'undo'        Name
')'           Punctuation
','           Punctuation
' '           Text
'nil'         Keyword.Pseudo
','           Punctuation
' '           Text
'-'           Operator
'1'           Literal.Number.Integer
')'           Punctuation
'\n  '        Text
'var'         Keyword.Declaration
' '           Text
'RedoItem'    Name
' '           Text
'='           Operator
' '           Text
'TopBar'      Name
'.'           Punctuation
'insertStock' Name
'('           Punctuation
'STOCK_REDO'  Name
','           Punctuation
' '           Text
'"'           Literal.String
'Redo'        Literal.String
'"'           Literal.String
','           Punctuation
'\n                      ' Text
'"'           Literal.String
'Redo'        Literal.String
'"'           Literal.String
','           Punctuation
' '           Text
'SIGNAL_FUNC' Name
'('           Punctuation
'aporia'      Name
'.'           Punctuation
'redo'        Name
')'           Punctuation
','           Punctuation
' '           Text
'nil'         Keyword.Pseudo
','           Punctuation
' '           Text
'-'           Operator
'1'           Literal.Number.Integer
')'           Punctuation
'\n  \n  '    Text
'MainBox'     Name
'.'           Punctuation
'packStart'   Name
'('           Punctuation
'TopBar'      Name
','           Punctuation
' '           Text
'False'       Keyword.Pseudo
','           Punctuation
' '           Text
'False'       Keyword.Pseudo
','           Punctuation
' '           Text
'0'           Literal.Number.Integer
')'           Punctuation
'\n  '        Text
'TopBar'      Name
'.'           Punctuation
'show'        Name
'('           Punctuation
')'           Punctuation
'\n  \n'      Text

'proc '       Keyword
'initSourceViewTabs' Name.Function
'('           Punctuation
')'           Punctuation
' '           Text
'='           Operator
'\n  '        Text
'win'         Name
'.'           Punctuation
'SourceViewTabs' Name
' '           Text
'='           Operator
' '           Text
'notebookNew' Name
'('           Punctuation
')'           Punctuation
'\n  '        Text
'#win.sourceViewTabs.dragDestSet(DEST_DEFAULT_DROP, nil, 0, ACTION_MOVE)' Comment
'\n  '        Text
'discard'     Keyword
' '           Text
'win'         Name
'.'           Punctuation
'SourceViewTabs' Name
'.'           Punctuation
'signalConnect' Name
'('           Punctuation
'\n          ' Text
'"'           Literal.String
'switch-page' Literal.String
'"'           Literal.String
','           Punctuation
' '           Text
'SIGNAL_FUNC' Name
'('           Punctuation
'onSwitchTab' Name
')'           Punctuation
','           Punctuation
' '           Text
'nil'         Keyword.Pseudo
')'           Punctuation
'\n  '        Text
'#discard win.SourceViewTabs.signalConnect(' Comment
'\n  '        Text
'#        "drag-drop", SIGNAL_FUNC(svTabs_DragDrop), nil)' Comment
'\n  '        Text
'#discard win.SourceViewTabs.signalConnect(' Comment
'\n  '        Text
'#        "drag-data-received", SIGNAL_FUNC(svTabs_DragDataRecv), nil)' Comment
'\n  '        Text
'#discard win.SourceViewTabs.signalConnect(' Comment
'\n  '        Text
'#        "drag-motion", SIGNAL_FUNC(svTabs_DragMotion), nil)' Comment
'\n  '        Text
'win'         Name
'.'           Punctuation
'SourceViewTabs' Name
'.'           Punctuation
'set_scrollable' Name
'('           Punctuation
'True'        Keyword.Pseudo
')'           Punctuation
'\n  \n  '    Text
'win'         Name
'.'           Punctuation
'SourceViewTabs' Name
'.'           Punctuation
'show'        Name
'('           Punctuation
')'           Punctuation
'\n  '        Text
'if'          Keyword
' '           Text
'lastSession' Name
'.'           Punctuation
'len'         Name
' '           Text
'!'           Operator
'='           Operator
' '           Text
'0'           Literal.Number.Integer
':'           Punctuation
'\n    '      Text
'for'         Keyword
' '           Text
'i'           Name
' '           Text
'in'          Operator.Word
' '           Text
'0'           Literal.Number.Integer
' '           Text
'..'          Punctuation
' '           Text
'len'         Name
'('           Punctuation
'lastSession' Name
')'           Punctuation
'-'           Operator
'1'           Literal.Number.Integer
':'           Punctuation
'\n      '    Text
'var'         Keyword.Declaration
' '           Text
'splitUp'     Name
' '           Text
'='           Operator
' '           Text
'lastSession' Name
'['           Operator
'i'           Name
']'           Operator
'.'           Punctuation
'split'       Name
'('           Punctuation
"'"           Literal.String.Char
'|'           Literal.String.Char
"'"           Literal.String.Char
')'           Punctuation
'\n      '    Text
'var'         Keyword.Declaration
' '           Text
'('           Punctuation
'filename'    Name
','           Punctuation
' '           Text
'offset'      Name
')'           Punctuation
' '           Text
'='           Operator
' '           Text
'('           Punctuation
'splitUp'     Name
'['           Operator
'0'           Literal.Number.Integer
']'           Operator
','           Punctuation
' '           Text
'splitUp'     Name
'['           Operator
'1'           Literal.Number.Integer
']'           Operator
')'           Punctuation
'\n      '    Text
'addTab'      Name
'('           Punctuation
'"'           Literal.String
'"'           Literal.String
','           Punctuation
' '           Text
'filename'    Name
')'           Punctuation
'\n      \n      ' Text
'var'         Keyword.Declaration
' '           Text
'iter'        Name
':'           Punctuation
' '           Text
'TTextIter'   Name
'\n      '    Text
'win'         Name
'.'           Punctuation
'Tabs'        Name
'['           Operator
'i'           Name
']'           Operator
'.'           Punctuation
'buffer'      Name
'.'           Punctuation
'getIterAtOffset' Name
'('           Punctuation
'addr'        Keyword
'('           Punctuation
'iter'        Name
')'           Punctuation
','           Punctuation
' '           Text
'offset'      Name
'.'           Punctuation
'parseInt'    Name
'('           Punctuation
')'           Punctuation
')'           Punctuation
'\n      '    Text
'win'         Name
'.'           Punctuation
'Tabs'        Name
'['           Operator
'i'           Name
']'           Operator
'.'           Punctuation
'buffer'      Name
'.'           Punctuation
'moveMarkByName' Name
'('           Punctuation
'"'           Literal.String
'insert'      Literal.String
'"'           Literal.String
','           Punctuation
' '           Text
'addr'        Keyword
'('           Punctuation
'iter'        Name
')'           Punctuation
')'           Punctuation
'\n      '    Text
'win'         Name
'.'           Punctuation
'Tabs'        Name
'['           Operator
'i'           Name
']'           Operator
'.'           Punctuation
'buffer'      Name
'.'           Punctuation
'moveMarkByName' Name
'('           Punctuation
'"'           Literal.String
'selection_bound' Literal.String
'"'           Literal.String
','           Punctuation
' '           Text
'addr'        Keyword
'('           Punctuation
'iter'        Name
')'           Punctuation
')'           Punctuation
'\n      \n      ' Text
'# TODO: Fix this..... :(' Comment
'\n      '    Text
'discard'     Keyword
' '           Text
'PTextView'   Name
'('           Punctuation
'win'         Name
'.'           Punctuation
'Tabs'        Name
'['           Operator
'i'           Name
']'           Operator
'.'           Punctuation
'sourceView'  Name
')'           Punctuation
'.'           Punctuation
'\n          ' Text
'scrollToIter' Name
'('           Punctuation
'addr'        Keyword
'('           Punctuation
'iter'        Name
')'           Punctuation
','           Punctuation
' '           Text
'0'           Literal.Number.Float
'.25'         Literal.Number.Float
','           Punctuation
' '           Text
'true'        Keyword.Pseudo
','           Punctuation
' '           Text
'0'           Literal.Number.Float
'.0'          Literal.Number.Float
','           Punctuation
' '           Text
'0'           Literal.Number.Float
'.0'          Literal.Number.Float
')'           Punctuation
'\n  '        Text
'else'        Keyword
':'           Punctuation
'\n    '      Text
'addTab'      Name
'('           Punctuation
'"'           Literal.String
'"'           Literal.String
','           Punctuation
' '           Text
'"'           Literal.String
'"'           Literal.String
')'           Punctuation
'\n  \n  '    Text
"# This doesn't work :\\" Comment
'\n  '        Text
'win'         Name
'.'           Punctuation
'Tabs'        Name
'['           Operator
'0'           Literal.Number.Integer
']'           Operator
'.'           Punctuation
'sourceView'  Name
'.'           Punctuation
'grabFocus'   Name
'('           Punctuation
')'           Punctuation
'\n\n  \n'    Text

'proc '       Keyword
'initBottomTabs' Name.Function
'('           Punctuation
')'           Punctuation
' '           Text
'='           Operator
'\n  '        Text
'win'         Name
'.'           Punctuation
'bottomPanelTabs' Name
' '           Text
'='           Operator
' '           Text
'notebookNew' Name
'('           Punctuation
')'           Punctuation
'\n  '        Text
'if'          Keyword
' '           Text
'win'         Name
'.'           Punctuation
'settings'    Name
'.'           Punctuation
'bottomPanelVisible' Name
':'           Punctuation
'\n    '      Text
'win'         Name
'.'           Punctuation
'bottomPanelTabs' Name
'.'           Punctuation
'show'        Name
'('           Punctuation
')'           Punctuation
'\n  \n  '    Text
'# output tab' Comment
'\n  '        Text
'var'         Keyword.Declaration
' '           Text
'tabLabel'    Name
' '           Text
'='           Operator
' '           Text
'labelNew'    Name
'('           Punctuation
'"'           Literal.String
'Output'      Literal.String
'"'           Literal.String
')'           Punctuation
'\n  '        Text
'var'         Keyword.Declaration
' '           Text
'outputTab'   Name
' '           Text
'='           Operator
' '           Text
'vboxNew'     Name
'('           Punctuation
'False'       Keyword.Pseudo
','           Punctuation
' '           Text
'0'           Literal.Number.Integer
')'           Punctuation
'\n  '        Text
'discard'     Keyword
' '           Text
'win'         Name
'.'           Punctuation
'bottomPanelTabs' Name
'.'           Punctuation
'appendPage'  Name
'('           Punctuation
'outputTab'   Name
','           Punctuation
' '           Text
'tabLabel'    Name
')'           Punctuation
'\n  '        Text
'# Compiler tabs, gtktextview' Comment
'\n  '        Text
'var'         Keyword.Declaration
' '           Text
'outputScrolledWindow' Name
' '           Text
'='           Operator
' '           Text
'scrolledwindowNew' Name
'('           Punctuation
'nil'         Keyword.Pseudo
','           Punctuation
' '           Text
'nil'         Keyword.Pseudo
')'           Punctuation
'\n  '        Text
'outputScrolledWindow' Name
'.'           Punctuation
'setPolicy'   Name
'('           Punctuation
'POLICY_AUTOMATIC' Name
','           Punctuation
' '           Text
'POLICY_AUTOMATIC' Name
')'           Punctuation
'\n  '        Text
'outputTab'   Name
'.'           Punctuation
'packStart'   Name
'('           Punctuation
'outputScrolledWindow' Name
','           Punctuation
' '           Text
'true'        Keyword.Pseudo
','           Punctuation
' '           Text
'true'        Keyword.Pseudo
','           Punctuation
' '           Text
'0'           Literal.Number.Integer
')'           Punctuation
'\n  '        Text
'outputScrolledWindow' Name
'.'           Punctuation
'show'        Name
'('           Punctuation
')'           Punctuation
'\n  \n  '    Text
'win'         Name
'.'           Punctuation
'outputTextView' Name
' '           Text
'='           Operator
' '           Text
'textviewNew' Name
'('           Punctuation
')'           Punctuation
'\n  '        Text
'outputScrolledWindow' Name
'.'           Punctuation
'add'         Name
'('           Punctuation
'win'         Name
'.'           Punctuation
'outputTextView' Name
')'           Punctuation
'\n  '        Text
'win'         Name
'.'           Punctuation
'outputTextView' Name
'.'           Punctuation
'show'        Name
'('           Punctuation
')'           Punctuation
'\n  \n  '    Text
'outputTab'   Name
'.'           Punctuation
'show'        Name
'('           Punctuation
')'           Punctuation
'\n\n'        Text

'proc '       Keyword
'initTAndBP'  Name.Function
'('           Punctuation
'MainBox'     Name
':'           Punctuation
' '           Text
'PBox'        Name
')'           Punctuation
' '           Text
'='           Operator
'\n  '        Text
"# This init's the HPaned, which splits the sourceViewTabs" Comment
'\n  '        Text
'# and the BottomPanelTabs' Comment
'\n  '        Text
'initSourceViewTabs' Name
'('           Punctuation
')'           Punctuation
'\n  '        Text
'initBottomTabs' Name
'('           Punctuation
')'           Punctuation
'\n  \n  '    Text
'var'         Keyword.Declaration
' '           Text
'TAndBPVPaned' Name
' '           Text
'='           Operator
' '           Text
'vpanedNew'   Name
'('           Punctuation
')'           Punctuation
'\n  '        Text
'tandbpVPaned' Name
'.'           Punctuation
'pack1'       Name
'('           Punctuation
'win'         Name
'.'           Punctuation
'sourceViewTabs' Name
','           Punctuation
' '           Text
'resize'      Name
'='           Operator
'True'        Keyword.Pseudo
','           Punctuation
' '           Text
'shrink'      Name
'='           Operator
'False'       Keyword.Pseudo
')'           Punctuation
'\n  '        Text
'tandbpVPaned' Name
'.'           Punctuation
'pack2'       Name
'('           Punctuation
'win'         Name
'.'           Punctuation
'bottomPanelTabs' Name
','           Punctuation
' '           Text
'resize'      Name
'='           Operator
'False'       Keyword.Pseudo
','           Punctuation
' '           Text
'shrink'      Name
'='           Operator
'False'       Keyword.Pseudo
')'           Punctuation
'\n  '        Text
'MainBox'     Name
'.'           Punctuation
'packStart'   Name
'('           Punctuation
'TAndBPVPaned' Name
','           Punctuation
' '           Text
'True'        Keyword.Pseudo
','           Punctuation
' '           Text
'True'        Keyword.Pseudo
','           Punctuation
' '           Text
'0'           Literal.Number.Integer
')'           Punctuation
'\n  '        Text
'tandbpVPaned' Name
'.'           Punctuation
'setPosition' Name
'('           Punctuation
'win'         Name
'.'           Punctuation
'settings'    Name
'.'           Punctuation
'VPanedPos'   Name
')'           Punctuation
'\n  '        Text
'TAndBPVPaned' Name
'.'           Punctuation
'show'        Name
'('           Punctuation
')'           Punctuation
'\n\n'        Text

'proc '       Keyword
'initFindBar' Name.Function
'('           Punctuation
'MainBox'     Name
':'           Punctuation
' '           Text
'PBox'        Name
')'           Punctuation
' '           Text
'='           Operator
'\n  '        Text
'# Create a fixed container' Comment
'\n  '        Text
'win'         Name
'.'           Punctuation
'findBar'     Name
' '           Text
'='           Operator
' '           Text
'HBoxNew'     Name
'('           Punctuation
'False'       Keyword.Pseudo
','           Punctuation
' '           Text
'0'           Literal.Number.Integer
')'           Punctuation
'\n  '        Text
'win'         Name
'.'           Punctuation
'findBar'     Name
'.'           Punctuation
'setSpacing'  Name
'('           Punctuation
'4'           Literal.Number.Integer
')'           Punctuation
'\n\n  '      Text
"# Add a Label 'Find'" Comment
'\n  '        Text
'var'         Keyword.Declaration
' '           Text
'findLabel'   Name
' '           Text
'='           Operator
' '           Text
'labelNew'    Name
'('           Punctuation
'"'           Literal.String
'Find:'       Literal.String
'"'           Literal.String
')'           Punctuation
'\n  '        Text
'win'         Name
'.'           Punctuation
'findBar'     Name
'.'           Punctuation
'packStart'   Name
'('           Punctuation
'findLabel'   Name
','           Punctuation
' '           Text
'False'       Keyword.Pseudo
','           Punctuation
' '           Text
'False'       Keyword.Pseudo
','           Punctuation
' '           Text
'0'           Literal.Number.Integer
')'           Punctuation
'\n  '        Text
'findLabel'   Name
'.'           Punctuation
'show'        Name
'('           Punctuation
')'           Punctuation
'\n\n  '      Text
'# Add a (find) text entry' Comment
'\n  '        Text
'win'         Name
'.'           Punctuation
'findEntry'   Name
' '           Text
'='           Operator
' '           Text
'entryNew'    Name
'('           Punctuation
')'           Punctuation
'\n  '        Text
'win'         Name
'.'           Punctuation
'findBar'     Name
'.'           Punctuation
'packStart'   Name
'('           Punctuation
'win'         Name
'.'           Punctuation
'findEntry'   Name
','           Punctuation
' '           Text
'False'       Keyword.Pseudo
','           Punctuation
' '           Text
'False'       Keyword.Pseudo
','           Punctuation
' '           Text
'0'           Literal.Number.Integer
')'           Punctuation
'\n  '        Text
'discard'     Keyword
' '           Text
'win'         Name
'.'           Punctuation
'findEntry'   Name
'.'           Punctuation
'signalConnect' Name
'('           Punctuation
'"'           Literal.String
'activate'    Literal.String
'"'           Literal.String
','           Punctuation
' '           Text
'SIGNAL_FUNC' Name
'('           Punctuation
'\n                                      ' Text
'aporia'      Name
'.'           Punctuation
'nextBtn_Clicked' Name
')'           Punctuation
','           Punctuation
' '           Text
'nil'         Keyword.Pseudo
')'           Punctuation
'\n  '        Text
'win'         Name
'.'           Punctuation
'findEntry'   Name
'.'           Punctuation
'show'        Name
'('           Punctuation
')'           Punctuation
'\n  '        Text
'var'         Keyword.Declaration
' '           Text
'rq'          Name
':'           Punctuation
' '           Text
'TRequisition' Name
' \n  '       Text
'win'         Name
'.'           Punctuation
'findEntry'   Name
'.'           Punctuation
'sizeRequest' Name
'('           Punctuation
'addr'        Keyword
'('           Punctuation
'rq'          Name
')'           Punctuation
')'           Punctuation
'\n\n  '      Text
'# Make the (find) text entry longer' Comment
'\n  '        Text
'win'         Name
'.'           Punctuation
'findEntry'   Name
'.'           Punctuation
'set_size_request' Name
'('           Punctuation
'190'         Literal.Number.Integer
','           Punctuation
' '           Text
'rq'          Name
'.'           Punctuation
'height'      Name
')'           Punctuation
'\n  \n  '    Text
"# Add a Label 'Replace' " Comment
'\n  '        Text
"# - This Is only shown, when the 'Search & Replace'(CTRL + H) is shown" Comment
'\n  '        Text
'win'         Name
'.'           Punctuation
'replaceLabel' Name
' '           Text
'='           Operator
' '           Text
'labelNew'    Name
'('           Punctuation
'"'           Literal.String
'Replace:'    Literal.String
'"'           Literal.String
')'           Punctuation
'\n  '        Text
'win'         Name
'.'           Punctuation
'findBar'     Name
'.'           Punctuation
'packStart'   Name
'('           Punctuation
'win'         Name
'.'           Punctuation
'replaceLabel' Name
','           Punctuation
' '           Text
'False'       Keyword.Pseudo
','           Punctuation
' '           Text
'False'       Keyword.Pseudo
','           Punctuation
' '           Text
'0'           Literal.Number.Integer
')'           Punctuation
'\n  '        Text
'#replaceLabel.show()' Comment
'\n  \n  '    Text
'# Add a (replace) text entry ' Comment
'\n  '        Text
"# - This Is only shown, when the 'Search & Replace'(CTRL + H) is shown" Comment
'\n  '        Text
'win'         Name
'.'           Punctuation
'replaceEntry' Name
' '           Text
'='           Operator
' '           Text
'entryNew'    Name
'('           Punctuation
')'           Punctuation
'\n  '        Text
'win'         Name
'.'           Punctuation
'findBar'     Name
'.'           Punctuation
'packStart'   Name
'('           Punctuation
'win'         Name
'.'           Punctuation
'replaceEntry' Name
','           Punctuation
' '           Text
'False'       Keyword.Pseudo
','           Punctuation
' '           Text
'False'       Keyword.Pseudo
','           Punctuation
' '           Text
'0'           Literal.Number.Integer
')'           Punctuation
'\n  '        Text
'#win.replaceEntry.show()' Comment
'\n  '        Text
'var'         Keyword.Declaration
' '           Text
'rq1'         Name
':'           Punctuation
' '           Text
'TRequisition' Name
' \n  '       Text
'win'         Name
'.'           Punctuation
'replaceEntry' Name
'.'           Punctuation
'sizeRequest' Name
'('           Punctuation
'addr'        Keyword
'('           Punctuation
'rq1'         Name
')'           Punctuation
')'           Punctuation
'\n\n  '      Text
'# Make the (replace) text entry longer' Comment
'\n  '        Text
'win'         Name
'.'           Punctuation
'replaceEntry' Name
'.'           Punctuation
'set_size_request' Name
'('           Punctuation
'100'         Literal.Number.Integer
','           Punctuation
' '           Text
'rq1'         Name
'.'           Punctuation
'height'      Name
')'           Punctuation
'\n  \n  '    Text
'# Find next button' Comment
'\n  '        Text
'var'         Keyword.Declaration
' '           Text
'nextBtn'     Name
' '           Text
'='           Operator
' '           Text
'buttonNew'   Name
'('           Punctuation
'"'           Literal.String
'Next'        Literal.String
'"'           Literal.String
')'           Punctuation
'\n  '        Text
'win'         Name
'.'           Punctuation
'findBar'     Name
'.'           Punctuation
'packStart'   Name
'('           Punctuation
'nextBtn'     Name
','           Punctuation
' '           Text
'false'       Keyword.Pseudo
','           Punctuation
' '           Text
'false'       Keyword.Pseudo
','           Punctuation
' '           Text
'0'           Literal.Number.Integer
')'           Punctuation
'\n  '        Text
'discard'     Keyword
' '           Text
'nextBtn'     Name
'.'           Punctuation
'signalConnect' Name
'('           Punctuation
'"'           Literal.String
'clicked'     Literal.String
'"'           Literal.String
','           Punctuation
' \n             ' Text
'SIGNAL_FUNC' Name
'('           Punctuation
'aporia'      Name
'.'           Punctuation
'nextBtn_Clicked' Name
')'           Punctuation
','           Punctuation
' '           Text
'nil'         Keyword.Pseudo
')'           Punctuation
'\n  '        Text
'nextBtn'     Name
'.'           Punctuation
'show'        Name
'('           Punctuation
')'           Punctuation
'\n  '        Text
'var'         Keyword.Declaration
' '           Text
'nxtBtnRq'    Name
':'           Punctuation
' '           Text
'TRequisition' Name
'\n  '        Text
'nextBtn'     Name
'.'           Punctuation
'sizeRequest' Name
'('           Punctuation
'addr'        Keyword
'('           Punctuation
'nxtBtnRq'    Name
')'           Punctuation
')'           Punctuation
'\n  \n  '    Text
'# Find previous button' Comment
'\n  '        Text
'var'         Keyword.Declaration
' '           Text
'prevBtn'     Name
' '           Text
'='           Operator
' '           Text
'buttonNew'   Name
'('           Punctuation
'"'           Literal.String
'Previous'    Literal.String
'"'           Literal.String
')'           Punctuation
'\n  '        Text
'win'         Name
'.'           Punctuation
'findBar'     Name
'.'           Punctuation
'packStart'   Name
'('           Punctuation
'prevBtn'     Name
','           Punctuation
' '           Text
'false'       Keyword.Pseudo
','           Punctuation
' '           Text
'false'       Keyword.Pseudo
','           Punctuation
' '           Text
'0'           Literal.Number.Integer
')'           Punctuation
'\n  '        Text
'discard'     Keyword
' '           Text
'prevBtn'     Name
'.'           Punctuation
'signalConnect' Name
'('           Punctuation
'"'           Literal.String
'clicked'     Literal.String
'"'           Literal.String
','           Punctuation
' \n             ' Text
'SIGNAL_FUNC' Name
'('           Punctuation
'aporia'      Name
'.'           Punctuation
'prevBtn_Clicked' Name
')'           Punctuation
','           Punctuation
' '           Text
'nil'         Keyword.Pseudo
')'           Punctuation
'\n  '        Text
'prevBtn'     Name
'.'           Punctuation
'show'        Name
'('           Punctuation
')'           Punctuation
'\n  \n  '    Text
'# Replace button' Comment
'\n  '        Text
"# - This Is only shown, when the 'Search & Replace'(CTRL + H) is shown" Comment
'\n  '        Text
'win'         Name
'.'           Punctuation
'replaceBtn'  Name
' '           Text
'='           Operator
' '           Text
'buttonNew'   Name
'('           Punctuation
'"'           Literal.String
'Replace'     Literal.String
'"'           Literal.String
')'           Punctuation
'\n  '        Text
'win'         Name
'.'           Punctuation
'findBar'     Name
'.'           Punctuation
'packStart'   Name
'('           Punctuation
'win'         Name
'.'           Punctuation
'replaceBtn'  Name
','           Punctuation
' '           Text
'false'       Keyword.Pseudo
','           Punctuation
' '           Text
'false'       Keyword.Pseudo
','           Punctuation
' '           Text
'0'           Literal.Number.Integer
')'           Punctuation
'\n  '        Text
'discard'     Keyword
' '           Text
'win'         Name
'.'           Punctuation
'replaceBtn'  Name
'.'           Punctuation
'signalConnect' Name
'('           Punctuation
'"'           Literal.String
'clicked'     Literal.String
'"'           Literal.String
','           Punctuation
' \n             ' Text
'SIGNAL_FUNC' Name
'('           Punctuation
'aporia'      Name
'.'           Punctuation
'replaceBtn_Clicked' Name
')'           Punctuation
','           Punctuation
' '           Text
'nil'         Keyword.Pseudo
')'           Punctuation
'\n  '        Text
'#replaceBtn.show()' Comment
'\n\n  '      Text
'# Replace all button' Comment
'\n  '        Text
"# - this Is only shown, when the 'Search & Replace'(CTRL + H) is shown" Comment
'\n  '        Text
'win'         Name
'.'           Punctuation
'replaceAllBtn' Name
' '           Text
'='           Operator
' '           Text
'buttonNew'   Name
'('           Punctuation
'"'           Literal.String
'Replace All' Literal.String
'"'           Literal.String
')'           Punctuation
'\n  '        Text
'win'         Name
'.'           Punctuation
'findBar'     Name
'.'           Punctuation
'packStart'   Name
'('           Punctuation
'win'         Name
'.'           Punctuation
'replaceAllBtn' Name
','           Punctuation
' '           Text
'false'       Keyword.Pseudo
','           Punctuation
' '           Text
'false'       Keyword.Pseudo
','           Punctuation
' '           Text
'0'           Literal.Number.Integer
')'           Punctuation
'\n  '        Text
'discard'     Keyword
' '           Text
'win'         Name
'.'           Punctuation
'replaceAllBtn' Name
'.'           Punctuation
'signalConnect' Name
'('           Punctuation
'"'           Literal.String
'clicked'     Literal.String
'"'           Literal.String
','           Punctuation
' \n             ' Text
'SIGNAL_FUNC' Name
'('           Punctuation
'aporia'      Name
'.'           Punctuation
'replaceAllBtn_Clicked' Name
')'           Punctuation
','           Punctuation
' '           Text
'nil'         Keyword.Pseudo
')'           Punctuation
'\n  '        Text
'#replaceAllBtn.show()' Comment
'\n  \n  '    Text
'# Right side ...' Comment
'\n  \n  '    Text
'# Close button - With a close stock image' Comment
'\n  '        Text
'var'         Keyword.Declaration
' '           Text
'closeBtn'    Name
' '           Text
'='           Operator
' '           Text
'buttonNew'   Name
'('           Punctuation
')'           Punctuation
'\n  '        Text
'var'         Keyword.Declaration
' '           Text
'closeImage'  Name
' '           Text
'='           Operator
' '           Text
'imageNewFromStock' Name
'('           Punctuation
'STOCK_CLOSE' Name
','           Punctuation
' '           Text
'ICON_SIZE_SMALL_TOOLBAR' Name
')'           Punctuation
'\n  '        Text
'var'         Keyword.Declaration
' '           Text
'closeBox'    Name
' '           Text
'='           Operator
' '           Text
'hboxNew'     Name
'('           Punctuation
'False'       Keyword.Pseudo
','           Punctuation
' '           Text
'0'           Literal.Number.Integer
')'           Punctuation
'\n  '        Text
'closeBtn'    Name
'.'           Punctuation
'add'         Name
'('           Punctuation
'closeBox'    Name
')'           Punctuation
'\n  '        Text
'closeBox'    Name
'.'           Punctuation
'show'        Name
'('           Punctuation
')'           Punctuation
'\n  '        Text
'closeBox'    Name
'.'           Punctuation
'add'         Name
'('           Punctuation
'closeImage'  Name
')'           Punctuation
'\n  '        Text
'closeImage'  Name
'.'           Punctuation
'show'        Name
'('           Punctuation
')'           Punctuation
'\n  '        Text
'discard'     Keyword
' '           Text
'closeBtn'    Name
'.'           Punctuation
'signalConnect' Name
'('           Punctuation
'"'           Literal.String
'clicked'     Literal.String
'"'           Literal.String
','           Punctuation
' \n             ' Text
'SIGNAL_FUNC' Name
'('           Punctuation
'aporia'      Name
'.'           Punctuation
'closeBtn_Clicked' Name
')'           Punctuation
','           Punctuation
' '           Text
'nil'         Keyword.Pseudo
')'           Punctuation
'\n  '        Text
'win'         Name
'.'           Punctuation
'findBar'     Name
'.'           Punctuation
'packEnd'     Name
'('           Punctuation
'closeBtn'    Name
','           Punctuation
' '           Text
'False'       Keyword.Pseudo
','           Punctuation
' '           Text
'False'       Keyword.Pseudo
','           Punctuation
' '           Text
'2'           Literal.Number.Integer
')'           Punctuation
'\n  '        Text
'closeBtn'    Name
'.'           Punctuation
'show'        Name
'('           Punctuation
')'           Punctuation
'\n  \n  '    Text
"# Extra button - When clicked shows a menu with options like 'Use regex'" Comment
'\n  '        Text
'var'         Keyword.Declaration
' '           Text
'extraBtn'    Name
' '           Text
'='           Operator
' '           Text
'buttonNew'   Name
'('           Punctuation
')'           Punctuation
'\n  '        Text
'var'         Keyword.Declaration
' '           Text
'extraImage'  Name
' '           Text
'='           Operator
' '           Text
'imageNewFromStock' Name
'('           Punctuation
'STOCK_PROPERTIES' Name
','           Punctuation
' '           Text
'ICON_SIZE_SMALL_TOOLBAR' Name
')'           Punctuation
'\n\n  '      Text
'var'         Keyword.Declaration
' '           Text
'extraBox'    Name
' '           Text
'='           Operator
' '           Text
'hboxNew'     Name
'('           Punctuation
'False'       Keyword.Pseudo
','           Punctuation
' '           Text
'0'           Literal.Number.Integer
')'           Punctuation
'\n  '        Text
'extraBtn'    Name
'.'           Punctuation
'add'         Name
'('           Punctuation
'extraBox'    Name
')'           Punctuation
'\n  '        Text
'extraBox'    Name
'.'           Punctuation
'show'        Name
'('           Punctuation
')'           Punctuation
'\n  '        Text
'extraBox'    Name
'.'           Punctuation
'add'         Name
'('           Punctuation
'extraImage'  Name
')'           Punctuation
'\n  '        Text
'extraImage'  Name
'.'           Punctuation
'show'        Name
'('           Punctuation
')'           Punctuation
'\n  '        Text
'discard'     Keyword
' '           Text
'extraBtn'    Name
'.'           Punctuation
'signalConnect' Name
'('           Punctuation
'"'           Literal.String
'clicked'     Literal.String
'"'           Literal.String
','           Punctuation
' \n             ' Text
'SIGNAL_FUNC' Name
'('           Punctuation
'aporia'      Name
'.'           Punctuation
'extraBtn_Clicked' Name
')'           Punctuation
','           Punctuation
' '           Text
'nil'         Keyword.Pseudo
')'           Punctuation
'\n  '        Text
'win'         Name
'.'           Punctuation
'findBar'     Name
'.'           Punctuation
'packEnd'     Name
'('           Punctuation
'extraBtn'    Name
','           Punctuation
' '           Text
'False'       Keyword.Pseudo
','           Punctuation
' '           Text
'False'       Keyword.Pseudo
','           Punctuation
' '           Text
'0'           Literal.Number.Integer
')'           Punctuation
'\n  '        Text
'extraBtn'    Name
'.'           Punctuation
'show'        Name
'('           Punctuation
')'           Punctuation
'\n  \n  '    Text
'MainBox'     Name
'.'           Punctuation
'packStart'   Name
'('           Punctuation
'win'         Name
'.'           Punctuation
'findBar'     Name
','           Punctuation
' '           Text
'False'       Keyword.Pseudo
','           Punctuation
' '           Text
'False'       Keyword.Pseudo
','           Punctuation
' '           Text
'0'           Literal.Number.Integer
')'           Punctuation
'\n  '        Text
'win'         Name
'.'           Punctuation
'findBar'     Name
'.'           Punctuation
'show'        Name
'('           Punctuation
')'           Punctuation
'\n\n'        Text

'proc '       Keyword
'initStatusBar' Name.Function
'('           Punctuation
'MainBox'     Name
':'           Punctuation
' '           Text
'PBox'        Name
')'           Punctuation
' '           Text
'='           Operator
'\n  '        Text
'win'         Name
'.'           Punctuation
'bottomBar'   Name
' '           Text
'='           Operator
' '           Text
'statusbarNew' Name
'('           Punctuation
')'           Punctuation
'\n  '        Text
'MainBox'     Name
'.'           Punctuation
'packStart'   Name
'('           Punctuation
'win'         Name
'.'           Punctuation
'bottomBar'   Name
','           Punctuation
' '           Text
'False'       Keyword.Pseudo
','           Punctuation
' '           Text
'False'       Keyword.Pseudo
','           Punctuation
' '           Text
'0'           Literal.Number.Integer
')'           Punctuation
'\n  '        Text
'win'         Name
'.'           Punctuation
'bottomBar'   Name
'.'           Punctuation
'show'        Name
'('           Punctuation
')'           Punctuation
'\n  \n  '    Text
'discard'     Keyword
' '           Text
'win'         Name
'.'           Punctuation
'bottomBar'   Name
'.'           Punctuation
'push'        Name
'('           Punctuation
'0'           Literal.Number.Integer
','           Punctuation
' '           Text
'"'           Literal.String
'Line: 0 Column: 0' Literal.String
'"'           Literal.String
')'           Punctuation
'\n  \n'      Text

'proc '       Keyword
'initControls' Name.Function
'('           Punctuation
')'           Punctuation
' '           Text
'='           Operator
'\n  '        Text
'# Load up the language style' Comment
'\n  '        Text
'win'         Name
'.'           Punctuation
'langMan'     Name
' '           Text
'='           Operator
' '           Text
'languageManagerGetDefault' Name
'('           Punctuation
')'           Punctuation
'\n  '        Text
'var'         Keyword.Declaration
' '           Text
'langpaths'   Name
':'           Punctuation
' '           Text
'array'       Keyword.Type
'['           Operator
'0'           Literal.Number.Float
'..'          Punctuation
'1'           Literal.Number.Integer
','           Punctuation
' '           Text
'cstring'     Name
']'           Operator
' '           Text
'='           Operator
' \n          ' Text
'['           Operator
'cstring'     Name
'('           Punctuation
'os'          Name
'.'           Punctuation
'getApplicationDir' Name
'('           Punctuation
')'           Punctuation
' '           Text
'/'           Operator
' '           Text
'langSpecs'   Name
')'           Punctuation
','           Punctuation
' '           Text
'nil'         Keyword.Pseudo
']'           Operator
'\n  '        Text
'win'         Name
'.'           Punctuation
'langMan'     Name
'.'           Punctuation
'setSearchPath' Name
'('           Punctuation
'addr'        Keyword
'('           Punctuation
'langpaths'   Name
')'           Punctuation
')'           Punctuation
'\n  '        Text
'var'         Keyword.Declaration
' '           Text
'nimLang'     Name
' '           Text
'='           Operator
' '           Text
'win'         Name
'.'           Punctuation
'langMan'     Name
'.'           Punctuation
'getLanguage' Name
'('           Punctuation
'"'           Literal.String
'nimrod'      Literal.String
'"'           Literal.String
')'           Punctuation
'\n  '        Text
'win'         Name
'.'           Punctuation
'nimLang'     Name
' '           Text
'='           Operator
' '           Text
'nimLang'     Name
'\n  \n  '    Text
'# Load the scheme' Comment
'\n  '        Text
'var'         Keyword.Declaration
' '           Text
'schemeMan'   Name
' '           Text
'='           Operator
' '           Text
'schemeManagerGetDefault' Name
'('           Punctuation
')'           Punctuation
'\n  '        Text
'var'         Keyword.Declaration
' '           Text
'schemepaths' Name
':'           Punctuation
' '           Text
'array'       Keyword.Type
'['           Operator
'0'           Literal.Number.Float
'..'          Punctuation
'1'           Literal.Number.Integer
','           Punctuation
' '           Text
'cstring'     Name
']'           Operator
' '           Text
'='           Operator
'\n          ' Text
'['           Operator
'cstring'     Name
'('           Punctuation
'os'          Name
'.'           Punctuation
'getApplicationDir' Name
'('           Punctuation
')'           Punctuation
' '           Text
'/'           Operator
' '           Text
'styles'      Name
')'           Punctuation
','           Punctuation
' '           Text
'nil'         Keyword.Pseudo
']'           Operator
'\n  '        Text
'schemeMan'   Name
'.'           Punctuation
'setSearchPath' Name
'('           Punctuation
'addr'        Keyword
'('           Punctuation
'schemepaths' Name
')'           Punctuation
')'           Punctuation
'\n  '        Text
'win'         Name
'.'           Punctuation
'scheme'      Name
' '           Text
'='           Operator
' '           Text
'schemeMan'   Name
'.'           Punctuation
'getScheme'   Name
'('           Punctuation
'win'         Name
'.'           Punctuation
'settings'    Name
'.'           Punctuation
'colorSchemeID' Name
')'           Punctuation
'\n  \n  '    Text
'# Window'    Comment
'\n  '        Text
'win'         Name
'.'           Punctuation
'w'           Name
' '           Text
'='           Operator
' '           Text
'windowNew'   Name
'('           Punctuation
'gtk2'        Name
'.'           Punctuation
'WINDOW_TOPLEVEL' Name
')'           Punctuation
'\n  '        Text
'win'         Name
'.'           Punctuation
'w'           Name
'.'           Punctuation
'setDefaultSize' Name
'('           Punctuation
'win'         Name
'.'           Punctuation
'settings'    Name
'.'           Punctuation
'winWidth'    Name
','           Punctuation
' '           Text
'win'         Name
'.'           Punctuation
'settings'    Name
'.'           Punctuation
'winHeight'   Name
')'           Punctuation
'\n  '        Text
'win'         Name
'.'           Punctuation
'w'           Name
'.'           Punctuation
'setTitle'    Name
'('           Punctuation
'"'           Literal.String
'Aporia IDE'  Literal.String
'"'           Literal.String
')'           Punctuation
'\n  '        Text
'if'          Keyword
' '           Text
'win'         Name
'.'           Punctuation
'settings'    Name
'.'           Punctuation
'winMaximized' Name
':'           Punctuation
' '           Text
'win'         Name
'.'           Punctuation
'w'           Name
'.'           Punctuation
'maximize'    Name
'('           Punctuation
')'           Punctuation
'\n  \n  '    Text
'win'         Name
'.'           Punctuation
'w'           Name
'.'           Punctuation
'show'        Name
'('           Punctuation
')'           Punctuation
' '           Text
'# The window has to be shown before' Comment
'\n               ' Text
'# setting the position of the VPaned so that' Comment
'\n               ' Text
'# it gets set correctly, when the window is maximized.' Comment
'\n    \n  '  Text
'discard'     Keyword
' '           Text
'win'         Name
'.'           Punctuation
'w'           Name
'.'           Punctuation
'signalConnect' Name
'('           Punctuation
'"'           Literal.String
'destroy'     Literal.String
'"'           Literal.String
','           Punctuation
' '           Text
'SIGNAL_FUNC' Name
'('           Punctuation
'aporia'      Name
'.'           Punctuation
'destroy'     Name
')'           Punctuation
','           Punctuation
' '           Text
'nil'         Keyword.Pseudo
')'           Punctuation
'\n  '        Text
'discard'     Keyword
' '           Text
'win'         Name
'.'           Punctuation
'w'           Name
'.'           Punctuation
'signalConnect' Name
'('           Punctuation
'"'           Literal.String
'delete_event' Literal.String
'"'           Literal.String
','           Punctuation
' \n    '     Text
'SIGNAL_FUNC' Name
'('           Punctuation
'aporia'      Name
'.'           Punctuation
'delete_event' Name
')'           Punctuation
','           Punctuation
' '           Text
'nil'         Keyword.Pseudo
')'           Punctuation
'\n  '        Text
'discard'     Keyword
' '           Text
'win'         Name
'.'           Punctuation
'w'           Name
'.'           Punctuation
'signalConnect' Name
'('           Punctuation
'"'           Literal.String
'window-state-event' Literal.String
'"'           Literal.String
','           Punctuation
' \n    '     Text
'SIGNAL_FUNC' Name
'('           Punctuation
'aporia'      Name
'.'           Punctuation
'windowState_Changed' Name
')'           Punctuation
','           Punctuation
' '           Text
'nil'         Keyword.Pseudo
')'           Punctuation
'\n  \n  '    Text
'# MainBox (vbox)' Comment
'\n  '        Text
'var'         Keyword.Declaration
' '           Text
'MainBox'     Name
' '           Text
'='           Operator
' '           Text
'vboxNew'     Name
'('           Punctuation
'False'       Keyword.Pseudo
','           Punctuation
' '           Text
'0'           Literal.Number.Integer
')'           Punctuation
'\n  '        Text
'win'         Name
'.'           Punctuation
'w'           Name
'.'           Punctuation
'add'         Name
'('           Punctuation
'MainBox'     Name
')'           Punctuation
'\n  \n  '    Text
'initTopMenu' Name
'('           Punctuation
'MainBox'     Name
')'           Punctuation
'\n  '        Text
'initToolBar' Name
'('           Punctuation
'MainBox'     Name
')'           Punctuation
'\n  '        Text
'initTAndBP'  Name
'('           Punctuation
'MainBox'     Name
')'           Punctuation
'\n  '        Text
'initFindBar' Name
'('           Punctuation
'MainBox'     Name
')'           Punctuation
'\n  '        Text
'initStatusBar' Name
'('           Punctuation
'MainBox'     Name
')'           Punctuation
'\n  \n  '    Text
'MainBox'     Name
'.'           Punctuation
'show'        Name
'('           Punctuation
')'           Punctuation
'\n  '        Text
'if'          Keyword
' '           Text
'confParseFail' Name
':'           Punctuation
'\n    '      Text
'dialogs'     Name
'.'           Punctuation
'warning'     Name
'('           Punctuation
'win'         Name
'.'           Punctuation
'w'           Name
','           Punctuation
' '           Text
'"'           Literal.String
'Error parsing config file, using default settings.' Literal.String
'"'           Literal.String
')'           Punctuation
'\n \n'       Text

'nimrod_init' Name
'('           Punctuation
')'           Punctuation
'\n'          Text

'initControls' Name
'('           Punctuation
')'           Punctuation
'\n'          Text

'main'        Name
'('           Punctuation
')'           Punctuation
'\n'          Text
