Full Code of martinribelotta/embedded-ide for AI

master 6961d5fd91c0 cached
750 files
15.9 MB
4.2M tokens
1 requests
Copy disabled (too large) Download .txt
Showing preview only (16,843K chars total). Download the full file to get everything.
Repository: martinribelotta/embedded-ide
Branch: master
Commit: 6961d5fd91c0
Files: 750
Total size: 15.9 MB

Directory structure:
gitextract_j16isbcq/

├── .gitignore
├── .travis.yml
├── 3rdpart/
│   ├── astyle/
│   │   ├── ASBeautifier.cpp
│   │   ├── ASEnhancer.cpp
│   │   ├── ASFormatter.cpp
│   │   ├── ASLocalizer.cpp
│   │   ├── ASLocalizer.h
│   │   ├── ASResource.cpp
│   │   ├── astyle.h
│   │   ├── astyle.pri
│   │   ├── astyle_main.cpp
│   │   └── astyle_main.h
│   ├── backward/
│   │   ├── backward.cpp
│   │   ├── backward.hpp
│   │   └── backward.pri
│   ├── hoedown/
│   │   ├── LICENSE
│   │   ├── README.md
│   │   ├── hoedown.def
│   │   ├── hoedown.pri
│   │   ├── html_block_names.gperf
│   │   └── src/
│   │       ├── autolink.c
│   │       ├── autolink.h
│   │       ├── buffer.c
│   │       ├── buffer.h
│   │       ├── document.c
│   │       ├── document.h
│   │       ├── escape.c
│   │       ├── escape.h
│   │       ├── hodedown_version.c
│   │       ├── html.c
│   │       ├── html.h
│   │       ├── html_blocks.c
│   │       ├── html_smartypants.c
│   │       ├── stack.c
│   │       ├── stack.h
│   │       └── version.h
│   ├── qdarkstyle/
│   │   ├── qdarkstype.pri
│   │   ├── style.qrc
│   │   └── style.qss
│   ├── qhexview/
│   │   ├── .gitignore
│   │   ├── LICENSE
│   │   ├── README.md
│   │   ├── include/
│   │   │   └── QHexView.h
│   │   ├── qhexview.pri
│   │   └── src/
│   │       └── QHexView.cpp
│   └── qt-mustache-master/
│       ├── .gitignore
│       ├── .travis.yml
│       ├── README.md
│       ├── qt-mustache.pri
│       ├── qt-mustache.pro
│       ├── src/
│       │   ├── mustache.cpp
│       │   └── mustache.h
│       └── tests/
│           ├── partial.mustache
│           ├── specs/
│           │   ├── comments.json
│           │   ├── comments.yml
│           │   ├── delimiters.json
│           │   ├── delimiters.yml
│           │   ├── interpolation.json
│           │   ├── interpolation.yml
│           │   ├── inverted.json
│           │   ├── inverted.yml
│           │   ├── partials.json
│           │   ├── partials.yml
│           │   ├── sections.json
│           │   └── sections.yml
│           ├── test_mustache.cpp
│           └── test_mustache.h
├── LICENSE
├── README.md
├── ci/
│   ├── BuildQSCI.mk
│   ├── extract-qt-installer
│   ├── qt-installer-silent.js
│   ├── qt5124-linux-packages
│   ├── qt5129-linux-packages
│   ├── tests-ci.sh
│   └── tests-environment.sh
├── docs/
│   ├── DIFF_TEMPLATES.md
│   └── TOOL_CMDLINE.md
├── embedded-ide.pro
├── ide/
│   ├── appconfig.cpp
│   ├── appconfig.h
│   ├── binaryviewer.cpp
│   ├── binaryviewer.h
│   ├── buildmanager.cpp
│   ├── buildmanager.h
│   ├── buttoneditoritemdelegate.h
│   ├── childprocess.cpp
│   ├── childprocess.h
│   ├── clangautocompletionprovider.cpp
│   ├── clangautocompletionprovider.h
│   ├── codetexteditor.cpp
│   ├── codetexteditor.h
│   ├── configwidget.cpp
│   ├── configwidget.h
│   ├── configwidget.ui
│   ├── consoleinterceptor.cpp
│   ├── consoleinterceptor.h
│   ├── cpptexteditor.cpp
│   ├── cpptexteditor.h
│   ├── documentmanager.cpp
│   ├── documentmanager.h
│   ├── envinputdialog.cpp
│   ├── envinputdialog.h
│   ├── envinputdialog.ui
│   ├── externaltoolmanager.cpp
│   ├── externaltoolmanager.h
│   ├── externaltoolmanager.ui
│   ├── filereferencesdialog.cpp
│   ├── filereferencesdialog.h
│   ├── filereferencesdialog.ui
│   ├── filesystemmanager.cpp
│   ├── filesystemmanager.h
│   ├── findandopenfiledialog.cpp
│   ├── findandopenfiledialog.h
│   ├── findandopenfiledialog.ui
│   ├── findinfilesdialog.cpp
│   ├── findinfilesdialog.h
│   ├── findinfilesdialog.ui
│   ├── findlineedit.cpp
│   ├── findlineedit.h
│   ├── findmakefiledialog.cpp
│   ├── findmakefiledialog.h
│   ├── findmakefiledialog.ui
│   ├── formfindreplace.cpp
│   ├── formfindreplace.h
│   ├── formfindreplace.ui
│   ├── icodemodelprovider.cpp
│   ├── icodemodelprovider.h
│   ├── ide.pro
│   ├── idocumenteditor.cpp
│   ├── idocumenteditor.h
│   ├── imageviewer.cpp
│   ├── imageviewer.h
│   ├── main.cpp
│   ├── mainwindow.cpp
│   ├── mainwindow.h
│   ├── mainwindow.ui
│   ├── mapfileviewer.cpp
│   ├── mapfileviewer.h
│   ├── markdowneditor.cpp
│   ├── markdowneditor.h
│   ├── markdownview.cpp
│   ├── markdownview.h
│   ├── newprojectdialog.cpp
│   ├── newprojectdialog.h
│   ├── newprojectdialog.ui
│   ├── newprojectfromremotedialog.cpp
│   ├── newprojectfromremotedialog.h
│   ├── newprojectfromremotedialog.ui
│   ├── plaintexteditor.cpp
│   ├── plaintexteditor.h
│   ├── processlinebufferizer.cpp
│   ├── processlinebufferizer.h
│   ├── processmanager.cpp
│   ├── processmanager.h
│   ├── projectmanager.cpp
│   ├── projectmanager.h
│   ├── regexhtmltranslator.cpp
│   ├── regexhtmltranslator.h
│   ├── resources/
│   │   ├── default-global.json
│   │   ├── default-local.json
│   │   ├── fonts.qrc
│   │   ├── iconactions.qrc
│   │   ├── images/
│   │   │   ├── dark/
│   │   │   │   └── index.theme
│   │   │   └── light/
│   │   │       └── index.theme
│   │   ├── kinds.qrc
│   │   ├── mimetypes.qrc
│   │   ├── reference-code.c
│   │   ├── resources.qrc
│   │   ├── styles/
│   │   │   ├── Bespin.xml
│   │   │   ├── Black board.xml
│   │   │   ├── Choco.xml
│   │   │   ├── Deep Black.xml
│   │   │   ├── Default.xml
│   │   │   ├── Hello Kitty.xml
│   │   │   ├── HotFudgeSundae.xml
│   │   │   ├── Material-Dark.xml
│   │   │   ├── Mono Industrial.xml
│   │   │   ├── Monokai.xml
│   │   │   ├── MossyLawn.xml
│   │   │   ├── Navajo.xml
│   │   │   ├── Obsidian.xml
│   │   │   ├── Plastic Code Wrap.xml
│   │   │   ├── Ruby Blue.xml
│   │   │   ├── Solarized-light.xml
│   │   │   ├── Solarized.xml
│   │   │   ├── Twilight.xml
│   │   │   ├── Vibrant Ink.xml
│   │   │   ├── Zenburn.xml
│   │   │   ├── khaki.xml
│   │   │   ├── tomorrow.xml
│   │   │   └── vim Dark Blue.xml
│   │   ├── styles.qrc
│   │   └── templates/
│   │       └── empty.template
│   ├── skeleton/
│   │   ├── bin/
│   │   │   ├── ftdi_rules.sh
│   │   │   └── qt.conf
│   │   ├── desktop-integration.sh
│   │   ├── embedded-ide.desktop
│   │   ├── embedded-ide.hardconf
│   │   ├── embedded-ide.sh
│   │   ├── embedded-ide.sh.wrapper
│   │   └── ftdi-tools.sh
│   ├── tar.h
│   ├── templatefile.cpp
│   ├── templatefile.h
│   ├── templateitemwidget.cpp
│   ├── templateitemwidget.h
│   ├── templateitemwidget.ui
│   ├── templatemanager.cpp
│   ├── templatemanager.h
│   ├── templatemanager.ui
│   ├── textmessagebrocker.cpp
│   ├── textmessagebrocker.h
│   ├── translations/
│   │   └── es.ts
│   ├── unsavedfilesdialog.cpp
│   ├── unsavedfilesdialog.h
│   ├── unsavedfilesdialog.ui
│   ├── version.cpp
│   └── version.h
├── mapview/
│   ├── main.cpp
│   ├── mapview.pri
│   ├── mapview.pro
│   ├── mapviewmodel.cpp
│   └── mapviewmodel.h
├── old/
│   ├── .gitignore
│   ├── 3rdpart/
│   │   ├── QHexEdit/
│   │   │   ├── LICENSE
│   │   │   ├── README.md
│   │   │   ├── qhexedit.cpp
│   │   │   ├── qhexedit.h
│   │   │   ├── qhexedit.pri
│   │   │   ├── qhexeditcomments.cpp
│   │   │   ├── qhexeditcomments.h
│   │   │   ├── qhexeditdata.cpp
│   │   │   ├── qhexeditdata.h
│   │   │   ├── qhexeditdatadevice.cpp
│   │   │   ├── qhexeditdatadevice.h
│   │   │   ├── qhexeditdatareader.cpp
│   │   │   ├── qhexeditdatareader.h
│   │   │   ├── qhexeditdatawriter.cpp
│   │   │   ├── qhexeditdatawriter.h
│   │   │   ├── qhexedithighlighter.cpp
│   │   │   ├── qhexedithighlighter.h
│   │   │   ├── qhexeditprivate.cpp
│   │   │   ├── qhexeditprivate.h
│   │   │   ├── sparserangemap.cpp
│   │   │   └── sparserangemap.h
│   │   ├── astyle/
│   │   │   ├── ASBeautifier.cpp
│   │   │   ├── ASEnhancer.cpp
│   │   │   ├── ASFormatter.cpp
│   │   │   ├── ASLocalizer.cpp
│   │   │   ├── ASLocalizer.h
│   │   │   ├── ASResource.cpp
│   │   │   ├── astyle.h
│   │   │   ├── astyle.pri
│   │   │   ├── astyle_main.cpp
│   │   │   └── astyle_main.h
│   │   ├── gdbdebugger/
│   │   │   ├── gdbdebugger.cpp
│   │   │   ├── gdbdebugger.h
│   │   │   └── gdbdebugger.pri
│   │   ├── qscintilla/
│   │   │   ├── ChangeLog
│   │   │   ├── LICENSE
│   │   │   ├── NEWS
│   │   │   ├── Qt4Qt5/
│   │   │   │   ├── InputMethod.cpp
│   │   │   │   ├── ListBoxQt.cpp
│   │   │   │   ├── ListBoxQt.h
│   │   │   │   ├── MacPasteboardMime.cpp
│   │   │   │   ├── PlatQt.cpp
│   │   │   │   ├── Qsci/
│   │   │   │   │   ├── qsciabstractapis.h
│   │   │   │   │   ├── qsciapis.h
│   │   │   │   │   ├── qscicommand.h
│   │   │   │   │   ├── qscicommandset.h
│   │   │   │   │   ├── qscidocument.h
│   │   │   │   │   ├── qsciglobal.h
│   │   │   │   │   ├── qscilexer.h
│   │   │   │   │   ├── qscilexeravs.h
│   │   │   │   │   ├── qscilexerbash.h
│   │   │   │   │   ├── qscilexerbatch.h
│   │   │   │   │   ├── qscilexercmake.h
│   │   │   │   │   ├── qscilexercoffeescript.h
│   │   │   │   │   ├── qscilexercpp.h
│   │   │   │   │   ├── qscilexercsharp.h
│   │   │   │   │   ├── qscilexercss.h
│   │   │   │   │   ├── qscilexercustom.h
│   │   │   │   │   ├── qscilexerd.h
│   │   │   │   │   ├── qscilexerdiff.h
│   │   │   │   │   ├── qscilexerfortran.h
│   │   │   │   │   ├── qscilexerfortran77.h
│   │   │   │   │   ├── qscilexerhtml.h
│   │   │   │   │   ├── qscilexeridl.h
│   │   │   │   │   ├── qscilexerjava.h
│   │   │   │   │   ├── qscilexerjavascript.h
│   │   │   │   │   ├── qscilexerjson.h
│   │   │   │   │   ├── qscilexerlua.h
│   │   │   │   │   ├── qscilexermakefile.h
│   │   │   │   │   ├── qscilexermarkdown.h
│   │   │   │   │   ├── qscilexermatlab.h
│   │   │   │   │   ├── qscilexeroctave.h
│   │   │   │   │   ├── qscilexerpascal.h
│   │   │   │   │   ├── qscilexerperl.h
│   │   │   │   │   ├── qscilexerpo.h
│   │   │   │   │   ├── qscilexerpostscript.h
│   │   │   │   │   ├── qscilexerpov.h
│   │   │   │   │   ├── qscilexerproperties.h
│   │   │   │   │   ├── qscilexerpython.h
│   │   │   │   │   ├── qscilexerruby.h
│   │   │   │   │   ├── qscilexerspice.h
│   │   │   │   │   ├── qscilexersql.h
│   │   │   │   │   ├── qscilexertcl.h
│   │   │   │   │   ├── qscilexertex.h
│   │   │   │   │   ├── qscilexerverilog.h
│   │   │   │   │   ├── qscilexervhdl.h
│   │   │   │   │   ├── qscilexerxml.h
│   │   │   │   │   ├── qscilexeryaml.h
│   │   │   │   │   ├── qscimacro.h
│   │   │   │   │   ├── qsciprinter.h
│   │   │   │   │   ├── qsciscintilla.h
│   │   │   │   │   ├── qsciscintillabase.h
│   │   │   │   │   ├── qscistyle.h
│   │   │   │   │   └── qscistyledtext.h
│   │   │   │   ├── SciClasses.cpp
│   │   │   │   ├── SciClasses.h
│   │   │   │   ├── SciNamespace.h
│   │   │   │   ├── ScintillaQt.cpp
│   │   │   │   ├── ScintillaQt.h
│   │   │   │   ├── features/
│   │   │   │   │   └── qscintilla2.prf
│   │   │   │   ├── features_staticlib/
│   │   │   │   │   └── qscintilla2.prf
│   │   │   │   ├── qsciabstractapis.cpp
│   │   │   │   ├── qsciapis.cpp
│   │   │   │   ├── qscicommand.cpp
│   │   │   │   ├── qscicommandset.cpp
│   │   │   │   ├── qscidocument.cpp
│   │   │   │   ├── qscilexer.cpp
│   │   │   │   ├── qscilexeravs.cpp
│   │   │   │   ├── qscilexerbash.cpp
│   │   │   │   ├── qscilexerbatch.cpp
│   │   │   │   ├── qscilexercmake.cpp
│   │   │   │   ├── qscilexercoffeescript.cpp
│   │   │   │   ├── qscilexercpp.cpp
│   │   │   │   ├── qscilexercsharp.cpp
│   │   │   │   ├── qscilexercss.cpp
│   │   │   │   ├── qscilexercustom.cpp
│   │   │   │   ├── qscilexerd.cpp
│   │   │   │   ├── qscilexerdiff.cpp
│   │   │   │   ├── qscilexerfortran.cpp
│   │   │   │   ├── qscilexerfortran77.cpp
│   │   │   │   ├── qscilexerhtml.cpp
│   │   │   │   ├── qscilexeridl.cpp
│   │   │   │   ├── qscilexerjava.cpp
│   │   │   │   ├── qscilexerjavascript.cpp
│   │   │   │   ├── qscilexerjson.cpp
│   │   │   │   ├── qscilexerlua.cpp
│   │   │   │   ├── qscilexermakefile.cpp
│   │   │   │   ├── qscilexermarkdown.cpp
│   │   │   │   ├── qscilexermatlab.cpp
│   │   │   │   ├── qscilexeroctave.cpp
│   │   │   │   ├── qscilexerpascal.cpp
│   │   │   │   ├── qscilexerperl.cpp
│   │   │   │   ├── qscilexerpo.cpp
│   │   │   │   ├── qscilexerpostscript.cpp
│   │   │   │   ├── qscilexerpov.cpp
│   │   │   │   ├── qscilexerproperties.cpp
│   │   │   │   ├── qscilexerpython.cpp
│   │   │   │   ├── qscilexerruby.cpp
│   │   │   │   ├── qscilexerspice.cpp
│   │   │   │   ├── qscilexersql.cpp
│   │   │   │   ├── qscilexertcl.cpp
│   │   │   │   ├── qscilexertex.cpp
│   │   │   │   ├── qscilexerverilog.cpp
│   │   │   │   ├── qscilexervhdl.cpp
│   │   │   │   ├── qscilexerxml.cpp
│   │   │   │   ├── qscilexeryaml.cpp
│   │   │   │   ├── qscimacro.cpp
│   │   │   │   ├── qscintilla.pro
│   │   │   │   ├── qscintilla_cs.ts
│   │   │   │   ├── qscintilla_de.ts
│   │   │   │   ├── qscintilla_es.ts
│   │   │   │   ├── qscintilla_fr.ts
│   │   │   │   ├── qscintilla_pt_br.ts
│   │   │   │   ├── qsciprinter.cpp
│   │   │   │   ├── qsciscintilla.cpp
│   │   │   │   ├── qsciscintillabase.cpp
│   │   │   │   ├── qscistyle.cpp
│   │   │   │   └── qscistyledtext.cpp
│   │   │   ├── README
│   │   │   ├── include/
│   │   │   │   ├── ILexer.h
│   │   │   │   ├── License.txt
│   │   │   │   ├── Platform.h
│   │   │   │   ├── SciLexer.h
│   │   │   │   ├── Sci_Position.h
│   │   │   │   ├── Scintilla.h
│   │   │   │   ├── Scintilla.iface
│   │   │   │   └── ScintillaWidget.h
│   │   │   ├── lexers/
│   │   │   │   ├── LexA68k.cpp
│   │   │   │   ├── LexAPDL.cpp
│   │   │   │   ├── LexASY.cpp
│   │   │   │   ├── LexAU3.cpp
│   │   │   │   ├── LexAVE.cpp
│   │   │   │   ├── LexAVS.cpp
│   │   │   │   ├── LexAbaqus.cpp
│   │   │   │   ├── LexAda.cpp
│   │   │   │   ├── LexAsm.cpp
│   │   │   │   ├── LexAsn1.cpp
│   │   │   │   ├── LexBaan.cpp
│   │   │   │   ├── LexBash.cpp
│   │   │   │   ├── LexBasic.cpp
│   │   │   │   ├── LexBatch.cpp
│   │   │   │   ├── LexBibTeX.cpp
│   │   │   │   ├── LexBullant.cpp
│   │   │   │   ├── LexCLW.cpp
│   │   │   │   ├── LexCOBOL.cpp
│   │   │   │   ├── LexCPP.cpp
│   │   │   │   ├── LexCSS.cpp
│   │   │   │   ├── LexCaml.cpp
│   │   │   │   ├── LexCmake.cpp
│   │   │   │   ├── LexCoffeeScript.cpp
│   │   │   │   ├── LexConf.cpp
│   │   │   │   ├── LexCrontab.cpp
│   │   │   │   ├── LexCsound.cpp
│   │   │   │   ├── LexD.cpp
│   │   │   │   ├── LexDMAP.cpp
│   │   │   │   ├── LexDMIS.cpp
│   │   │   │   ├── LexDiff.cpp
│   │   │   │   ├── LexECL.cpp
│   │   │   │   ├── LexEDIFACT.cpp
│   │   │   │   ├── LexEScript.cpp
│   │   │   │   ├── LexEiffel.cpp
│   │   │   │   ├── LexErlang.cpp
│   │   │   │   ├── LexErrorList.cpp
│   │   │   │   ├── LexFlagship.cpp
│   │   │   │   ├── LexForth.cpp
│   │   │   │   ├── LexFortran.cpp
│   │   │   │   ├── LexGAP.cpp
│   │   │   │   ├── LexGui4Cli.cpp
│   │   │   │   ├── LexHTML.cpp
│   │   │   │   ├── LexHaskell.cpp
│   │   │   │   ├── LexHex.cpp
│   │   │   │   ├── LexInno.cpp
│   │   │   │   ├── LexJSON.cpp
│   │   │   │   ├── LexKVIrc.cpp
│   │   │   │   ├── LexKix.cpp
│   │   │   │   ├── LexLaTeX.cpp
│   │   │   │   ├── LexLisp.cpp
│   │   │   │   ├── LexLout.cpp
│   │   │   │   ├── LexLua.cpp
│   │   │   │   ├── LexMMIXAL.cpp
│   │   │   │   ├── LexMPT.cpp
│   │   │   │   ├── LexMSSQL.cpp
│   │   │   │   ├── LexMagik.cpp
│   │   │   │   ├── LexMake.cpp
│   │   │   │   ├── LexMarkdown.cpp
│   │   │   │   ├── LexMatlab.cpp
│   │   │   │   ├── LexMetapost.cpp
│   │   │   │   ├── LexModula.cpp
│   │   │   │   ├── LexMySQL.cpp
│   │   │   │   ├── LexNimrod.cpp
│   │   │   │   ├── LexNsis.cpp
│   │   │   │   ├── LexNull.cpp
│   │   │   │   ├── LexOScript.cpp
│   │   │   │   ├── LexOpal.cpp
│   │   │   │   ├── LexPB.cpp
│   │   │   │   ├── LexPLM.cpp
│   │   │   │   ├── LexPO.cpp
│   │   │   │   ├── LexPOV.cpp
│   │   │   │   ├── LexPS.cpp
│   │   │   │   ├── LexPascal.cpp
│   │   │   │   ├── LexPerl.cpp
│   │   │   │   ├── LexPowerPro.cpp
│   │   │   │   ├── LexPowerShell.cpp
│   │   │   │   ├── LexProgress.cpp
│   │   │   │   ├── LexProps.cpp
│   │   │   │   ├── LexPython.cpp
│   │   │   │   ├── LexR.cpp
│   │   │   │   ├── LexRebol.cpp
│   │   │   │   ├── LexRegistry.cpp
│   │   │   │   ├── LexRuby.cpp
│   │   │   │   ├── LexRust.cpp
│   │   │   │   ├── LexSML.cpp
│   │   │   │   ├── LexSQL.cpp
│   │   │   │   ├── LexSTTXT.cpp
│   │   │   │   ├── LexScriptol.cpp
│   │   │   │   ├── LexSmalltalk.cpp
│   │   │   │   ├── LexSorcus.cpp
│   │   │   │   ├── LexSpecman.cpp
│   │   │   │   ├── LexSpice.cpp
│   │   │   │   ├── LexTACL.cpp
│   │   │   │   ├── LexTADS3.cpp
│   │   │   │   ├── LexTAL.cpp
│   │   │   │   ├── LexTCL.cpp
│   │   │   │   ├── LexTCMD.cpp
│   │   │   │   ├── LexTeX.cpp
│   │   │   │   ├── LexTxt2tags.cpp
│   │   │   │   ├── LexVB.cpp
│   │   │   │   ├── LexVHDL.cpp
│   │   │   │   ├── LexVerilog.cpp
│   │   │   │   ├── LexVisualProlog.cpp
│   │   │   │   ├── LexYAML.cpp
│   │   │   │   └── License.txt
│   │   │   ├── lexlib/
│   │   │   │   ├── Accessor.cpp
│   │   │   │   ├── Accessor.h
│   │   │   │   ├── CharacterCategory.cpp
│   │   │   │   ├── CharacterCategory.h
│   │   │   │   ├── CharacterSet.cpp
│   │   │   │   ├── CharacterSet.h
│   │   │   │   ├── LexAccessor.h
│   │   │   │   ├── LexerBase.cpp
│   │   │   │   ├── LexerBase.h
│   │   │   │   ├── LexerModule.cpp
│   │   │   │   ├── LexerModule.h
│   │   │   │   ├── LexerNoExceptions.cpp
│   │   │   │   ├── LexerNoExceptions.h
│   │   │   │   ├── LexerSimple.cpp
│   │   │   │   ├── LexerSimple.h
│   │   │   │   ├── License.txt
│   │   │   │   ├── OptionSet.h
│   │   │   │   ├── PropSetSimple.cpp
│   │   │   │   ├── PropSetSimple.h
│   │   │   │   ├── SparseState.h
│   │   │   │   ├── StringCopy.h
│   │   │   │   ├── StyleContext.cpp
│   │   │   │   ├── StyleContext.h
│   │   │   │   ├── SubStyles.h
│   │   │   │   ├── WordList.cpp
│   │   │   │   └── WordList.h
│   │   │   ├── qscintilla.pri
│   │   │   └── src/
│   │   │       ├── AutoComplete.cpp
│   │   │       ├── AutoComplete.h
│   │   │       ├── CallTip.cpp
│   │   │       ├── CallTip.h
│   │   │       ├── CaseConvert.cpp
│   │   │       ├── CaseConvert.h
│   │   │       ├── CaseFolder.cpp
│   │   │       ├── CaseFolder.h
│   │   │       ├── Catalogue.cpp
│   │   │       ├── Catalogue.h
│   │   │       ├── CellBuffer.cpp
│   │   │       ├── CellBuffer.h
│   │   │       ├── CharClassify.cpp
│   │   │       ├── CharClassify.h
│   │   │       ├── ContractionState.cpp
│   │   │       ├── ContractionState.h
│   │   │       ├── Decoration.cpp
│   │   │       ├── Decoration.h
│   │   │       ├── Document.cpp
│   │   │       ├── Document.h
│   │   │       ├── EditModel.cpp
│   │   │       ├── EditModel.h
│   │   │       ├── EditView.cpp
│   │   │       ├── EditView.h
│   │   │       ├── Editor.cpp
│   │   │       ├── Editor.h
│   │   │       ├── ExternalLexer.cpp
│   │   │       ├── ExternalLexer.h
│   │   │       ├── FontQuality.h
│   │   │       ├── Indicator.cpp
│   │   │       ├── Indicator.h
│   │   │       ├── KeyMap.cpp
│   │   │       ├── KeyMap.h
│   │   │       ├── License.txt
│   │   │       ├── LineMarker.cpp
│   │   │       ├── LineMarker.h
│   │   │       ├── MarginView.cpp
│   │   │       ├── MarginView.h
│   │   │       ├── Partitioning.h
│   │   │       ├── PerLine.cpp
│   │   │       ├── PerLine.h
│   │   │       ├── Position.h
│   │   │       ├── PositionCache.cpp
│   │   │       ├── PositionCache.h
│   │   │       ├── RESearch.cpp
│   │   │       ├── RESearch.h
│   │   │       ├── RunStyles.cpp
│   │   │       ├── RunStyles.h
│   │   │       ├── SciTE.properties
│   │   │       ├── ScintillaBase.cpp
│   │   │       ├── ScintillaBase.h
│   │   │       ├── Selection.cpp
│   │   │       ├── Selection.h
│   │   │       ├── SparseVector.h
│   │   │       ├── SplitVector.h
│   │   │       ├── Style.cpp
│   │   │       ├── Style.h
│   │   │       ├── UniConversion.cpp
│   │   │       ├── UniConversion.h
│   │   │       ├── UnicodeFromUTF8.h
│   │   │       ├── ViewStyle.cpp
│   │   │       ├── ViewStyle.h
│   │   │       ├── XPM.cpp
│   │   │       └── XPM.h
│   │   └── qtc_gdbmi/
│   │       ├── gdbmi.cpp
│   │       ├── gdbmi.h
│   │       └── qtc_gdbmi.pri
│   ├── aboutdialog.cpp
│   ├── aboutdialog.h
│   ├── aboutdialog.ui
│   ├── appconfig.cpp
│   ├── appconfig.h
│   ├── bannerwidget.cpp
│   ├── bannerwidget.h
│   ├── bannerwidget.ui
│   ├── clangcodecontext.cpp
│   ├── clangcodecontext.h
│   ├── codeeditor.cpp
│   ├── codeeditor.h
│   ├── codetemplate.cpp
│   ├── codetemplate.h
│   ├── combodocumentview.cpp
│   ├── combodocumentview.h
│   ├── componentitemwidget.cpp
│   ├── componentitemwidget.h
│   ├── componentitemwidget.ui
│   ├── componentsdialog.cpp
│   ├── componentsdialog.h
│   ├── componentsdialog.ui
│   ├── configdialog.cpp
│   ├── configdialog.h
│   ├── configdialog.ui
│   ├── debugui.cpp
│   ├── debugui.h
│   ├── debugui.ui
│   ├── dialogconfigworkspace.cpp
│   ├── dialogconfigworkspace.h
│   ├── dialogconfigworkspace.ui
│   ├── documentarea.cpp
│   ├── documentarea.h
│   ├── editorwidget.ui
│   ├── embedded-ide.desktop
│   ├── etags.cpp
│   ├── etags.h
│   ├── filedownloader.cpp
│   ├── filedownloader.h
│   ├── filepropertiesdialog.cpp
│   ├── filepropertiesdialog.h
│   ├── filepropertiesdialog.ui
│   ├── findinfilesdialog.cpp
│   ├── findinfilesdialog.h
│   ├── findinfilesdialog.ui
│   ├── findlineedit.cpp
│   ├── findlineedit.h
│   ├── formfindreplace.cpp
│   ├── formfindreplace.h
│   ├── formfindreplace.ui
│   ├── gdbstartdialog.cpp
│   ├── gdbstartdialog.h
│   ├── gdbstartdialog.ui
│   ├── i18n/
│   │   ├── es.ts
│   │   └── zh.ts
│   ├── ide.pro
│   ├── loggerwidget.cpp
│   ├── loggerwidget.h
│   ├── main.cpp
│   ├── mainmenuwidget.cpp
│   ├── mainmenuwidget.h
│   ├── mainmenuwidget.ui
│   ├── mainwindow.cpp
│   ├── mainwindow.h
│   ├── mainwindow.ui
│   ├── make2compilationdb.sh
│   ├── makefileinfo.cpp
│   ├── makefileinfo.h
│   ├── mapviewer.cpp
│   ├── mapviewer.h
│   ├── mapviewer.ui
│   ├── passwordpromtdialog.cpp
│   ├── passwordpromtdialog.h
│   ├── passwordpromtdialog.ui
│   ├── projectexporter.cpp
│   ├── projectexporter.h
│   ├── projecticonprovider.cpp
│   ├── projecticonprovider.h
│   ├── projectnewdialog.cpp
│   ├── projectnewdialog.h
│   ├── projectnewdialog.ui
│   ├── projectview.cpp
│   ├── projectview.h
│   ├── projectview.ui
│   ├── projetfromtemplate.cpp
│   ├── projetfromtemplate.h
│   ├── qsvtextoperationswidget.cpp
│   ├── qsvtextoperationswidget.h
│   ├── qtdialog/
│   │   ├── main.cpp
│   │   └── qtdialog.pro
│   ├── replaceform.ui
│   ├── resources/
│   │   ├── project-filters.txt
│   │   ├── reference-code.c
│   │   ├── resources.qrc
│   │   ├── style.css
│   │   ├── styles/
│   │   │   ├── Bespin.xml
│   │   │   ├── Black board.xml
│   │   │   ├── Choco.xml
│   │   │   ├── Deep Black.xml
│   │   │   ├── Default.xml
│   │   │   ├── Hello Kitty.xml
│   │   │   ├── HotFudgeSundae.xml
│   │   │   ├── Material-Dark.xml
│   │   │   ├── Mono Industrial.xml
│   │   │   ├── Monokai.xml
│   │   │   ├── MossyLawn.xml
│   │   │   ├── Navajo.xml
│   │   │   ├── Obsidian.xml
│   │   │   ├── Plastic Code Wrap.xml
│   │   │   ├── Ruby Blue.xml
│   │   │   ├── Solarized-light.xml
│   │   │   ├── Solarized.xml
│   │   │   ├── Twilight.xml
│   │   │   ├── Vibrant Ink.xml
│   │   │   ├── Zenburn.xml
│   │   │   ├── khaki.xml
│   │   │   └── vim Dark Blue.xml
│   │   └── templates/
│   │       ├── empty.template
│   │       ├── gcc-exec.template
│   │       ├── lpcopen-picociaa.template
│   │       ├── lpcopen.template
│   │       └── sAPI-Project.template
│   ├── searchform.ui
│   ├── skeleton/
│   │   ├── bin/
│   │   │   ├── ftdi_rules.sh
│   │   │   └── qt.conf
│   │   ├── desktop-integration.sh
│   │   ├── embedded-ide.hardconf
│   │   ├── embedded-ide.sh
│   │   ├── embedded-ide.sh.wrapper
│   │   └── ftdi-tools.sh
│   ├── taglist.cpp
│   ├── taglist.h
│   ├── targetupdatediscover.cpp
│   ├── targetupdatediscover.h
│   ├── templatedownloader.cpp
│   ├── templatedownloader.h
│   ├── templatesdownloadselector.cpp
│   ├── templatesdownloadselector.h
│   ├── templatesdownloadselector.ui
│   ├── toolmanager.cpp
│   ├── toolmanager.h
│   ├── toolmanager.ui
│   ├── version.cpp
│   └── version.h
├── qtshdialog/
│   ├── 3rdpart/
│   │   └── QJsonModel/
│   │       ├── LICENSE
│   │       ├── QJsonModel.pri
│   │       ├── QJsonModel.pro
│   │       ├── README.md
│   │       ├── main.cpp
│   │       ├── qjsonmodel.cpp
│   │       ├── qjsonmodel.h
│   │       └── qjsonmodel.py
│   ├── main.cpp
│   └── qtshdialog.pro
└── socketwaiter/
    ├── .gitignore
    ├── LICENSE
    ├── README.md
    ├── main.cpp
    └── socketwaiter.pro

================================================
FILE CONTENTS
================================================

================================================
FILE: .gitignore
================================================
*.o
*.d
*.elf
*.moc
moc_*.cpp
ui_*.h
*.pro.user


================================================
FILE: .travis.yml
================================================
language: cpp
sudo: required
dist: xenial

os: linux

env:
  global:
    - DISPLAY=:99
    - MXE_TRIPLE=i686-w64-mingw32.shared

before_install:
  - chmod a+x ./ci/tests-environment.sh
  - ./ci/tests-environment.sh

script:
 - chmod a+x ./ci/tests-ci.sh
 - ./ci/tests-ci.sh

after_success:
  - wget -c https://github.com/probonopd/uploadtool/raw/master/upload.sh
  # quick fix for issue 223
  - if [ "$TRAVIS_TAG" != "$TRAVIS_BRANCH" ] && [ "$TRAVIS_BRANCH" != "master" ]; then export TRAVIS_EVENT_TYPE=pull_request; fi
  - bash ./upload.sh ./Embedded_IDE-*.AppImage ./Embedded_IDE-*.zip ./Embedded_IDE-*.tar.bz2

branches:
  except:
    - # Do not build tags that we create when we upload to GitHub Releases
    - /^(?i:continuous)$/


================================================
FILE: 3rdpart/astyle/ASBeautifier.cpp
================================================
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 *   ASBeautifier.cpp
 *
 *   Copyright (C) 2014 by Jim Pattee
 *   <http://www.gnu.org/licenses/lgpl-3.0.html>
 *
 *   This file is a part of Artistic Style - an indentation and
 *   reformatting tool for C, C++, C# and Java source files.
 *   <http://astyle.sourceforge.net>
 *
 *   Artistic Style is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU Lesser General Public License as published
 *   by the Free Software Foundation, either version 3 of the License, or
 *   (at your option) any later version.
 *
 *   Artistic Style is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU Lesser General Public License for more details.
 *
 *   You should have received a copy of the GNU Lesser General Public License
 *   along with Artistic Style.  If not, see <http://www.gnu.org/licenses/>.
 *
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 */

#include "astyle.h"

#include <algorithm>


namespace astyle {

// this must be global
static int g_preprocessorCppExternCBracket;

/**
 * ASBeautifier's constructor
 * This constructor is called only once for each source file.
 * The cloned ASBeautifier objects are created with the copy constructor.
 */
ASBeautifier::ASBeautifier()
{
	g_preprocessorCppExternCBracket = 0;

	waitingBeautifierStack = NULL;
	activeBeautifierStack = NULL;
	waitingBeautifierStackLengthStack = NULL;
	activeBeautifierStackLengthStack = NULL;

	headerStack = NULL;
	tempStacks = NULL;
	blockParenDepthStack = NULL;
	blockStatementStack = NULL;
	parenStatementStack = NULL;
	bracketBlockStateStack = NULL;
	inStatementIndentStack = NULL;
	inStatementIndentStackSizeStack = NULL;
	parenIndentStack = NULL;
	preprocIndentStack = NULL;
	sourceIterator = NULL;
	isModeManuallySet = false;
	shouldForceTabIndentation = false;
	setSpaceIndentation(4);
	setMinConditionalIndentOption(MINCOND_TWO);
	setMaxInStatementIndentLength(40);
	classInitializerIndents = 1;
	tabLength = 0;
	setClassIndent(false);
	setModifierIndent(false);
	setSwitchIndent(false);
	setCaseIndent(false);
	setBlockIndent(false);
	setBracketIndent(false);
	setBracketIndentVtk(false);
	setNamespaceIndent(false);
	setLabelIndent(false);
	setEmptyLineFill(false);
	setCStyle();
	setPreprocDefineIndent(false);
	setPreprocConditionalIndent(false);
	setAlignMethodColon(false);

	// initialize ASBeautifier member vectors
	beautifierFileType = 9;		// reset to an invalid type
	headers = new vector<const string*>;
	nonParenHeaders = new vector<const string*>;
	assignmentOperators = new vector<const string*>;
	nonAssignmentOperators = new vector<const string*>;
	preBlockStatements = new vector<const string*>;
	preCommandHeaders = new vector<const string*>;
	indentableHeaders = new vector<const string*>;
}

/**
 * ASBeautifier's copy constructor
 * Copy the vector objects to vectors in the new ASBeautifier
 * object so the new object can be destroyed without deleting
 * the vector objects in the copied vector.
 * This is the reason a copy constructor is needed.
 *
 * Must explicitly call the base class copy constructor.
 */
ASBeautifier::ASBeautifier(const ASBeautifier &other) : ASBase(other)
{
	// these don't need to copy the stack
	waitingBeautifierStack = NULL;
	activeBeautifierStack = NULL;
	waitingBeautifierStackLengthStack = NULL;
	activeBeautifierStackLengthStack = NULL;

	// vector '=' operator performs a DEEP copy of all elements in the vector

	headerStack = new vector<const string*>;
	*headerStack = *other.headerStack;

	tempStacks = copyTempStacks(other);

	blockParenDepthStack = new vector<int>;
	*blockParenDepthStack = *other.blockParenDepthStack;

	blockStatementStack = new vector<bool>;
	*blockStatementStack = *other.blockStatementStack;

	parenStatementStack = new vector<bool>;
	*parenStatementStack = *other.parenStatementStack;

	bracketBlockStateStack = new vector<bool>;
	*bracketBlockStateStack = *other.bracketBlockStateStack;

	inStatementIndentStack = new vector<int>;
	*inStatementIndentStack = *other.inStatementIndentStack;

	inStatementIndentStackSizeStack = new vector<int>;
	*inStatementIndentStackSizeStack = *other.inStatementIndentStackSizeStack;

	parenIndentStack = new vector<int>;
	*parenIndentStack = *other.parenIndentStack;

	preprocIndentStack = new vector<pair<int, int> >;
	*preprocIndentStack = *other.preprocIndentStack;

	// Copy the pointers to vectors.
	// This is ok because the original ASBeautifier object
	// is not deleted until end of job.
	beautifierFileType = other.beautifierFileType;
	headers = other.headers;
	nonParenHeaders = other.nonParenHeaders;
	assignmentOperators = other.assignmentOperators;
	nonAssignmentOperators = other.nonAssignmentOperators;
	preBlockStatements = other.preBlockStatements;
	preCommandHeaders = other.preCommandHeaders;
	indentableHeaders = other.indentableHeaders;

	// protected variables
	// variables set by ASFormatter
	// must also be updated in activeBeautifierStack
	inLineNumber = other.inLineNumber;
	horstmannIndentInStatement = other.horstmannIndentInStatement;
	nonInStatementBracket = other.nonInStatementBracket;
	lineCommentNoBeautify = other.lineCommentNoBeautify;
	isElseHeaderIndent = other.isElseHeaderIndent;
	isCaseHeaderCommentIndent = other.isCaseHeaderCommentIndent;
	isNonInStatementArray = other.isNonInStatementArray;
	isSharpAccessor = other.isSharpAccessor;
	isSharpDelegate = other.isSharpDelegate;
	isInExternC = other.isInExternC;
	isInBeautifySQL = other.isInBeautifySQL;
	isInIndentableStruct = other.isInIndentableStruct;
	isInIndentablePreproc = other.isInIndentablePreproc;

	// private variables
	sourceIterator = other.sourceIterator;
	currentHeader = other.currentHeader;
	previousLastLineHeader = other.previousLastLineHeader;
	probationHeader = other.probationHeader;
	lastLineHeader = other.lastLineHeader;
	indentString = other.indentString;
	verbatimDelimiter = other.verbatimDelimiter;
	isInQuote = other.isInQuote;
	isInVerbatimQuote = other.isInVerbatimQuote;
	haveLineContinuationChar = other.haveLineContinuationChar;
	isInAsm = other.isInAsm;
	isInAsmOneLine = other.isInAsmOneLine;
	isInAsmBlock = other.isInAsmBlock;
	isInComment = other.isInComment;
	isInPreprocessorComment = other.isInPreprocessorComment;
	isInHorstmannComment = other.isInHorstmannComment;
	isInCase = other.isInCase;
	isInQuestion = other.isInQuestion;
	isInStatement = other.isInStatement;
	isInHeader = other.isInHeader;
	isInTemplate = other.isInTemplate;
	isInDefine = other.isInDefine;
	isInDefineDefinition = other.isInDefineDefinition;
	classIndent = other.classIndent;
	isIndentModeOff = other.isIndentModeOff;
	isInClassHeader = other.isInClassHeader;
	isInClassHeaderTab = other.isInClassHeaderTab;
	isInClassInitializer = other.isInClassInitializer;
	isInClass = other.isInClass;
	isInObjCMethodDefinition = other.isInObjCMethodDefinition;
	isImmediatelyPostObjCMethodDefinition = other.isImmediatelyPostObjCMethodDefinition;
	isInIndentablePreprocBlock = other.isInIndentablePreprocBlock;
	isInObjCInterface = other.isInObjCInterface;
	isInEnum = other.isInEnum;
	isInEnumTypeID = other.isInEnumTypeID;
	isInLet = other.isInLet;
	modifierIndent = other.modifierIndent;
	switchIndent = other.switchIndent;
	caseIndent = other.caseIndent;
	namespaceIndent = other.namespaceIndent;
	bracketIndent = other.bracketIndent;
	bracketIndentVtk = other.bracketIndentVtk;
	blockIndent = other.blockIndent;
	labelIndent = other.labelIndent;
	isInConditional = other.isInConditional;
	isModeManuallySet = other.isModeManuallySet;
	shouldForceTabIndentation = other.shouldForceTabIndentation;
	emptyLineFill = other.emptyLineFill;
	lineOpensWithLineComment = other.lineOpensWithLineComment;
	lineOpensWithComment = other.lineOpensWithComment;
	lineStartsInComment = other.lineStartsInComment;
	backslashEndsPrevLine = other.backslashEndsPrevLine;
	blockCommentNoIndent = other.blockCommentNoIndent;
	blockCommentNoBeautify = other.blockCommentNoBeautify;
	previousLineProbationTab = other.previousLineProbationTab;
	lineBeginsWithOpenBracket = other.lineBeginsWithOpenBracket;
	lineBeginsWithCloseBracket = other.lineBeginsWithCloseBracket;
	lineBeginsWithComma = other.lineBeginsWithComma;
	lineIsCommentOnly = other.lineIsCommentOnly;
	lineIsLineCommentOnly = other.lineIsLineCommentOnly;
	shouldIndentBrackettedLine = other.shouldIndentBrackettedLine;
	isInSwitch = other.isInSwitch;
	foundPreCommandHeader = other.foundPreCommandHeader;
	foundPreCommandMacro = other.foundPreCommandMacro;
	shouldAlignMethodColon = other.shouldAlignMethodColon;
	shouldIndentPreprocDefine = other.shouldIndentPreprocDefine;
	shouldIndentPreprocConditional = other.shouldIndentPreprocConditional;
	indentCount = other.indentCount;
	spaceIndentCount = other.spaceIndentCount;
	spaceIndentObjCMethodDefinition = other.spaceIndentObjCMethodDefinition;
	colonIndentObjCMethodDefinition = other.colonIndentObjCMethodDefinition;
	lineOpeningBlocksNum = other.lineOpeningBlocksNum;
	lineClosingBlocksNum = other.lineClosingBlocksNum;
	fileType = other.fileType;
	minConditionalOption = other.minConditionalOption;
	minConditionalIndent = other.minConditionalIndent;
	parenDepth = other.parenDepth;
	indentLength = other.indentLength;
	tabLength = other.tabLength;
	blockTabCount = other.blockTabCount;
	maxInStatementIndent = other.maxInStatementIndent;
	classInitializerIndents = other.classInitializerIndents;
	templateDepth = other.templateDepth;
	squareBracketCount = other.squareBracketCount;
	prevFinalLineSpaceIndentCount = other.prevFinalLineSpaceIndentCount;
	prevFinalLineIndentCount = other.prevFinalLineIndentCount;
	defineIndentCount = other.defineIndentCount;
	preprocBlockIndent = other.preprocBlockIndent;
	quoteChar = other.quoteChar;
	prevNonSpaceCh = other.prevNonSpaceCh;
	currentNonSpaceCh = other.currentNonSpaceCh;
	currentNonLegalCh = other.currentNonLegalCh;
	prevNonLegalCh = other.prevNonLegalCh;
}

/**
 * ASBeautifier's destructor
 */
ASBeautifier::~ASBeautifier()
{
	deleteBeautifierContainer(waitingBeautifierStack);
	deleteBeautifierContainer(activeBeautifierStack);
	deleteContainer(waitingBeautifierStackLengthStack);
	deleteContainer(activeBeautifierStackLengthStack);
	deleteContainer(headerStack);
	deleteTempStacksContainer(tempStacks);
	deleteContainer(blockParenDepthStack);
	deleteContainer(blockStatementStack);
	deleteContainer(parenStatementStack);
	deleteContainer(bracketBlockStateStack);
	deleteContainer(inStatementIndentStack);
	deleteContainer(inStatementIndentStackSizeStack);
	deleteContainer(parenIndentStack);
	deleteContainer(preprocIndentStack);
}

/**
 * initialize the ASBeautifier.
 *
 * This init() should be called every time a ABeautifier object is to start
 * beautifying a NEW source file.
 * It is called only when a new ASFormatter object is created.
 * init() receives a pointer to a ASSourceIterator object that will be
 * used to iterate through the source code.
 *
 * @param iter     a pointer to the ASSourceIterator or ASStreamIterator object.
 */
void ASBeautifier::init(ASSourceIterator* iter)
{
	sourceIterator = iter;
	initVectors();
	ASBase::init(getFileType());

	initContainer(waitingBeautifierStack, new vector<ASBeautifier*>);
	initContainer(activeBeautifierStack, new vector<ASBeautifier*>);

	initContainer(waitingBeautifierStackLengthStack, new vector<int>);
	initContainer(activeBeautifierStackLengthStack, new vector<int>);

	initContainer(headerStack, new vector<const string*>);

	initTempStacksContainer(tempStacks, new vector<vector<const string*>*>);
	tempStacks->push_back(new vector<const string*>);

	initContainer(blockParenDepthStack, new vector<int>);
	initContainer(blockStatementStack, new vector<bool>);
	initContainer(parenStatementStack, new vector<bool>);
	initContainer(bracketBlockStateStack, new vector<bool>);
	bracketBlockStateStack->push_back(true);
	initContainer(inStatementIndentStack, new vector<int>);
	initContainer(inStatementIndentStackSizeStack, new vector<int>);
	inStatementIndentStackSizeStack->push_back(0);
	initContainer(parenIndentStack, new vector<int>);
	initContainer(preprocIndentStack, new vector<pair<int, int> >);

	previousLastLineHeader = NULL;
	currentHeader = NULL;

	isInQuote = false;
	isInVerbatimQuote = false;
	haveLineContinuationChar = false;
	isInAsm = false;
	isInAsmOneLine = false;
	isInAsmBlock = false;
	isInComment = false;
	isInPreprocessorComment = false;
	isInHorstmannComment = false;
	isInStatement = false;
	isInCase = false;
	isInQuestion = false;
	isIndentModeOff = false;
	isInClassHeader = false;
	isInClassHeaderTab = false;
	isInClassInitializer = false;
	isInClass = false;
	isInObjCMethodDefinition = false;
	isImmediatelyPostObjCMethodDefinition = false;
	isInIndentablePreprocBlock = false;
	isInObjCInterface = false;
	isInEnum = false;
	isInEnumTypeID = false;
	isInLet = false;
	isInHeader = false;
	isInTemplate = false;
	isInConditional = false;

	indentCount = 0;
	spaceIndentCount = 0;
	spaceIndentObjCMethodDefinition = 0;
	colonIndentObjCMethodDefinition = 0;
	lineOpeningBlocksNum = 0;
	lineClosingBlocksNum = 0;
	templateDepth = 0;
	squareBracketCount = 0;
	parenDepth = 0;
	blockTabCount = 0;
	prevFinalLineSpaceIndentCount = 0;
	prevFinalLineIndentCount = 0;
	defineIndentCount = 0;
	preprocBlockIndent = 0;
	prevNonSpaceCh = '{';
	currentNonSpaceCh = '{';
	prevNonLegalCh = '{';
	currentNonLegalCh = '{';
	quoteChar = ' ';
	probationHeader = NULL;
	lastLineHeader = NULL;
	backslashEndsPrevLine = false;
	lineOpensWithLineComment = false;
	lineOpensWithComment = false;
	lineStartsInComment = false;
	isInDefine = false;
	isInDefineDefinition = false;
	lineCommentNoBeautify = false;
	isElseHeaderIndent = false;
	isCaseHeaderCommentIndent = false;
	blockCommentNoIndent = false;
	blockCommentNoBeautify = false;
	previousLineProbationTab = false;
	lineBeginsWithOpenBracket = false;
	lineBeginsWithCloseBracket = false;
	lineBeginsWithComma = false;
	lineIsCommentOnly = false;
	lineIsLineCommentOnly = false;
	shouldIndentBrackettedLine = true;
	isInSwitch = false;
	foundPreCommandHeader = false;
	foundPreCommandMacro = false;

	isNonInStatementArray = false;
	isSharpAccessor = false;
	isSharpDelegate = false;
	isInExternC = false;
	isInBeautifySQL = false;
	isInIndentableStruct = false;
	isInIndentablePreproc = false;
	inLineNumber = 0;
	horstmannIndentInStatement = 0;
	nonInStatementBracket = 0;
}

/*
 * initialize the vectors
 */
void ASBeautifier::initVectors()
{
	if (fileType == beautifierFileType)    // don't build unless necessary
		return;

	beautifierFileType = fileType;

	headers->clear();
	nonParenHeaders->clear();
	assignmentOperators->clear();
	nonAssignmentOperators->clear();
	preBlockStatements->clear();
	preCommandHeaders->clear();
	indentableHeaders->clear();

	ASResource::buildHeaders(headers, fileType, true);
	ASResource::buildNonParenHeaders(nonParenHeaders, fileType, true);
	ASResource::buildAssignmentOperators(assignmentOperators);
	ASResource::buildNonAssignmentOperators(nonAssignmentOperators);
	ASResource::buildPreBlockStatements(preBlockStatements, fileType);
	ASResource::buildPreCommandHeaders(preCommandHeaders, fileType);
	ASResource::buildIndentableHeaders(indentableHeaders);
}

/**
 * set indentation style to C/C++.
 */
void ASBeautifier::setCStyle()
{
	fileType = C_TYPE;
}

/**
 * set indentation style to Java.
 */
void ASBeautifier::setJavaStyle()
{
	fileType = JAVA_TYPE;
}

/**
 * set indentation style to C#.
 */
void ASBeautifier::setSharpStyle()
{
	fileType = SHARP_TYPE;
}

/**
 * set mode manually set flag
 */
void ASBeautifier::setModeManuallySet(bool state)
{
	isModeManuallySet = state;
}

/**
 * set tabLength equal to indentLength.
 * This is done when tabLength is not explicitly set by
 * "indent=force-tab-x"
 *
 */
void ASBeautifier::setDefaultTabLength()
{
	tabLength = indentLength;
}

/**
 * indent using a different tab setting for indent=force-tab
 *
 * @param   length     number of spaces per tab.
 */
void ASBeautifier::setForceTabXIndentation(int length)
{
	// set tabLength instead of indentLength
	indentString = "\t";
	tabLength = length;
	shouldForceTabIndentation = true;
}

/**
 * indent using one tab per indentation
 */
void ASBeautifier::setTabIndentation(int length, bool forceTabs)
{
	indentString = "\t";
	indentLength = length;
	shouldForceTabIndentation = forceTabs;
}

/**
 * indent using a number of spaces per indentation.
 *
 * @param   length     number of spaces per indent.
 */
void ASBeautifier::setSpaceIndentation(int length)
{
	indentString = string(length, ' ');
	indentLength = length;
}

/**
 * set the maximum indentation between two lines in a multi-line statement.
 *
 * @param   max     maximum indentation length.
 */
void ASBeautifier::setMaxInStatementIndentLength(int max)
{
	maxInStatementIndent = max;
}

/**
 * set the minimum conditional indentation option.
 *
 * @param   min     minimal indentation option.
 */
void ASBeautifier::setMinConditionalIndentOption(int min)
{
	minConditionalOption = min;
}

/**
 * set minConditionalIndent from the minConditionalOption.
 */
void ASBeautifier::setMinConditionalIndentLength()
{
	if (minConditionalOption == MINCOND_ZERO)
		minConditionalIndent = 0;
	else if (minConditionalOption == MINCOND_ONE)
		minConditionalIndent = indentLength;
	else if (minConditionalOption == MINCOND_ONEHALF)
		minConditionalIndent = indentLength / 2;
	// minConditionalOption = INDENT_TWO
	else
		minConditionalIndent = indentLength * 2;
}

/**
 * set the state of the bracket indent option. If true, brackets will
 * be indented one additional indent.
 *
 * @param   state             state of option.
 */
void ASBeautifier::setBracketIndent(bool state)
{
	bracketIndent = state;
}

/**
* set the state of the bracket indent VTK option. If true, brackets will
* be indented one additional indent, except for the opening bracket.
*
* @param   state             state of option.
*/
void ASBeautifier::setBracketIndentVtk(bool state)
{
	// need to set both of these
	setBracketIndent(state);
	bracketIndentVtk = state;
}

/**
 * set the state of the block indentation option. If true, entire blocks
 * will be indented one additional indent, similar to the GNU indent style.
 *
 * @param   state             state of option.
 */
void ASBeautifier::setBlockIndent(bool state)
{
	blockIndent = state;
}

/**
 * set the state of the class indentation option. If true, C++ class
 * definitions will be indented one additional indent.
 *
 * @param   state             state of option.
 */
void ASBeautifier::setClassIndent(bool state)
{
	classIndent = state;
}

/**
 * set the state of the modifier indentation option. If true, C++ class
 * access modifiers will be indented one-half an indent.
 *
 * @param   state             state of option.
 */
void ASBeautifier::setModifierIndent(bool state)
{
	modifierIndent = state;
}

/**
 * set the state of the switch indentation option. If true, blocks of 'switch'
 * statements will be indented one additional indent.
 *
 * @param   state             state of option.
 */
void ASBeautifier::setSwitchIndent(bool state)
{
	switchIndent = state;
}

/**
 * set the state of the case indentation option. If true, lines of 'case'
 * statements will be indented one additional indent.
 *
 * @param   state             state of option.
 */
void ASBeautifier::setCaseIndent(bool state)
{
	caseIndent = state;
}

/**
 * set the state of the namespace indentation option.
 * If true, blocks of 'namespace' statements will be indented one
 * additional indent. Otherwise, NO indentation will be added.
 *
 * @param   state             state of option.
 */
void ASBeautifier::setNamespaceIndent(bool state)
{
	namespaceIndent = state;
}

/**
 * set the state of the label indentation option.
 * If true, labels will be indented one indent LESS than the
 * current indentation level.
 * If false, labels will be flushed to the left with NO
 * indent at all.
 *
 * @param   state             state of option.
 */
void ASBeautifier::setLabelIndent(bool state)
{
	labelIndent = state;
}

/**
 * set the state of the preprocessor indentation option.
 * If true, multi-line #define statements will be indented.
 *
 * @param   state             state of option.
 */
void ASBeautifier::setPreprocDefineIndent(bool state)
{
	shouldIndentPreprocDefine = state;
}

void ASBeautifier::setPreprocConditionalIndent(bool state)
{
	shouldIndentPreprocConditional = state;
}

/**
 * set the state of the empty line fill option.
 * If true, empty lines will be filled with the whitespace.
 * of their previous lines.
 * If false, these lines will remain empty.
 *
 * @param   state             state of option.
 */
void ASBeautifier::setEmptyLineFill(bool state)
{
	emptyLineFill = state;
}

void ASBeautifier::setAlignMethodColon(bool state)
{
	shouldAlignMethodColon = state;
}

/**
 * get the file type.
 */
int ASBeautifier::getFileType() const
{
	return fileType;
}

/**
 * get the number of spaces per indent
 *
 * @return   value of indentLength option.
 */
int ASBeautifier::getIndentLength(void) const
{
	return indentLength;
}

/**
 * get the char used for indentation, space or tab
 *
 * @return   the char used for indentation.
 */
string ASBeautifier::getIndentString(void) const
{
	return indentString;
}

/**
 * get mode manually set flag
 */
bool ASBeautifier::getModeManuallySet() const
{
	return isModeManuallySet;
}

/**
 * get the state of the force tab indentation option.
 *
 * @return   state of force tab indentation.
 */
bool ASBeautifier::getForceTabIndentation(void) const
{
	return shouldForceTabIndentation;
}

/**
 * get the state of the block indentation option.
 *
 * @return   state of blockIndent option.
 */
bool ASBeautifier::getBlockIndent(void) const
{
	return blockIndent;
}

/**
 * get the state of the bracket indentation option.
 *
 * @return   state of bracketIndent option.
 */
bool ASBeautifier::getBracketIndent(void) const
{
	return bracketIndent;
}

/**
* Get the state of the namespace indentation option. If true, blocks
* of the 'namespace' statement will be indented one additional indent.
*
* @return   state of namespaceIndent option.
*/
bool ASBeautifier::getNamespaceIndent(void) const
{
	return namespaceIndent;
}

/**
 * Get the state of the class indentation option. If true, blocks of
 * the 'class' statement will be indented one additional indent.
 *
 * @return   state of classIndent option.
 */
bool ASBeautifier::getClassIndent(void) const
{
	return classIndent;
}

/**
 * Get the state of the class access modifier indentation option.
 * If true, the class access modifiers will be indented one-half indent.
 *
 * @return   state of modifierIndent option.
 */
bool ASBeautifier::getModifierIndent(void) const
{
	return modifierIndent;
}

/**
 * get the state of the switch indentation option. If true, blocks of
 * the 'switch' statement will be indented one additional indent.
 *
 * @return   state of switchIndent option.
 */
bool ASBeautifier::getSwitchIndent(void) const
{
	return switchIndent;
}

/**
 * get the state of the case indentation option. If true, lines of 'case'
 * statements will be indented one additional indent.
 *
 * @return   state of caseIndent option.
 */
bool ASBeautifier::getCaseIndent(void) const
{
	return caseIndent;
}

/**
 * get the state of the empty line fill option.
 * If true, empty lines will be filled with the whitespace.
 * of their previous lines.
 * If false, these lines will remain empty.
 *
 * @return   state of emptyLineFill option.
 */
bool ASBeautifier::getEmptyLineFill(void) const
{
	return emptyLineFill;
}

/**
 * get the state of the preprocessor indentation option.
 * If true, preprocessor "define" lines will be indented.
 * If false, preprocessor "define" lines will be unchanged.
 *
 * @return   state of shouldIndentPreprocDefine option.
 */
bool ASBeautifier::getPreprocDefineIndent(void) const
{
	return shouldIndentPreprocDefine;
}

/**
 * get the length of the tab indentation option.
 *
 * @return   length of tab indent option.
 */
int ASBeautifier::getTabLength(void) const
{
	return tabLength;
}

/**
 * beautify a line of source code.
 * every line of source code in a source code file should be sent
 * one after the other to the beautify method.
 *
 * @return      the indented line.
 * @param originalLine       the original unindented line.
 */
string ASBeautifier::beautify(const string &originalLine)
{
	string line;
	bool isInQuoteContinuation = isInVerbatimQuote | haveLineContinuationChar;

	currentHeader = NULL;
	lastLineHeader = NULL;
	blockCommentNoBeautify = blockCommentNoIndent;
	isInClass = false;
	isInSwitch = false;
	lineBeginsWithOpenBracket = false;
	lineBeginsWithCloseBracket = false;
	lineBeginsWithComma = false;
	lineIsCommentOnly = false;
	lineIsLineCommentOnly = false;
	shouldIndentBrackettedLine = true;
	isInAsmOneLine = false;
	lineOpensWithLineComment = false;
	lineOpensWithComment = false;
	lineStartsInComment = isInComment;
	previousLineProbationTab = false;
	haveLineContinuationChar = false;
	lineOpeningBlocksNum = 0;
	lineClosingBlocksNum = 0;
	if (isImmediatelyPostObjCMethodDefinition)
		clearObjCMethodDefinitionAlignment();

	// handle and remove white spaces around the line:
	// If not in comment, first find out size of white space before line,
	// so that possible comments starting in the line continue in
	// relation to the preliminary white-space.
	if (isInQuoteContinuation)
	{
		// trim a single space added by ASFormatter, otherwise leave it alone
		if (!(originalLine.length() == 1 && originalLine[0] == ' '))
			line = originalLine;
	}
	else if (isInComment || isInBeautifySQL)
	{
		// trim the end of comment and SQL lines
		line = originalLine;
		size_t trimEnd = line.find_last_not_of(" \t");
		if (trimEnd == string::npos)
			trimEnd = 0;
		else
			trimEnd++;
		if (trimEnd < line.length())
			line.erase(trimEnd);
		// does a bracket open the line
		size_t firstChar = line.find_first_not_of(" \t");
		if (firstChar != string::npos)
		{
			if (line[firstChar] == '{')
				lineBeginsWithOpenBracket = true;
			else if (line[firstChar] == '}')
				lineBeginsWithCloseBracket = true;
			else if (line[firstChar] == ',')
				lineBeginsWithComma = true;
		}
	}
	else
	{
		line = trim(originalLine);
		if (line.length() > 0)
		{
			if (line[0] == '{')
				lineBeginsWithOpenBracket = true;
			else if (line[0] == '}')
				lineBeginsWithCloseBracket = true;
			else if (line[0] == ',')
				lineBeginsWithComma = true;
			else if (line.compare(0, 2, "//") == 0)
				lineIsLineCommentOnly = true;
			else if (line.compare(0, 2, "/*") == 0)
			{
				if (line.find("*/", 2) != string::npos)
					lineIsCommentOnly = true;
			}
		}

		isInHorstmannComment = false;
		size_t j = line.find_first_not_of(" \t{");
		if (j != string::npos && line.compare(j, 2, "//") == 0)
			lineOpensWithLineComment = true;
		if (j != string::npos && line.compare(j, 2, "/*") == 0)
		{
			lineOpensWithComment = true;
			size_t k = line.find_first_not_of(" \t");
			if (k != string::npos && line.compare(k, 1, "{") == 0)
				isInHorstmannComment = true;
		}
	}

	// When indent is OFF the lines must still be processed by ASBeautifier.
	// Otherwise the lines immediately following may not be indented correctly.
	if ((lineIsLineCommentOnly || lineIsCommentOnly)
	        && line.find("*INDENT-OFF*", 0) != string::npos)
		isIndentModeOff = true;

	if (line.length() == 0)
	{
		if (backslashEndsPrevLine)
		{
			backslashEndsPrevLine = false;
			isInDefine = false;
			isInDefineDefinition = false;
		}
		if (emptyLineFill && !isInQuoteContinuation)
		{
			if (isInIndentablePreprocBlock)
				return preLineWS(preprocBlockIndent, 0);
			else if (!headerStack->empty() || isInEnum)
				return preLineWS(prevFinalLineIndentCount, prevFinalLineSpaceIndentCount);
			// must fall thru here
		}
		else
			return line;
	}

	// handle preprocessor commands
	if (isInIndentablePreprocBlock
	        && line.length() > 0
	        && line[0] != '#')
	{
		string indentedLine;
		if (isInClassHeaderTab || isInClassInitializer)
		{
			// parsing is turned off in ASFormatter by indent-off
			// the originalLine will probably never be returned here
			indentedLine = preLineWS(prevFinalLineIndentCount, prevFinalLineSpaceIndentCount) + line;
			return getIndentedLineReturn(indentedLine, originalLine);
		}
		else
		{
			indentedLine = preLineWS(preprocBlockIndent, 0) + line;
			return getIndentedLineReturn(indentedLine, originalLine);
		}
	}
	if (!isInComment
	        && !isInQuoteContinuation
	        && line.length() > 0
	        && ((line[0] == '#' && !isIndentedPreprocessor(line, 0))
	            || backslashEndsPrevLine))
	{
		if (line[0] == '#' && !isInDefine)
		{
			string preproc = extractPreprocessorStatement(line);
			processPreprocessor(preproc, line);
			if (isInIndentablePreprocBlock || isInIndentablePreproc)
			{
				string indentedLine;
				if ((preproc.length() >= 2 && preproc.substr(0, 2) == "if")) // #if, #ifdef, #ifndef
				{
					indentedLine = preLineWS(preprocBlockIndent, 0) + line;
					preprocBlockIndent += 1;
					isInIndentablePreprocBlock = true;
				}
				else if (preproc == "else" || preproc == "elif")
				{
					indentedLine = preLineWS(preprocBlockIndent - 1, 0) + line;
				}
				else if (preproc == "endif")
				{
					preprocBlockIndent -= 1;
					indentedLine = preLineWS(preprocBlockIndent, 0) + line;
					if (preprocBlockIndent == 0)
						isInIndentablePreprocBlock = false;
				}
				else
					indentedLine = preLineWS(preprocBlockIndent, 0) + line;
				return getIndentedLineReturn(indentedLine, originalLine);
			}
			if (shouldIndentPreprocConditional && preproc.length() > 0)
			{
				string indentedLine;
				if (preproc.length() >= 2 && preproc.substr(0, 2) == "if") // #if, #ifdef, #ifndef
				{
					pair<int, int> entry;	// indentCount, spaceIndentCount
					if (!isInDefine && activeBeautifierStack != NULL && !activeBeautifierStack->empty())
						entry = activeBeautifierStack->back()->computePreprocessorIndent();
					else
						entry = computePreprocessorIndent();
					preprocIndentStack->push_back(entry);
					indentedLine = preLineWS(preprocIndentStack->back().first,
					                         preprocIndentStack->back().second) + line;
					return getIndentedLineReturn(indentedLine, originalLine);
				}
				else if (preproc == "else" || preproc == "elif")
				{
					if (preprocIndentStack->size() > 0)	// if no entry don't indent
					{
						indentedLine = preLineWS(preprocIndentStack->back().first,
						                         preprocIndentStack->back().second) + line;
						return getIndentedLineReturn(indentedLine, originalLine);
					}
				}
				else if (preproc == "endif")
				{
					if (preprocIndentStack->size() > 0)	// if no entry don't indent
					{
						indentedLine = preLineWS(preprocIndentStack->back().first,
						                         preprocIndentStack->back().second) + line;
						preprocIndentStack->pop_back();
						return getIndentedLineReturn(indentedLine, originalLine);
					}
				}
			}
		}

		// check if the last char is a backslash
		if (line.length() > 0)
			backslashEndsPrevLine = (line[line.length() - 1] == '\\');
		// comments within the definition line can be continued without the backslash
		if (isInPreprocessorUnterminatedComment(line))
			backslashEndsPrevLine = true;

		// check if this line ends a multi-line #define
		// if so, use the #define's cloned beautifier for the line's indentation
		// and then remove it from the active beautifier stack and delete it.
		if (!backslashEndsPrevLine && isInDefineDefinition && !isInDefine)
		{
			ASBeautifier* defineBeautifier;

			isInDefineDefinition = false;
			defineBeautifier = activeBeautifierStack->back();
			activeBeautifierStack->pop_back();

			string indentedLine = defineBeautifier->beautify(line);
			delete defineBeautifier;
			return getIndentedLineReturn(indentedLine, originalLine);
		}

		// unless this is a multi-line #define, return this precompiler line as is.
		if (!isInDefine && !isInDefineDefinition)
			return originalLine;
	}

	// if there exists any worker beautifier in the activeBeautifierStack,
	// then use it instead of me to indent the current line.
	// variables set by ASFormatter must be updated.
	if (!isInDefine && activeBeautifierStack != NULL && !activeBeautifierStack->empty())
	{
		activeBeautifierStack->back()->inLineNumber = inLineNumber;
		activeBeautifierStack->back()->horstmannIndentInStatement = horstmannIndentInStatement;
		activeBeautifierStack->back()->nonInStatementBracket = nonInStatementBracket;
		activeBeautifierStack->back()->lineCommentNoBeautify = lineCommentNoBeautify;
		activeBeautifierStack->back()->isElseHeaderIndent = isElseHeaderIndent;
		activeBeautifierStack->back()->isCaseHeaderCommentIndent = isCaseHeaderCommentIndent;
		activeBeautifierStack->back()->isNonInStatementArray = isNonInStatementArray;
		activeBeautifierStack->back()->isSharpAccessor = isSharpAccessor;
		activeBeautifierStack->back()->isSharpDelegate = isSharpDelegate;
		activeBeautifierStack->back()->isInExternC = isInExternC;
		activeBeautifierStack->back()->isInBeautifySQL = isInBeautifySQL;
		activeBeautifierStack->back()->isInIndentableStruct = isInIndentableStruct;
		activeBeautifierStack->back()->isInIndentablePreproc = isInIndentablePreproc;
		// must return originalLine not the trimmed line
		return activeBeautifierStack->back()->beautify(originalLine);
	}

	// Flag an indented header in case this line is a one-line block.
	// The header in the header stack will be deleted by a one-line block.
	bool isInExtraHeaderIndent = false;
	if (!headerStack->empty()
	        && lineBeginsWithOpenBracket
	        && (headerStack->back() != &AS_OPEN_BRACKET
	            || probationHeader != NULL))
		isInExtraHeaderIndent = true;

	size_t iPrelim = headerStack->size();

	// calculate preliminary indentation based on headerStack and data from past lines
	computePreliminaryIndentation();

	// parse characters in the current line.
	parseCurrentLine(line);

	// handle special cases of indentation
	adjustParsedLineIndentation(iPrelim, isInExtraHeaderIndent);

	// Objective-C continuation line
	if (isInObjCMethodDefinition)
	{
		// register indent for Objective-C continuation line
		if (line.length() > 0
		        && (line[0] == '-' || line[0] == '+'))
		{
			if (shouldAlignMethodColon)
			{
				colonIndentObjCMethodDefinition = line.find(':');
			}
			else if (inStatementIndentStack->empty()
			         || inStatementIndentStack->back() == 0)
			{
				inStatementIndentStack->push_back(indentLength);
				isInStatement = true;
			}
		}
		// set indent for last definition line
		else if (!lineBeginsWithOpenBracket)
		{
			if (shouldAlignMethodColon)
				spaceIndentCount = computeObjCColonAlignment(line, colonIndentObjCMethodDefinition);
			else if (inStatementIndentStack->empty())
				spaceIndentCount = spaceIndentObjCMethodDefinition;
		}
	}

	if (isInDefine)
	{
		if (line.length() > 0 && line[0] == '#')
		{
			// the 'define' does not have to be attached to the '#'
			string preproc = trim(line.substr(1));
			if (preproc.compare(0, 6, "define") == 0)
			{
				if (!inStatementIndentStack->empty()
				        && inStatementIndentStack->back() > 0)
				{
					defineIndentCount = indentCount;
				}
				else
				{
					defineIndentCount = indentCount - 1;
					--indentCount;
				}
			}
		}

		indentCount -= defineIndentCount;
	}

	if (indentCount < 0)
		indentCount = 0;

	if (lineCommentNoBeautify || blockCommentNoBeautify || isInQuoteContinuation)
		indentCount = spaceIndentCount = 0;

	// finally, insert indentations into beginning of line

	string indentedLine = preLineWS(indentCount, spaceIndentCount) + line;
	indentedLine = getIndentedLineReturn(indentedLine, originalLine);

	prevFinalLineSpaceIndentCount = spaceIndentCount;
	prevFinalLineIndentCount = indentCount;

	if (lastLineHeader != NULL)
		previousLastLineHeader = lastLineHeader;

	if ((lineIsLineCommentOnly || lineIsCommentOnly)
	        && line.find("*INDENT-ON*", 0) != string::npos)
		isIndentModeOff = false;

	return indentedLine;
}

string &ASBeautifier::getIndentedLineReturn(string &newLine, const string &originalLine) const
{
	if (isIndentModeOff)
		return const_cast<string &>(originalLine);
	return newLine;
}

string ASBeautifier::preLineWS(int lineIndentCount, int lineSpaceIndentCount) const
{
	if (shouldForceTabIndentation)
	{
		if (tabLength != indentLength)
		{
			// adjust for different tab length
			int indentCountOrig = lineIndentCount;
			int spaceIndentCountOrig = lineSpaceIndentCount;
			lineIndentCount = ((indentCountOrig * indentLength) + spaceIndentCountOrig) / tabLength;
			lineSpaceIndentCount = ((indentCountOrig * indentLength) + spaceIndentCountOrig) % tabLength;
		}
		else
		{
			lineIndentCount += lineSpaceIndentCount / indentLength;
			lineSpaceIndentCount = lineSpaceIndentCount % indentLength;
		}
	}

	string ws;
	for (int i = 0; i < lineIndentCount; i++)
		ws += indentString;
	while ((lineSpaceIndentCount--) > 0)
		ws += string(" ");
	return ws;
}

/**
 * register an in-statement indent.
 */
void ASBeautifier::registerInStatementIndent(const string &line, int i, int spaceTabCount_,
                                             int tabIncrementIn, int minIndent, bool updateParenStack)
{
	int inStatementIndent;
	int remainingCharNum = line.length() - i;
	int nextNonWSChar = getNextProgramCharDistance(line, i);

	// if indent is around the last char in the line, indent instead one indent from the previous indent
	if (nextNonWSChar == remainingCharNum)
	{
		int previousIndent = spaceTabCount_;
		if (!inStatementIndentStack->empty())
			previousIndent = inStatementIndentStack->back();
		int currIndent = /*2*/ indentLength + previousIndent;
		if (currIndent > maxInStatementIndent
		        && line[i] != '{')
			currIndent = indentLength * 2 + spaceTabCount_;
		inStatementIndentStack->push_back(currIndent);
		if (updateParenStack)
			parenIndentStack->push_back(previousIndent);
		return;
	}

	if (updateParenStack)
		parenIndentStack->push_back(i + spaceTabCount_ - horstmannIndentInStatement);

	int tabIncrement = tabIncrementIn;

	// check for following tabs
	for (int j = i + 1; j < (i + nextNonWSChar); j++)
	{
		if (line[j] == '\t')
			tabIncrement += convertTabToSpaces(j, tabIncrement);
	}

	inStatementIndent = i + nextNonWSChar + spaceTabCount_ + tabIncrement;

	// check for run-in statement
	if (i > 0 && line[0] == '{')
		inStatementIndent -= indentLength;

	if (inStatementIndent < minIndent)
		inStatementIndent = minIndent + spaceTabCount_;

	// this is not done for an in-statement array
	if (inStatementIndent > maxInStatementIndent
	        && !(prevNonLegalCh == '=' && currentNonLegalCh == '{'))
		inStatementIndent = indentLength * 2 + spaceTabCount_;

	if (!inStatementIndentStack->empty()
	        && inStatementIndent < inStatementIndentStack->back())
		inStatementIndent = inStatementIndentStack->back();

	// the block opener is not indented for a NonInStatementArray
	if (isNonInStatementArray && !isInEnum && !bracketBlockStateStack->empty() && bracketBlockStateStack->back())
		inStatementIndent = 0;

	inStatementIndentStack->push_back(inStatementIndent);
}

/**
* Register an in-statement indent for a class header or a class initializer colon.
*/
void ASBeautifier::registerInStatementIndentColon(const string &line, int i, int tabIncrementIn)
{
	assert(line[i] == ':');
	assert(isInClassInitializer || isInClassHeaderTab);

	// register indent at first word after the colon
	size_t firstChar = line.find_first_not_of(" \t");
	if (firstChar == (size_t)i)		// firstChar is ':'
	{
		size_t firstWord = line.find_first_not_of(" \t", firstChar + 1);
		if (firstChar != string::npos)
		{
			int inStatementIndent = firstWord + spaceIndentCount + tabIncrementIn;
			inStatementIndentStack->push_back(inStatementIndent);
			isInStatement = true;
		}
	}
}

/**
 * Compute indentation for a preprocessor #if statement.
 * This may be called for the activeBeautiferStack
 * instead of the active ASBeautifier object.
 */
pair<int, int> ASBeautifier::computePreprocessorIndent()
{
	computePreliminaryIndentation();
	pair<int, int> entry(indentCount, spaceIndentCount);
	if (!headerStack->empty()
	        && entry.first > 0
	        && (headerStack->back() == &AS_IF
	            || headerStack->back() == &AS_ELSE
	            || headerStack->back() == &AS_FOR
	            || headerStack->back() == &AS_WHILE))
		--entry.first;
	return entry;
}

/**
 * get distance to the next non-white space, non-comment character in the line.
 * if no such character exists, return the length remaining to the end of the line.
 */
int ASBeautifier::getNextProgramCharDistance(const string &line, int i) const
{
	bool inComment = false;
	int  remainingCharNum = line.length() - i;
	int  charDistance;
	char ch;

	for (charDistance = 1; charDistance < remainingCharNum; charDistance++)
	{
		ch = line[i + charDistance];
		if (inComment)
		{
			if (line.compare(i + charDistance, 2, "*/") == 0)
			{
				charDistance++;
				inComment = false;
			}
			continue;
		}
		else if (isWhiteSpace(ch))
			continue;
		else if (ch == '/')
		{
			if (line.compare(i + charDistance, 2, "//") == 0)
				return remainingCharNum;
			else if (line.compare(i + charDistance, 2, "/*") == 0)
			{
				charDistance++;
				inComment = true;
			}
		}
		else
			return charDistance;
	}

	return charDistance;
}

// check if a specific line position contains a header.
const string* ASBeautifier::findHeader(const string &line, int i,
                                       const vector<const string*>* possibleHeaders) const
{
	assert(isCharPotentialHeader(line, i));
	// check the word
	size_t maxHeaders = possibleHeaders->size();
	for (size_t p = 0; p < maxHeaders; p++)
	{
		const string* header = (*possibleHeaders)[p];
		const size_t wordEnd = i + header->length();
		if (wordEnd > line.length())
			continue;
		int result = (line.compare(i, header->length(), *header));
		if (result > 0)
			continue;
		if (result < 0)
			break;
		// check that this is not part of a longer word
		if (wordEnd == line.length())
			return header;
		if (isLegalNameChar(line[wordEnd]))
			continue;
		const char peekChar = peekNextChar(line, wordEnd - 1);
		// is not a header if part of a definition
		if (peekChar == ',' || peekChar == ')')
			break;
		// the following accessor definitions are NOT headers
		// goto default; is NOT a header
		// default(int) keyword in C# is NOT a header
		else if ((header == &AS_GET || header == &AS_SET || header == &AS_DEFAULT)
		         && (peekChar == ';' || peekChar == '(' || peekChar == '='))
			break;
		return header;
	}
	return NULL;
}

// check if a specific line position contains an operator.
const string* ASBeautifier::findOperator(const string &line, int i,
                                         const vector<const string*>* possibleOperators) const
{
	assert(isCharPotentialOperator(line[i]));
	// find the operator in the vector
	// the vector contains the LONGEST operators first
	// must loop thru the entire vector
	size_t maxOperators = possibleOperators->size();
	for (size_t p = 0; p < maxOperators; p++)
	{
		const size_t wordEnd = i + (*(*possibleOperators)[p]).length();
		if (wordEnd > line.length())
			continue;
		if (line.compare(i, (*(*possibleOperators)[p]).length(), *(*possibleOperators)[p]) == 0)
			return (*possibleOperators)[p];
	}
	return NULL;
}

/**
 * find the index number of a string element in a container of strings
 *
 * @return              the index number of element in the container. -1 if element not found.
 * @param container     a vector of strings.
 * @param element       the element to find .
 */
int ASBeautifier::indexOf(vector<const string*> &container, const string* element) const
{
	vector<const string*>::const_iterator where;

	where = find(container.begin(), container.end(), element);
	if (where == container.end())
		return -1;
	else
		return (int) (where - container.begin());
}

/**
 * convert tabs to spaces.
 * i is the position of the character to convert to spaces.
 * tabIncrementIn is the increment that must be added for tab indent characters
 *     to get the correct column for the current tab.
 */
int ASBeautifier::convertTabToSpaces(int i, int tabIncrementIn) const
{
	int tabToSpacesAdjustment = indentLength - 1 - ((tabIncrementIn + i) % indentLength);
	return tabToSpacesAdjustment;
}

/**
 * trim removes the white space surrounding a line.
 *
 * @return          the trimmed line.
 * @param str       the line to trim.
 */
string ASBeautifier::trim(const string &str) const
{

	int start = 0;
	int end = str.length() - 1;

	while (start < end && isWhiteSpace(str[start]))
		start++;

	while (start <= end && isWhiteSpace(str[end]))
		end--;

	// don't trim if it ends in a continuation
	if (end > -1 && str[end] == '\\')
		end = str.length() - 1;

	string returnStr(str, start, end + 1 - start);
	return returnStr;
}

/**
 * rtrim removes the white space from the end of a line.
 *
 * @return          the trimmed line.
 * @param str       the line to trim.
 */
string ASBeautifier::rtrim(const string &str) const
{
	size_t len = str.length();
	size_t end = str.find_last_not_of(" \t");
	if (end == string::npos
	        || end == len - 1)
		return str;
	string returnStr(str, 0, end + 1);
	return returnStr;
}

/**
 * Copy tempStacks for the copy constructor.
 * The value of the vectors must also be copied.
 */
vector<vector<const string*>*>* ASBeautifier::copyTempStacks(const ASBeautifier &other) const
{
	vector<vector<const string*>*>* tempStacksNew = new vector<vector<const string*>*>;
	vector<vector<const string*>*>::iterator iter;
	for (iter = other.tempStacks->begin();
	        iter != other.tempStacks->end();
	        ++iter)
	{
		vector<const string*>* newVec = new vector<const string*>;
		*newVec = **iter;
		tempStacksNew->push_back(newVec);
	}
	return tempStacksNew;
}

/**
 * delete a member vectors to eliminate memory leak reporting
 */
void ASBeautifier::deleteBeautifierVectors()
{
	beautifierFileType = 9;		// reset to an invalid type
	delete headers;
	delete nonParenHeaders;
	delete preBlockStatements;
	delete preCommandHeaders;
	delete assignmentOperators;
	delete nonAssignmentOperators;
	delete indentableHeaders;
}

/**
 * delete a vector object
 * T is the type of vector
 * used for all vectors except tempStacks
 */
template<typename T>
void ASBeautifier::deleteContainer(T &container)
{
	if (container != NULL)
	{
		container->clear();
		delete (container);
		container = NULL;
	}
}

/**
 * Delete the ASBeautifier vector object.
 * This is a vector of pointers to ASBeautifier objects allocated with the 'new' operator.
 * Therefore the ASBeautifier objects have to be deleted in addition to the
 * ASBeautifier pointer entries.
 */
void ASBeautifier::deleteBeautifierContainer(vector<ASBeautifier*>* &container)
{
	if (container != NULL)
	{
		vector<ASBeautifier*>::iterator iter = container->begin();
		while (iter < container->end())
		{
			delete *iter;
			++iter;
		}
		container->clear();
		delete (container);
		container = NULL;
	}
}

/**
 * Delete the tempStacks vector object.
 * The tempStacks is a vector of pointers to strings allocated with the 'new' operator.
 * Therefore the strings have to be deleted in addition to the tempStacks entries.
 */
void ASBeautifier::deleteTempStacksContainer(vector<vector<const string*>*>* &container)
{
	if (container != NULL)
	{
		vector<vector<const string*>*>::iterator iter = container->begin();
		while (iter < container->end())
		{
			delete *iter;
			++iter;
		}
		container->clear();
		delete (container);
		container = NULL;
	}
}

/**
 * initialize a vector object
 * T is the type of vector used for all vectors
 */
template<typename T>
void ASBeautifier::initContainer(T &container, T value)
{
	// since the ASFormatter object is never deleted,
	// the existing vectors must be deleted before creating new ones
	if (container != NULL)
		deleteContainer(container);
	container = value;
}

/**
 * Initialize the tempStacks vector object.
 * The tempStacks is a vector of pointers to strings allocated with the 'new' operator.
 * Any residual entries are deleted before the vector is initialized.
 */
void ASBeautifier::initTempStacksContainer(vector<vector<const string*>*>* &container,
                                           vector<vector<const string*>*>* value)
{
	if (container != NULL)
		deleteTempStacksContainer(container);
	container = value;
}

/**
 * Determine if an assignment statement ends with a comma
 *     that is not in a function argument. It ends with a
 *     comma if a comma is the last char on the line.
 *
 * @return  true if line ends with a comma, otherwise false.
 */
bool ASBeautifier::statementEndsWithComma(const string &line, int index) const
{
	assert(line[index] == '=');

	bool isInComment_ = false;
	bool isInQuote_ = false;
	int parenCount = 0;
	size_t lineLength = line.length();
	size_t i = 0;
	char quoteChar_ = ' ';

	for (i = index + 1; i < lineLength; ++i)
	{
		char ch = line[i];

		if (isInComment_)
		{
			if (line.compare(i, 2, "*/") == 0)
			{
				isInComment_ = false;
				++i;
			}
			continue;
		}

		if (ch == '\\')
		{
			++i;
			continue;
		}

		if (isInQuote_)
		{
			if (ch == quoteChar_)
				isInQuote_ = false;
			continue;
		}

		if (ch == '"' || ch == '\'')
		{
			isInQuote_ = true;
			quoteChar_ = ch;
			continue;
		}

		if (line.compare(i, 2, "//") == 0)
			break;

		if (line.compare(i, 2, "/*") == 0)
		{
			if (isLineEndComment(line, i))
				break;
			else
			{
				isInComment_ = true;
				++i;
				continue;
			}
		}

		if (ch == '(')
			parenCount++;
		if (ch == ')')
			parenCount--;
	}
	if (isInComment_
	        || isInQuote_
	        || parenCount > 0)
		return false;

	size_t lastChar = line.find_last_not_of(" \t", i - 1);

	if (lastChar == string::npos || line[lastChar] != ',')
		return false;

	return true;
}

/**
 * check if current comment is a line-end comment
 *
 * @return     is before a line-end comment.
 */
bool ASBeautifier::isLineEndComment(const string &line, int startPos) const
{
	assert(line.compare(startPos, 2, "/*") == 0);

	// comment must be closed on this line with nothing after it
	size_t endNum = line.find("*/", startPos + 2);
	if (endNum != string::npos)
	{
		size_t nextChar = line.find_first_not_of(" \t", endNum + 2);
		if (nextChar == string::npos)
			return true;
	}
	return false;
}

/**
 * get the previous word index for an assignment operator
 *
 * @return is the index to the previous word (the in statement indent).
 */
int ASBeautifier::getInStatementIndentAssign(const string &line, size_t currPos) const
{
	assert(line[currPos] == '=');

	if (currPos == 0)
		return 0;

	// get the last legal word (may be a number)
	size_t end = line.find_last_not_of(" \t", currPos - 1);
	if (end == string::npos || !isLegalNameChar(line[end]))
		return 0;

	int start;          // start of the previous word
	for (start = end; start > -1; start--)
	{
		if (!isLegalNameChar(line[start]) || line[start] == '.')
			break;
	}
	start++;

	return start;
}

/**
 * get the instatement indent for a comma
 *
 * @return is the indent to the second word on the line (the in statement indent).
 */
int ASBeautifier::getInStatementIndentComma(const string &line, size_t currPos) const
{
	assert(line[currPos] == ',');

	// get first word on a line
	size_t indent = line.find_first_not_of(" \t");
	if (indent == string::npos || !isLegalNameChar(line[indent]))
		return 0;

	// bypass first word
	for (; indent < currPos; indent++)
	{
		if (!isLegalNameChar(line[indent]))
			break;
	}
	indent++;
	if (indent >= currPos || indent < 4)
		return 0;

	// point to second word or assignment operator
	indent = line.find_first_not_of(" \t", indent);
	if (indent == string::npos || indent >= currPos)
		return 0;

	return indent;
}

/**
 * get the next word on a line
 * the argument 'currPos' must point to the current position.
 *
 * @return is the next word or an empty string if none found.
 */
string ASBeautifier::getNextWord(const string &line, size_t currPos) const
{
	size_t lineLength = line.length();
	// get the last legal word (may be a number)
	if (currPos == lineLength - 1)
		return string();

	size_t start = line.find_first_not_of(" \t", currPos + 1);
	if (start == string::npos || !isLegalNameChar(line[start]))
		return string();

	size_t end;			// end of the current word
	for (end = start + 1; end <= lineLength; end++)
	{
		if (!isLegalNameChar(line[end]) || line[end] == '.')
			break;
	}

	return line.substr(start, end - start);
}

/**
 * Check if a preprocessor directive is always indented.
 * C# "region" and "endregion" are always indented.
 * C/C++ "pragma omp" is always indented.
 *
 * @return is true or false.
 */
bool ASBeautifier::isIndentedPreprocessor(const string &line, size_t currPos) const
{
	assert(line[0] == '#');
	string nextWord = getNextWord(line, currPos);
	if (nextWord == "region" || nextWord == "endregion")
		return true;
	// is it #pragma omp
	if (nextWord == "pragma")
	{
		// find pragma
		size_t start = line.find("pragma");
		if (start == string::npos || !isLegalNameChar(line[start]))
			return false;
		// bypass pragma
		for (; start < line.length(); start++)
		{
			if (!isLegalNameChar(line[start]))
				break;
		}
		start++;
		if (start >= line.length())
			return false;
		// point to start of second word
		start = line.find_first_not_of(" \t", start);
		if (start == string::npos)
			return false;
		// point to end of second word
		size_t end;
		for (end = start; end < line.length(); end++)
		{
			if (!isLegalNameChar(line[end]))
				break;
		}
		// check for "pragma omp"
		string word = line.substr(start, end - start);
		if (word == "omp" || word == "region" || word == "endregion")
			return true;
	}
	return false;
}

/**
 * Check if a preprocessor directive is checking for __cplusplus defined.
 *
 * @return is true or false.
 */
bool ASBeautifier::isPreprocessorConditionalCplusplus(const string &line) const
{
	string preproc = trim(line.substr(1));
	if (preproc.compare(0, 5, "ifdef") == 0 && getNextWord(preproc, 4) == "__cplusplus")
		return true;
	if (preproc.compare(0, 2, "if") == 0)
	{
		// check for " #if defined(__cplusplus)"
		size_t charNum = 2;
		charNum = preproc.find_first_not_of(" \t", charNum);
		if (preproc.compare(charNum, 7, "defined") == 0)
		{
			charNum += 7;
			charNum = preproc.find_first_not_of(" \t", charNum);
			if (preproc.compare(charNum, 1, "(") == 0)
			{
				++charNum;
				charNum = preproc.find_first_not_of(" \t", charNum);
				if (preproc.compare(charNum, 11, "__cplusplus") == 0)
					return true;
			}
		}
	}
	return false;
}

/**
 * Check if a preprocessor definition contains an unterminated comment.
 * Comments within a preprocessor definition can be continued without the backslash.
 *
 * @return is true or false.
 */
bool ASBeautifier::isInPreprocessorUnterminatedComment(const string &line)
{
	if (!isInPreprocessorComment)
	{
		size_t startPos = line.find("/*");
		if (startPos == string::npos)
			return false;
	}
	size_t endNum = line.find("*/");
	if (endNum != string::npos)
	{
		isInPreprocessorComment = false;
		return false;
	}
	isInPreprocessorComment = true;
	return true;
}

void ASBeautifier::popLastInStatementIndent()
{
	assert(!inStatementIndentStackSizeStack->empty());
	int previousIndentStackSize = inStatementIndentStackSizeStack->back();
	if (inStatementIndentStackSizeStack->size() > 1)
		inStatementIndentStackSizeStack->pop_back();
	while (previousIndentStackSize < (int) inStatementIndentStack->size())
		inStatementIndentStack->pop_back();
}

// for unit testing
int ASBeautifier::getBeautifierFileType() const
{ return beautifierFileType; }

/**
 * Process preprocessor statements and update the beautifier stacks.
 */
void ASBeautifier::processPreprocessor(const string &preproc, const string &line)
{
	// When finding a multi-lined #define statement, the original beautifier
	// 1. sets its isInDefineDefinition flag
	// 2. clones a new beautifier that will be used for the actual indentation
	//    of the #define. This clone is put into the activeBeautifierStack in order
	//    to be called for the actual indentation.
	// The original beautifier will have isInDefineDefinition = true, isInDefine = false
	// The cloned beautifier will have   isInDefineDefinition = true, isInDefine = true
	if (shouldIndentPreprocDefine && preproc == "define" && line[line.length() - 1] == '\\')
	{
		if (!isInDefineDefinition)
		{
			ASBeautifier* defineBeautifier;

			// this is the original beautifier
			isInDefineDefinition = true;

			// push a new beautifier into the active stack
			// this beautifier will be used for the indentation of this define
			defineBeautifier = new ASBeautifier(*this);
			activeBeautifierStack->push_back(defineBeautifier);
		}
		else
		{
			// the is the cloned beautifier that is in charge of indenting the #define.
			isInDefine = true;
		}
	}
	else if (preproc.length() >= 2 && preproc.substr(0, 2) == "if")
	{
		if (isPreprocessorConditionalCplusplus(line) && !g_preprocessorCppExternCBracket)
			g_preprocessorCppExternCBracket = 1;
		// push a new beautifier into the stack
		waitingBeautifierStackLengthStack->push_back(waitingBeautifierStack->size());
		activeBeautifierStackLengthStack->push_back(activeBeautifierStack->size());
		if (activeBeautifierStackLengthStack->back() == 0)
			waitingBeautifierStack->push_back(new ASBeautifier(*this));
		else
			waitingBeautifierStack->push_back(new ASBeautifier(*activeBeautifierStack->back()));
	}
	else if (preproc == "else")
	{
		if (waitingBeautifierStack && !waitingBeautifierStack->empty())
		{
			// MOVE current waiting beautifier to active stack.
			activeBeautifierStack->push_back(waitingBeautifierStack->back());
			waitingBeautifierStack->pop_back();
		}
	}
	else if (preproc == "elif")
	{
		if (waitingBeautifierStack && !waitingBeautifierStack->empty())
		{
			// append a COPY current waiting beautifier to active stack, WITHOUT deleting the original.
			activeBeautifierStack->push_back(new ASBeautifier(*(waitingBeautifierStack->back())));
		}
	}
	else if (preproc == "endif")
	{
		int stackLength;
		ASBeautifier* beautifier;

		if (waitingBeautifierStackLengthStack != NULL && !waitingBeautifierStackLengthStack->empty())
		{
			stackLength = waitingBeautifierStackLengthStack->back();
			waitingBeautifierStackLengthStack->pop_back();
			while ((int) waitingBeautifierStack->size() > stackLength)
			{
				beautifier = waitingBeautifierStack->back();
				waitingBeautifierStack->pop_back();
				delete beautifier;
			}
		}

		if (!activeBeautifierStackLengthStack->empty())
		{
			stackLength = activeBeautifierStackLengthStack->back();
			activeBeautifierStackLengthStack->pop_back();
			while ((int) activeBeautifierStack->size() > stackLength)
			{
				beautifier = activeBeautifierStack->back();
				activeBeautifierStack->pop_back();
				delete beautifier;
			}
		}
	}
}

// Compute the preliminary indentation based on data in the headerStack
// and data from previous lines.
// Update the class variable indentCount.
void ASBeautifier::computePreliminaryIndentation()
{
	indentCount = 0;
	spaceIndentCount = 0;
	isInClassHeaderTab = false;

	if (isInObjCMethodDefinition && !inStatementIndentStack->empty())
		spaceIndentObjCMethodDefinition = inStatementIndentStack->back();

	if (!inStatementIndentStack->empty())
		spaceIndentCount = inStatementIndentStack->back();

	for (size_t i = 0; i < headerStack->size(); i++)
	{
		isInClass = false;

		if (blockIndent)
		{
			// do NOT indent opening block for these headers
			if (!((*headerStack)[i] == &AS_NAMESPACE
			        || (*headerStack)[i] == &AS_CLASS
			        || (*headerStack)[i] == &AS_STRUCT
			        || (*headerStack)[i] == &AS_UNION
			        || (*headerStack)[i] == &AS_INTERFACE
			        || (*headerStack)[i] == &AS_THROWS
			        || (*headerStack)[i] == &AS_STATIC))
				++indentCount;
		}
		else if (!(i > 0 && (*headerStack)[i - 1] != &AS_OPEN_BRACKET
		           && (*headerStack)[i] == &AS_OPEN_BRACKET))
			++indentCount;

		if (!isJavaStyle() && !namespaceIndent && i > 0
		        && (*headerStack)[i - 1] == &AS_NAMESPACE
		        && (*headerStack)[i] == &AS_OPEN_BRACKET)
			--indentCount;

		if (isCStyle() && i >= 1
		        && (*headerStack)[i - 1] == &AS_CLASS
		        && (*headerStack)[i] == &AS_OPEN_BRACKET)
		{
			if (classIndent)
				++indentCount;
			isInClass = true;
		}

		// is the switchIndent option is on, indent switch statements an additional indent.
		else if (switchIndent && i > 1
		         && (*headerStack)[i - 1] == &AS_SWITCH
		         && (*headerStack)[i] == &AS_OPEN_BRACKET)
		{
			++indentCount;
			isInSwitch = true;
		}

	}	// end of for loop

	if (isInClassHeader)
	{
		if (!isJavaStyle())
			isInClassHeaderTab = true;
		if (lineOpensWithLineComment || lineStartsInComment || lineOpensWithComment)
		{
			if (!lineBeginsWithOpenBracket)
				--indentCount;
			if (!inStatementIndentStack->empty())
				spaceIndentCount -= inStatementIndentStack->back();
		}
		else if (blockIndent)
		{
			if (!lineBeginsWithOpenBracket)
				++indentCount;
		}
	}

	if (isInClassInitializer || isInEnumTypeID)
	{
		indentCount += classInitializerIndents;
	}

	if (isInEnum && lineBeginsWithComma && !inStatementIndentStack->empty())
	{
		// unregister '=' indent from the previous line
		inStatementIndentStack->pop_back();
		isInStatement = false;
		spaceIndentCount = 0;
	}

	// Objective-C interface continuation line
	if (isInObjCInterface)
		++indentCount;

	// unindent a class closing bracket...
	if (!lineStartsInComment
	        && isCStyle()
	        && isInClass
	        && classIndent
	        && headerStack->size() >= 2
	        && (*headerStack)[headerStack->size() - 2] == &AS_CLASS
	        && (*headerStack)[headerStack->size() - 1] == &AS_OPEN_BRACKET
	        && lineBeginsWithCloseBracket
	        && bracketBlockStateStack->back() == true)
		--indentCount;

	// unindent an indented switch closing bracket...
	else if (!lineStartsInComment
	         && isInSwitch
	         && switchIndent
	         && headerStack->size() >= 2
	         && (*headerStack)[headerStack->size() - 2] == &AS_SWITCH
	         && (*headerStack)[headerStack->size() - 1] == &AS_OPEN_BRACKET
	         && lineBeginsWithCloseBracket)
		--indentCount;

	// handle special case of horstmann comment in an indented class statement
	if (isInClass
	        && classIndent
	        && isInHorstmannComment
	        && !lineOpensWithComment
	        && headerStack->size() > 1
	        && (*headerStack)[headerStack->size() - 2] == &AS_CLASS)
		--indentCount;

	if (isInConditional)
		--indentCount;
	if (g_preprocessorCppExternCBracket >= 4)
		--indentCount;
}

void ASBeautifier::adjustParsedLineIndentation(size_t iPrelim, bool isInExtraHeaderIndent)
{
	if (lineStartsInComment)
		return;

	// unindent a one-line statement in a header indent
	if (!blockIndent
	        && lineBeginsWithOpenBracket
	        && headerStack->size() < iPrelim
	        && isInExtraHeaderIndent
	        && (lineOpeningBlocksNum > 0 && lineOpeningBlocksNum <= lineClosingBlocksNum)
	        && shouldIndentBrackettedLine)
		--indentCount;

	/*
	 * if '{' doesn't follow an immediately previous '{' in the headerStack
	 * (but rather another header such as "for" or "if", then unindent it
	 * by one indentation relative to its block.
	 */
	else if (!blockIndent
	         && lineBeginsWithOpenBracket
	         && !(lineOpeningBlocksNum > 0 && lineOpeningBlocksNum <= lineClosingBlocksNum)
	         && (headerStack->size() > 1 && (*headerStack)[headerStack->size() - 2] != &AS_OPEN_BRACKET)
	         && shouldIndentBrackettedLine)
		--indentCount;

	// must check one less in headerStack if more than one header on a line (allow-addins)...
	else if (headerStack->size() > iPrelim + 1
	         && !blockIndent
	         && lineBeginsWithOpenBracket
	         && !(lineOpeningBlocksNum > 0 && lineOpeningBlocksNum <= lineClosingBlocksNum)
	         && (headerStack->size() > 2 && (*headerStack)[headerStack->size() - 3] != &AS_OPEN_BRACKET)
	         && shouldIndentBrackettedLine)
		--indentCount;

	// unindent a closing bracket...
	else if (lineBeginsWithCloseBracket
	         && shouldIndentBrackettedLine)
		--indentCount;

	// correctly indent one-line-blocks...
	else if (lineOpeningBlocksNum > 0
	         && lineOpeningBlocksNum == lineClosingBlocksNum
	         && previousLineProbationTab)
		--indentCount;

	if (indentCount < 0)
		indentCount = 0;

	// take care of extra bracket indentation option...
	if (!lineStartsInComment
	        && bracketIndent
	        && shouldIndentBrackettedLine
	        && (lineBeginsWithOpenBracket || lineBeginsWithCloseBracket))
	{
		if (!bracketIndentVtk)
			++indentCount;
		else
		{
			// determine if a style VTK bracket is indented
			bool haveUnindentedBracket = false;
			for (size_t i = 0; i < headerStack->size(); i++)
			{
				if (((*headerStack)[i] == &AS_NAMESPACE
				        || (*headerStack)[i] == &AS_CLASS
				        || (*headerStack)[i] == &AS_STRUCT)
				        && i + 1 < headerStack->size()
				        && (*headerStack)[i + 1] == &AS_OPEN_BRACKET)
					i++;
				else if (lineBeginsWithOpenBracket)
				{
					// don't double count the current bracket
					if (i + 1 < headerStack->size()
					        && (*headerStack)[i] == &AS_OPEN_BRACKET)
						haveUnindentedBracket = true;
				}
				else if ((*headerStack)[i] == &AS_OPEN_BRACKET)
					haveUnindentedBracket = true;
			}	// end of for loop
			if (haveUnindentedBracket)
				++indentCount;
		}
	}
}

/**
 * Compute indentCount adjustment when in a series of else-if statements
 * and shouldBreakElseIfs is requested.
 * It increments by one for each 'else' in the tempStack.
 */
int ASBeautifier::adjustIndentCountForBreakElseIfComments() const
{
	assert(isElseHeaderIndent && !tempStacks->empty());
	int indentCountIncrement = 0;
	vector<const string*>* lastTempStack = tempStacks->back();
	if (lastTempStack != NULL)
	{
		for (size_t i = 0; i < lastTempStack->size(); i++)
		{
			if (*lastTempStack->at(i) == AS_ELSE)
				indentCountIncrement++;
		}
	}
	return indentCountIncrement;
}

/**
 * Extract a preprocessor statement without the #.
 * If a error occurs an empty string is returned.
 */
string ASBeautifier::extractPreprocessorStatement(const string &line) const
{
	string preproc;
	size_t start = line.find_first_not_of("#/ \t");
	if (start == string::npos)
		return preproc;
	size_t end = line.find_first_of("/ \t", start);
	if (end == string::npos)
		end = line.length();
	preproc = line.substr(start, end - start);
	return preproc;
}

/**
 * Clear the variables used to align the Objective-C method definitions.
 */
void ASBeautifier::clearObjCMethodDefinitionAlignment()
{
	assert(isImmediatelyPostObjCMethodDefinition);
	spaceIndentCount = 0;
	spaceIndentObjCMethodDefinition = 0;
	colonIndentObjCMethodDefinition = 0;
	isInObjCMethodDefinition = false;
	isImmediatelyPostObjCMethodDefinition = false;
	if (!inStatementIndentStack->empty())
		inStatementIndentStack->pop_back();
}

/**
 * Compute the spaceIndentCount necessary to align the current line colon
 * with the colon position in the argument.
 * If it cannot be aligned indentLength is returned and a new colon
 * position is calculated.
 */
int ASBeautifier::computeObjCColonAlignment(string &line, int colonAlignPosition) const
{
	int colonPosition = line.find(':');
	if (colonPosition < 0 || colonPosition > colonAlignPosition)
		return indentLength;
	return (colonAlignPosition - colonPosition);
}

/**
 * Parse the current line to update indentCount and spaceIndentCount.
 */
void ASBeautifier::parseCurrentLine(const string &line)
{
	bool isInLineComment = false;
	bool isInOperator = false;
	bool isSpecialChar = false;
	bool haveCaseIndent = false;
	bool haveAssignmentThisLine = false;
	bool closingBracketReached = false;
	bool previousLineProbation = (probationHeader != NULL);
	char ch = ' ';
	int tabIncrementIn = 0;

	for (size_t i = 0; i < line.length(); i++)
	{
		ch = line[i];

		if (isInBeautifySQL)
			continue;

		if (isWhiteSpace(ch))
		{
			if (ch == '\t')
				tabIncrementIn += convertTabToSpaces(i, tabIncrementIn);
			continue;
		}

		// handle special characters (i.e. backslash+character such as \n, \t, ...)

		if (isInQuote && !isInVerbatimQuote)
		{
			if (isSpecialChar)
			{
				isSpecialChar = false;
				continue;
			}
			if (line.compare(i, 2, "\\\\") == 0)
			{
				i++;
				continue;
			}
			if (ch == '\\')
			{
				if (peekNextChar(line, i) == ' ')   // is this '\' at end of line
					haveLineContinuationChar = true;
				else
					isSpecialChar = true;
				continue;
			}
		}
		else if (isInDefine && ch == '\\')
			continue;

		// handle quotes (such as 'x' and "Hello Dolly")
		if (!(isInComment || isInLineComment) && (ch == '"' || ch == '\''))
		{
			if (!isInQuote)
			{
				quoteChar = ch;
				isInQuote = true;
				char prevCh = i > 0 ? line[i - 1] : ' ';
				if (isCStyle() && prevCh == 'R')
				{
					int parenPos = line.find('(', i);
					if (parenPos != -1)
					{
						isInVerbatimQuote = true;
						verbatimDelimiter = line.substr(i + 1, parenPos - i - 1);
					}
				}
				else if (isSharpStyle() && prevCh == '@')
					isInVerbatimQuote = true;
				// check for "C" following "extern"
				else if (g_preprocessorCppExternCBracket == 2 && line.compare(i, 3, "\"C\"") == 0)
					++g_preprocessorCppExternCBracket;
			}
			else if (isInVerbatimQuote && ch == '"')
			{
				if (isCStyle())
				{
					string delim = ')' + verbatimDelimiter;
					int delimStart = i - delim.length();
					if (delimStart > 0 && line.substr(delimStart, delim.length()) == delim)
					{
						isInQuote = false;
						isInVerbatimQuote = false;
					}
				}
				else if (isSharpStyle())
				{
					if (peekNextChar(line, i) == '"')           // check consecutive quotes
						i++;
					else
					{
						isInQuote = false;
						isInVerbatimQuote = false;
					}
				}
			}
			else if (quoteChar == ch)
			{
				isInQuote = false;
				isInStatement = true;
				continue;
			}
		}
		if (isInQuote)
			continue;

		// handle comments

		if (!(isInComment || isInLineComment) && line.compare(i, 2, "//") == 0)
		{
			// if there is a 'case' statement after these comments unindent by 1
			if (isCaseHeaderCommentIndent)
				--indentCount;
			// isElseHeaderIndent is set by ASFormatter if shouldBreakElseIfs is requested
			// if there is an 'else' after these comments a tempStacks indent is required
			if (isElseHeaderIndent && lineOpensWithLineComment && !tempStacks->empty())
				indentCount += adjustIndentCountForBreakElseIfComments();
			isInLineComment = true;
			i++;
			continue;
		}
		else if (!(isInComment || isInLineComment) && line.compare(i, 2, "/*") == 0)
		{
			// if there is a 'case' statement after these comments unindent by 1
			if (isCaseHeaderCommentIndent && lineOpensWithComment)
				--indentCount;
			// isElseHeaderIndent is set by ASFormatter if shouldBreakElseIfs is requested
			// if there is an 'else' after these comments a tempStacks indent is required
			if (isElseHeaderIndent && lineOpensWithComment && !tempStacks->empty())
				indentCount += adjustIndentCountForBreakElseIfComments();
			isInComment = true;
			i++;
			if (!lineOpensWithComment)				// does line start with comment?
				blockCommentNoIndent = true;        // if no, cannot indent continuation lines
			continue;
		}
		else if ((isInComment || isInLineComment) && line.compare(i, 2, "*/") == 0)
		{
			size_t firstText = line.find_first_not_of(" \t");
			// if there is a 'case' statement after these comments unindent by 1
			// only if the ending comment is the first entry on the line
			if (isCaseHeaderCommentIndent && firstText == i)
				--indentCount;
			// if this comment close starts the line, must check for else-if indent
			// isElseHeaderIndent is set by ASFormatter if shouldBreakElseIfs is requested
			// if there is an 'else' after these comments a tempStacks indent is required
			if (firstText == i)
			{
				if (isElseHeaderIndent && !lineOpensWithComment && !tempStacks->empty())
					indentCount += adjustIndentCountForBreakElseIfComments();
			}
			isInComment = false;
			i++;
			blockCommentNoIndent = false;           // ok to indent next comment
			continue;
		}
		// treat indented preprocessor lines as a line comment
		else if (line[0] == '#' && isIndentedPreprocessor(line, i))
		{
			isInLineComment = true;
		}

		if (isInLineComment)
		{
			// bypass rest of the comment up to the comment end
			while (i + 1 < line.length())
				i++;

			continue;
		}
		if (isInComment)
		{
			// if there is a 'case' statement after these comments unindent by 1
			if (!lineOpensWithComment && isCaseHeaderCommentIndent)
				--indentCount;
			// isElseHeaderIndent is set by ASFormatter if shouldBreakElseIfs is requested
			// if there is an 'else' after these comments a tempStacks indent is required
			if (!lineOpensWithComment && isElseHeaderIndent && !tempStacks->empty())
				indentCount += adjustIndentCountForBreakElseIfComments();
			// bypass rest of the comment up to the comment end
			while (i + 1 < line.length()
			        && line.compare(i + 1, 2, "*/") != 0)
				i++;

			continue;
		}

		// if we have reached this far then we are NOT in a comment or string of special character...

		if (probationHeader != NULL)
		{
			if ((probationHeader == &AS_STATIC && ch == '{')
			        || (probationHeader == &AS_SYNCHRONIZED && ch == '('))
			{
				// insert the probation header as a new header
				isInHeader = true;
				headerStack->push_back(probationHeader);

				// handle the specific probation header
				isInConditional = (probationHeader == &AS_SYNCHRONIZED);

				isInStatement = false;
				// if the probation comes from the previous line, then indent by 1 tab count.
				if (previousLineProbation
				        && ch == '{'
				        && !(blockIndent && probationHeader == &AS_STATIC))
				{
					++indentCount;
					previousLineProbationTab = true;
				}
				previousLineProbation = false;
			}

			// dismiss the probation header
			probationHeader = NULL;
		}

		prevNonSpaceCh = currentNonSpaceCh;
		currentNonSpaceCh = ch;
		if (!isLegalNameChar(ch) && ch != ',' && ch != ';')
		{
			prevNonLegalCh = currentNonLegalCh;
			currentNonLegalCh = ch;
		}

		if (isInHeader)
		{
			isInHeader = false;
			currentHeader = headerStack->back();
		}
		else
			currentHeader = NULL;

		if (isCStyle() && isInTemplate
		        && (ch == '<' || ch == '>')
		        && !(line.length() > i + 1 && line.compare(i, 2, ">=") == 0))
		{
			if (ch == '<')
			{
				++templateDepth;
				inStatementIndentStackSizeStack->push_back(inStatementIndentStack->size());
				registerInStatementIndent(line, i, spaceIndentCount, tabIncrementIn, 0, true);
			}
			else if (ch == '>')
			{
				popLastInStatementIndent();
				if (--templateDepth <= 0)
				{
					ch = ';';
					isInTemplate = false;
					templateDepth = 0;
				}
			}
		}

		// handle parentheses
		if (ch == '(' || ch == '[' || ch == ')' || ch == ']')
		{
			if (ch == '(' || ch == '[')
			{
				isInOperator = false;
				// if have a struct header, this is a declaration not a definition
				if (ch == '('
				        && !headerStack->empty()
				        && headerStack->back() == &AS_STRUCT)
				{
					headerStack->pop_back();
					isInClassHeader = false;
					if (line.find(AS_STRUCT, 0) > i)	// if not on this line
						indentCount -= classInitializerIndents;
					if (indentCount < 0)
						indentCount = 0;
				}

				if (parenDepth == 0)
				{
					parenStatementStack->push_back(isInStatement);
					isInStatement = true;
				}
				parenDepth++;
				if (ch == '[')
					++squareBracketCount;

				inStatementIndentStackSizeStack->push_back(inStatementIndentStack->size());

				if (currentHeader != NULL)
					registerInStatementIndent(line, i, spaceIndentCount, tabIncrementIn, minConditionalIndent/*indentLength*2*/, true);
				else
					registerInStatementIndent(line, i, spaceIndentCount, tabIncrementIn, 0, true);
			}
			else if (ch == ')' || ch == ']')
			{
				if (ch == ']')
					--squareBracketCount;
				if (squareBracketCount < 0)
					squareBracketCount = 0;
				foundPreCommandHeader = false;
				parenDepth--;
				if (parenDepth == 0)
				{
					if (!parenStatementStack->empty())      // in case of unmatched closing parens
					{
						isInStatement = parenStatementStack->back();
						parenStatementStack->pop_back();
					}
					isInAsm = false;
					isInConditional = false;
				}

				if (!inStatementIndentStackSizeStack->empty())
				{
					popLastInStatementIndent();

					if (!parenIndentStack->empty())
					{
						int poppedIndent = parenIndentStack->back();
						parenIndentStack->pop_back();

						if (i == 0)
							spaceIndentCount = poppedIndent;
					}
				}
			}
			continue;
		}

		if (ch == '{')
		{
			// first, check if '{' is a block-opener or a static-array opener
			bool isBlockOpener = ((prevNonSpaceCh == '{' && bracketBlockStateStack->back())
			                      || prevNonSpaceCh == '}'
			                      || prevNonSpaceCh == ')'
			                      || prevNonSpaceCh == ';'
			                      || peekNextChar(line, i) == '{'
			                      || foundPreCommandHeader
			                      || foundPreCommandMacro
			                      || isInClassHeader
			                      || (isInClassInitializer && !isLegalNameChar(prevNonSpaceCh))
			                      || isNonInStatementArray
			                      || isInObjCMethodDefinition
			                      || isInObjCInterface
			                      || isSharpAccessor
			                      || isSharpDelegate
			                      || isInExternC
			                      || isInAsmBlock
			                      || getNextWord(line, i) == AS_NEW
			                      || (isInDefine
			                          && (prevNonSpaceCh == '('
			                              || isLegalNameChar(prevNonSpaceCh))));

			if (isInObjCMethodDefinition)
				isImmediatelyPostObjCMethodDefinition = true;

			if (!isBlockOpener && !isInStatement && !isInClassInitializer && !isInEnum)
			{
				if (headerStack->empty())
					isBlockOpener = true;
				else if (headerStack->back() == &AS_NAMESPACE
				         || headerStack->back() == &AS_CLASS
				         || headerStack->back() == &AS_INTERFACE
				         || headerStack->back() == &AS_STRUCT
				         || headerStack->back() == &AS_UNION)
					isBlockOpener = true;
			}

			if (!isBlockOpener && currentHeader != NULL)
			{
				for (size_t n = 0; n < nonParenHeaders->size(); n++)
					if (currentHeader == (*nonParenHeaders)[n])
					{
						isBlockOpener = true;
						break;
					}
			}

			bracketBlockStateStack->push_back(isBlockOpener);

			if (!isBlockOpener)
			{
				inStatementIndentStackSizeStack->push_back(inStatementIndentStack->size());
				registerInStatementIndent(line, i, spaceIndentCount, tabIncrementIn, 0, true);
				parenDepth++;
				if (i == 0)
					shouldIndentBrackettedLine = false;
				isInEnumTypeID = false;

				continue;
			}

			// this bracket is a block opener...

			++lineOpeningBlocksNum;

			if (isInClassInitializer || isInEnumTypeID)
			{
				// decrease tab count if bracket is broken
				if (lineBeginsWithOpenBracket)
				{
					indentCount -= classInitializerIndents;
					// decrease one more if an empty class
					if (!headerStack->empty()
					        && (*headerStack).back() == &AS_CLASS)
					{
						int nextChar = getNextProgramCharDistance(line, i);
						if ((int) line.length() > nextChar && line[nextChar] == '}')
							--indentCount;
					}
				}
			}

			if (isInObjCInterface)
			{
				isInObjCInterface = false;
				if (lineBeginsWithOpenBracket)
					--indentCount;
			}

			if (bracketIndent && !namespaceIndent && !headerStack->empty()
			        && (*headerStack).back() == &AS_NAMESPACE)
			{
				shouldIndentBrackettedLine = false;
				--indentCount;
			}

			// an indentable struct is treated like a class in the header stack
			if (!headerStack->empty()
			        && (*headerStack).back() == &AS_STRUCT
			        && isInIndentableStruct)
				(*headerStack).back() = &AS_CLASS;

			blockParenDepthStack->push_back(parenDepth);
			blockStatementStack->push_back(isInStatement);

			if (!inStatementIndentStack->empty())
			{
				// completely purge the inStatementIndentStack
				while (!inStatementIndentStack->empty())
					popLastInStatementIndent();
				if (isInClassInitializer || isInClassHeaderTab)
				{
					if (lineBeginsWithOpenBracket || lineBeginsWithComma)
						spaceIndentCount = 0;
				}
				else
					spaceIndentCount = 0;
			}

			blockTabCount += (isInStatement ? 1 : 0);
			if (g_preprocessorCppExternCBracket == 3)
				++g_preprocessorCppExternCBracket;
			parenDepth = 0;
			isInClassHeader = false;
			isInClassHeaderTab = false;
			isInClassInitializer = false;
			isInEnumTypeID = false;
			isInStatement = false;
			isInQuestion = false;
			isInLet = false;
			foundPreCommandHeader = false;
			foundPreCommandMacro = false;
			isInExternC = false;

			tempStacks->push_back(new vector<const string*>);
			headerStack->push_back(&AS_OPEN_BRACKET);
			lastLineHeader = &AS_OPEN_BRACKET;

			continue;
		}	// end '{'

		//check if a header has been reached
		bool isPotentialHeader = isCharPotentialHeader(line, i);

		if (isPotentialHeader && !squareBracketCount)
		{
			const string* newHeader = findHeader(line, i, headers);

			// Qt headers may be variables in C++
			if (newHeader == &AS_FOREVER || newHeader == &AS_FOREACH)
			{
				if (line.find_first_of("=;", i) != string::npos)
					newHeader = NULL;
			}

			if (newHeader != NULL)
			{
				// if we reached here, then this is a header...
				bool isIndentableHeader = true;

				isInHeader = true;

				vector<const string*>* lastTempStack;
				if (tempStacks->empty())
					lastTempStack = NULL;
				else
					lastTempStack = tempStacks->back();

				// if a new block is opened, push a new stack into tempStacks to hold the
				// future list of headers in the new block.

				// take care of the special case: 'else if (...)'
				if (newHeader == &AS_IF && lastLineHeader == &AS_ELSE)
				{
					headerStack->pop_back();
				}

				// take care of 'else'
				else if (newHeader == &AS_ELSE)
				{
					if (lastTempStack != NULL)
					{
						int indexOfIf = indexOf(*lastTempStack, &AS_IF);
						if (indexOfIf != -1)
						{
							// recreate the header list in headerStack up to the previous 'if'
							// from the temporary snapshot stored in lastTempStack.
							int restackSize = lastTempStack->size() - indexOfIf - 1;
							for (int r = 0; r < restackSize; r++)
							{
								headerStack->push_back(lastTempStack->back());
								lastTempStack->pop_back();
							}
							if (!closingBracketReached)
								indentCount += restackSize;
						}
						/*
						 * If the above if is not true, i.e. no 'if' before the 'else',
						 * then nothing beautiful will come out of this...
						 * I should think about inserting an Exception here to notify the caller of this...
						 */
					}
				}

				// check if 'while' closes a previous 'do'
				else if (newHeader == &AS_WHILE)
				{
					if (lastTempStack != NULL)
					{
						int indexOfDo = indexOf(*lastTempStack, &AS_DO);
						if (indexOfDo != -1)
						{
							// recreate the header list in headerStack up to the previous 'do'
							// from the temporary snapshot stored in lastTempStack.
							int restackSize = lastTempStack->size() - indexOfDo - 1;
							for (int r = 0; r < restackSize; r++)
							{
								headerStack->push_back(lastTempStack->back());
								lastTempStack->pop_back();
							}
							if (!closingBracketReached)
								indentCount += restackSize;
						}
					}
				}
				// check if 'catch' closes a previous 'try' or 'catch'
				else if (newHeader == &AS_CATCH || newHeader == &AS_FINALLY)
				{
					if (lastTempStack != NULL)
					{
						int indexOfTry = indexOf(*lastTempStack, &AS_TRY);
						if (indexOfTry == -1)
							indexOfTry = indexOf(*lastTempStack, &AS_CATCH);
						if (indexOfTry != -1)
						{
							// recreate the header list in headerStack up to the previous 'try'
							// from the temporary snapshot stored in lastTempStack.
							int restackSize = lastTempStack->size() - indexOfTry - 1;
							for (int r = 0; r < restackSize; r++)
							{
								headerStack->push_back(lastTempStack->back());
								lastTempStack->pop_back();
							}

							if (!closingBracketReached)
								indentCount += restackSize;
						}
					}
				}
				else if (newHeader == &AS_CASE)
				{
					isInCase = true;
					if (!haveCaseIndent)
					{
						haveCaseIndent = true;
						if (!lineBeginsWithOpenBracket)
							--indentCount;
					}
				}
				else if (newHeader == &AS_DEFAULT)
				{
					isInCase = true;
					--indentCount;
				}
				else if (newHeader == &AS_STATIC
				         || newHeader == &AS_SYNCHRONIZED)
				{
					if (!headerStack->empty()
					        && (headerStack->back() == &AS_STATIC
					            || headerStack->back() == &AS_SYNCHRONIZED))
					{
						isIndentableHeader = false;
					}
					else
					{
						isIndentableHeader = false;
						probationHeader = newHeader;
					}
				}
				else if (newHeader == &AS_TEMPLATE)
				{
					isInTemplate = true;
					isIndentableHeader = false;
				}

				if (isIndentableHeader)
				{
					headerStack->push_back(newHeader);
					isInStatement = false;
					if (indexOf(*nonParenHeaders, newHeader) == -1)
					{
						isInConditional = true;
					}
					lastLineHeader = newHeader;
				}
				else
					isInHeader = false;

				i += newHeader->length() - 1;

				continue;
			}  // newHeader != NULL

			if (findHeader(line, i, preCommandHeaders))
				foundPreCommandHeader = true;

			// Objective-C NSException macros are preCommandHeaders
			if (isCStyle() && findKeyword(line, i, AS_NS_DURING))
				foundPreCommandMacro = true;
			if (isCStyle() && findKeyword(line, i, AS_NS_HANDLER))
				foundPreCommandMacro = true;

			if (parenDepth == 0 && findKeyword(line, i, AS_ENUM))
				isInEnum = true;

			if (isSharpStyle() && findKeyword(line, i, AS_LET))
				isInLet = true;

		}   // isPotentialHeader

		if (ch == '?')
			isInQuestion = true;

		// special handling of colons
		if (ch == ':')
		{
			if (line.length() > i + 1 && line[i + 1] == ':') // look for ::
			{
				++i;
				continue;
			}
			else if (isInQuestion)
			{
				// do nothing special
			}
			else if (parenDepth > 0)
			{
				// found a 'for' loop or an objective-C statement
				// so do nothing special
			}
			else if (isInEnum)
			{
				// found an enum with a base-type
				isInEnumTypeID = true;
				if (i == 0)
					indentCount += classInitializerIndents;
			}
			else if (isCStyle()
			         && !isInCase
			         && (prevNonSpaceCh == ')' || foundPreCommandHeader))
			{
				// found a 'class' c'tor initializer
				isInClassInitializer = true;
				registerInStatementIndentColon(line, i, tabIncrementIn);
				if (i == 0)
					indentCount += classInitializerIndents;
			}
			else if (isInClassHeader || isInObjCInterface)
			{
				// is in a 'class A : public B' definition
				isInClassHeaderTab = true;
				registerInStatementIndentColon(line, i, tabIncrementIn);
			}
			else if (isInAsm || isInAsmOneLine || isInAsmBlock)
			{
				// do nothing special
			}
			else if (isDigit(peekNextChar(line, i)))
			{
				// found a bit field
				// so do nothing special
			}
			else if (isCStyle() && isInClass && prevNonSpaceCh != ')')
			{
				// found a 'private:' or 'public:' inside a class definition
				--indentCount;
				if (modifierIndent)
					spaceIndentCount += (indentLength / 2);
			}
			else if (isCStyle() && !isInClass
			         && headerStack->size() >= 2
			         && (*headerStack)[headerStack->size() - 2] == &AS_CLASS
			         && (*headerStack)[headerStack->size() - 1] == &AS_OPEN_BRACKET)
			{
				// found a 'private:' or 'public:' inside a class definition
				// and on the same line as the class opening bracket
				// do nothing
			}
			else if (isJavaStyle() && lastLineHeader == &AS_FOR)
			{
				// found a java for-each statement
				// so do nothing special
			}
			else
			{
				currentNonSpaceCh = ';'; // so that brackets after the ':' will appear as block-openers
				char peekedChar = peekNextChar(line, i);
				if (isInCase)
				{
					isInCase = false;
					ch = ';'; // from here on, treat char as ';'
				}
				else if (isCStyle() || (isSharpStyle() && peekedChar == ';'))
				{
					// is in a label (e.g. 'label1:')
					if (labelIndent)
						--indentCount; // unindent label by one indent
					else if (!lineBeginsWithOpenBracket)
						indentCount = 0; // completely flush indent to left
				}
			}
		}

		if ((ch == ';' || (parenDepth > 0 && ch == ',')) && !inStatementIndentStackSizeStack->empty())
			while ((int) inStatementIndentStackSizeStack->back() + (parenDepth > 0 ? 1 : 0)
			        < (int) inStatementIndentStack->size())
				inStatementIndentStack->pop_back();

		else if (ch == ',' && isInEnum && isNonInStatementArray && !inStatementIndentStack->empty())
			inStatementIndentStack->pop_back();

		// handle commas
		// previous "isInStatement" will be from an assignment operator or class initializer
		if (ch == ',' && parenDepth == 0 && !isInStatement && !isNonInStatementArray)
		{
			// is comma at end of line
			size_t nextChar = line.find_first_not_of(" \t", i + 1);
			if (nextChar != string::npos)
			{
				if (line.compare(nextChar, 2, "//") == 0
				        || line.compare(nextChar, 2, "/*") == 0)
					nextChar = string::npos;
			}
			// register indent
			if (nextChar == string::npos)
			{
				// register indent at previous word
				if (isJavaStyle() && isInClassHeader)
				{
					// do nothing for now
				}
				// register indent at second word on the line
				else if (!isInTemplate && !isInClassHeaderTab && !isInClassInitializer)
				{
					int prevWord = getInStatementIndentComma(line, i);
					int inStatementIndent = prevWord + spaceIndentCount + tabIncrementIn;
					inStatementIndentStack->push_back(inStatementIndent);
					isInStatement = true;
				}
			}
		}
		// handle comma first initializers
		if (ch == ',' && parenDepth == 0 && lineBeginsWithComma
		        && (isInClassInitializer || isInClassHeaderTab))
			spaceIndentCount = 0;

		// handle ends of statements
		if ((ch == ';' && parenDepth == 0) || ch == '}')
		{
			if (ch == '}')
			{
				// first check if this '}' closes a previous block, or a static array...
				if (bracketBlockStateStack->size() > 1)
				{
					bool bracketBlockState = bracketBlockStateStack->back();
					bracketBlockStateStack->pop_back();
					if (!bracketBlockState)
					{
						if (!inStatementIndentStackSizeStack->empty())
						{
							// this bracket is a static array
							popLastInStatementIndent();
							parenDepth--;
							if (i == 0)
								shouldIndentBrackettedLine = false;

							if (!parenIndentStack->empty())
							{
								int poppedIndent = parenIndentStack->back();
								parenIndentStack->pop_back();
								if (i == 0)
									spaceIndentCount = poppedIndent;
							}
						}
						continue;
					}
				}

				// this bracket is block closer...

				++lineClosingBlocksNum;

				if (!inStatementIndentStackSizeStack->empty())
					popLastInStatementIndent();

				if (!blockParenDepthStack->empty())
				{
					parenDepth = blockParenDepthStack->back();
					blockParenDepthStack->pop_back();
					isInStatement = blockStatementStack->back();
					blockStatementStack->pop_back();

					if (isInStatement)
						blockTabCount--;
				}

				closingBracketReached = true;
				if (i == 0)
					spaceIndentCount = 0;
				isInAsmBlock = false;
				isInAsm = isInAsmOneLine = isInQuote = false;	// close these just in case

				int headerPlace = indexOf(*headerStack, &AS_OPEN_BRACKET);
				if (headerPlace != -1)
				{
					const string* popped = headerStack->back();
					while (popped != &AS_OPEN_BRACKET)
					{
						headerStack->pop_back();
						popped = headerStack->back();
					}
					headerStack->pop_back();

					if (headerStack->empty())
						g_preprocessorCppExternCBracket = 0;

					// do not indent namespace bracket unless namespaces are indented
					if (!namespaceIndent && !headerStack->empty()
					        && (*headerStack).back() == &AS_NAMESPACE
					        && i == 0)		// must be the first bracket on the line
						shouldIndentBrackettedLine = false;

					if (!tempStacks->empty())
					{
						vector<const string*>* temp = tempStacks->back();
						tempStacks->pop_back();
						delete temp;
					}
				}

				ch = ' '; // needed due to cases such as '}else{', so that headers ('else' in this case) will be identified...
			}	// ch == '}'

			/*
			 * Create a temporary snapshot of the current block's header-list in the
			 * uppermost inner stack in tempStacks, and clear the headerStack up to
			 * the beginning of the block.
			 * Thus, the next future statement will think it comes one indent past
			 * the block's '{' unless it specifically checks for a companion-header
			 * (such as a previous 'if' for an 'else' header) within the tempStacks,
			 * and recreates the temporary snapshot by manipulating the tempStacks.
			 */
			if (!tempStacks->back()->empty())
				while (!tempStacks->back()->empty())
					tempStacks->back()->pop_back();
			while (!headerStack->empty() && headerStack->back() != &AS_OPEN_BRACKET)
			{
				tempStacks->back()->push_back(headerStack->back());
				headerStack->pop_back();
			}

			if (parenDepth == 0 && ch == ';')
				isInStatement = false;
			if (isInObjCMethodDefinition)
				isImmediatelyPostObjCMethodDefinition = true;

			previousLastLineHeader = NULL;
			isInClassHeader = false;		// for 'friend' class
			isInEnum = false;
			isInQuestion = false;
			isInObjCInterface = false;
			foundPreCommandHeader = false;
			foundPreCommandMacro = false;
			squareBracketCount = 0;

			continue;
		}

		if (isPotentialHeader)
		{
			// check for preBlockStatements in C/C++ ONLY if not within parentheses
			// (otherwise 'struct XXX' statements would be wrongly interpreted...)
			if (!isInTemplate && !(isCStyle() && parenDepth > 0))
			{
				const string* newHeader = findHeader(line, i, preBlockStatements);
				if (newHeader != NULL
				        && !(isCStyle() && newHeader == &AS_CLASS && isInEnum))	// is not 'enum class'
				{
					if (!isSharpStyle())
						headerStack->push_back(newHeader);
					// do not need 'where' in the headerStack
					// do not need second 'class' statement in a row
					else if (!(newHeader == &AS_WHERE
					           || (newHeader == &AS_CLASS
					               && !headerStack->empty()
					               && headerStack->back() == &AS_CLASS)))
						headerStack->push_back(newHeader);

					if (!headerStack->empty())
					{
						if ((*headerStack).back() == &AS_CLASS
						        || (*headerStack).back() == &AS_STRUCT
						        || (*headerStack).back() == &AS_INTERFACE)
						{
							isInClassHeader = true;
						}
						else if ((*headerStack).back() == &AS_NAMESPACE)
						{
							// remove inStatementIndent from namespace
							if (!inStatementIndentStack->empty())
								inStatementIndentStack->pop_back();
							isInStatement = false;
						}
					}

					i += newHeader->length() - 1;
					continue;
				}
			}
			const string* foundIndentableHeader = findHeader(line, i, indentableHeaders);

			if (foundIndentableHeader != NULL)
			{
				// must bypass the header before registering the in statement
				i += foundIndentableHeader->length() - 1;
				if (!isInOperator && !isInTemplate && !isNonInStatementArray)
				{
					registerInStatementIndent(line, i, spaceIndentCount, tabIncrementIn, 0, false);
					isInStatement = true;
				}
				continue;
			}

			if (isCStyle() && findKeyword(line, i, AS_OPERATOR))
				isInOperator = true;

			if (g_preprocessorCppExternCBracket == 1 && findKeyword(line, i, AS_EXTERN))
				++g_preprocessorCppExternCBracket;

			if (g_preprocessorCppExternCBracket == 3)	// extern "C" is not followed by a '{'
				g_preprocessorCppExternCBracket = 0;

			// "new" operator is a pointer, not a calculation
			if (findKeyword(line, i, AS_NEW))
			{
				if (isInStatement && !inStatementIndentStack->empty() && prevNonSpaceCh == '=' )
					inStatementIndentStack->back() = 0;
			}

			if (isCStyle())
			{
				if (findKeyword(line, i, AS_ASM)
				        || findKeyword(line, i, AS__ASM__))
				{
					isInAsm = true;
				}
				else if (findKeyword(line, i, AS_MS_ASM)		// microsoft specific
				         || findKeyword(line, i, AS_MS__ASM))
				{
					int index = 4;
					if (peekNextChar(line, i) == '_')		// check for __asm
						index = 5;

					char peekedChar = ASBase::peekNextChar(line, i + index);
					if (peekedChar == '{' || peekedChar == ' ')
						isInAsmBlock = true;
					else
						isInAsmOneLine = true;
				}
			}

			// bypass the entire name for all others
			string name = getCurrentWord(line, i);
			i += name.length() - 1;
			continue;
		}

		// Handle Objective-C statements

		if (ch == '@'
		        && isCharPotentialHeader(line, i + 1))
		{
			string curWord = getCurrentWord(line, i + 1);
			if (curWord == AS_INTERFACE	&& headerStack->empty())
			{
				isInObjCInterface = true;
				string name = '@' + curWord;
				i += name.length() - 1;
				continue;
			}
			else if (curWord == AS_PUBLIC
			         || curWord == AS_PRIVATE
			         || curWord == AS_PROTECTED)
			{
				--indentCount;
				if (modifierIndent)
					spaceIndentCount += (indentLength / 2);
				string name = '@' + curWord;
				i += name.length() - 1;
				continue;
			}
			else if (curWord == AS_END)
			{
				popLastInStatementIndent();
				spaceIndentCount = 0;
				if (isInObjCInterface)
					--indentCount;
				isInObjCInterface = false;
				isInObjCMethodDefinition = false;
				string name = '@' + curWord;
				i += name.length() - 1;
				continue;
			}
		}
		else if ((ch == '-' || ch == '+')
		         && peekNextChar(line, i) == '('
		         && headerStack->empty()
		         && line.find_first_not_of(" \t") == i)
		{
			if (isInObjCInterface)
				--indentCount;
			isInObjCInterface = false;
			isInObjCMethodDefinition = true;
			continue;
		}

		// Handle operators

		bool isPotentialOperator = isCharPotentialOperator(ch);

		if (isPotentialOperator)
		{
			// Check if an operator has been reached.
			const string* foundAssignmentOp = findOperator(line, i, assignmentOperators);
			const string* foundNonAssignmentOp = findOperator(line, i, nonAssignmentOperators);

			if (foundNonAssignmentOp == &AS_LAMBDA)
				foundPreCommandHeader = true;

			if (isInTemplate && foundNonAssignmentOp == &AS_GR_GR)
				foundNonAssignmentOp = NULL;

			// Since findHeader's boundary checking was not used above, it is possible
			// that both an assignment op and a non-assignment op where found,
			// e.g. '>>' and '>>='. If this is the case, treat the LONGER one as the
			// found operator.
			if (foundAssignmentOp != NULL && foundNonAssignmentOp != NULL)
			{
				if (foundAssignmentOp->length() < foundNonAssignmentOp->length())
					foundAssignmentOp = NULL;
				else
					foundNonAssignmentOp = NULL;
			}

			if (foundNonAssignmentOp != NULL)
			{
				if (foundNonAssignmentOp->length() > 1)
					i += foundNonAssignmentOp->length() - 1;

				// For C++ input/output, operator<< and >> should be
				// aligned, if we are not in a statement already and
				// also not in the "operator<<(...)" header line
				if (!isInOperator
				        && inStatementIndentStack->empty()
				        && isCStyle()
				        && (foundNonAssignmentOp == &AS_GR_GR
				            || foundNonAssignmentOp == &AS_LS_LS))
				{
					// this will be true if the line begins with the operator
					if (i < 2 && spaceIndentCount == 0)
						spaceIndentCount += 2 * indentLength;
					// align to the beginning column of the operator
					registerInStatementIndent(line, i - foundNonAssignmentOp->length(), spaceIndentCount, tabIncrementIn, 0, false);
				}
			}

			else if (foundAssignmentOp != NULL)
			{
				foundPreCommandHeader = false;		// clears this for array assignments
				foundPreCommandMacro = false;

				if (foundAssignmentOp->length() > 1)
					i += foundAssignmentOp->length() - 1;

				if (!isInOperator && !isInTemplate && (!isNonInStatementArray || isInEnum))
				{
					// if multiple assignments, align on the previous word
					if (foundAssignmentOp == &AS_ASSIGN
					        && prevNonSpaceCh != ']'		// an array
					        && statementEndsWithComma(line, i))
					{
						if (!haveAssignmentThisLine)		// only one assignment indent per line
						{
							// register indent at previous word
							haveAssignmentThisLine = true;
							int prevWordIndex = getInStatementIndentAssign(line, i);
							int inStatementIndent = prevWordIndex + spaceIndentCount + tabIncrementIn;
							inStatementIndentStack->push_back(inStatementIndent);
							isInStatement = true;
						}
					}
					// don't indent an assignment if 'let'
					else if (isInLet)
					{
						isInLet = false;
					}
					else
					{
						if (i == 0 && spaceIndentCount == 0)
							spaceIndentCount += indentLength;
						registerInStatementIndent(line, i, spaceIndentCount, tabIncrementIn, 0, false);
						isInStatement = true;
					}
				}
			}
		}
	}	// end of for loop * end of for loop * end of for loop * end of for loop * end of for loop *
}


}   // end namespace astyle


================================================
FILE: 3rdpart/astyle/ASEnhancer.cpp
================================================
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 *   ASEnhancer.cpp
 *
 *   Copyright (C) 2014 by Jim Pattee
 *   <http://www.gnu.org/licenses/lgpl-3.0.html>
 *
 *   This file is a part of Artistic Style - an indentation and
 *   reformatting tool for C, C++, C# and Java source files.
 *   <http://astyle.sourceforge.net>
 *
 *   Artistic Style is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU Lesser General Public License as published
 *   by the Free Software Foundation, either version 3 of the License, or
 *   (at your option) any later version.
 *
 *   Artistic Style is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU Lesser General Public License for more details.
 *
 *   You should have received a copy of the GNU Lesser General Public License
 *   along with Artistic Style.  If not, see <http://www.gnu.org/licenses/>.
 *
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 */

#include "astyle.h"


namespace astyle {

/**
 * ASEnhancer constructor
 */
ASEnhancer::ASEnhancer()
{
}

/**
 * Destructor of ASEnhancer
 */
ASEnhancer::~ASEnhancer()
{
}

/**
 * initialize the ASEnhancer.
 *
 * init() is called each time an ASFormatter object is initialized.
 */
void ASEnhancer::init(int  _fileType,
                      int  _indentLength,
                      int  _tabLength,
                      bool _useTabs,
                      bool _forceTab,
                      bool _namespaceIndent,
                      bool _caseIndent,
                      bool _preprocBlockIndent,
                      bool _preprocDefineIndent,
                      bool _emptyLineFill,
                      vector<const pair<const string, const string>* >* _indentableMacros)
{
	// formatting variables from ASFormatter and ASBeautifier
	ASBase::init(_fileType);
	indentLength = _indentLength;
	tabLength = _tabLength;
	useTabs = _useTabs;
	forceTab = _forceTab;
	namespaceIndent = _namespaceIndent;
	caseIndent = _caseIndent;
	preprocBlockIndent = _preprocBlockIndent;
	preprocDefineIndent = _preprocDefineIndent;
	emptyLineFill = _emptyLineFill;
	indentableMacros = _indentableMacros;
	quoteChar = '\'';

	// unindent variables
	lineNumber = 0;
	bracketCount = 0;
	isInComment = false;
	isInQuote = false;
	switchDepth = 0;
	eventPreprocDepth = 0;
	lookingForCaseBracket = false;
	unindentNextLine = false;
	shouldUnindentLine = false;
	shouldUnindentComment = false;

	// switch struct and vector
	sw.switchBracketCount = 0;
	sw.unindentDepth = 0;
	sw.unindentCase = false;
	switchStack.clear();

	// other variables
	nextLineIsEventIndent = false;
	isInEventTable = false;
	nextLineIsDeclareIndent = false;
	isInDeclareSection = false;
}

/**
 * additional formatting for line of source code.
 * every line of source code in a source code file should be sent
 *     one after the other to this function.
 * indents event tables
 * unindents the case blocks
 *
 * @param line       the original formatted line will be updated if necessary.
 */
void ASEnhancer::enhance(string &line, bool isInNamespace, bool isInPreprocessor, bool isInSQL)
{
	shouldUnindentLine = true;
	shouldUnindentComment = false;
	lineNumber++;

	// check for beginning of event table
	if (nextLineIsEventIndent)
	{
		isInEventTable = true;
		nextLineIsEventIndent = false;
	}

	// check for beginning of SQL declare section
	if (nextLineIsDeclareIndent)
	{
		isInDeclareSection = true;
		nextLineIsDeclareIndent = false;
	}

	if (line.length() == 0
	        && !isInEventTable
	        && !isInDeclareSection
	        && !emptyLineFill)
		return;

	// test for unindent on attached brackets
	if (unindentNextLine)
	{
		sw.unindentDepth++;
		sw.unindentCase = true;
		unindentNextLine = false;
	}

	// parse characters in the current line
	parseCurrentLine(line, isInPreprocessor, isInSQL);

	// check for SQL indentable lines
	if (isInDeclareSection)
	{
		size_t firstText = line.find_first_not_of(" \t");
		if (firstText == string::npos || line[firstText] != '#')
			indentLine(line, 1);
	}

	// check for event table indentable lines
	if (isInEventTable
	        && (eventPreprocDepth == 0
	            || (namespaceIndent && isInNamespace)))
	{
		size_t firstText = line.find_first_not_of(" \t");
		if (firstText == string::npos || line[firstText] != '#')
			indentLine(line, 1);
	}

	if (shouldUnindentComment && sw.unindentDepth > 0)
		unindentLine(line, sw.unindentDepth - 1);
	else if (shouldUnindentLine && sw.unindentDepth > 0)
		unindentLine(line, sw.unindentDepth);
}

/**
 * convert a force-tab indent to spaces
 *
 * @param line          a reference to the line that will be converted.
 */
void ASEnhancer::convertForceTabIndentToSpaces(string &line) const
{
	// replace tab indents with spaces
	for (size_t i = 0; i < line.length(); i++)
	{
		if (!isWhiteSpace(line[i]))
			break;
		if (line[i] == '\t')
		{
			line.erase(i, 1);
			line.insert(i, tabLength, ' ');
			i += tabLength - 1;
		}
	}
}

/**
 * convert a space indent to force-tab
 *
 * @param line          a reference to the line that will be converted.
 */
void ASEnhancer::convertSpaceIndentToForceTab(string &line) const
{
	assert(tabLength > 0);

	// replace leading spaces with tab indents
	size_t newSpaceIndentLength = line.find_first_not_of(" \t");
	size_t tabCount = newSpaceIndentLength / tabLength;		// truncate extra spaces
	line.erase(0U, tabCount * tabLength);
	line.insert(0U, tabCount, '\t');
}

/**
 * find the colon following a 'case' statement
 *
 * @param line          a reference to the line.
 * @param caseIndex     the line index of the case statement.
 * @return              the line index of the colon.
 */
size_t ASEnhancer::findCaseColon(string &line, size_t caseIndex) const
{
	size_t i = caseIndex;
	bool isInQuote_ = false;
	char quoteChar_ = ' ';
	for (; i < line.length(); i++)
	{
		if (isInQuote_)
		{
			if (line[i] == '\\')
			{
				i++;
				continue;
			}
			else if (line[i] == quoteChar_)          // check ending quote
			{
				isInQuote_ = false;
				quoteChar_ = ' ';
				continue;
			}
			else
			{
				continue;                           // must close quote before continuing
			}
		}
		if (line[i] == '\'' || line[i] == '\"')		// check opening quote
		{
			isInQuote_ = true;
			quoteChar_ = line[i];
			continue;
		}
		if (line[i] == ':')
		{
			if ((i + 1 < line.length()) && (line[i + 1] == ':'))
				i++;                                // bypass scope resolution operator
			else
				break;                              // found it
		}
	}
	return i;
}

/**
* indent a line by a given number of tabsets
 *    by inserting leading whitespace to the line argument.
 *
 * @param line          a reference to the line to indent.
 * @param indent        the number of tabsets to insert.
 * @return              the number of characters inserted.
 */
int ASEnhancer::indentLine(string &line, int indent) const
{
	if (line.length() == 0
	        && !emptyLineFill)
		return 0;

	size_t charsToInsert;

	if (forceTab && indentLength != tabLength)
	{
		// replace tab indents with spaces
		convertForceTabIndentToSpaces(line);
		// insert the space indents
		charsToInsert = indent * indentLength;
		line.insert(0U, charsToInsert, ' ');
		// replace leading spaces with tab indents
		convertSpaceIndentToForceTab(line);
	}
	else if (useTabs)
	{
		charsToInsert = indent;
		line.insert(0U, charsToInsert, '\t');
	}
	else // spaces
	{
		charsToInsert = indent * indentLength;
		line.insert(0U, charsToInsert, ' ');
	}

	return charsToInsert;
}

/**
 * check for SQL "BEGIN DECLARE SECTION".
 * must compare case insensitive and allow any spacing between words.
 *
 * @param line          a reference to the line to indent.
 * @param index         the current line index.
 * @return              true if a hit.
 */
bool ASEnhancer::isBeginDeclareSectionSQL(string &line, size_t index) const
{
	string word;
	size_t hits = 0;
	size_t i;
	for (i = index; i < line.length(); i++)
	{
		i = line.find_first_not_of(" \t", i);
		if (i == string::npos)
			return false;
		if (line[i] == ';')
			break;
		if (!isCharPotentialHeader(line, i))
			continue;
		word = getCurrentWord(line, i);
		for (size_t j = 0; j < word.length(); j++)
			word[j] = (char) toupper(word[j]);
		if (word == "EXEC" || word == "SQL")
		{
			i += word.length() - 1;
			continue;
		}
		if (word == "DECLARE" || word == "SECTION")
		{
			hits++;
			i += word.length() - 1;
			continue;
		}
		if (word == "BEGIN")
		{
			hits++;
			i += word.length() - 1;
			continue;
		}
		return false;
	}
	if (hits == 3)
		return true;
	return false;
}

/**
 * check for SQL "END DECLARE SECTION".
 * must compare case insensitive and allow any spacing between words.
 *
 * @param line          a reference to the line to indent.
 * @param index         the current line index.
 * @return              true if a hit.
 */
bool ASEnhancer::isEndDeclareSectionSQL(string &line, size_t index) const
{
	string word;
	size_t hits = 0;
	size_t i;
	for (i = index; i < line.length(); i++)
	{
		i = line.find_first_not_of(" \t", i);
		if (i == string::npos)
			return false;
		if (line[i] == ';')
			break;
		if (!isCharPotentialHeader(line, i))
			continue;
		word = getCurrentWord(line, i);
		for (size_t j = 0; j < word.length(); j++)
			word[j] = (char) toupper(word[j]);
		if (word == "EXEC" || word == "SQL")
		{
			i += word.length() - 1;
			continue;
		}
		if (word == "DECLARE" || word == "SECTION")
		{
			hits++;
			i += word.length() - 1;
			continue;
		}
		if (word == "END")
		{
			hits++;
			i += word.length() - 1;
			continue;
		}
		return false;
	}
	if (hits == 3)
		return true;
	return false;
}

/**
 * check if a one-line bracket has been reached,
 * i.e. if the currently reached '{' character is closed
 * with a complimentary '}' elsewhere on the current line,
 *.
 * @return     false = one-line bracket has not been reached.
 *             true  = one-line bracket has been reached.
 */
bool ASEnhancer::isOneLineBlockReached(string &line, int startChar) const
{
	assert(line[startChar] == '{');

	bool isInComment_ = false;
	bool isInQuote_ = false;
	int _bracketCount = 1;
	int lineLength = line.length();
	char quoteChar_ = ' ';
	char ch = ' ';

	for (int i = startChar + 1; i < lineLength; ++i)
	{
		ch = line[i];

		if (isInComment_)
		{
			if (line.compare(i, 2, "*/") == 0)
			{
				isInComment_ = false;
				++i;
			}
			continue;
		}

		if (ch == '\\')
		{
			++i;
			continue;
		}

		if (isInQuote_)
		{
			if (ch == quoteChar_)
				isInQuote_ = false;
			continue;
		}

		if (ch == '"' || ch == '\'')
		{
			isInQuote_ = true;
			quoteChar_ = ch;
			continue;
		}

		if (line.compare(i, 2, "//") == 0)
			break;

		if (line.compare(i, 2, "/*") == 0)
		{
			isInComment_ = true;
			++i;
			continue;
		}

		if (ch == '{')
			++_bracketCount;
		else if (ch == '}')
			--_bracketCount;

		if (_bracketCount == 0)
			return true;
	}

	return false;
}

/**
 * parse characters in the current line to determine if an indent
 * or unindent is needed.
 */
void ASEnhancer::parseCurrentLine(string &line, bool isInPreprocessor, bool isInSQL)
{
	bool isSpecialChar = false;			// is a backslash escape character

	for (size_t i = 0; i < line.length(); i++)
	{
		char ch = line[i];

		// bypass whitespace
		if (isWhiteSpace(ch))
			continue;

		// handle special characters (i.e. backslash+character such as \n, \t, ...)
		if (isSpecialChar)
		{
			isSpecialChar = false;
			continue;
		}
		if (!(isInComment) && line.compare(i, 2, "\\\\") == 0)
		{
			i++;
			continue;
		}
		if (!(isInComment) && ch == '\\')
		{
			isSpecialChar = true;
			continue;
		}

		// handle quotes (such as 'x' and "Hello Dolly")
		if (!isInComment && (ch == '"' || ch == '\''))
		{
			if (!isInQuote)
			{
				quoteChar = ch;
				isInQuote = true;
			}
			else if (quoteChar == ch)
			{
				isInQuote = false;
				continue;
			}
		}

		if (isInQuote)
			continue;

		// handle comments

		if (!(isInComment) && line.compare(i, 2, "//") == 0)
		{
			// check for windows line markers
			if (line.compare(i + 2, 1, "\xf0") > 0)
				lineNumber--;
			// unindent if not in case brackets
			if (line.find_first_not_of(" \t") == i
			        && sw.switchBracketCount == 1
			        && sw.unindentCase)
				shouldUnindentComment = true;
			break;                 // finished with the line
		}
		else if (!(isInComment) && line.compare(i, 2, "/*") == 0)
		{
			// unindent if not in case brackets
			if (sw.switchBracketCount == 1 && sw.unindentCase)
				shouldUnindentComment = true;
			isInComment = true;
			size_t commentEnd = line.find("*/", i);
			if (commentEnd == string::npos)
				i = line.length() - 1;
			else
				i = commentEnd - 1;
			continue;
		}
		else if ((isInComment) && line.compare(i, 2, "*/") == 0)
		{
			// unindent if not in case brackets
			if (sw.switchBracketCount == 1 && sw.unindentCase)
				shouldUnindentComment = true;
			isInComment = false;
			i++;
			continue;
		}

		if (isInComment)
		{
			// unindent if not in case brackets
			if (sw.switchBracketCount == 1 && sw.unindentCase)
				shouldUnindentComment = true;
			size_t commentEnd = line.find("*/", i);
			if (commentEnd == string::npos)
				i = line.length() - 1;
			else
				i = commentEnd - 1;
			continue;
		}

		// if we have reached this far then we are NOT in a comment or string of special characters

		if (line[i] == '{')
			bracketCount++;

		if (line[i] == '}')
			bracketCount--;

		// check for preprocessor within an event table
		if (isInEventTable && line[i] == '#' && preprocBlockIndent)
		{
			string preproc;
			preproc = line.substr(i + 1);
			if (preproc.substr(0, 2) == "if") // #if, #ifdef, #ifndef)
				eventPreprocDepth += 1;
			if (preproc.substr(0, 5) == "endif" && eventPreprocDepth > 0)
				eventPreprocDepth -= 1;
		}

		bool isPotentialKeyword = isCharPotentialHeader(line, i);

		// ----------------  wxWidgets and MFC macros  ----------------------------------

		if (isPotentialKeyword)
		{
			for (size_t j = 0; j < indentableMacros->size(); j++)
			{
				// 'first' is the beginning macro
				if (findKeyword(line, i, indentableMacros->at(j)->first))
				{
					nextLineIsEventIndent = true;
					break;
				}
			}
			for (size_t j = 0; j < indentableMacros->size(); j++)
			{
				// 'second' is the ending macro
				if (findKeyword(line, i, indentableMacros->at(j)->second))
				{
					isInEventTable = false;
					eventPreprocDepth = 0;
					break;
				}
			}
		}

		// ----------------  process SQL  -----------------------------------------------

		if (isInSQL)
		{
			if (isBeginDeclareSectionSQL(line, i))
				nextLineIsDeclareIndent = true;
			if (isEndDeclareSectionSQL(line, i))
				isInDeclareSection = false;
			break;
		}

		// ----------------  process switch statements  ---------------------------------

		if (isPotentialKeyword && findKeyword(line, i, "switch"))
		{
			switchDepth++;
			switchStack.push_back(sw);                      // save current variables
			sw.switchBracketCount = 0;
			sw.unindentCase = false;                        // don't clear case until end of switch
			i += 5;                                         // bypass switch statement
			continue;
		}

		// just want unindented case statements from this point

		if (caseIndent
		        || switchDepth == 0
		        || (isInPreprocessor && !preprocDefineIndent))
		{
			// bypass the entire word
			if (isPotentialKeyword)
			{
				string name = getCurrentWord(line, i);
				i += name.length() - 1;
			}
			continue;
		}

		i = processSwitchBlock(line, i);

	}   // end of for loop * end of for loop * end of for loop * end of for loop
}

/**
 * process the character at the current index in a switch block.
 *
 * @param line          a reference to the line to indent.
 * @param index         the current line index.
 * @return              the new line index.
 */
size_t ASEnhancer::processSwitchBlock(string &line, size_t index)
{
	size_t i = index;
	bool isPotentialKeyword = isCharPotentialHeader(line, i);

	if (line[i] == '{')
	{
		sw.switchBracketCount++;
		if (lookingForCaseBracket)                      // if 1st after case statement
		{
			sw.unindentCase = true;                     // unindenting this case
			sw.unindentDepth++;
			lookingForCaseBracket = false;              // not looking now
		}
		return i;
	}
	lookingForCaseBracket = false;                      // no opening bracket, don't indent

	if (line[i] == '}')
	{
		sw.switchBracketCount--;
		assert(sw.switchBracketCount <= bracketCount);
		if (sw.switchBracketCount == 0)                 // if end of switch statement
		{
			int lineUnindent = sw.unindentDepth;
			if (line.find_first_not_of(" \t") == i
			        && !switchStack.empty())
				lineUnindent = switchStack[switchStack.size() - 1].unindentDepth;
			if (shouldUnindentLine)
			{
				if (lineUnindent > 0)
					i -= unindentLine(line, lineUnindent);
				shouldUnindentLine = false;
			}
			switchDepth--;
			sw = switchStack.back();
			switchStack.pop_back();
		}
		return i;
	}

	if (isPotentialKeyword
	        && (findKeyword(line, i, "case") || findKeyword(line, i, "default")))
	{
		if (sw.unindentCase)					// if unindented last case
		{
			sw.unindentCase = false;			// stop unindenting previous case
			sw.unindentDepth--;
		}

		i = findCaseColon(line, i);

		i++;
		for (; i < line.length(); i++)			// bypass whitespace
		{
			if (!isWhiteSpace(line[i]))
				break;
		}
		if (i < line.length())
		{
			if (line[i] == '{')
			{
				bracketCount++;
				sw.switchBracketCount++;
				if (!isOneLineBlockReached(line, i))
					unindentNextLine = true;
				return i;
			}
		}
		lookingForCaseBracket = true;
		i--;									// need to process this char
		return i;
	}
	if (isPotentialKeyword)
	{
		string name = getCurrentWord(line, i);          // bypass the entire name
		i += name.length() - 1;
	}
	return i;
}

/**
 * unindent a line by a given number of tabsets
 *    by erasing the leading whitespace from the line argument.
 *
 * @param line          a reference to the line to unindent.
 * @param unindent      the number of tabsets to erase.
 * @return              the number of characters erased.
 */
int ASEnhancer::unindentLine(string &line, int unindent) const
{
	size_t whitespace = line.find_first_not_of(" \t");

	if (whitespace == string::npos)         // if line is blank
		whitespace = line.length();         // must remove padding, if any

	if (whitespace == 0)
		return 0;

	size_t charsToErase = 0;

	if (forceTab && indentLength != tabLength)
	{
		// replace tab indents with spaces
		convertForceTabIndentToSpaces(line);
		// remove the space indents
		size_t spaceIndentLength = line.find_first_not_of(" \t");
		charsToErase = unindent * indentLength;
		if (charsToErase <= spaceIndentLength)
			line.erase(0, charsToErase);
		else
			charsToErase = 0;
		// replace leading spaces with tab indents
		convertSpaceIndentToForceTab(line);
	}
	else if (useTabs)
	{
		charsToErase = unindent;
		if (charsToErase <= whitespace)
			line.erase(0, charsToErase);
		else
			charsToErase = 0;
	}
	else // spaces
	{
		charsToErase = unindent * indentLength;
		if (charsToErase <= whitespace)
			line.erase(0, charsToErase);
		else
			charsToErase = 0;
	}

	return charsToErase;
}


}   // end namespace astyle


================================================
FILE: 3rdpart/astyle/ASFormatter.cpp
================================================
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 *   ASFormatter.cpp
 *
 *   Copyright (C) 2014 by Jim Pattee
 *   <http://www.gnu.org/licenses/lgpl-3.0.html>
 *
 *   This file is a part of Artistic Style - an indentation and
 *   reformatting tool for C, C++, C# and Java source files.
 *   <http://astyle.sourceforge.net>
 *
 *   Artistic Style is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU Lesser General Public License as published
 *   by the Free Software Foundation, either version 3 of the License, or
 *   (at your option) any later version.
 *
 *   Artistic Style is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU Lesser General Public License for more details.
 *
 *   You should have received a copy of the GNU Lesser General Public License
 *   along with Artistic Style.  If not, see <http://www.gnu.org/licenses/>.
 *
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 */

#include "astyle.h"

#include <algorithm>
#include <fstream>


namespace astyle {
/**
 * Constructor of ASFormatter
 */
ASFormatter::ASFormatter()
{
	sourceIterator = NULL;
	enhancer = new ASEnhancer;
	preBracketHeaderStack = NULL;
	bracketTypeStack = NULL;
	parenStack = NULL;
	structStack = NULL;
	questionMarkStack = NULL;
	lineCommentNoIndent = false;
	formattingStyle = STYLE_NONE;
	bracketFormatMode = NONE_MODE;
	pointerAlignment = PTR_ALIGN_NONE;
	referenceAlignment = REF_SAME_AS_PTR;
	objCColonPadMode = COLON_PAD_NO_CHANGE;
	lineEnd = LINEEND_DEFAULT;
	maxCodeLength = string::npos;
	shouldPadOperators = false;
	shouldPadParensOutside = false;
	shouldPadFirstParen = false;
	shouldPadParensInside = false;
	shouldPadHeader = false;
	shouldStripCommentPrefix = false;
	shouldUnPadParens = false;
	attachClosingBracketMode = false;
	shouldBreakOneLineBlocks = true;
	shouldBreakOneLineStatements = true;
	shouldConvertTabs = false;
	shouldIndentCol1Comments = false;
	shouldIndentPreprocBlock = false;
	shouldCloseTemplates = false;
	shouldAttachExternC = false;
	shouldAttachNamespace = false;
	shouldAttachClass = false;
	shouldAttachInline = false;
	shouldBreakBlocks = false;
	shouldBreakClosingHeaderBlocks = false;
	shouldBreakClosingHeaderBrackets = false;
	shouldDeleteEmptyLines = false;
	shouldBreakElseIfs = false;
	shouldBreakLineAfterLogical = false;
	shouldAddBrackets = false;
	shouldAddOneLineBrackets = false;
	shouldRemoveBrackets = false;
	shouldPadMethodColon = false;
	shouldPadMethodPrefix = false;
	shouldUnPadMethodPrefix = false;

	// initialize ASFormatter member vectors
	formatterFileType = 9;		// reset to an invalid type
	headers = new vector<const string*>;
	nonParenHeaders = new vector<const string*>;
	preDefinitionHeaders = new vector<const string*>;
	preCommandHeaders = new vector<const string*>;
	operators = new vector<const string*>;
	assignmentOperators = new vector<const string*>;
	castOperators = new vector<const string*>;

	// initialize ASEnhancer member vectors
	indentableMacros = new vector<const pair<const string, const string>* >;
}

/**
 * Destructor of ASFormatter
 */
ASFormatter::~ASFormatter()
{
	// delete ASFormatter stack vectors
	deleteContainer(preBracketHeaderStack);
	deleteContainer(bracketTypeStack);
	deleteContainer(parenStack);
	deleteContainer(structStack);
	deleteContainer(questionMarkStack);

	// delete ASFormatter member vectors
	formatterFileType = 9;		// reset to an invalid type
	delete headers;
	delete nonParenHeaders;
	delete preDefinitionHeaders;
	delete preCommandHeaders;
	delete operators;
	delete assignmentOperators;
	delete castOperators;

	// delete ASEnhancer member vectors
	delete indentableMacros;

	// delete ASBeautifier member vectors
	// must be done when the ASFormatter object is deleted (not ASBeautifier)
	ASBeautifier::deleteBeautifierVectors();

	delete enhancer;
}

/**
 * initialize the ASFormatter.
 *
 * init() should be called every time a ASFormatter object is to start
 * formatting a NEW source file.
 * init() receives a pointer to a ASSourceIterator object that will be
 * used to iterate through the source code.
 *
 * @param si        a pointer to the ASSourceIterator or ASStreamIterator object.
 */
void ASFormatter::init(ASSourceIterator* si)
{
	buildLanguageVectors();
	fixOptionVariableConflicts();
	ASBeautifier::init(si);
	sourceIterator = si;

	enhancer->init(getFileType(),
	               getIndentLength(),
	               getTabLength(),
	               getIndentString() == "\t" ? true : false,
	               getForceTabIndentation(),
	               getNamespaceIndent(),
	               getCaseIndent(),
	               shouldIndentPreprocBlock,
	               getPreprocDefineIndent(),
	               getEmptyLineFill(),
	               indentableMacros);

	initContainer(preBracketHeaderStack, new vector<const string*>);
	initContainer(parenStack, new vector<int>);
	initContainer(structStack, new vector<bool>);
	initContainer(questionMarkStack, new vector<bool>);
	parenStack->push_back(0);               // parenStack must contain this default entry
	initContainer(bracketTypeStack, new vector<BracketType>);
	bracketTypeStack->push_back(NULL_TYPE); // bracketTypeStack must contain this default entry
	clearFormattedLineSplitPoints();

	currentHeader = NULL;
	currentLine = "";
	readyFormattedLine = "";
	formattedLine = "";
	verbatimDelimiter = "";
	currentChar = ' ';
	previousChar = ' ';
	previousCommandChar = ' ';
	previousNonWSChar = ' ';
	quoteChar = '"';
	preprocBlockEnd = 0;
	charNum = 0;
	checksumIn = 0;
	checksumOut = 0;
	currentLineFirstBracketNum = string::npos;
	formattedLineCommentNum = 0;
	leadingSpaces = 0;
	previousReadyFormattedLineLength = string::npos;
	preprocBracketTypeStackSize = 0;
	spacePadNum = 0;
	nextLineSpacePadNum = 0;
	templateDepth = 0;
	squareBracketCount = 0;
	horstmannIndentChars = 0;
	tabIncrementIn = 0;
	previousBracketType = NULL_TYPE;
	previousOperator = NULL;

	isVirgin = true;
	isInLineComment = false;
	isInComment = false;
	isInCommentStartLine = false;
	noTrimCommentContinuation = false;
	isInPreprocessor = false;
	isInPreprocessorBeautify = false;
	doesLineStartComment = false;
	lineEndsInCommentOnly = false;
	lineIsCommentOnly = false;
	lineIsLineCommentOnly = false;
	lineIsEmpty = false;
	isImmediatelyPostCommentOnly = false;
	isImmediatelyPostEmptyLine = false;
	isInClassInitializer = false;
	isInQuote = false;
	isInVerbatimQuote = false;
	haveLineContinuationChar = false;
	isInQuoteContinuation = false;
	isHeaderInMultiStatementLine = false;
	isSpecialChar = false;
	isNonParenHeader = false;
	foundNamespaceHeader = false;
	foundClassHeader = false;
	foundStructHeader = false;
	foundInterfaceHeader = false;
	foundPreDefinitionHeader = false;
	foundPreCommandHeader = false;
	foundPreCommandMacro = false;
	foundCastOperator = false;
	foundQuestionMark = false;
	isInLineBreak = false;
	endOfAsmReached = false;
	endOfCodeReached = false;
	isFormattingModeOff = false;
	isInEnum = false;
	isInExecSQL = false;
	isInAsm = false;
	isInAsmOneLine = false;
	isInAsmBlock = false;
	isLineReady = false;
	elseHeaderFollowsComments = false;
	caseHeaderFollowsComments = false;
	isPreviousBracketBlockRelated = false;
	isInPotentialCalculation = false;
	shouldReparseCurrentChar = false;
	needHeaderOpeningBracket = false;
	shouldBreakLineAtNextChar = false;
	shouldKeepLineUnbroken = false;
	passedSemicolon = false;
	passedColon = false;
	isImmediatelyPostNonInStmt = false;
	isCharImmediatelyPostNonInStmt = false;
	isInTemplate = false;
	isImmediatelyPostComment = false;
	isImmediatelyPostLineComment = false;
	isImmediatelyPostEmptyBlock = false;
	isImmediatelyPostPreprocessor = false;
	isImmediatelyPostReturn = false;
	isImmediatelyPostThrow = false;
	isImmediatelyPostOperator = false;
	isImmediatelyPostTemplate = false;
	isImmediatelyPostPointerOrReference = false;
	isCharImmediatelyPostReturn = false;
	isCharImmediatelyPostThrow = false;
	isCharImmediatelyPostOperator = false;
	isCharImmediatelyPostComment = false;
	isPreviousCharPostComment = false;
	isCharImmediatelyPostLineComment = false;
	isCharImmediatelyPostOpenBlock = false;
	isCharImmediatelyPostCloseBlock = false;
	isCharImmediatelyPostTemplate = false;
	isCharImmediatelyPostPointerOrReference = false;
	isInObjCMethodDefinition = false;
	isInObjCInterface = false;
	isInObjCSelector = false;
	breakCurrentOneLineBlock = false;
	shouldRemoveNextClosingBracket = false;
	isInHorstmannRunIn = false;
	currentLineBeginsWithBracket = false;
	isPrependPostBlockEmptyLineRequested = false;
	isAppendPostBlockEmptyLineRequested = false;
	isIndentableProprocessor = false;
	isIndentableProprocessorBlock = false;
	prependEmptyLine = false;
	appendOpeningBracket = false;
	foundClosingHeader = false;
	isImmediatelyPostHeader = false;
	isInHeader = false;
	isInCase = false;
	isFirstPreprocConditional = false;
	processedFirstConditional = false;
	isJavaStaticConstructor = false;
}

/**
 * build vectors for each programing language
 * depending on the file extension.
 */
void ASFormatter::buildLanguageVectors()
{
	if (getFileType() == formatterFileType)  // don't build unless necessary
		return;

	formatterFileType = getFileType();

	headers->clear();
	nonParenHeaders->clear();
	preDefinitionHeaders->clear();
	preCommandHeaders->clear();
	operators->clear();
	assignmentOperators->clear();
	castOperators->clear();
	indentableMacros->clear();	// ASEnhancer

	ASResource::buildHeaders(headers, getFileType());
	ASResource::buildNonParenHeaders(nonParenHeaders, getFileType());
	ASResource::buildPreDefinitionHeaders(preDefinitionHeaders, getFileType());
	ASResource::buildPreCommandHeaders(preCommandHeaders, getFileType());
	ASResource::buildOperators(operators, getFileType());
	ASResource::buildAssignmentOperators(assignmentOperators);
	ASResource::buildCastOperators(castOperators);
	ASResource::buildIndentableMacros(indentableMacros);	//ASEnhancer
}

/**
 * set the variables for each predefined style.
 * this will override any previous settings.
 */
void ASFormatter::fixOptionVariableConflicts()
{
	if (formattingStyle == STYLE_ALLMAN)
	{
		setBracketFormatMode(BREAK_MODE);
	}
	else if (formattingStyle == STYLE_JAVA)
	{
		setBracketFormatMode(ATTACH_MODE);
	}
	else if (formattingStyle == STYLE_KR)
	{
		setBracketFormatMode(LINUX_MODE);
	}
	else if (formattingStyle == STYLE_STROUSTRUP)
	{
		setBracketFormatMode(STROUSTRUP_MODE);
	}
	else if (formattingStyle == STYLE_WHITESMITH)
	{
		setBracketFormatMode(BREAK_MODE);
		setBracketIndent(true);
		setClassIndent(true);			// avoid hanging indent with access modifiers
		setSwitchIndent(true);			// avoid hanging indent with case statements
	}
	else if (formattingStyle == STYLE_VTK)
	{
		// the unindented class bracket does NOT cause a hanging indent like Whitesmith
		setBracketFormatMode(BREAK_MODE);
		setBracketIndentVtk(true);		// sets both bracketIndent and bracketIndentVtk
		setSwitchIndent(true);			// avoid hanging indent with case statements
	}
	else if (formattingStyle == STYLE_BANNER)
	{
		// attached brackets can have hanging indents with the closing bracket
		setBracketFormatMode(ATTACH_MODE);
		setBracketIndent(true);
		setClassIndent(true);			// avoid hanging indent with access modifiers
		setSwitchIndent(true);			// avoid hanging indent with case statements
	}
	else if (formattingStyle == STYLE_GNU)
	{
		setBracketFormatMode(BREAK_MODE);
		setBlockIndent(true);
	}
	else if (formattingStyle == STYLE_LINUX)
	{
		setBracketFormatMode(LINUX_MODE);
		// always for Linux style
		setMinConditionalIndentOption(MINCOND_ONEHALF);
	}
	else if (formattingStyle == STYLE_HORSTMANN)
	{
		setBracketFormatMode(RUN_IN_MODE);
		setSwitchIndent(true);
	}
	else if (formattingStyle == STYLE_1TBS)
	{
		setBracketFormatMode(LINUX_MODE);
		setAddBracketsMode(true);
		setRemoveBracketsMode(false);
	}
	else if (formattingStyle == STYLE_GOOGLE)
	{
		setBracketFormatMode(ATTACH_MODE);
		setModifierIndent(true);
		setClassIndent(false);
	}
	else if (formattingStyle == STYLE_PICO)
	{
		setBracketFormatMode(RUN_IN_MODE);
		setAttachClosingBracketMode(true);
		setSwitchIndent(true);
		setBreakOneLineBlocksMode(false);
		setSingleStatementsMode(false);
		// add-brackets won't work for pico, but it could be fixed if necessary
		// both options should be set to true
		if (shouldAddBrackets)
			shouldAddOneLineBrackets = true;
	}
	else if (formattingStyle == STYLE_LISP)
	{
		setBracketFormatMode(ATTACH_MODE);
		setAttachClosingBracketMode(true);
		setSingleStatementsMode(false);
		// add-one-line-brackets won't work for lisp
		// only shouldAddBrackets should be set to true
		if (shouldAddOneLineBrackets)
		{
			shouldAddBrackets = true;
			shouldAddOneLineBrackets = false;
		}
	}
	setMinConditionalIndentLength();
	// if not set by indent=force-tab-x set equal to indentLength
	if (!getTabLength())
		setDefaultTabLength();
	// add-one-line-brackets implies keep-one-line-blocks
	if (shouldAddOneLineBrackets)
		setBreakOneLineBlocksMode(false);
	// don't allow add-brackets and remove-brackets
	if (shouldAddBrackets || shouldAddOneLineBrackets)
		setRemoveBracketsMode(false);
	// don't allow indent-classes and indent-modifiers
	if (getClassIndent())
		setModifierIndent(false);
}

/**
 * get the next formatted line.
 *
 * @return    formatted line.
 */
string ASFormatter::nextLine()
{
	const string* newHeader;
	bool isInVirginLine = isVirgin;
	isCharImmediatelyPostComment = false;
	isPreviousCharPostComment = false;
	isCharImmediatelyPostLineComment = false;
	isCharImmediatelyPostOpenBlock = false;
	isCharImmediatelyPostCloseBlock = false;
	isCharImmediatelyPostTemplate = false;

	while (!isLineReady)
	{
		if (shouldReparseCurrentChar)
			shouldReparseCurrentChar = false;
		else if (!getNextChar())
		{
			breakLine();
			continue;
		}
		else // stuff to do when reading a new character...
		{
			// make sure that a virgin '{' at the beginning of the file will be treated as a block...
			if (isInVirginLine && currentChar == '{'
			        && currentLineBeginsWithBracket
			        && previousCommandChar == ' ')
				previousCommandChar = '{';
			if (isInClassInitializer
			        && isBracketType(bracketTypeStack->back(), COMMAND_TYPE))
				isInClassInitializer = false;
			if (isInHorstmannRunIn)
				isInLineBreak = false;
			if (!isWhiteSpace(currentChar))
				isInHorstmannRunIn = false;
			isPreviousCharPostComment = isCharImmediatelyPostComment;
			isCharImmediatelyPostComment = false;
			isCharImmediatelyPostTemplate = false;
			isCharImmediatelyPostReturn = false;
			isCharImmediatelyPostThrow = false;
			isCharImmediatelyPostOperator = false;
			isCharImmediatelyPostPointerOrReference = false;
			isCharImmediatelyPostOpenBlock = false;
			isCharImmediatelyPostCloseBlock = false;
		}

		if ((lineIsLineCommentOnly || lineIsCommentOnly)
		        && currentLine.find("*INDENT-ON*", charNum) != string::npos
		        && isFormattingModeOff)
		{
			isFormattingModeOff = false;
			breakLine();
			formattedLine = currentLine;
			charNum = (int) currentLine.length() - 1;
			continue;
		}
		if (isFormattingModeOff)
		{
			breakLine();
			formattedLine = currentLine;
			charNum = (int) currentLine.length() - 1;
			continue;
		}
		if ((lineIsLineCommentOnly || lineIsCommentOnly)
		        && currentLine.find("*INDENT-OFF*", charNum) != string::npos)
		{
			isFormattingModeOff = true;
			if (isInLineBreak)			// is true if not the first line
				breakLine();
			formattedLine = currentLine;
			charNum = (int)currentLine.length() - 1;
			continue;
		}

		if (shouldBreakLineAtNextChar)
		{
			if (isWhiteSpace(currentChar) && !lineIsEmpty)
				continue;
			isInLineBreak = true;
			shouldBreakLineAtNextChar = false;
		}

		if (isInExecSQL && !passedSemicolon)
		{
			if (currentChar == ';')
				passedSemicolon = true;
			appendCurrentChar();
			continue;
		}

		if (isInLineComment)
		{
			formatLineCommentBody();
			continue;
		}
		else if (isInComment)
		{
			formatCommentBody();
			continue;
		}

		else if (isInQuote)
		{
			formatQuoteBody();
			continue;
		}

		// not in quote or comment or line comment

		if (isSequenceReached("//"))
		{
			formatLineCommentOpener();
			testForTimeToSplitFormattedLine();
			continue;
		}
		else if (isSequenceReached("/*"))
		{
			formatCommentOpener();
			testForTimeToSplitFormattedLine();
			continue;
		}
		else if (currentChar == '"' || currentChar == '\'')
		{
			formatQuoteOpener();
			testForTimeToSplitFormattedLine();
			continue;
		}
		// treat these preprocessor statements as a line comment
		else if (currentChar == '#'
		         && currentLine.find_first_not_of(" \t") == (size_t) charNum)
		{
			string preproc = trim(currentLine.c_str() + charNum + 1);
			if (preproc.length() > 0
			        && isCharPotentialHeader(preproc, 0)
			        && (findKeyword(preproc, 0, "region")
			            || findKeyword(preproc, 0, "endregion")
			            || findKeyword(preproc, 0, "error")
			            || findKeyword(preproc, 0, "warning")
			            || findKeyword(preproc, 0, "line")))
			{
				currentLine = rtrim(currentLine);	// trim the end only
				// check for horstmann run-in
				if (formattedLine.length() > 0 && formattedLine[0] == '{')
				{
					isInLineBreak = true;
					isInHorstmannRunIn = false;
				}
				if (previousCommandChar == '}')
					currentHeader = NULL;
				isInLineComment = true;
				appendCurrentChar();
				continue;
			}
		}

		if (isInPreprocessor)
		{
			appendCurrentChar();
			continue;
		}

		if (isInTemplate && shouldCloseTemplates)
		{
			if (previousCommandChar == '<' && isWhiteSpace(currentChar))
				continue;
			if (isWhiteSpace(currentChar) && peekNextChar() == '>')
				continue;
		}

		if (shouldRemoveNextClosingBracket && currentChar == '}')
		{
			currentLine[charNum] = currentChar = ' ';
			shouldRemoveNextClosingBracket = false;
			assert(adjustChecksumIn(-'}'));
			// if the line is empty, delete it
			if (currentLine.find_first_not_of(" \t"))
				continue;
		}

		// handle white space - needed to simplify the rest.
		if (isWhiteSpace(currentChar))
		{
			appendCurrentChar();
			continue;
		}

		/* not in MIDDLE of quote or comment or SQL or white-space of any type ... */

		// check if in preprocessor
		// ** isInPreprocessor will be automatically reset at the beginning
		//    of a new line in getnextChar()
		if (currentChar == '#')
		{
			isInPreprocessor = true;
			// check for horstmann run-in
			if (formattedLine.length() > 0 && formattedLine[0] == '{')
			{
				isInLineBreak = true;
				isInHorstmannRunIn = false;
			}
			processPreprocessor();
			// if top level it is potentially indentable
			if (shouldIndentPreprocBlock
			        && (isBracketType(bracketTypeStack->back(), NULL_TYPE)
			            || isBracketType(bracketTypeStack->back(), NAMESPACE_TYPE))
			        && !foundClassHeader
			        && !isInClassInitializer
			        && sourceIterator->tellg() > preprocBlockEnd)
			{
				// indent the #if preprocessor blocks
				string preproc = ASBeautifier::extractPreprocessorStatement(currentLine);
				if (preproc.length() >= 2 && preproc.substr(0, 2) == "if") // #if, #ifdef, #ifndef
				{
					if (isImmediatelyPostPreprocessor)
						breakLine();
					isIndentableProprocessorBlock = isIndentablePreprocessorBlock(currentLine, charNum);
					isIndentableProprocessor = isIndentableProprocessorBlock;
				}
			}
			if (isIndentableProprocessorBlock
			        && charNum < (int) currentLine.length() - 1
			        && isWhiteSpace(currentLine[charNum + 1]))
			{
				size_t nextText = currentLine.find_first_not_of(" \t", charNum + 1);
				if (nextText != string::npos)
					currentLine.erase(charNum + 1, nextText - charNum - 1);
			}
			if (isIndentableProprocessorBlock
			        && sourceIterator->tellg() >= preprocBlockEnd)
				isIndentableProprocessorBlock = false;
			//  need to fall thru here to reset the variables
		}

		/* not in preprocessor ... */

		if (isImmediatelyPostComment)
		{
			caseHeaderFollowsComments = false;
			isImmediatelyPostComment = false;
			isCharImmediatelyPostComment = true;
		}

		if (isImmediatelyPostLineComment)
		{
			caseHeaderFollowsComments = false;
			isImmediatelyPostLineComment = false;
			isCharImmediatelyPostLineComment = true;
		}

		if (isImmediatelyPostReturn)
		{
			isImmediatelyPostReturn = false;
			isCharImmediatelyPostReturn = true;
		}

		if (isImmediatelyPostThrow)
		{
			isImmediatelyPostThrow = false;
			isCharImmediatelyPostThrow = true;
		}

		if (isImmediatelyPostOperator)
		{
			isImmediatelyPostOperator = false;
			isCharImmediatelyPostOperator = true;
		}
		if (isImmediatelyPostTemplate)
		{
			isImmediatelyPostTemplate = false;
			isCharImmediatelyPostTemplate = true;
		}
		if (isImmediatelyPostPointerOrReference)
		{
			isImmediatelyPostPointerOrReference = false;
			isCharImmediatelyPostPointerOrReference = true;
		}

		// reset isImmediatelyPostHeader information
		if (isImmediatelyPostHeader)
		{
			// should brackets be added
			if (currentChar != '{' && shouldAddBrackets)
			{
				bool bracketsAdded = addBracketsToStatement();
				if (bracketsAdded && !shouldAddOneLineBrackets)
				{
					size_t firstText = currentLine.find_first_not_of(" \t");
					assert(firstText != string::npos);
					if ((int) firstText == charNum)
						breakCurrentOneLineBlock = true;
				}
			}
			// should brackets be removed
			else if (currentChar == '{' && shouldRemoveBrackets)
			{
				bool bracketsRemoved = removeBracketsFromStatement();
				if (bracketsRemoved)
				{
					shouldRemoveNextClosingBracket = true;
					if (isBeforeAnyLineEndComment(charNum))
						spacePadNum--;
					else if (shouldBreakOneLineBlocks
					         || (currentLineBeginsWithBracket
					             && currentLine.find_first_not_of(" \t") != string::npos))
						shouldBreakLineAtNextChar = true;
					continue;
				}
			}

			// break 'else-if' if shouldBreakElseIfs is requested
			if (shouldBreakElseIfs
			        && currentHeader == &AS_ELSE
			        && isOkToBreakBlock(bracketTypeStack->back())
			        && !isBeforeAnyComment()
			        && (shouldBreakOneLineStatements || !isHeaderInMultiStatementLine))
			{
				string nextText = peekNextText(currentLine.substr(charNum));
				if (nextText.length() > 0
				        && isCharPotentialHeader(nextText, 0)
				        && ASBeautifier::findHeader(nextText, 0, headers) == &AS_IF)
				{
					isInLineBreak = true;
				}
			}

			isImmediatelyPostHeader = false;
		}

		if (passedSemicolon)    // need to break the formattedLine
		{
			passedSemicolon = false;
			if (parenStack->back() == 0 && !isCharImmediatelyPostComment && currentChar != ';') // allow ;;
			{
				// does a one-line block have ending comments?
				if (isBracketType(bracketTypeStack->back(), SINGLE_LINE_TYPE))
				{
					size_t blockEnd = currentLine.rfind(AS_CLOSE_BRACKET);
					assert(blockEnd != string::npos);
					// move ending comments to this formattedLine
					if (isBeforeAnyLineEndComment(blockEnd))
					{
						size_t commentStart = currentLine.find_first_not_of(" \t", blockEnd + 1);
						assert(commentStart != string::npos);
						assert((currentLine.compare(commentStart, 2, "//") == 0)
						       || (currentLine.compare(commentStart, 2, "/*") == 0));
						size_t commentLength = currentLine.length() - commentStart;
						formattedLine.append(getIndentLength() - 1, ' ');
						formattedLine.append(currentLine, commentStart, commentLength);
						currentLine.erase(commentStart, commentLength);
						testForTimeToSplitFormattedLine();
					}
				}
				isInExecSQL = false;
				shouldReparseCurrentChar = true;
				if (formattedLine.find_first_not_of(" \t") != string::npos)
					isInLineBreak = true;
				if (needHeaderOpeningBracket)
				{
					isCharImmediatelyPostCloseBlock = true;
					needHeaderOpeningBracket = false;
				}
				continue;
			}
		}

		if (passedColon)
		{
			passedColon = false;
			if (parenStack->back() == 0
			        && !isBeforeAnyComment()
			        && (formattedLine.find_first_not_of(" \t") != string::npos))
			{
				shouldReparseCurrentChar = true;
				isInLineBreak = true;
				continue;
			}
		}

		// Check if in template declaration, e.g. foo<bar> or foo<bar,fig>
		if (!isInTemplate && currentChar == '<')
		{
			checkIfTemplateOpener();
		}

		// handle parens
		if (currentChar == '(' || currentChar == '[' || (isInTemplate && currentChar == '<'))
		{
			questionMarkStack->push_back(foundQuestionMark);
			foundQuestionMark = false;
			parenStack->back()++;
			if (currentChar == '[')
				++squareBracketCount;
		}
		else if (currentChar == ')' || currentChar == ']' || (isInTemplate && currentChar == '>'))
		{
			foundPreCommandHeader = false;
			parenStack->back()--;
			// this can happen in preprocessor directives
			if (parenStack->back() < 0)
				parenStack->back() = 0;
			if (!questionMarkStack->empty())
			{
				foundQuestionMark = questionMarkStack->back();
				questionMarkStack->pop_back();
			}
			if (isInTemplate && currentChar == '>')
			{
				templateDepth--;
				if (templateDepth == 0)
				{
					isInTemplate = false;
					isImmediatelyPostTemplate = true;
				}
			}

			// check if this parenthesis closes a header, e.g. if (...), while (...)
			if (isInHeader && parenStack->back() == 0)
			{
				isInHeader = false;
				isImmediatelyPostHeader = true;
				foundQuestionMark = false;
			}
			if (currentChar == ']')
			{
				--squareBracketCount;
				if (squareBracketCount < 0)
					squareBracketCount = 0;
			}
			if (currentChar == ')')
			{
				foundCastOperator = false;
				if (parenStack->back() == 0)
					endOfAsmReached = true;
			}
		}

		// handle brackets
		if (currentChar == '{' || currentChar == '}')
		{
			// if appendOpeningBracket this was already done for the original bracket
			if (currentChar == '{' && !appendOpeningBracket)
			{
				BracketType newBracketType = getBracketType();
				foundNamespaceHeader = false;
				foundClassHeader = false;
				foundStructHeader = false;
				foundInterfaceHeader = false;
				foundPreDefinitionHeader = false;
				foundPreCommandHeader = false;
				foundPreCommandMacro = false;
				isInPotentialCalculation = false;
				isInObjCMethodDefinition = false;
				isInObjCInterface = false;
				isInEnum = false;
				isJavaStaticConstructor = false;
				isCharImmediatelyPostNonInStmt = false;
				needHeaderOpeningBracket = false;
				shouldKeepLineUnbroken = false;

				isPreviousBracketBlockRelated = !isBracketType(newBracketType, ARRAY_TYPE);
				bracketTypeStack->push_back(newBracketType);
				preBracketHeaderStack->push_back(currentHeader);
				currentHeader = NULL;
				structStack->push_back(isInIndentableStruct);
				if (isBracketType(newBracketType, STRUCT_TYPE) && isCStyle())
					isInIndentableStruct = isStructAccessModified(currentLine, charNum);
				else
					isInIndentableStruct = false;
			}

			// this must be done before the bracketTypeStack is popped
			BracketType bracketType = bracketTypeStack->back();
			bool isOpeningArrayBracket = (isBracketType(bracketType, ARRAY_TYPE)
			                              && bracketTypeStack->size() >= 2
			                              && !isBracketType((*bracketTypeStack)[bracketTypeStack->size() - 2], ARRAY_TYPE)
			                             );

			if (currentChar == '}')
			{
				// if a request has been made to append a post block empty line,
				// but the block exists immediately before a closing bracket,
				// then there is no need for the post block empty line.
				isAppendPostBlockEmptyLineRequested = false;
				breakCurrentOneLineBlock = false;
				if (isInAsm)
					endOfAsmReached = true;
				isInAsmOneLine = isInQuote = false;
				shouldKeepLineUnbroken = false;
				squareBracketCount = 0;

				if (bracketTypeStack->size() > 1)
				{
					previousBracketType = bracketTypeStack->back();
					bracketTypeStack->pop_back();
					isPreviousBracketBlockRelated = !isBracketType(bracketType, ARRAY_TYPE);
				}
				else
				{
					previousBracketType = NULL_TYPE;
					isPreviousBracketBlockRelated = false;
				}

				if (!preBracketHeaderStack->empty())
				{
					currentHeader = preBracketHeaderStack->back();
					preBracketHeaderStack->pop_back();
				}
				else
					currentHeader = NULL;

				if (!structStack->empty())
				{
					isInIndentableStruct = structStack->back();
					structStack->pop_back();
				}
				else
					isInIndentableStruct = false;

				if (isNonInStatementArray
				        && (!isBracketType(bracketTypeStack->back(), ARRAY_TYPE)	// check previous bracket
				            || peekNextChar() == ';'))								// check for "};" added V2.01
					isImmediatelyPostNonInStmt = true;
			}

			// format brackets
			appendOpeningBracket = false;
			if (isBracketType(bracketType, ARRAY_TYPE))
			{
				formatArrayBrackets(bracketType, isOpeningArrayBracket);
			}
			else
			{
				if (currentChar == '{')
					formatOpeningBracket(bracketType);
				else
					formatClosingBracket(bracketType);
			}
			continue;
		}

		if ((((previousCommandChar == '{' && isPreviousBracketBlockRelated)
		        || ((previousCommandChar == '}'
		             && !isImmediatelyPostEmptyBlock
		             && isPreviousBracketBlockRelated
		             && !isPreviousCharPostComment       // Fixes wrongly appended newlines after '}' immediately after comments
		             && peekNextChar() != ' '
		             && !isBracketType(previousBracketType, DEFINITION_TYPE))
		            && !isBracketType(bracketTypeStack->back(), DEFINITION_TYPE)))
		        && isOkToBreakBlock(bracketTypeStack->back()))
		        // check for array
		        || (previousCommandChar == '{'			// added 9/30/2010
		            && isBracketType(bracketTypeStack->back(), ARRAY_TYPE)
		            && !isBracketType(bracketTypeStack->back(), SINGLE_LINE_TYPE)
		            && isNonInStatementArray))
		{
			isCharImmediatelyPostOpenBlock = (previousCommandChar == '{');
			isCharImmediatelyPostCloseBlock = (previousCommandChar == '}');

			if (isCharImmediatelyPostOpenBlock
			        && !isCharImmediatelyPostComment
			        && !isCharImmediatelyPostLineComment)
			{
				previousCommandChar = ' ';

				if (bracketFormatMode == NONE_MODE)
				{
					if (shouldBreakOneLineBlocks
					        && isBracketType(bracketTypeStack->back(), SINGLE_LINE_TYPE))
						isInLineBreak = true;
					else if (currentLineBeginsWithBracket)
						formatRunIn();
					else
						breakLine();
				}
				else if (bracketFormatMode == RUN_IN_MODE
				         && currentChar != '#')
					formatRunIn();
				else
					isInLineBreak = true;
			}
			else if (isCharImmediatelyPostCloseBlock
			         && shouldBreakOneLineStatements
			         && (isLegalNameChar(currentChar) && currentChar != '.')
			         && !isCharImmediatelyPostComment)
			{
				previousCommandChar = ' ';
				isInLineBreak = true;
			}
		}

		// reset block handling flags
		isImmediatelyPostEmptyBlock = false;

		// look for headers
		bool isPotentialHeader = isCharPotentialHeader(currentLine, charNum);

		if (isPotentialHeader && !isInTemplate && !squareBracketCount)
		{
			isNonParenHeader = false;
			foundClosingHeader = false;
			newHeader = findHeader(headers);

			// Qt headers may be variables in C++
			if (newHeader == &AS_FOREVER || newHeader == &AS_FOREACH)
			{
				if (currentLine.find_first_of("=;", charNum) != string::npos)
					newHeader = NULL;
			}

			if (newHeader != NULL)
			{
				const string* previousHeader;

				// recognize closing headers of do..while, if..else, try..catch..finally
				if ((newHeader == &AS_ELSE && currentHeader == &AS_IF)
				        || (newHeader == &AS_WHILE && currentHeader == &AS_DO)
				        || (newHeader == &AS_CATCH && currentHeader == &AS_TRY)
				        || (newHeader == &AS_CATCH && currentHeader == &AS_CATCH)
				        || (newHeader == &AS_FINALLY && currentHeader == &AS_TRY)
				        || (newHeader == &AS_FINALLY && currentHeader == &AS_CATCH)
				        || (newHeader == &_AS_FINALLY && currentHeader == &_AS_TRY)
				        || (newHeader == &_AS_EXCEPT && currentHeader == &_AS_TRY)
				        || (newHeader == &AS_SET && currentHeader == &AS_GET)
				        || (newHeader == &AS_REMOVE && currentHeader == &AS_ADD))
					foundClosingHeader = true;

				previousHeader = currentHeader;
				currentHeader = newHeader;
				needHeaderOpeningBracket = true;

				// is the previous statement on the same line?
				if ((previousNonWSChar == ';' || previousNonWSChar == ':')
				        && !isInLineBreak
				        && isOkToBreakBlock(bracketTypeStack->back()))
				{
					// if breaking lines, break the line at the header
					// except for multiple 'case' statements on a line
					if (maxCodeLength != string::npos
					        && previousHeader != &AS_CASE)
						isInLineBreak = true;
					else
						isHeaderInMultiStatementLine = true;
				}

				if (foundClosingHeader && previousNonWSChar == '}')
				{
					if (isOkToBreakBlock(bracketTypeStack->back()))
						isLineBreakBeforeClosingHeader();

					// get the adjustment for a comment following the closing header
					if (isInLineBreak)
						nextLineSpacePadNum = getNextLineCommentAdjustment();
					else
						spacePadNum = getCurrentLineCommentAdjustment();
				}

				// check if the found header is non-paren header
				isNonParenHeader = findHeader(nonParenHeaders) != NULL;

				// join 'else if' statements
				if (currentHeader == &AS_IF && previousHeader == &AS_ELSE && isInLineBreak
				        && !shouldBreakElseIfs && !isCharImmediatelyPostLineComment)
				{
					// 'else' must be last thing on the line
					size_t start = formattedLine.length() >= 6 ? formattedLine.length() - 6 : 0;
					if (formattedLine.find(AS_ELSE, start) != string::npos)
					{
						appendSpacePad();
						isInLineBreak = false;
					}
				}

				appendSequence(*currentHeader);
				goForward(currentHeader->length() - 1);
				// if a paren-header is found add a space after it, if needed
				// this checks currentLine, appendSpacePad() checks formattedLine
				// in 'case' and C# 'catch' can be either a paren or non-paren header
				if (shouldPadHeader
				        && (!isNonParenHeader
				            || (currentHeader == &AS_CASE && peekNextChar() == '(')
				            || (currentHeader == &AS_CATCH && peekNextChar() == '('))
				        && charNum < (int) currentLine.length() - 1 && !isWhiteSpace(currentLine[charNum + 1]))
					appendSpacePad();

				// Signal that a header has been reached
				// *** But treat a closing while() (as in do...while)
				//     as if it were NOT a header since a closing while()
				//     should never have a block after it!
				if (currentHeader != &AS_CASE && currentHeader != &AS_DEFAULT
				        && !(foundClosingHeader && currentHeader == &AS_WHILE))
				{
					isInHeader = true;

					// in C# 'catch' and 'delegate' can be a paren or non-paren header
					if (isNonParenHeader && !isSharpStyleWithParen(currentHeader))
					{
						isImmediatelyPostHeader = true;
						isInHeader = false;
					}
				}

				if (shouldBreakBlocks
				        && isOkToBreakBlock(bracketTypeStack->back())
				        && !isHeaderInMultiStatementLine)
				{
					if (previousHeader == NULL
					        && !foundClosingHeader
					        && !isCharImmediatelyPostOpenBlock
					        && !isImmediatelyPostCommentOnly)
					{
						isPrependPostBlockEmptyLineRequested = true;
					}

					if (currentHeader == &AS_ELSE
					        || currentHeader == &AS_CATCH
					        || currentHeader == &AS_FINALLY
					        || foundClosingHeader)
					{
						isPrependPostBlockEmptyLineRequested = false;
					}

					if (shouldBreakClosingHeaderBlocks
					        && isCharImmediatelyPostCloseBlock
					        && !isImmediatelyPostCommentOnly
					        && currentHeader != &AS_WHILE)    // closing do-while block
					{
						isPrependPostBlockEmptyLineRequested = true;
					}
				}

				if (currentHeader == &AS_CASE
				        || currentHeader == &AS_DEFAULT)
					isInCase = true;

				continue;
			}
			else if ((newHeader = findHeader(preDefinitionHeaders)) != NULL
			         && parenStack->back() == 0
			         && !isInEnum)		// not C++11 enum class
			{
				if (newHeader == &AS_NAMESPACE)
					foundNamespaceHeader = true;
				if (newHeader == &AS_CLASS)
					foundClassHeader = true;
				if (newHeader == &AS_STRUCT)
					foundStructHeader = true;
				if (newHeader == &AS_INTERFACE)
					foundInterfaceHeader = true;
				foundPreDefinitionHeader = true;
				appendSequence(*newHeader);
				goForward(newHeader->length() - 1);

				continue;
			}
			else if ((newHeader = findHeader(preCommandHeaders)) != NULL)
			{
				// a 'const' variable is not a preCommandHeader
				if (previousNonWSChar != ';'
				        && previousNonWSChar != '{'
				        && getPreviousWord(currentLine, charNum) != AS_STATIC)
					foundPreCommandHeader = true;
			}
			else if ((newHeader = findHeader(castOperators)) != NULL)
			{
				foundCastOperator = true;
				appendSequence(*newHeader);
				goForward(newHeader->length() - 1);
				continue;
			}
		}   // (isPotentialHeader && !isInTemplate)

		if (isInLineBreak)          // OK to break line here
		{
			breakLine();
			if (isInVirginLine)		// adjust for the first line
			{
				lineCommentNoBeautify = lineCommentNoIndent;
				lineCommentNoIndent = false;
				if (isImmediatelyPostPreprocessor)
				{
					isInIndentablePreproc = isIndentableProprocessor;
					isIndentableProprocessor = false;
				}
			}
		}

		if (previousNonWSChar == '}' || currentChar == ';')
		{
			if (currentChar == ';')
			{
				squareBracketCount = 0;

				if (((shouldBreakOneLineStatements
				        || isBracketType(bracketTypeStack->back(), SINGLE_LINE_TYPE))
				        && isOkToBreakBlock(bracketTypeStack->back()))
				        && !(attachClosingBracketMode && peekNextChar() == '}'))
				{
					passedSemicolon = true;
				}

				// append post block empty line for unbracketed header
				if (shouldBreakBlocks
				        && currentHeader != NULL
				        && currentHeader != &AS_CASE
				        && currentHeader != &AS_DEFAULT
				        && !isHeaderInMultiStatementLine
				        && parenStack->back() == 0)
				{
					isAppendPostBlockEmptyLineRequested = true;
				}
			}
			if (currentChar != ';'
			        || (needHeaderOpeningBracket && parenStack->back() == 0))
				currentHeader = NULL;
			resetEndOfStatement();
		}

		if (currentChar == ':'
		        && previousChar != ':'         // not part of '::'
		        && peekNextChar() != ':')      // not part of '::'
		{
			if (isInCase)
			{
				isInCase = false;
				if (shouldBreakOneLineStatements)
					passedColon = true;
			}
			else if (isCStyle()                     // for C/C++ only
			         && isOkToBreakBlock(bracketTypeStack->back())
			         && shouldBreakOneLineStatements
			         && !foundQuestionMark          // not in a ?: sequence
			         && !foundPreDefinitionHeader   // not in a definition block (e.g. class foo : public bar
			         && previousCommandChar != ')'  // not immediately after closing paren of a method header, e.g. ASFormatter::ASFormatter(...) : ASBeautifier(...)
			         && !foundPreCommandHeader      // not after a 'noexcept'
			         && !squareBracketCount         // not in objC method call
			         && !isInObjCMethodDefinition   // not objC '-' or '+' method
			         && !isInObjCInterface          // not objC @interface
			         && !isInObjCSelector           // not objC @selector
			         && !isDigit(peekNextChar())    // not a bit field
			         && !isInEnum                   // not an enum with a base type
			         && !isInAsm                    // not in extended assembler
			         && !isInAsmOneLine             // not in extended assembler
			         && !isInAsmBlock)              // not in extended assembler
			{
				passedColon = true;
			}

			if (isCStyle()
			        && shouldPadMethodColon
			        && (squareBracketCount > 0 || isInObjCMethodDefinition || isInObjCSelector)
			        && !foundQuestionMark)			// not in a ?: sequence
				padObjCMethodColon();

			if (isInObjCInterface)
			{
				appendSpacePad();
				if ((int) currentLine.length() > charNum + 1 && !isWhiteSpace(currentLine[charNum + 1]))
					currentLine.insert(charNum + 1, " ");
			}

			if (isClassInitializer())
				isInClassInitializer = true;
		}

		if (currentChar == '?')
			foundQuestionMark = true;

		if (isPotentialHeader && !isInTemplate)
		{
			if (findKeyword(currentLine, charNum, AS_NEW))
				isInPotentialCalculation = false;

			if (findKeyword(currentLine, charNum, AS_RETURN))
			{
				isInPotentialCalculation = true;	// return is the same as an = sign
				isImmediatelyPostReturn = true;
			}

			if (findKeyword(currentLine, charNum, AS_OPERATOR))
				isImmediatelyPostOperator = true;

			if (findKeyword(currentLine, charNum, AS_ENUM))
			{
				size_t firstNum = currentLine.find_first_of("(){},/");
				if (firstNum == string::npos
				        || currentLine[firstNum] == '{'
				        || currentLine[firstNum] == '/')
					isInEnum = true;
			}

			if (isCStyle()
			        && findKeyword(currentLine, charNum, AS_THROW)
			        && previousCommandChar != ')'
			        && !foundPreCommandHeader)      // 'const' throw()
				isImmediatelyPostThrow = true;

			if (isCStyle() && findKeyword(currentLine, charNum, AS_EXTERN) && isExternC())
				isInExternC = true;

			// Objective-C NSException macros are preCommandHeaders
			if (isCStyle() && findKeyword(currentLine, charNum, AS_NS_DURING))
				foundPreCommandMacro = true;
			if (isCStyle() && findKeyword(currentLine, charNum, AS_NS_HANDLER))
				foundPreCommandMacro = true;

			if (isCStyle() && isExecSQL(currentLine, charNum))
				isInExecSQL = true;

			if (isCStyle())
			{
				if (findKeyword(currentLine, charNum, AS_ASM)
				        || findKeyword(currentLine, charNum, AS__ASM__))
				{
					isInAsm = true;
				}
				else if (findKeyword(currentLine, charNum, AS_MS_ASM)		// microsoft specific
				         || findKeyword(currentLine, charNum, AS_MS__ASM))
				{
					int index = 4;
					if (peekNextChar() == '_')	// check for __asm
						index = 5;

					char peekedChar = ASBase::peekNextChar(currentLine, charNum + index);
					if (peekedChar == '{' || peekedChar == ' ')
						isInAsmBlock = true;
					else
						isInAsmOneLine = true;
				}
			}

			if (isJavaStyle()
			        && (findKeyword(currentLine, charNum, AS_STATIC)
			            && isNextCharOpeningBracket(charNum + 6)))
				isJavaStaticConstructor = true;

			if (isSharpStyle()
			        && (findKeyword(currentLine, charNum, AS_DELEGATE)
			            || findKeyword(currentLine, charNum, AS_UNCHECKED)))
				isSharpDelegate = true;

			// append the entire name
			string name = getCurrentWord(currentLine, charNum);
			// must pad the 'and' and 'or' operators if required
			if (name == "and" || name == "or")
			{
				if (shouldPadOperators && previousNonWSChar != ':')
				{
					appendSpacePad();
					appendOperator(name);
					goForward(name.length() - 1);
					if (!isBeforeAnyComment()
					        && !(currentLine.compare(charNum + 1, 1, AS_SEMICOLON) == 0)
					        && !(currentLine.compare(charNum + 1, 2, AS_SCOPE_RESOLUTION) == 0))
						appendSpaceAfter();
				}
				else
				{
					appendOperator(name);
					goForward(name.length() - 1);
				}
			}
			else
			{
				appendSequence(name);
				goForward(name.length() - 1);
			}

			continue;

		}   // (isPotentialHeader &&  !isInTemplate)

		// determine if this is an Objective-C statement

		if (currentChar == '@'
		        && isCharPotentialHeader(currentLine, charNum + 1)
		        && findKeyword(currentLine, charNum + 1, AS_INTERFACE)
		        && isBracketType(bracketTypeStack->back(), NULL_TYPE))
		{
			isInObjCInterface = true;
			string name = '@' + AS_INTERFACE;
			appendSequence(name);
			goForward(name.length() - 1);
			continue;
		}
		else if (currentChar == '@'
		         && isCharPotentialHeader(currentLine, charNum + 1)
		         && findKeyword(currentLine, charNum + 1, AS_SELECTOR))
		{
			isInObjCSelector = true;
			string name = '@' + AS_SELECTOR;
			appendSequence(name);
			goForward(name.length() - 1);
			continue;
		}
		else if ((currentChar == '-' || currentChar == '+')
		         && peekNextChar() == '('
		         && isBracketType(bracketTypeStack->back(), NULL_TYPE)
		         && !isInPotentialCalculation)
		{
			isInObjCMethodDefinition = true;
			isInObjCInterface = false;
			appendCurrentChar();
			if (shouldPadMethodPrefix || shouldUnPadMethodPrefix)
			{
				size_t i = currentLine.find_first_not_of(" \t", charNum + 1);
				if (i != string::npos)
					goForward(i - charNum - 1);
				if (shouldPadMethodPrefix)
					appendSpaceAfter();
			}
			continue;
		}

		// determine if this is a potential calculation

		bool isPotentialOperator = isCharPotentialOperator(currentChar);
		newHeader = NULL;

		if (isPotentialOperator)
		{
			newHeader = findOperator(operators);

			// check for Java ? wildcard
			if (newHeader == &AS_GCC_MIN_ASSIGN && isJavaStyle() && isInTemplate)
				newHeader = NULL;

			if (newHeader != NULL)
			{
				if (newHeader == &AS_LAMBDA)
					foundPreCommandHeader = true;

				// correct mistake of two >> closing a template
				if (isInTemplate && (newHeader == &AS_GR_GR || newHeader == &AS_GR_GR_GR))
					newHeader = &AS_GR;

				if (!isInPotentialCalculation)
				{
					// must determine if newHeader is an assignment operator
					// do NOT use findOperator!!!
					if (find(assignmentOperators->begin(), assignmentOperators->end(), newHeader)
					        != assignmentOperators->end())
					{
						foundPreCommandHeader = false;
						char peekedChar = peekNextChar();
						isInPotentialCalculation = !(newHeader == &AS_EQUAL && peekedChar == '*')
						                           && !(newHeader == &AS_EQUAL && peekedChar == '&')
						                           && !isCharImmediatelyPostOperator;
					}
				}
			}
		}

		// process pointers and references
		// check newHeader to eliminate things like '&&' sequence
		if (!isJavaStyle()
		        && (newHeader == &AS_MULT
		            || newHeader == &AS_BIT_AND
		            || newHeader == &AS_BIT_XOR
		            || newHeader == &AS_AND)
		        && isPointerOrReference())
		{
			if (!isDereferenceOrAddressOf() && !isOperatorPaddingDisabled())
				formatPointerOrReference();
			else
			{
				appendOperator(*newHeader);
				goForward(newHeader->length() - 1);
			}
			isImmediatelyPostPointerOrReference = true;
			continue;
		}

		if (shouldPadOperators && newHeader != NULL && !isOperatorPaddingDisabled())
		{
			padOperators(newHeader);
			continue;
		}

		// pad commas and semi-colons
		if (currentChar == ';'
		        || (currentChar == ',' && shouldPadOperators))
		{
			char nextChar = ' ';
			if (charNum + 1 < (int) currentLine.length())
				nextChar = currentLine[charNum + 1];
			if (!isWhiteSpace(nextChar)
			        && nextChar != '}'
			        && nextChar != ')'
			        && nextChar != ']'
			        && nextChar != '>'
			        && nextChar != ';'
			        && !isBeforeAnyComment()
			        /* && !(isBracketType(bracketTypeStack->back(), ARRAY_TYPE)) */
			   )
			{
				appendCurrentChar();
				appendSpaceAfter();
				continue;
			}
		}

		// do NOT use 'continue' after this, it must do padParens if necessary
		if (currentChar == '('
		        && shouldPadHeader
		        && (isCharImmediatelyPostReturn || isCharImmediatelyPostThrow))
			appendSpacePad();

		if ((currentChar == '(' || currentChar == ')')
		        && (shouldPadParensOutside || shouldPadParensInside || shouldUnPadParens || shouldPadFirstParen))
		{
			padParens();
			continue;
		}

		// bypass the entire operator
		if (newHeader != NULL)
		{
			appendOperator(*newHeader);
			goForward(newHeader->length() - 1);
			continue;
		}

		appendCurrentChar();

	}   // end of while loop  *  end of while loop  *  end of while loop  *  end of while loop

	// return a beautified (i.e. correctly indented) line.

	string beautifiedLine;
	size_t readyFormattedLineLength = trim(readyFormattedLine).length();
	bool isInNamespace = isBracketType(bracketTypeStack->back(), NAMESPACE_TYPE);

	if (prependEmptyLine		// prepend a blank line before this formatted line
	        && readyFormattedLineLength > 0
	        && previousReadyFormattedLineLength > 0)
	{
		isLineReady = true;		// signal a waiting readyFormattedLine
		beautifiedLine = beautify("");
		previousReadyFormattedLineLength = 0;
		// call the enhancer for new empty lines
		enhancer->enhance(beautifiedLine, isInNamespace, isInPreprocessorBeautify, isInBeautifySQL);
	}
	else		// format the current formatted line
	{
		isLineReady = false;
		horstmannIndentInStatement = horstmannIndentChars;
		beautifiedLine = beautify(readyFormattedLine);
		previousReadyFormattedLineLength = readyFormattedLineLength;
		// the enhancer is not called for no-indent line comments
		if (!lineCommentNoBeautify && !isFormattingModeOff)
			enhancer->enhance(beautifiedLine, isInNamespace, isInPreprocessorBeautify, isInBeautifySQL);
		horstmannIndentChars = 0;
		lineCommentNoBeautify = lineCommentNoIndent;
		lineCommentNoIndent = false;
		isInIndentablePreproc = isIndentableProprocessor;
		isIndentableProprocessor = false;
		isElseHeaderIndent = elseHeaderFollowsComments;
		isCaseHeaderCommentIndent = caseHeaderFollowsComments;
		if (isCharImmediatelyPostNonInStmt)
		{
			isNonInStatementArray = false;
			isCharImmediatelyPostNonInStmt = false;
		}
		isInPreprocessorBeautify = isInPreprocessor;	// used by ASEnhancer
		isInBeautifySQL = isInExecSQL;					// used by ASEnhancer
	}

	prependEmptyLine = false;
	assert(computeChecksumOut(beautifiedLine));
	return beautifiedLine;
}

/**
 * check if there are any indented lines ready to be read by nextLine()
 *
 * @return    are there any indented lines ready?
 */
bool ASFormatter::hasMoreLines() const
{
	return !endOfCodeReached;
}

/**
 * comparison function for BracketType enum
 */
bool ASFormatter::isBracketType(BracketType a, BracketType b) const
{
	if (a == NULL_TYPE || b == NULL_TYPE)
		return (a == b);
	return ((a & b) == b);
}

/**
 * set the formatting style.
 *
 * @param style         the formatting style.
 */
void ASFormatter::setFormattingStyle(FormatStyle style)
{
	formattingStyle = style;
}

/**
 * set the add brackets mode.
 * options:
 *    true     brackets added to headers for single line statements.
 *    false    brackets NOT added to headers for single line statements.
 *
 * @param state         the add brackets state.
 */
void ASFormatter::setAddBracketsMode(bool state)
{
	shouldAddBrackets = state;
}

/**
 * set the add one line brackets mode.
 * options:
 *    true     one line brackets added to headers for single line statements.
 *    false    one line brackets NOT added to headers for single line statements.
 *
 * @param state         the add one line brackets state.
 */
void ASFormatter::setAddOneLineBracketsMode(bool state)
{
	shouldAddBrackets = state;
	shouldAddOneLineBrackets = state;
}

/**
 * set the remove brackets mode.
 * options:
 *    true     brackets removed from headers for single line statements.
 *    false    brackets NOT removed from headers for single line statements.
 *
 * @param state         the remove brackets state.
 */
void ASFormatter::setRemoveBracketsMode(bool state)
{
	shouldRemoveBrackets = state;
}

/**
 * set the bracket formatting mode.
 * options:
 *
 * @param mode         the bracket formatting mode.
 */
void ASFormatter::setBracketFormatMode(BracketMode mode)
{
	bracketFormatMode = mode;
}

/**
 * set 'break after' mode for maximum code length
 *
 * @param state         the 'break after' mode.
 */
void ASFormatter::setBreakAfterMode(bool state)
{
	shouldBreakLineAfterLogical = state;
}

/**
 * set closing header bracket breaking mode
 * options:
 *    true     brackets just before closing headers (e.g. 'else', 'catch')
 *             will be broken, even if standard brackets are attached.
 *    false    closing header brackets will be treated as standard brackets.
 *
 * @param state         the closing header bracket breaking mode.
 */
void ASFormatter::setBreakClosingHeaderBracketsMode(bool state)
{
	shouldBreakClosingHeaderBrackets = state;
}

/**
 * set 'else if()' breaking mode
 * options:
 *    true     'else' headers will be broken from their succeeding 'if' headers.
 *    false    'else' headers will be attached to their succeeding 'if' headers.
 *
 * @param state         the 'else if()' breaking mode.
 */
void ASFormatter::setBreakElseIfsMode(bool state)
{
	shouldBreakElseIfs = state;
}

/**
 * set maximum code length
 *
 * @param max         the maximum code length.
 */
void ASFormatter::setMaxCodeLength(int max)
{
	maxCodeLength = max;
}

/**
 * set operator padding mode.
 * options:
 *    true     statement operators will be padded with spaces around them.
 *    false    statement operators will not be padded.
 *
 * @param state         the padding mode.
 */
void ASFormatter::setOperatorPaddingMode(bool state)
{
	shouldPadOperators = state;
}

/**
 * set parenthesis outside padding mode.
 * options:
 *    true     statement parentheses will be padded with spaces around them.
 *    false    statement parentheses will not be padded.
 *
 * @param state         the padding mode.
 */
void ASFormatter::setParensOutsidePaddingMode(bool state)
{
	shouldPadParensOutside = state;
}

/**
 * set parenthesis inside padding mode.
 * options:
 *    true     statement parenthesis will be padded with spaces around them.
 *    false    statement parenthesis will not be padded.
 *
 * @param state         the padding mode.
 */
void ASFormatter::setParensInsidePaddingMode(bool state)
{
	shouldPadParensInside = state;
}

/**
 * set padding mode before one or more open parentheses.
 * options:
 *    true     first open parenthesis will be padded with a space before.
 *    false    first open parenthesis will not be padded.
 *
 * @param state         the padding mode.
 */
void ASFormatter::setParensFirstPaddingMode(bool state)
{
	shouldPadFirstParen = state;
}

/**
 * set header padding mode.
 * options:
 *    true     headers will be padded with spaces around them.
 *    false    headers will not be padded.
 *
 * @param state         the padding mode.
 */
void ASFormatter::setParensHeaderPaddingMode(bool state)
{
	shouldPadHeader = state;
}

/**
 * set parenthesis unpadding mode.
 * options:
 *    true     statement parenthesis will be unpadded with spaces removed around them.
 *    false    statement parenthesis will not be unpadded.
 *
 * @param state         the padding mode.
 */
void ASFormatter::setParensUnPaddingMode(bool state)
{
	shouldUnPadParens = state;
}

/**
* set the state of the preprocessor indentation option.
* If true, #ifdef blocks at level 0 will be indented.
*
* @param   state             state of option.
*/
void ASFormatter::setPreprocBlockIndent(bool state)
{
	shouldIndentPreprocBlock = state;
}

/**
 * Set strip comment prefix mode.
 * options:
 *    true     strip leading '*' in a comment.
 *    false    leading '*' in a comment will be left unchanged.
 *
 * @param state         the strip comment prefix mode.
 */
void ASFormatter::setStripCommentPrefix(bool state)
{
	shouldStripCommentPrefix = state;
}

/**
 * set objective-c '-' or '+' class prefix padding mode.
 * options:
 *    true     class prefix will be padded a spaces after them.
 *    false    class prefix will be left unchanged.
 *
 * @param state         the padding mode.
 */
void ASFormatter::setMethodPrefixPaddingMode(bool state)
{
	shouldPadMethodPrefix = state;
}

/**
 * set objective-c '-' or '+' class prefix unpadding mode.
 * options:
 *    true     class prefix will be unpadded with spaces after them removed.
 *    false    class prefix will left unchanged.
 *
 * @param state         the unpadding mode.
 */
void ASFormatter::setMethodPrefixUnPaddingMode(bool state)
{
	shouldUnPadMethodPrefix = state;
}

/**
 * set objective-c method colon padding mode.
 *
 * @param mode         objective-c colon padding mode.
 */
void ASFormatter::setObjCColonPaddingMode(ObjCColonPad mode)
{
	shouldPadMethodColon = true;
	objCColonPadMode = mode;
}

/**
 * set option to attach closing brackets
 *
 * @param state        true = attach, false = don't attach.
 */
void ASFormatter::setAttachClosingBracketMode(bool state)
{
	attachClosingBracketMode = state;
}

/**
 * set option to attach class brackets
 *
 * @param state        true = attach, false = use style default.
 */
void ASFormatter::setAttachClass(bool state)
{
	shouldAttachClass = state;
}

/**
 * set option to attach extern "C" brackets
 *
 * @param state        true = attach, false = use style default.
 */
void ASFormatter::setAttachExternC(bool state)
{
	shouldAttachExternC = state;
}

/**
 * set option to attach namespace brackets
 *
 * @param state        true = attach, false = use style default.
 */
void ASFormatter::setAttachNamespace(bool state)
{
	shouldAttachNamespace = state;
}

/**
 * set option to attach inline brackets
 *
 * @param state        true = attach, false = use style default.
 */
void ASFormatter::setAttachInline(bool state)
{
	shouldAttachInline = state;
}

/**
 * set option to break/not break one-line blocks
 *
 * @param state        true = break, false = don't break.
 */
void ASFormatter::setBreakOneLineBlocksMode(bool state)
{
	shouldBreakOneLineBlocks = state;
}

void ASFormatter::setCloseTemplatesMode(bool state)
{
	shouldCloseTemplates = state;
}

/**
 * set option to break/not break lines consisting of multiple statements.
 *
 * @param state        true = break, false = don't break.
 */
void ASFormatter::setSingleStatementsMode(bool state)
{
	shouldBreakOneLineStatements = state;
}

/**
 * set option to convert tabs to spaces.
 *
 * @param state        true = convert, false = don't convert.
 */
void ASFormatter::setTabSpaceConversionMode(bool state)
{
	shouldConvertTabs = state;
}

/**
 * set option to indent comments in column 1.
 *
 * @param state        true = indent, false = don't indent.
 */
void ASFormatter::setIndentCol1CommentsMode(bool state)
{
	shouldIndentCol1Comments = state;
}

/**
 * set option to force all line ends to a particular style.
 *
 * @param fmt           format enum value
 */
void ASFormatter::setLineEndFormat(LineEndFormat fmt)
{
	lineEnd = fmt;
}

/**
 * set option to break unrelated blocks of code with empty lines.
 *
 * @param state        true = convert, false = don't convert.
 */
void ASFormatter::setBreakBlocksMode(bool state)
{
	shouldBreakBlocks = state;
}

/**
 * set option to break closing header blocks of code (such as 'else', 'catch', ...) with empty lines.
 *
 * @param state        true = convert, false = don't convert.
 */
void ASFormatter::setBreakClosingHeaderBlocksMode(bool state)
{
	shouldBreakClosingHeaderBlocks = state;
}

/**
 * set option to delete empty lines.
 *
 * @param state        true = delete, false = don't delete.
 */
void ASFormatter::setDeleteEmptyLinesMode(bool state)
{
	shouldDeleteEmptyLines = state;
}

/**
 * set the pointer alignment.
 *
 * @param alignment    the pointer alignment.
 */
void ASFormatter::setPointerAlignment(PointerAlign alignment)
{
	pointerAlignment = alignment;
}

void ASFormatter::setReferenceAlignment(ReferenceAlign alignment)
{
	referenceAlignment = alignment;
}

/**
 * jump over several characters.
 *
 * @param i       the number of characters to jump over.
 */
void ASFormatter::goForward(int i)
{
	while (--i >= 0)
		getNextChar();
}

/**
 * peek at the next unread character.
 *
 * @return     the next unread character.
 */
char ASFormatter::peekNextChar() const
{
	char ch = ' ';
	size_t peekNum = currentLine.find_first_not_of(" \t", charNum + 1);

	if (peekNum == string::npos)
		return ch;

	ch = currentLine[peekNum];

	return ch;
}

/**
 * check if current placement is before a comment
 *
 * @return     is before a comment.
 */
bool ASFormatter::isBeforeComment() const
{
	bool foundComment = false;
	size_t peekNum = currentLine.find_first_not_of(" \t", charNum + 1);

	if (peekNum == string::npos)
		return foundComment;

	foundComment = (currentLine.compare(peekNum, 2, "/*") == 0);

	return foundComment;
}

/**
 * check if current placement is before a comment or line-comment
 *
 * @return     is before a comment or line-comment.
 */
bool ASFormatter::isBeforeAnyComment() const
{
	bool foundComment = false;
	size_t peekNum = currentLine.find_first_not_of(" \t", charNum + 1);

	if (peekNum == string::npos)
		return foundComment;

	foundComment = (currentLine.compare(peekNum, 2, "/*") == 0
	                || currentLine.compare(peekNum, 2, "//") == 0);

	return foundComment;
}

/**
 * check if current placement is before a comment or line-comment
 * if a block comment it must be at the end of the line
 *
 * @return     is before a comment or line-comment.
 */
bool ASFormatter::isBeforeAnyLineEndComment(int startPos) const
{
	bool foundLineEndComment = false;
	size_t peekNum = currentLine.find_first_not_of(" \t", startPos + 1);

	if (peekNum != string::npos)
	{
		if (currentLine.compare(peekNum, 2, "//") == 0)
			foundLineEndComment = true;
		else if (currentLine.compare(peekNum, 2, "/*") == 0)
		{
			// comment must be closed on this line with nothing after it
			size_t endNum = currentLine.find("*/", peekNum + 2);
			if (endNum != string::npos)
			{
				size_t nextChar = currentLine.find_first_not_of(" \t", endNum + 2);
				if (nextChar == string::npos)
					foundLineEndComment = true;
			}
		}
	}
	return foundLineEndComment;
}

/**
 * check if current placement is before a comment followed by a line-comment
 *
 * @return     is before a multiple line-end comment.
 */
bool ASFormatter::isBeforeMultipleLineEndComments(int startPos) const
{
	bool foundMultipleLineEndComment = false;
	size_t peekNum = currentLine.find_first_not_of(" \t", startPos + 1);

	if (peekNum != string::npos)
	{
		if (currentLine.compare(peekNum, 2, "/*") == 0)
		{
			// comment must be closed on this line with nothing after it
			size_t endNum = currentLine.find("*/", peekNum + 2);
			if (endNum != string::npos)
			{
				size_t nextChar = currentLine.find_first_not_of(" \t", endNum + 2);
				if (nextChar != string::npos
				        && currentLine.compare(nextChar, 2, "//") == 0)
					foundMultipleLineEndComment = true;
			}
		}
	}
	return foundMultipleLineEndComment;
}

/**
 * get the next character, increasing the current placement in the process.
 * the new character is inserted into the variable currentChar.
 *
 * @return   whether succeeded to receive the new character.
 */
bool ASFormatter::getNextChar()
{
	isInLineBreak = false;
	previousChar = currentChar;

	if (!isWhiteSpace(currentChar))
	{
		previousNonWSChar = currentChar;
		if (!isInComment && !isInLineComment && !isInQuote
		        && !isImmediatelyPostComment
		        && !isImmediatelyPostLineComment
		        && !isInPreprocessor
		        && !isSequenceReached("/*")
		        && !isSequenceReached("//"))
			previousCommandChar = currentChar;
	}

	if (charNum + 1 < (int) currentLine.length()
	        && (!isWhiteSpace(peekNextChar()) || isInComment || isInLineComment))
	{
		currentChar = currentLine[++charNum];

		if (currentChar == '\t' && shouldConvertTabs)
			convertTabToSpaces();

		return true;
	}

	// end of line has been reached
	return getNextLine();
}

/**
 * get the next line of input, increasing the current placement in the process.
 *
 * @param emptyLineWasDeleted         an empty line was deleted.
 * @return   whether succeeded in reading the next line.
 */
bool ASFormatter::getNextLine(bool emptyLineWasDeleted /*false*/)
{
	if (sourceIterator->hasMoreLines())
	{
		if (appendOpeningBracket)
			currentLine = "{";		// append bracket that was removed from the previous line
		else
		{
			currentLine = sourceIterator->nextLine(emptyLineWasDeleted);
			assert(computeChecksumIn(currentLine));
		}
		// reset variables for new line
		inLineNumber++;
		if (endOfAsmReached)
			endOfAsmReached = isInAsmBlock = isInAsm = false;
		shouldKeepLineUnbroken = false;
		isInCommentStartLine = false;
		isInCase = false;
		isInAsmOneLine = false;
		isHeaderInMultiStatementLine = false;
		isInQuoteContinuation = isInVerbatimQuote | haveLineContinuationChar;
		haveLineContinuationChar = false;
		isImmediatelyPostEmptyLine = lineIsEmpty;
		previousChar = ' ';

		if (currentLine.length() == 0)
			currentLine = string(" ");        // a null is inserted if this is not done

		// unless reading in the first line of the file, break a new line.
		if (!isVirgin)
			isInLineBreak = true;
		else
			isVirgin = false;

		if (isImmediatelyPostNonInStmt)
		{
			isCharImmediatelyPostNonInStmt = true;
			isImmediatelyPostNonInStmt = false;
		}

		// check if is in preprocessor before line trimming
		// a blank line after a \ will remove the flag
		isImmediatelyPostPreprocessor = isInPreprocessor;
		if (!isInComment
		        && (previousNonWSChar != '\\'
		            || isEmptyLine(currentLine)))
			isInPreprocessor = false;

		if (passedSemicolon)
			isInExecSQL = false;
		initNewLine();

		currentChar = currentLine[charNum];
		if (isInHorstmannRunIn && previousNonWSChar == '{' && !isInComment)
			isInLineBreak = false;
		isInHorstmannRunIn = false;

		if (currentChar == '\t' && shouldConvertTabs)
			convertTabToSpaces();

		// check for an empty line inside a command bracket.
		// if yes then read the next line (calls getNextLine recursively).
		// must be after initNewLine.
		if (shouldDeleteEmptyLines
		        && lineIsEmpty
		        && isBracketType((*bracketTypeStack)[bracketTypeStack->size() - 1], COMMAND_TYPE))
		{
			if (!shouldBreakBlocks || previousNonWSChar == '{' || !commentAndHeaderFollows())
			{
				isInPreprocessor = isImmediatelyPostPreprocessor;		// restore
				lineIsEmpty = false;
				return getNextLine(true);
			}
		}
		return true;
	}
	else
	{
		endOfCodeReached = true;
		return false;
	}
}

/**
 * jump over the leading white space in the current line,
 * IF the line does not begin a comment or is in a preprocessor definition.
 */
void ASFormatter::initNewLine()
{
	size_t len = currentLine.length();
	size_t tabSize = getTabLength();
	charNum = 0;

	// don't trim these
	if (isInQuoteContinuation
	        || (isInPreprocessor && !getPreprocDefineIndent()))
		return;

	// SQL continuation lines must be adjusted so the leading spaces
	// is equivalent to the opening EXEC SQL
	if (isInExecSQL)
	{
		// replace leading tabs with spaces
		// so that continuation indent will be spaces
		size_t tabCount_ = 0;
		size_t i;
		for (i = 0; i < currentLine.length(); i++)
		{
			if (!isWhiteSpace(currentLine[i]))		// stop at first text
				break;
			if (currentLine[i] == '\t')
			{
				size_t numSpaces = tabSize - ((tabCount_ + i) % tabSize);
				currentLine.replace(i, 1, numSpaces, ' ');
				tabCount_++;
				i += tabSize - 1;
			}
		}
		// this will correct the format if EXEC SQL is not a hanging indent
		trimContinuationLine();
		return;
	}

	// comment continuation lines must be adjusted so the leading spaces
	// is equivalent to the opening comment
	if (isInComment)
	{
		if (noTrimCommentContinuation)
			leadingSpaces = tabIncrementIn = 0;
		trimContinuationLine();
		return;
	}

	// compute leading spaces
	isImmediatelyPostCommentOnly = lineIsLineCommentOnly || lineEndsInCommentOnly;
	lineIsCommentOnly = false;
	lineIsLineCommentOnly = false;
	lineEndsInCommentOnly = false;
	doesLineStartComment = false;
	currentLineBeginsWithBracket = false;
	lineIsEmpty = false;
	currentLineFirstBracketNum = string::npos;
	tabIncrementIn = 0;

	// bypass whitespace at the start of a line
	// preprocessor tabs are replaced later in the program
	for (charNum = 0; isWhiteSpace(currentLine[charNum]) && charNum + 1 < (int) len; charNum++)
	{
		if (currentLine[charNum] == '\t' && !isInPreprocessor)
			tabIncrementIn += tabSize - 1 - ((tabIncrementIn + charNum) % tabSize);
	}
	leadingSpaces = charNum + tabIncrementIn;

	if (isSequenceReached("/*"))
	{
		doesLineStartComment = true;
		if ((int) currentLine.length() > charNum + 2
		        && currentLine.find("*/", charNum + 2) != string::npos)
			lineIsCommentOnly = true;
	}
	else if (isSequenceReached("//"))
	{
		lineIsLineCommentOnly = true;
	}
	else if (isSequenceReached("{"))
	{
		currentLineBeginsWithBracket = true;
		currentLineFirstBracketNum = charNum;
		size_t firstText = currentLine.find_first_not_of(" \t", charNum + 1);
		if (firstText != string::npos)
		{
			if (currentLine.compare(firstText, 2, "//") == 0)
				lineIsLineCommentOnly = true;
			else if (currentLine.compare(firstText, 2, "/*") == 0
			         || isExecSQL(currentLine, firstText))
			{
				// get the extra adjustment
				size_t j;
				for (j = charNum + 1; j < firstText && isWhiteSpace(currentLine[j]); j++)
				{
					if (currentLine[j] == '\t')
						tabIncrementIn += tabSize - 1 - ((tabIncrementIn + j) % tabSize);
				}
				leadingSpaces = j + tabIncrementIn;
				if (currentLine.compare(firstText, 2, "/*") == 0)
					doesLineStartComment = true;
			}
		}
	}
	else if (isWhiteSpace(currentLine[charNum]) && !(charNum + 1 < (int) currentLine.length()))
	{
		lineIsEmpty = true;
	}

	// do not trim indented preprocessor define (except for comment continuation lines)
	if (isInPreprocessor)
	{
		if (!doesLineStartComment)
			leadingSpaces = 0;
		charNum = 0;
	}
}

/**
 * Append a character to the current formatted line.
 * The formattedLine split points are updated.
 *
 * @param ch               the character to append.
 * @param canBreakLine     if true, a registered line-break
 */
void ASFormatter::appendChar(char ch, bool canBreakLine)
{
	if (canBreakLine && isInLineBreak)
		breakLine();

	formattedLine.append(1, ch);
	isImmediatelyPostCommentOnly = false;
	if (maxCodeLength != string::npos)
	{
		// These compares reduce the frequency of function calls.
		if (isOkToSplitFormattedLine())
			updateFormattedLineSplitPoints(ch);
		if (formattedLine.length() > maxCodeLength)
			testForTimeToSplitFormattedLine();
	}
}

/**
 * Append a string sequence to the current formatted line.
 * The formattedLine split points are NOT updated.
 * But the formattedLine is checked for time to split.
 *
 * @param sequence         the sequence to append.
 * @param canBreakLine     if true, a registered line-break
 */
void ASFormatter::appendSequence(const string &sequence, bool canBreakLine)
{
	if (canBreakLine && isInLineBreak)
		breakLine();
	formattedLine.append(sequence);
	if (formattedLine.length() > maxCodeLength)
		testForTimeToSplitFormattedLine();
}

/**
 * Append an operator sequence to the current formatted line.
 * The formattedLine split points are updated.
 *
 * @param sequence         the sequence to append.
 * @param canBreakLine     if true, a registered line-break
 */
void ASFormatter::appendOperator(const string &sequence, bool canBreakLine)
{
	if (canBreakLine && isInLineBreak)
		breakLine();
	formattedLine.append(sequence);
	if (maxCodeLength != string::npos)
	{
		// These compares reduce the frequency of function calls.
		if (isOkToSplitFormattedLine())
			updateFormattedLineSplitPointsOperator(sequence);
		if (formattedLine.length() > maxCodeLength)
			testForTimeToSplitFormattedLine();
	}
}

/**
 * append a space to the current formattedline, UNLESS the
 * last character is already a white-space character.
 */
void ASFormatter::appendSpacePad()
{
	int len = formattedLine.length();
	if (len > 0 && !isWhiteSpace(formattedLine[len - 1]))
	{
		formattedLine.append(1, ' ');
		spacePadNum++;
		if (maxCodeLength != string::npos)
		{
			// These compares reduce the frequency of function calls.
			if (isOkToSplitFormattedLine())
				updateFormattedLineSplitPoints(' ');
			if (formattedLine.length() > maxCodeLength)
				testForTimeToSplitFormattedLine();
		}
	}
}

/**
 * append a space to the current formattedline, UNLESS the
 * next character is already a white-space character.
 */
void ASFormatter::appendSpaceAfter()
{
	int len = currentLine.length();
	if (charNum + 1 < len && !isWhiteSpace(currentLine[charNum + 1]))
	{
		formattedLine.append(1, ' ');
		spacePadNum++;
		if (maxCodeLength != string::npos)
		{
			// These compares reduce the frequency of function calls.
			if (isOkToSplitFormattedLine())
				updateFormattedLineSplitPoints(' ');
			if (formattedLine.length() > maxCodeLength)
				testForTimeToSplitFormattedLine();
		}
	}
}

/**
 * register a line break for the formatted line.
 */
void ASFormatter::breakLine(bool isSplitLine /*false*/)
{
	isLineReady = true;
	isInLineBreak = false;
	spacePadNum = nextLineSpacePadNum;
	nextLineSpacePadNum = 0;
	readyFormattedLine = formattedLine;
	formattedLine.erase();
	// queue an empty line prepend request if one exists
	prependEmptyLine = isPrependPostBlockEmptyLineRequested;

	if (!isSplitLine)
	{
		formattedLineCommentNum = string::npos;
		clearFormattedLineSplitPoints();

		if (isAppendPostBlockEmptyLineRequested)
		{
			isAppendPostBlockEmptyLineRequested = false;
			isPrependPostBlockEmptyLineRequested = true;
		}
		else
			isPrependPostBlockEmptyLineRequested = false;
	}
}

/**
 * check if the currently reached open-bracket (i.e. '{')
 * opens a:
 * - a definition type block (such as a class or namespace),
 * - a command block (such as a method block)
 * - a static array
 * this method takes for granted that the current character
 * is an opening bracket.
 *
 * @return    the type of the opened block.
 */
BracketType ASFormatter::getBracketType()
{
	assert(currentChar == '{');

	BracketType returnVal;

	if ((previousNonWSChar == '='
	        || isBracketType(bracketTypeStack->back(), ARRAY_TYPE))
	        && previousCommandChar != ')')
		returnVal = ARRAY_TYPE;
	else if (foundPreDefinitionHeader && previousCommandChar != ')')
	{
		returnVal = DEFINITION_TYPE;
		if (foundNamespaceHeader)
			returnVal = (BracketType)(returnVal | NAMESPACE_TYPE);
		else if (foundClassHeader)
			returnVal = (BracketType)(returnVal | CLASS_TYPE);
		else if (foundStructHeader)
			returnVal = (BracketType)(returnVal | STRUCT_TYPE);
		else if (foundInterfaceHeader)
			returnVal = (BracketType)(returnVal | INTERFACE_TYPE);
	}
	else if (isInEnum)
	{
		returnVal = (BracketType)(ARRAY_TYPE | ENUM_TYPE);
	}
	else
	{
		bool isCommandType = (foundPreCommandHeader
		                      || foundPreCommandMacro
		                      || (currentHeader != NULL && isNonParenHeader)
		                      || (previousCommandChar == ')')
		                      || (previousCommandChar == ':' && !foundQuestionMark)
		                      || (previousCommandChar == ';')
		                      || ((previousCommandChar == '{' || previousCommandChar == '}')
		                          && isPreviousBracketBlockRelated)
		                      || (isInClassInitializer
		                          && (!isLegalNameChar(previousNonWSChar) || foundPreCommandHeader))
		                      || isInObjCMethodDefinition
		                      || isInObjCInterface
		                      || isJavaStaticConstructor
		                      || isSharpDelegate);

		// C# methods containing 'get', 'set', 'add', and 'remove' do NOT end with parens
		if (!isCommandType && isSharpStyle() && isNextWordSharpNonParenHeader(charNum + 1))
		{
			isCommandType = true;
			isSharpAccessor = true;
		}

		if (isInExternC)
			returnVal = (isCommandType ? COMMAND_TYPE : EXTERN_TYPE);
		else
			returnVal = (isCommandType ? COMMAND_TYPE : ARRAY_TYPE);
	}

	int foundOneLineBlock = isOneLineBlockReached(currentLine, charNum);
	// this assumes each array definition is on a single line
	// (foundOneLineBlock == 2) is a one line block followed by a comma
	if (foundOneLineBlock == 2 && returnVal == COMMAND_TYPE)
		returnVal = ARRAY_TYPE;

	if (foundOneLineBlock > 0)		// found one line block
		returnVal = (BracketType)(returnVal | SINGLE_LINE_TYPE);

	if (isBracketType(returnVal, ARRAY_TYPE))
	{
		if (isNonInStatementArrayBracket())
		{
			returnVal = (BracketType)(returnVal | ARRAY_NIS_TYPE);
			isNonInStatementArray = true;
			isImmediatelyPostNonInStmt = false;		// in case of "},{"
			nonInStatementBracket = formattedLine.length() - 1;
		}
		if (isUniformInitializerBracket())
			returnVal = (BracketType)(returnVal | INIT_TYPE);
	}

	return returnVal;
}

/**
* check if a colon is a class initializer separator
*
* @return        whether it is a class initializer separator
*/
bool ASFormatter::isClassInitializer() const
{
	assert(currentLine[charNum] == ':');
	assert(previousChar != ':' && peekNextChar() != ':');	// not part of '::'

	// this should be similar to ASBeautifier::parseCurrentLine()
	bool foundClassInitializer = false;

	if (foundQuestionMark)
	{
		// do nothing special
	}
	else if (parenStack->back() > 0)
	{
		// found a 'for' loop or an objective-C statement
		// so do nothing special
	}
	else if (isInEnum)
	{
		// found an enum with a base-type
	}
	else if (isCStyle()
	         && !isInCase
	         && (previousCommandChar == ')' || foundPreCommandHeader))
	{
		// found a 'class' c'tor initializer
		foundClassInitializer = true;
	}
	return foundClassInitializer;
}

/**
 * check if a line is empty
 *
 * @return        whether line is empty
 */
bool ASFormatter::isEmptyLine(const string &line) const
{
	return line.find_first_not_of(" \t") == string::npos;
}

/**
 * Check if the following text is "C" as in extern "C".
 *
 * @return        whether the statement is extern "C"
 */
bool ASFormatter::isExternC() const
{
	// charNum should be at 'extern'
	assert(
Download .txt
gitextract_j16isbcq/

├── .gitignore
├── .travis.yml
├── 3rdpart/
│   ├── astyle/
│   │   ├── ASBeautifier.cpp
│   │   ├── ASEnhancer.cpp
│   │   ├── ASFormatter.cpp
│   │   ├── ASLocalizer.cpp
│   │   ├── ASLocalizer.h
│   │   ├── ASResource.cpp
│   │   ├── astyle.h
│   │   ├── astyle.pri
│   │   ├── astyle_main.cpp
│   │   └── astyle_main.h
│   ├── backward/
│   │   ├── backward.cpp
│   │   ├── backward.hpp
│   │   └── backward.pri
│   ├── hoedown/
│   │   ├── LICENSE
│   │   ├── README.md
│   │   ├── hoedown.def
│   │   ├── hoedown.pri
│   │   ├── html_block_names.gperf
│   │   └── src/
│   │       ├── autolink.c
│   │       ├── autolink.h
│   │       ├── buffer.c
│   │       ├── buffer.h
│   │       ├── document.c
│   │       ├── document.h
│   │       ├── escape.c
│   │       ├── escape.h
│   │       ├── hodedown_version.c
│   │       ├── html.c
│   │       ├── html.h
│   │       ├── html_blocks.c
│   │       ├── html_smartypants.c
│   │       ├── stack.c
│   │       ├── stack.h
│   │       └── version.h
│   ├── qdarkstyle/
│   │   ├── qdarkstype.pri
│   │   ├── style.qrc
│   │   └── style.qss
│   ├── qhexview/
│   │   ├── .gitignore
│   │   ├── LICENSE
│   │   ├── README.md
│   │   ├── include/
│   │   │   └── QHexView.h
│   │   ├── qhexview.pri
│   │   └── src/
│   │       └── QHexView.cpp
│   └── qt-mustache-master/
│       ├── .gitignore
│       ├── .travis.yml
│       ├── README.md
│       ├── qt-mustache.pri
│       ├── qt-mustache.pro
│       ├── src/
│       │   ├── mustache.cpp
│       │   └── mustache.h
│       └── tests/
│           ├── partial.mustache
│           ├── specs/
│           │   ├── comments.json
│           │   ├── comments.yml
│           │   ├── delimiters.json
│           │   ├── delimiters.yml
│           │   ├── interpolation.json
│           │   ├── interpolation.yml
│           │   ├── inverted.json
│           │   ├── inverted.yml
│           │   ├── partials.json
│           │   ├── partials.yml
│           │   ├── sections.json
│           │   └── sections.yml
│           ├── test_mustache.cpp
│           └── test_mustache.h
├── LICENSE
├── README.md
├── ci/
│   ├── BuildQSCI.mk
│   ├── extract-qt-installer
│   ├── qt-installer-silent.js
│   ├── qt5124-linux-packages
│   ├── qt5129-linux-packages
│   ├── tests-ci.sh
│   └── tests-environment.sh
├── docs/
│   ├── DIFF_TEMPLATES.md
│   └── TOOL_CMDLINE.md
├── embedded-ide.pro
├── ide/
│   ├── appconfig.cpp
│   ├── appconfig.h
│   ├── binaryviewer.cpp
│   ├── binaryviewer.h
│   ├── buildmanager.cpp
│   ├── buildmanager.h
│   ├── buttoneditoritemdelegate.h
│   ├── childprocess.cpp
│   ├── childprocess.h
│   ├── clangautocompletionprovider.cpp
│   ├── clangautocompletionprovider.h
│   ├── codetexteditor.cpp
│   ├── codetexteditor.h
│   ├── configwidget.cpp
│   ├── configwidget.h
│   ├── configwidget.ui
│   ├── consoleinterceptor.cpp
│   ├── consoleinterceptor.h
│   ├── cpptexteditor.cpp
│   ├── cpptexteditor.h
│   ├── documentmanager.cpp
│   ├── documentmanager.h
│   ├── envinputdialog.cpp
│   ├── envinputdialog.h
│   ├── envinputdialog.ui
│   ├── externaltoolmanager.cpp
│   ├── externaltoolmanager.h
│   ├── externaltoolmanager.ui
│   ├── filereferencesdialog.cpp
│   ├── filereferencesdialog.h
│   ├── filereferencesdialog.ui
│   ├── filesystemmanager.cpp
│   ├── filesystemmanager.h
│   ├── findandopenfiledialog.cpp
│   ├── findandopenfiledialog.h
│   ├── findandopenfiledialog.ui
│   ├── findinfilesdialog.cpp
│   ├── findinfilesdialog.h
│   ├── findinfilesdialog.ui
│   ├── findlineedit.cpp
│   ├── findlineedit.h
│   ├── findmakefiledialog.cpp
│   ├── findmakefiledialog.h
│   ├── findmakefiledialog.ui
│   ├── formfindreplace.cpp
│   ├── formfindreplace.h
│   ├── formfindreplace.ui
│   ├── icodemodelprovider.cpp
│   ├── icodemodelprovider.h
│   ├── ide.pro
│   ├── idocumenteditor.cpp
│   ├── idocumenteditor.h
│   ├── imageviewer.cpp
│   ├── imageviewer.h
│   ├── main.cpp
│   ├── mainwindow.cpp
│   ├── mainwindow.h
│   ├── mainwindow.ui
│   ├── mapfileviewer.cpp
│   ├── mapfileviewer.h
│   ├── markdowneditor.cpp
│   ├── markdowneditor.h
│   ├── markdownview.cpp
│   ├── markdownview.h
│   ├── newprojectdialog.cpp
│   ├── newprojectdialog.h
│   ├── newprojectdialog.ui
│   ├── newprojectfromremotedialog.cpp
│   ├── newprojectfromremotedialog.h
│   ├── newprojectfromremotedialog.ui
│   ├── plaintexteditor.cpp
│   ├── plaintexteditor.h
│   ├── processlinebufferizer.cpp
│   ├── processlinebufferizer.h
│   ├── processmanager.cpp
│   ├── processmanager.h
│   ├── projectmanager.cpp
│   ├── projectmanager.h
│   ├── regexhtmltranslator.cpp
│   ├── regexhtmltranslator.h
│   ├── resources/
│   │   ├── default-global.json
│   │   ├── default-local.json
│   │   ├── fonts.qrc
│   │   ├── iconactions.qrc
│   │   ├── images/
│   │   │   ├── dark/
│   │   │   │   └── index.theme
│   │   │   └── light/
│   │   │       └── index.theme
│   │   ├── kinds.qrc
│   │   ├── mimetypes.qrc
│   │   ├── reference-code.c
│   │   ├── resources.qrc
│   │   ├── styles/
│   │   │   ├── Bespin.xml
│   │   │   ├── Black board.xml
│   │   │   ├── Choco.xml
│   │   │   ├── Deep Black.xml
│   │   │   ├── Default.xml
│   │   │   ├── Hello Kitty.xml
│   │   │   ├── HotFudgeSundae.xml
│   │   │   ├── Material-Dark.xml
│   │   │   ├── Mono Industrial.xml
│   │   │   ├── Monokai.xml
│   │   │   ├── MossyLawn.xml
│   │   │   ├── Navajo.xml
│   │   │   ├── Obsidian.xml
│   │   │   ├── Plastic Code Wrap.xml
│   │   │   ├── Ruby Blue.xml
│   │   │   ├── Solarized-light.xml
│   │   │   ├── Solarized.xml
│   │   │   ├── Twilight.xml
│   │   │   ├── Vibrant Ink.xml
│   │   │   ├── Zenburn.xml
│   │   │   ├── khaki.xml
│   │   │   ├── tomorrow.xml
│   │   │   └── vim Dark Blue.xml
│   │   ├── styles.qrc
│   │   └── templates/
│   │       └── empty.template
│   ├── skeleton/
│   │   ├── bin/
│   │   │   ├── ftdi_rules.sh
│   │   │   └── qt.conf
│   │   ├── desktop-integration.sh
│   │   ├── embedded-ide.desktop
│   │   ├── embedded-ide.hardconf
│   │   ├── embedded-ide.sh
│   │   ├── embedded-ide.sh.wrapper
│   │   └── ftdi-tools.sh
│   ├── tar.h
│   ├── templatefile.cpp
│   ├── templatefile.h
│   ├── templateitemwidget.cpp
│   ├── templateitemwidget.h
│   ├── templateitemwidget.ui
│   ├── templatemanager.cpp
│   ├── templatemanager.h
│   ├── templatemanager.ui
│   ├── textmessagebrocker.cpp
│   ├── textmessagebrocker.h
│   ├── translations/
│   │   └── es.ts
│   ├── unsavedfilesdialog.cpp
│   ├── unsavedfilesdialog.h
│   ├── unsavedfilesdialog.ui
│   ├── version.cpp
│   └── version.h
├── mapview/
│   ├── main.cpp
│   ├── mapview.pri
│   ├── mapview.pro
│   ├── mapviewmodel.cpp
│   └── mapviewmodel.h
├── old/
│   ├── .gitignore
│   ├── 3rdpart/
│   │   ├── QHexEdit/
│   │   │   ├── LICENSE
│   │   │   ├── README.md
│   │   │   ├── qhexedit.cpp
│   │   │   ├── qhexedit.h
│   │   │   ├── qhexedit.pri
│   │   │   ├── qhexeditcomments.cpp
│   │   │   ├── qhexeditcomments.h
│   │   │   ├── qhexeditdata.cpp
│   │   │   ├── qhexeditdata.h
│   │   │   ├── qhexeditdatadevice.cpp
│   │   │   ├── qhexeditdatadevice.h
│   │   │   ├── qhexeditdatareader.cpp
│   │   │   ├── qhexeditdatareader.h
│   │   │   ├── qhexeditdatawriter.cpp
│   │   │   ├── qhexeditdatawriter.h
│   │   │   ├── qhexedithighlighter.cpp
│   │   │   ├── qhexedithighlighter.h
│   │   │   ├── qhexeditprivate.cpp
│   │   │   ├── qhexeditprivate.h
│   │   │   ├── sparserangemap.cpp
│   │   │   └── sparserangemap.h
│   │   ├── astyle/
│   │   │   ├── ASBeautifier.cpp
│   │   │   ├── ASEnhancer.cpp
│   │   │   ├── ASFormatter.cpp
│   │   │   ├── ASLocalizer.cpp
│   │   │   ├── ASLocalizer.h
│   │   │   ├── ASResource.cpp
│   │   │   ├── astyle.h
│   │   │   ├── astyle.pri
│   │   │   ├── astyle_main.cpp
│   │   │   └── astyle_main.h
│   │   ├── gdbdebugger/
│   │   │   ├── gdbdebugger.cpp
│   │   │   ├── gdbdebugger.h
│   │   │   └── gdbdebugger.pri
│   │   ├── qscintilla/
│   │   │   ├── ChangeLog
│   │   │   ├── LICENSE
│   │   │   ├── NEWS
│   │   │   ├── Qt4Qt5/
│   │   │   │   ├── InputMethod.cpp
│   │   │   │   ├── ListBoxQt.cpp
│   │   │   │   ├── ListBoxQt.h
│   │   │   │   ├── MacPasteboardMime.cpp
│   │   │   │   ├── PlatQt.cpp
│   │   │   │   ├── Qsci/
│   │   │   │   │   ├── qsciabstractapis.h
│   │   │   │   │   ├── qsciapis.h
│   │   │   │   │   ├── qscicommand.h
│   │   │   │   │   ├── qscicommandset.h
│   │   │   │   │   ├── qscidocument.h
│   │   │   │   │   ├── qsciglobal.h
│   │   │   │   │   ├── qscilexer.h
│   │   │   │   │   ├── qscilexeravs.h
│   │   │   │   │   ├── qscilexerbash.h
│   │   │   │   │   ├── qscilexerbatch.h
│   │   │   │   │   ├── qscilexercmake.h
│   │   │   │   │   ├── qscilexercoffeescript.h
│   │   │   │   │   ├── qscilexercpp.h
│   │   │   │   │   ├── qscilexercsharp.h
│   │   │   │   │   ├── qscilexercss.h
│   │   │   │   │   ├── qscilexercustom.h
│   │   │   │   │   ├── qscilexerd.h
│   │   │   │   │   ├── qscilexerdiff.h
│   │   │   │   │   ├── qscilexerfortran.h
│   │   │   │   │   ├── qscilexerfortran77.h
│   │   │   │   │   ├── qscilexerhtml.h
│   │   │   │   │   ├── qscilexeridl.h
│   │   │   │   │   ├── qscilexerjava.h
│   │   │   │   │   ├── qscilexerjavascript.h
│   │   │   │   │   ├── qscilexerjson.h
│   │   │   │   │   ├── qscilexerlua.h
│   │   │   │   │   ├── qscilexermakefile.h
│   │   │   │   │   ├── qscilexermarkdown.h
│   │   │   │   │   ├── qscilexermatlab.h
│   │   │   │   │   ├── qscilexeroctave.h
│   │   │   │   │   ├── qscilexerpascal.h
│   │   │   │   │   ├── qscilexerperl.h
│   │   │   │   │   ├── qscilexerpo.h
│   │   │   │   │   ├── qscilexerpostscript.h
│   │   │   │   │   ├── qscilexerpov.h
│   │   │   │   │   ├── qscilexerproperties.h
│   │   │   │   │   ├── qscilexerpython.h
│   │   │   │   │   ├── qscilexerruby.h
│   │   │   │   │   ├── qscilexerspice.h
│   │   │   │   │   ├── qscilexersql.h
│   │   │   │   │   ├── qscilexertcl.h
│   │   │   │   │   ├── qscilexertex.h
│   │   │   │   │   ├── qscilexerverilog.h
│   │   │   │   │   ├── qscilexervhdl.h
│   │   │   │   │   ├── qscilexerxml.h
│   │   │   │   │   ├── qscilexeryaml.h
│   │   │   │   │   ├── qscimacro.h
│   │   │   │   │   ├── qsciprinter.h
│   │   │   │   │   ├── qsciscintilla.h
│   │   │   │   │   ├── qsciscintillabase.h
│   │   │   │   │   ├── qscistyle.h
│   │   │   │   │   └── qscistyledtext.h
│   │   │   │   ├── SciClasses.cpp
│   │   │   │   ├── SciClasses.h
│   │   │   │   ├── SciNamespace.h
│   │   │   │   ├── ScintillaQt.cpp
│   │   │   │   ├── ScintillaQt.h
│   │   │   │   ├── features/
│   │   │   │   │   └── qscintilla2.prf
│   │   │   │   ├── features_staticlib/
│   │   │   │   │   └── qscintilla2.prf
│   │   │   │   ├── qsciabstractapis.cpp
│   │   │   │   ├── qsciapis.cpp
│   │   │   │   ├── qscicommand.cpp
│   │   │   │   ├── qscicommandset.cpp
│   │   │   │   ├── qscidocument.cpp
│   │   │   │   ├── qscilexer.cpp
│   │   │   │   ├── qscilexeravs.cpp
│   │   │   │   ├── qscilexerbash.cpp
│   │   │   │   ├── qscilexerbatch.cpp
│   │   │   │   ├── qscilexercmake.cpp
│   │   │   │   ├── qscilexercoffeescript.cpp
│   │   │   │   ├── qscilexercpp.cpp
│   │   │   │   ├── qscilexercsharp.cpp
│   │   │   │   ├── qscilexercss.cpp
│   │   │   │   ├── qscilexercustom.cpp
│   │   │   │   ├── qscilexerd.cpp
│   │   │   │   ├── qscilexerdiff.cpp
│   │   │   │   ├── qscilexerfortran.cpp
│   │   │   │   ├── qscilexerfortran77.cpp
│   │   │   │   ├── qscilexerhtml.cpp
│   │   │   │   ├── qscilexeridl.cpp
│   │   │   │   ├── qscilexerjava.cpp
│   │   │   │   ├── qscilexerjavascript.cpp
│   │   │   │   ├── qscilexerjson.cpp
│   │   │   │   ├── qscilexerlua.cpp
│   │   │   │   ├── qscilexermakefile.cpp
│   │   │   │   ├── qscilexermarkdown.cpp
│   │   │   │   ├── qscilexermatlab.cpp
│   │   │   │   ├── qscilexeroctave.cpp
│   │   │   │   ├── qscilexerpascal.cpp
│   │   │   │   ├── qscilexerperl.cpp
│   │   │   │   ├── qscilexerpo.cpp
│   │   │   │   ├── qscilexerpostscript.cpp
│   │   │   │   ├── qscilexerpov.cpp
│   │   │   │   ├── qscilexerproperties.cpp
│   │   │   │   ├── qscilexerpython.cpp
│   │   │   │   ├── qscilexerruby.cpp
│   │   │   │   ├── qscilexerspice.cpp
│   │   │   │   ├── qscilexersql.cpp
│   │   │   │   ├── qscilexertcl.cpp
│   │   │   │   ├── qscilexertex.cpp
│   │   │   │   ├── qscilexerverilog.cpp
│   │   │   │   ├── qscilexervhdl.cpp
│   │   │   │   ├── qscilexerxml.cpp
│   │   │   │   ├── qscilexeryaml.cpp
│   │   │   │   ├── qscimacro.cpp
│   │   │   │   ├── qscintilla.pro
│   │   │   │   ├── qscintilla_cs.ts
│   │   │   │   ├── qscintilla_de.ts
│   │   │   │   ├── qscintilla_es.ts
│   │   │   │   ├── qscintilla_fr.ts
│   │   │   │   ├── qscintilla_pt_br.ts
│   │   │   │   ├── qsciprinter.cpp
│   │   │   │   ├── qsciscintilla.cpp
│   │   │   │   ├── qsciscintillabase.cpp
│   │   │   │   ├── qscistyle.cpp
│   │   │   │   └── qscistyledtext.cpp
│   │   │   ├── README
│   │   │   ├── include/
│   │   │   │   ├── ILexer.h
│   │   │   │   ├── License.txt
│   │   │   │   ├── Platform.h
│   │   │   │   ├── SciLexer.h
│   │   │   │   ├── Sci_Position.h
│   │   │   │   ├── Scintilla.h
│   │   │   │   ├── Scintilla.iface
│   │   │   │   └── ScintillaWidget.h
│   │   │   ├── lexers/
│   │   │   │   ├── LexA68k.cpp
│   │   │   │   ├── LexAPDL.cpp
│   │   │   │   ├── LexASY.cpp
│   │   │   │   ├── LexAU3.cpp
│   │   │   │   ├── LexAVE.cpp
│   │   │   │   ├── LexAVS.cpp
│   │   │   │   ├── LexAbaqus.cpp
│   │   │   │   ├── LexAda.cpp
│   │   │   │   ├── LexAsm.cpp
│   │   │   │   ├── LexAsn1.cpp
│   │   │   │   ├── LexBaan.cpp
│   │   │   │   ├── LexBash.cpp
│   │   │   │   ├── LexBasic.cpp
│   │   │   │   ├── LexBatch.cpp
│   │   │   │   ├── LexBibTeX.cpp
│   │   │   │   ├── LexBullant.cpp
│   │   │   │   ├── LexCLW.cpp
│   │   │   │   ├── LexCOBOL.cpp
│   │   │   │   ├── LexCPP.cpp
│   │   │   │   ├── LexCSS.cpp
│   │   │   │   ├── LexCaml.cpp
│   │   │   │   ├── LexCmake.cpp
│   │   │   │   ├── LexCoffeeScript.cpp
│   │   │   │   ├── LexConf.cpp
│   │   │   │   ├── LexCrontab.cpp
│   │   │   │   ├── LexCsound.cpp
│   │   │   │   ├── LexD.cpp
│   │   │   │   ├── LexDMAP.cpp
│   │   │   │   ├── LexDMIS.cpp
│   │   │   │   ├── LexDiff.cpp
│   │   │   │   ├── LexECL.cpp
│   │   │   │   ├── LexEDIFACT.cpp
│   │   │   │   ├── LexEScript.cpp
│   │   │   │   ├── LexEiffel.cpp
│   │   │   │   ├── LexErlang.cpp
│   │   │   │   ├── LexErrorList.cpp
│   │   │   │   ├── LexFlagship.cpp
│   │   │   │   ├── LexForth.cpp
│   │   │   │   ├── LexFortran.cpp
│   │   │   │   ├── LexGAP.cpp
│   │   │   │   ├── LexGui4Cli.cpp
│   │   │   │   ├── LexHTML.cpp
│   │   │   │   ├── LexHaskell.cpp
│   │   │   │   ├── LexHex.cpp
│   │   │   │   ├── LexInno.cpp
│   │   │   │   ├── LexJSON.cpp
│   │   │   │   ├── LexKVIrc.cpp
│   │   │   │   ├── LexKix.cpp
│   │   │   │   ├── LexLaTeX.cpp
│   │   │   │   ├── LexLisp.cpp
│   │   │   │   ├── LexLout.cpp
│   │   │   │   ├── LexLua.cpp
│   │   │   │   ├── LexMMIXAL.cpp
│   │   │   │   ├── LexMPT.cpp
│   │   │   │   ├── LexMSSQL.cpp
│   │   │   │   ├── LexMagik.cpp
│   │   │   │   ├── LexMake.cpp
│   │   │   │   ├── LexMarkdown.cpp
│   │   │   │   ├── LexMatlab.cpp
│   │   │   │   ├── LexMetapost.cpp
│   │   │   │   ├── LexModula.cpp
│   │   │   │   ├── LexMySQL.cpp
│   │   │   │   ├── LexNimrod.cpp
│   │   │   │   ├── LexNsis.cpp
│   │   │   │   ├── LexNull.cpp
│   │   │   │   ├── LexOScript.cpp
│   │   │   │   ├── LexOpal.cpp
│   │   │   │   ├── LexPB.cpp
│   │   │   │   ├── LexPLM.cpp
│   │   │   │   ├── LexPO.cpp
│   │   │   │   ├── LexPOV.cpp
│   │   │   │   ├── LexPS.cpp
│   │   │   │   ├── LexPascal.cpp
│   │   │   │   ├── LexPerl.cpp
│   │   │   │   ├── LexPowerPro.cpp
│   │   │   │   ├── LexPowerShell.cpp
│   │   │   │   ├── LexProgress.cpp
│   │   │   │   ├── LexProps.cpp
│   │   │   │   ├── LexPython.cpp
│   │   │   │   ├── LexR.cpp
│   │   │   │   ├── LexRebol.cpp
│   │   │   │   ├── LexRegistry.cpp
│   │   │   │   ├── LexRuby.cpp
│   │   │   │   ├── LexRust.cpp
│   │   │   │   ├── LexSML.cpp
│   │   │   │   ├── LexSQL.cpp
│   │   │   │   ├── LexSTTXT.cpp
│   │   │   │   ├── LexScriptol.cpp
│   │   │   │   ├── LexSmalltalk.cpp
│   │   │   │   ├── LexSorcus.cpp
│   │   │   │   ├── LexSpecman.cpp
│   │   │   │   ├── LexSpice.cpp
│   │   │   │   ├── LexTACL.cpp
│   │   │   │   ├── LexTADS3.cpp
│   │   │   │   ├── LexTAL.cpp
│   │   │   │   ├── LexTCL.cpp
│   │   │   │   ├── LexTCMD.cpp
│   │   │   │   ├── LexTeX.cpp
│   │   │   │   ├── LexTxt2tags.cpp
│   │   │   │   ├── LexVB.cpp
│   │   │   │   ├── LexVHDL.cpp
│   │   │   │   ├── LexVerilog.cpp
│   │   │   │   ├── LexVisualProlog.cpp
│   │   │   │   ├── LexYAML.cpp
│   │   │   │   └── License.txt
│   │   │   ├── lexlib/
│   │   │   │   ├── Accessor.cpp
│   │   │   │   ├── Accessor.h
│   │   │   │   ├── CharacterCategory.cpp
│   │   │   │   ├── CharacterCategory.h
│   │   │   │   ├── CharacterSet.cpp
│   │   │   │   ├── CharacterSet.h
│   │   │   │   ├── LexAccessor.h
│   │   │   │   ├── LexerBase.cpp
│   │   │   │   ├── LexerBase.h
│   │   │   │   ├── LexerModule.cpp
│   │   │   │   ├── LexerModule.h
│   │   │   │   ├── LexerNoExceptions.cpp
│   │   │   │   ├── LexerNoExceptions.h
│   │   │   │   ├── LexerSimple.cpp
│   │   │   │   ├── LexerSimple.h
│   │   │   │   ├── License.txt
│   │   │   │   ├── OptionSet.h
│   │   │   │   ├── PropSetSimple.cpp
│   │   │   │   ├── PropSetSimple.h
│   │   │   │   ├── SparseState.h
│   │   │   │   ├── StringCopy.h
│   │   │   │   ├── StyleContext.cpp
│   │   │   │   ├── StyleContext.h
│   │   │   │   ├── SubStyles.h
│   │   │   │   ├── WordList.cpp
│   │   │   │   └── WordList.h
│   │   │   ├── qscintilla.pri
│   │   │   └── src/
│   │   │       ├── AutoComplete.cpp
│   │   │       ├── AutoComplete.h
│   │   │       ├── CallTip.cpp
│   │   │       ├── CallTip.h
│   │   │       ├── CaseConvert.cpp
│   │   │       ├── CaseConvert.h
│   │   │       ├── CaseFolder.cpp
│   │   │       ├── CaseFolder.h
│   │   │       ├── Catalogue.cpp
│   │   │       ├── Catalogue.h
│   │   │       ├── CellBuffer.cpp
│   │   │       ├── CellBuffer.h
│   │   │       ├── CharClassify.cpp
│   │   │       ├── CharClassify.h
│   │   │       ├── ContractionState.cpp
│   │   │       ├── ContractionState.h
│   │   │       ├── Decoration.cpp
│   │   │       ├── Decoration.h
│   │   │       ├── Document.cpp
│   │   │       ├── Document.h
│   │   │       ├── EditModel.cpp
│   │   │       ├── EditModel.h
│   │   │       ├── EditView.cpp
│   │   │       ├── EditView.h
│   │   │       ├── Editor.cpp
│   │   │       ├── Editor.h
│   │   │       ├── ExternalLexer.cpp
│   │   │       ├── ExternalLexer.h
│   │   │       ├── FontQuality.h
│   │   │       ├── Indicator.cpp
│   │   │       ├── Indicator.h
│   │   │       ├── KeyMap.cpp
│   │   │       ├── KeyMap.h
│   │   │       ├── License.txt
│   │   │       ├── LineMarker.cpp
│   │   │       ├── LineMarker.h
│   │   │       ├── MarginView.cpp
│   │   │       ├── MarginView.h
│   │   │       ├── Partitioning.h
│   │   │       ├── PerLine.cpp
│   │   │       ├── PerLine.h
│   │   │       ├── Position.h
│   │   │       ├── PositionCache.cpp
│   │   │       ├── PositionCache.h
│   │   │       ├── RESearch.cpp
│   │   │       ├── RESearch.h
│   │   │       ├── RunStyles.cpp
│   │   │       ├── RunStyles.h
│   │   │       ├── SciTE.properties
│   │   │       ├── ScintillaBase.cpp
│   │   │       ├── ScintillaBase.h
│   │   │       ├── Selection.cpp
│   │   │       ├── Selection.h
│   │   │       ├── SparseVector.h
│   │   │       ├── SplitVector.h
│   │   │       ├── Style.cpp
│   │   │       ├── Style.h
│   │   │       ├── UniConversion.cpp
│   │   │       ├── UniConversion.h
│   │   │       ├── UnicodeFromUTF8.h
│   │   │       ├── ViewStyle.cpp
│   │   │       ├── ViewStyle.h
│   │   │       ├── XPM.cpp
│   │   │       └── XPM.h
│   │   └── qtc_gdbmi/
│   │       ├── gdbmi.cpp
│   │       ├── gdbmi.h
│   │       └── qtc_gdbmi.pri
│   ├── aboutdialog.cpp
│   ├── aboutdialog.h
│   ├── aboutdialog.ui
│   ├── appconfig.cpp
│   ├── appconfig.h
│   ├── bannerwidget.cpp
│   ├── bannerwidget.h
│   ├── bannerwidget.ui
│   ├── clangcodecontext.cpp
│   ├── clangcodecontext.h
│   ├── codeeditor.cpp
│   ├── codeeditor.h
│   ├── codetemplate.cpp
│   ├── codetemplate.h
│   ├── combodocumentview.cpp
│   ├── combodocumentview.h
│   ├── componentitemwidget.cpp
│   ├── componentitemwidget.h
│   ├── componentitemwidget.ui
│   ├── componentsdialog.cpp
│   ├── componentsdialog.h
│   ├── componentsdialog.ui
│   ├── configdialog.cpp
│   ├── configdialog.h
│   ├── configdialog.ui
│   ├── debugui.cpp
│   ├── debugui.h
│   ├── debugui.ui
│   ├── dialogconfigworkspace.cpp
│   ├── dialogconfigworkspace.h
│   ├── dialogconfigworkspace.ui
│   ├── documentarea.cpp
│   ├── documentarea.h
│   ├── editorwidget.ui
│   ├── embedded-ide.desktop
│   ├── etags.cpp
│   ├── etags.h
│   ├── filedownloader.cpp
│   ├── filedownloader.h
│   ├── filepropertiesdialog.cpp
│   ├── filepropertiesdialog.h
│   ├── filepropertiesdialog.ui
│   ├── findinfilesdialog.cpp
│   ├── findinfilesdialog.h
│   ├── findinfilesdialog.ui
│   ├── findlineedit.cpp
│   ├── findlineedit.h
│   ├── formfindreplace.cpp
│   ├── formfindreplace.h
│   ├── formfindreplace.ui
│   ├── gdbstartdialog.cpp
│   ├── gdbstartdialog.h
│   ├── gdbstartdialog.ui
│   ├── i18n/
│   │   ├── es.ts
│   │   └── zh.ts
│   ├── ide.pro
│   ├── loggerwidget.cpp
│   ├── loggerwidget.h
│   ├── main.cpp
│   ├── mainmenuwidget.cpp
│   ├── mainmenuwidget.h
│   ├── mainmenuwidget.ui
│   ├── mainwindow.cpp
│   ├── mainwindow.h
│   ├── mainwindow.ui
│   ├── make2compilationdb.sh
│   ├── makefileinfo.cpp
│   ├── makefileinfo.h
│   ├── mapviewer.cpp
│   ├── mapviewer.h
│   ├── mapviewer.ui
│   ├── passwordpromtdialog.cpp
│   ├── passwordpromtdialog.h
│   ├── passwordpromtdialog.ui
│   ├── projectexporter.cpp
│   ├── projectexporter.h
│   ├── projecticonprovider.cpp
│   ├── projecticonprovider.h
│   ├── projectnewdialog.cpp
│   ├── projectnewdialog.h
│   ├── projectnewdialog.ui
│   ├── projectview.cpp
│   ├── projectview.h
│   ├── projectview.ui
│   ├── projetfromtemplate.cpp
│   ├── projetfromtemplate.h
│   ├── qsvtextoperationswidget.cpp
│   ├── qsvtextoperationswidget.h
│   ├── qtdialog/
│   │   ├── main.cpp
│   │   └── qtdialog.pro
│   ├── replaceform.ui
│   ├── resources/
│   │   ├── project-filters.txt
│   │   ├── reference-code.c
│   │   ├── resources.qrc
│   │   ├── style.css
│   │   ├── styles/
│   │   │   ├── Bespin.xml
│   │   │   ├── Black board.xml
│   │   │   ├── Choco.xml
│   │   │   ├── Deep Black.xml
│   │   │   ├── Default.xml
│   │   │   ├── Hello Kitty.xml
│   │   │   ├── HotFudgeSundae.xml
│   │   │   ├── Material-Dark.xml
│   │   │   ├── Mono Industrial.xml
│   │   │   ├── Monokai.xml
│   │   │   ├── MossyLawn.xml
│   │   │   ├── Navajo.xml
│   │   │   ├── Obsidian.xml
│   │   │   ├── Plastic Code Wrap.xml
│   │   │   ├── Ruby Blue.xml
│   │   │   ├── Solarized-light.xml
│   │   │   ├── Solarized.xml
│   │   │   ├── Twilight.xml
│   │   │   ├── Vibrant Ink.xml
│   │   │   ├── Zenburn.xml
│   │   │   ├── khaki.xml
│   │   │   └── vim Dark Blue.xml
│   │   └── templates/
│   │       ├── empty.template
│   │       ├── gcc-exec.template
│   │       ├── lpcopen-picociaa.template
│   │       ├── lpcopen.template
│   │       └── sAPI-Project.template
│   ├── searchform.ui
│   ├── skeleton/
│   │   ├── bin/
│   │   │   ├── ftdi_rules.sh
│   │   │   └── qt.conf
│   │   ├── desktop-integration.sh
│   │   ├── embedded-ide.hardconf
│   │   ├── embedded-ide.sh
│   │   ├── embedded-ide.sh.wrapper
│   │   └── ftdi-tools.sh
│   ├── taglist.cpp
│   ├── taglist.h
│   ├── targetupdatediscover.cpp
│   ├── targetupdatediscover.h
│   ├── templatedownloader.cpp
│   ├── templatedownloader.h
│   ├── templatesdownloadselector.cpp
│   ├── templatesdownloadselector.h
│   ├── templatesdownloadselector.ui
│   ├── toolmanager.cpp
│   ├── toolmanager.h
│   ├── toolmanager.ui
│   ├── version.cpp
│   └── version.h
├── qtshdialog/
│   ├── 3rdpart/
│   │   └── QJsonModel/
│   │       ├── LICENSE
│   │       ├── QJsonModel.pri
│   │       ├── QJsonModel.pro
│   │       ├── README.md
│   │       ├── main.cpp
│   │       ├── qjsonmodel.cpp
│   │       ├── qjsonmodel.h
│   │       └── qjsonmodel.py
│   ├── main.cpp
│   └── qtshdialog.pro
└── socketwaiter/
    ├── .gitignore
    ├── LICENSE
    ├── README.md
    ├── main.cpp
    └── socketwaiter.pro
Copy disabled (too large) Download .json
Condensed preview — 750 files, each showing path, character count, and a content snippet. Download the .json file for the full structured content (17,962K chars).
[
  {
    "path": ".gitignore",
    "chars": 48,
    "preview": "*.o\n*.d\n*.elf\n*.moc\nmoc_*.cpp\nui_*.h\n*.pro.user\n"
  },
  {
    "path": ".travis.yml",
    "chars": 735,
    "preview": "language: cpp\nsudo: required\ndist: xenial\n\nos: linux\n\nenv:\n  global:\n    - DISPLAY=:99\n    - MXE_TRIPLE=i686-w64-mingw32"
  },
  {
    "path": "3rdpart/astyle/ASBeautifier.cpp",
    "chars": 101586,
    "preview": "/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n *   ASBeautifier.cpp\n *\n *   Copyright (C)"
  },
  {
    "path": "3rdpart/astyle/ASEnhancer.cpp",
    "chars": 19374,
    "preview": "/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n *   ASEnhancer.cpp\n *\n *   Copyright (C) 2"
  },
  {
    "path": "3rdpart/astyle/ASFormatter.cpp",
    "chars": 202716,
    "preview": "/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n *   ASFormatter.cpp\n *\n *   Copyright (C) "
  },
  {
    "path": "3rdpart/astyle/ASLocalizer.cpp",
    "chars": 42246,
    "preview": "//\n//  FILE ENCODING IS UTF-8 WITHOUT A BOM.\n//  русский    中文(简体)    日本    한국의\n//\n/* * * * * * * * * * * * * * * * * * "
  },
  {
    "path": "3rdpart/astyle/ASLocalizer.h",
    "chars": 4877,
    "preview": "/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n *   ASLocalizer.h\n *\n *   Copyright (C) 20"
  },
  {
    "path": "3rdpart/astyle/ASResource.cpp",
    "chars": 21735,
    "preview": "/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n *   ASResource.cpp\n *\n *   Copyright (C) 2"
  },
  {
    "path": "3rdpart/astyle/astyle.h",
    "chars": 36246,
    "preview": "/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n *   astyle.h\n\n *   Copyright (C) 2014 by J"
  },
  {
    "path": "3rdpart/astyle/astyle.pri",
    "chars": 331,
    "preview": "SOURCES += $$PWD/ASBeautifier.cpp\nSOURCES += $$PWD/ASEnhancer.cpp\nSOURCES += $$PWD/ASFormatter.cpp\nSOURCES += $$PWD/ASLo"
  },
  {
    "path": "3rdpart/astyle/astyle_main.cpp",
    "chars": 110622,
    "preview": "/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n *   astyle_main.cpp\n *\n *   Copyright (C) "
  },
  {
    "path": "3rdpart/astyle/astyle_main.h",
    "chars": 18212,
    "preview": "/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n *   astyle_main.h\n *\n *   Copyright (C) 20"
  },
  {
    "path": "3rdpart/backward/backward.cpp",
    "chars": 757,
    "preview": "// Pick your poison.\n//\n// On GNU/Linux, you have few choices to get the most out of your stack trace.\n//\n// By default "
  },
  {
    "path": "3rdpart/backward/backward.hpp",
    "chars": 60969,
    "preview": "/*\n * backward.hpp\n * Copyright 2013 Google Inc. All Rights Reserved.\n *\n * Permission is hereby granted, free of charge"
  },
  {
    "path": "3rdpart/backward/backward.pri",
    "chars": 81,
    "preview": "SOURCES += $$PWD/backward.cpp\nHEADERS += $$PWD/backward.hpp\nINCLUDEPATH += $$PWD\n"
  },
  {
    "path": "3rdpart/hoedown/LICENSE",
    "chars": 834,
    "preview": "Copyright (c) 2008, Natacha Porté\nCopyright (c) 2011, Vicent Martí\nCopyright (c) 2014, Xavier Mendez, Devin Torres and t"
  },
  {
    "path": "3rdpart/hoedown/README.md",
    "chars": 4043,
    "preview": "Hoedown\n=======\n\n[![Build Status](https://travis-ci.org/hoedown/hoedown.png?branch=master)](https://travis-ci.org/hoedow"
  },
  {
    "path": "3rdpart/hoedown/hoedown.def",
    "chars": 871,
    "preview": "LIBRARY HOEDOWN\nEXPORTS\n\thoedown_autolink_is_safe\n\thoedown_autolink__www\n\thoedown_autolink__email\n\thoedown_autolink__url"
  },
  {
    "path": "3rdpart/hoedown/hoedown.pri",
    "chars": 515,
    "preview": "HEADERS += $$PWD/src/escape.h\nHEADERS += $$PWD/src/html.h\nHEADERS += $$PWD/src/autolink.h\nHEADERS += $$PWD/src/document."
  },
  {
    "path": "3rdpart/hoedown/html_block_names.gperf",
    "chars": 117,
    "preview": "p\ndl\nh1\nh2\nh3\nh4\nh5\nh6\nol\nul\ndel\ndiv\nins\npre\nform\nmath\nstyle\ntable\nfigure\niframe\nscript\nfieldset\nnoscript\nblockquote\n"
  },
  {
    "path": "3rdpart/hoedown/src/autolink.c",
    "chars": 5530,
    "preview": "#include \"autolink.h\"\n\n#include <string.h>\n#include <stdlib.h>\n#include <stdio.h>\n#include <ctype.h>\n\n#ifndef _MSC_VER\n#"
  },
  {
    "path": "3rdpart/hoedown/src/autolink.h",
    "chars": 1189,
    "preview": "/* autolink.h - versatile autolinker */\n\n#ifndef HOEDOWN_AUTOLINK_H\n#define HOEDOWN_AUTOLINK_H\n\n#include \"buffer.h\"\n\n#if"
  },
  {
    "path": "3rdpart/hoedown/src/buffer.c",
    "chars": 5639,
    "preview": "#include \"buffer.h\"\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <assert.h>\n\nvoid *\nhoedown_mall"
  },
  {
    "path": "3rdpart/hoedown/src/buffer.h",
    "chars": 4535,
    "preview": "/* buffer.h - simple, fast buffers */\n\n#ifndef HOEDOWN_BUFFER_H\n#define HOEDOWN_BUFFER_H\n\n#include <stdio.h>\n#include <s"
  },
  {
    "path": "3rdpart/hoedown/src/document.c",
    "chars": 71642,
    "preview": "#include \"document.h\"\n\n#include <assert.h>\n#include <string.h>\n#include <ctype.h>\n#include <stdio.h>\n\n#include \"stack.h\""
  },
  {
    "path": "3rdpart/hoedown/src/document.h",
    "chars": 7387,
    "preview": "/* document.h - generic markdown parser */\n\n#ifndef HOEDOWN_DOCUMENT_H\n#define HOEDOWN_DOCUMENT_H\n\n#include \"buffer.h\"\n#"
  },
  {
    "path": "3rdpart/hoedown/src/escape.c",
    "chars": 5091,
    "preview": "#include \"escape.h\"\n\n#include <assert.h>\n#include <stdio.h>\n#include <string.h>\n\n\n#define likely(x)       __builtin_expe"
  },
  {
    "path": "3rdpart/hoedown/src/escape.h",
    "chars": 532,
    "preview": "/* escape.h - escape utilities */\n\n#ifndef HOEDOWN_ESCAPE_H\n#define HOEDOWN_ESCAPE_H\n\n#include \"buffer.h\"\n\n#ifdef __cplu"
  },
  {
    "path": "3rdpart/hoedown/src/hodedown_version.c",
    "chars": 191,
    "preview": "#include \"version.h\"\n\nvoid\nhoedown_version(int *major, int *minor, int *revision)\n{\n\t*major = HOEDOWN_VERSION_MAJOR;\n\t*m"
  },
  {
    "path": "3rdpart/hoedown/src/html.c",
    "chars": 19546,
    "preview": "#include \"html.h\"\n\n#include <string.h>\n#include <stdlib.h>\n#include <stdio.h>\n#include <ctype.h>\n\n#include \"escape.h\"\n\n#"
  },
  {
    "path": "3rdpart/hoedown/src/html.h",
    "chars": 2003,
    "preview": "/* html.h - HTML renderer and utilities */\n\n#ifndef HOEDOWN_HTML_H\n#define HOEDOWN_HTML_H\n\n#include \"document.h\"\n#includ"
  },
  {
    "path": "3rdpart/hoedown/src/html_blocks.c",
    "chars": 8515,
    "preview": "/* ANSI-C code produced by gperf version 3.0.3 */\n/* Command-line: gperf -L ANSI-C -N hoedown_find_block_tag -c -C -E -S"
  },
  {
    "path": "3rdpart/hoedown/src/html_smartypants.c",
    "chars": 12602,
    "preview": "#include \"html.h\"\n\n#include <string.h>\n#include <stdlib.h>\n#include <stdio.h>\n#include <ctype.h>\n\n#ifdef _MSC_VER\n#defin"
  },
  {
    "path": "3rdpart/hoedown/src/stack.c",
    "chars": 1136,
    "preview": "#include \"stack.h\"\n\n#include \"buffer.h\"\n\n#include <stdlib.h>\n#include <string.h>\n#include <assert.h>\n\nvoid\nhoedown_stack"
  },
  {
    "path": "3rdpart/hoedown/src/stack.h",
    "chars": 1113,
    "preview": "/* stack.h - simple stacking */\n\n#ifndef HOEDOWN_STACK_H\n#define HOEDOWN_STACK_H\n\n#include <stddef.h>\n\n#ifdef __cplusplu"
  },
  {
    "path": "3rdpart/hoedown/src/version.h",
    "chars": 547,
    "preview": "/* version.h - holds Hoedown's version */\n\n#ifndef HOEDOWN_VERSION_H\n#define HOEDOWN_VERSION_H\n\n#ifdef __cplusplus\nexter"
  },
  {
    "path": "3rdpart/qdarkstyle/qdarkstype.pri",
    "chars": 30,
    "preview": "RESOURCES += $$PWD//style.qrc\n"
  },
  {
    "path": "3rdpart/qdarkstyle/style.qrc",
    "chars": 1741,
    "preview": "<RCC>\n  <qresource prefix=\"qss_icons\">\n    <file>rc/up_arrow_disabled.png</file>\n    <file>rc/Hmovetoolbar.png</file>\n  "
  },
  {
    "path": "3rdpart/qdarkstyle/style.qss",
    "chars": 41774,
    "preview": "/* QDarkStyleSheet --------------------------------------------------------\n\nThis is the main style sheet, the palette h"
  },
  {
    "path": "3rdpart/qhexview/.gitignore",
    "chars": 42,
    "preview": "build\nmoc_*\n*.o\nexample/qhexview\nMakefile\n"
  },
  {
    "path": "3rdpart/qhexview/LICENSE",
    "chars": 1068,
    "preview": "The MIT License (MIT)\n\nCopyright (c) 2015 \n\nPermission is hereby granted, free of charge, to any person obtaining a copy"
  },
  {
    "path": "3rdpart/qhexview/README.md",
    "chars": 536,
    "preview": "QHexView\n==========\n\nThis is Qt widget for display binary data in traditional hex-editor style. This widget doesn`t have"
  },
  {
    "path": "3rdpart/qhexview/include/QHexView.h",
    "chars": 1927,
    "preview": "#ifndef Q_HEX_VIEWER_H_\n#define Q_HEX_VIEWER_H_\n\n#include <QAbstractScrollArea>\n#include <QByteArray>\n#include <QFile>\n\n"
  },
  {
    "path": "3rdpart/qhexview/qhexview.pri",
    "chars": 99,
    "preview": "SOURCES += $$PWD/src/QHexView.cpp\nHEADERS += $$PWD/include/QHexView.h\nINCLUDEPATH += $$PWD/include\n"
  },
  {
    "path": "3rdpart/qhexview/src/QHexView.cpp",
    "chars": 12869,
    "preview": "#include \"../include/QHexView.h\"\n#include <QScrollBar>\n#include <QPainter>\n#include <QSize>\n#include <QPaintEvent>\n#incl"
  },
  {
    "path": "3rdpart/qt-mustache-master/.gitignore",
    "chars": 12,
    "preview": "build-debug\n"
  },
  {
    "path": "3rdpart/qt-mustache-master/.travis.yml",
    "chars": 292,
    "preview": "language: cpp\n\nenv:\n - QT_SELECT=qt4\n - QT_SELECT=qt5\n\nbefore_install:\n - sudo add-apt-repository --yes ppa:ubuntu-sdk-t"
  },
  {
    "path": "3rdpart/qt-mustache-master/README.md",
    "chars": 2952,
    "preview": "[![Build Status](https://travis-ci.org/robertknight/qt-mustache.svg?branch=master)](https://travis-ci.org/robertknight/q"
  },
  {
    "path": "3rdpart/qt-mustache-master/qt-mustache.pri",
    "chars": 92,
    "preview": "INCLUDEPATH += $$PWD/src\n\nHEADERS += $$PWD/src/mustache.h\nSOURCES += $$PWD/src/mustache.cpp\n"
  },
  {
    "path": "3rdpart/qt-mustache-master/qt-mustache.pro",
    "chars": 994,
    "preview": "######################################################################\n# Automatically generated by qmake (2.01a) Mon Au"
  },
  {
    "path": "3rdpart/qt-mustache-master/src/mustache.cpp",
    "chars": 14114,
    "preview": "/*\n  Copyright 2012, Robert Knight\n\n  Redistribution and use in source and binary forms, with or without modification,\n "
  },
  {
    "path": "3rdpart/qt-mustache-master/src/mustache.h",
    "chars": 8140,
    "preview": "/*\n  Copyright 2012, Robert Knight\n\n  Redistribution and use in source and binary forms, with or without modification,\n "
  },
  {
    "path": "3rdpart/qt-mustache-master/tests/partial.mustache",
    "chars": 22,
    "preview": "{{name}} -- {{email}}\n"
  },
  {
    "path": "3rdpart/qt-mustache-master/tests/specs/comments.json",
    "chars": 2326,
    "preview": "{\"__ATTN__\":\"Do not edit this file; changes belong in the appropriate YAML file.\",\"overview\":\"Comment tags represent con"
  },
  {
    "path": "3rdpart/qt-mustache-master/tests/specs/comments.yml",
    "chars": 2495,
    "preview": "overview: |\n  Comment tags represent content that should never appear in the resulting\n  output.\n\n  The tag's content ma"
  },
  {
    "path": "3rdpart/qt-mustache-master/tests/specs/delimiters.json",
    "chars": 3415,
    "preview": "{\"__ATTN__\":\"Do not edit this file; changes belong in the appropriate YAML file.\",\"overview\":\"Set Delimiter tags are use"
  },
  {
    "path": "3rdpart/qt-mustache-master/tests/specs/delimiters.yml",
    "chars": 3802,
    "preview": "overview: |\n  Set Delimiter tags are used to change the tag delimiters for all content\n  following the tag in the curren"
  },
  {
    "path": "3rdpart/qt-mustache-master/tests/specs/interpolation.json",
    "chars": 7731,
    "preview": "{\"__ATTN__\":\"Do not edit this file; changes belong in the appropriate YAML file.\",\"overview\":\"Interpolation tags are use"
  },
  {
    "path": "3rdpart/qt-mustache-master/tests/specs/interpolation.yml",
    "chars": 8307,
    "preview": "overview: |\n  Interpolation tags are used to integrate dynamic content into the template.\n\n  The tag's content MUST be a"
  },
  {
    "path": "3rdpart/qt-mustache-master/tests/specs/inverted.json",
    "chars": 6202,
    "preview": "{\"__ATTN__\":\"Do not edit this file; changes belong in the appropriate YAML file.\",\"overview\":\"Inverted Section tags and "
  },
  {
    "path": "3rdpart/qt-mustache-master/tests/specs/inverted.yml",
    "chars": 6539,
    "preview": "overview: |\n  Inverted Section tags and End Section tags are used in combination to wrap a\n  section of the template.\n\n "
  },
  {
    "path": "3rdpart/qt-mustache-master/tests/specs/partials.json",
    "chars": 3103,
    "preview": "{\"__ATTN__\":\"Do not edit this file; changes belong in the appropriate YAML file.\",\"overview\":\"Partial tags are used to e"
  },
  {
    "path": "3rdpart/qt-mustache-master/tests/specs/partials.yml",
    "chars": 3297,
    "preview": "overview: |\n  Partial tags are used to expand an external template into the current\n  template.\n\n  The tag's content MUS"
  },
  {
    "path": "3rdpart/qt-mustache-master/tests/specs/sections.json",
    "chars": 7572,
    "preview": "{\"__ATTN__\":\"Do not edit this file; changes belong in the appropriate YAML file.\",\"overview\":\"Section tags and End Secti"
  },
  {
    "path": "3rdpart/qt-mustache-master/tests/specs/sections.yml",
    "chars": 8160,
    "preview": "overview: |\n  Section tags and End Section tags are used in combination to wrap a section\n  of the template for iteratio"
  },
  {
    "path": "3rdpart/qt-mustache-master/tests/test_mustache.cpp",
    "chars": 15096,
    "preview": "/*\n  Copyright 2012, Robert Knight\n\n  Redistribution and use in source and binary forms, with or without modification,\n "
  },
  {
    "path": "3rdpart/qt-mustache-master/tests/test_mustache.h",
    "chars": 1170,
    "preview": "/*\n  Copyright 2012, Robert Knight\n\n  Redistribution and use in source and binary forms, with or without modification,\n "
  },
  {
    "path": "LICENSE",
    "chars": 35141,
    "preview": "                    GNU GENERAL PUBLIC LICENSE\n                       Version 3, 29 June 2007\n\n Copyright (C) 2007 Free "
  },
  {
    "path": "README.md",
    "chars": 2398,
    "preview": "# Embedded IDE\n\nMakefile based, C/C++ IDE\n\n![Main Screen](docs/screen_0.png)\n\n## Features\n  - Syntax highlighter (C/C++/"
  },
  {
    "path": "ci/BuildQSCI.mk",
    "chars": 574,
    "preview": "BASE=/tmp/qsci\nQSCI_VER=2.11.1\nSOURCE_URL=https://www.riverbankcomputing.com/static/Downloads/QScintilla/${QSCI_VER}/QSc"
  },
  {
    "path": "ci/extract-qt-installer",
    "chars": 537,
    "preview": "#!/bin/sh\nB=$(dirname $(realpath $0))\nset -x\nset -e\nMAJOR=5\nMINOR=12\nREV=9\n#VER=5124\nVER=${MAJOR}${MINOR}${REV}\nVERSION="
  },
  {
    "path": "ci/qt-installer-silent.js",
    "chars": 3362,
    "preview": "/*\n * Qt Installer script for a non-interactive installation of Qt5 on Windows.\n * Installs the 64-bit package if enviro"
  },
  {
    "path": "ci/qt5124-linux-packages",
    "chars": 2835,
    "preview": "http://download.qt.io/online/qtsdkrepository/linux_x64/desktop/qt5_5124/qt.qt5.5124.gcc_64/5.12.4-0-201906140147qtbase-L"
  },
  {
    "path": "ci/qt5129-linux-packages",
    "chars": 2835,
    "preview": "http://download.qt.io/online/qtsdkrepository/linux_x64/desktop/qt5_5129/qt.qt5.5129.gcc_64/5.12.9-0-202006121744qtbase-L"
  },
  {
    "path": "ci/tests-ci.sh",
    "chars": 5305,
    "preview": "#!/bin/bash\n\nset -x\n\n#export QTDIR=$(readlink -f /opt/qt*/)\nexport QTDIR=$(readlink -f /opt/qt*/5.12.*/gcc_64)\n\nPATH=${Q"
  },
  {
    "path": "ci/tests-environment.sh",
    "chars": 2078,
    "preview": "#!/bin/bash\n\nset -e\nset -x\n\n# sudo add-apt-repository --yes ppa:beineri/opt-qt-5.12.8-xenial\n\nsudo add-apt-repository --"
  },
  {
    "path": "docs/DIFF_TEMPLATES.md",
    "chars": 1934,
    "preview": "# Diff project documentation\n\nEmbedded-IDE base export/import project on diff/patch utils.\n\n## Export\n\nFor project expor"
  },
  {
    "path": "docs/TOOL_CMDLINE.md",
    "chars": 364,
    "preview": "# External tool command line syntax\n\n - `${{text: label}}` Replaced by text entered in textbox with ==label== text label"
  },
  {
    "path": "embedded-ide.pro",
    "chars": 57,
    "preview": "TEMPLATE = subdirs\nSUBDIRS = ide socketwaiter qtshdialog\n"
  },
  {
    "path": "ide/appconfig.cpp",
    "chars": 21095,
    "preview": "/*\n * This file is part of Embedded-IDE\n *\n * Copyright 2019 Martin Ribelotta <martinribelotta@gmail.com>\n *\n * This pro"
  },
  {
    "path": "ide/appconfig.h",
    "chars": 4488,
    "preview": "/*\n * This file is part of Embedded-IDE\n * \n * Copyright 2019 Martin Ribelotta <martinribelotta@gmail.com>\n * \n * This p"
  },
  {
    "path": "ide/binaryviewer.cpp",
    "chars": 1717,
    "preview": "/*\n * This file is part of Embedded-IDE\n * \n * Copyright 2019 Martin Ribelotta <martinribelotta@gmail.com>\n * \n * This p"
  },
  {
    "path": "ide/binaryviewer.h",
    "chars": 1955,
    "preview": "/*\n * This file is part of Embedded-IDE\n * \n * Copyright 2019 Martin Ribelotta <martinribelotta@gmail.com>\n * \n * This p"
  },
  {
    "path": "ide/buildmanager.cpp",
    "chars": 2151,
    "preview": "/*\n * This file is part of Embedded-IDE\n * \n * Copyright 2019 Martin Ribelotta <martinribelotta@gmail.com>\n * \n * This p"
  },
  {
    "path": "ide/buildmanager.h",
    "chars": 1394,
    "preview": "/*\n * This file is part of Embedded-IDE\n * \n * Copyright 2019 Martin Ribelotta <martinribelotta@gmail.com>\n * \n * This p"
  },
  {
    "path": "ide/buttoneditoritemdelegate.h",
    "chars": 1821,
    "preview": "/*\n * This file is part of Embedded-IDE\n *\n * Copyright 2019 Martin Ribelotta <martinribelotta@gmail.com>\n *\n * This pro"
  },
  {
    "path": "ide/childprocess.cpp",
    "chars": 1222,
    "preview": "/*\n * This file is part of Embedded-IDE\n * \n * Copyright 2019 Martin Ribelotta <martinribelotta@gmail.com>\n * \n * This p"
  },
  {
    "path": "ide/childprocess.h",
    "chars": 3215,
    "preview": "/*\n * This file is part of Embedded-IDE\n * \n * Copyright 2019 Martin Ribelotta <martinribelotta@gmail.com>\n * \n * This p"
  },
  {
    "path": "ide/clangautocompletionprovider.cpp",
    "chars": 12673,
    "preview": "/*\n * This file is part of Embedded-IDE\n * \n * Copyright 2019 Martin Ribelotta <martinribelotta@gmail.com>\n * \n * This p"
  },
  {
    "path": "ide/clangautocompletionprovider.h",
    "chars": 1735,
    "preview": "/*\n * This file is part of Embedded-IDE\n * \n * Copyright 2019 Martin Ribelotta <martinribelotta@gmail.com>\n * \n * This p"
  },
  {
    "path": "ide/codetexteditor.cpp",
    "chars": 8216,
    "preview": "/*\n * This file is part of Embedded-IDE\n * \n * Copyright 2019 Martin Ribelotta <martinribelotta@gmail.com>\n * \n * This p"
  },
  {
    "path": "ide/codetexteditor.h",
    "chars": 1241,
    "preview": "/*\n * This file is part of Embedded-IDE\n * \n * Copyright 2019 Martin Ribelotta <martinribelotta@gmail.com>\n * \n * This p"
  },
  {
    "path": "ide/configwidget.cpp",
    "chars": 11349,
    "preview": "/*\n * This file is part of Embedded-IDE\n * \n * Copyright 2019 Martin Ribelotta <martinribelotta@gmail.com>\n * \n * This p"
  },
  {
    "path": "ide/configwidget.h",
    "chars": 1216,
    "preview": "/*\n * This file is part of Embedded-IDE\n * \n * Copyright 2019 Martin Ribelotta <martinribelotta@gmail.com>\n * \n * This p"
  },
  {
    "path": "ide/configwidget.ui",
    "chars": 22541,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ui version=\"4.0\">\n <class>ConfigWidget</class>\n <widget class=\"QDialog\" name=\"Co"
  },
  {
    "path": "ide/consoleinterceptor.cpp",
    "chars": 4056,
    "preview": "/*\n * This file is part of Embedded-IDE\n * \n * Copyright 2019 Martin Ribelotta <martinribelotta@gmail.com>\n * \n * This p"
  },
  {
    "path": "ide/consoleinterceptor.h",
    "chars": 2383,
    "preview": "/*\n * This file is part of Embedded-IDE\n * \n * Copyright 2019 Martin Ribelotta <martinribelotta@gmail.com>\n * \n * This p"
  },
  {
    "path": "ide/cpptexteditor.cpp",
    "chars": 8214,
    "preview": "/*\n * This file is part of Embedded-IDE\n * \n * Copyright 2019 Martin Ribelotta <martinribelotta@gmail.com>\n * \n * This p"
  },
  {
    "path": "ide/cpptexteditor.h",
    "chars": 1447,
    "preview": "/*\n * This file is part of Embedded-IDE\n * \n * Copyright 2019 Martin Ribelotta <martinribelotta@gmail.com>\n * \n * This p"
  },
  {
    "path": "ide/documentmanager.cpp",
    "chars": 10422,
    "preview": "/*\n * This file is part of Embedded-IDE\n * \n * Copyright 2019 Martin Ribelotta <martinribelotta@gmail.com>\n * \n * This p"
  },
  {
    "path": "ide/documentmanager.h",
    "chars": 2599,
    "preview": "/*\n * This file is part of Embedded-IDE\n * \n * Copyright 2019 Martin Ribelotta <martinribelotta@gmail.com>\n * \n * This p"
  },
  {
    "path": "ide/envinputdialog.cpp",
    "chars": 2076,
    "preview": "#include \"envinputdialog.h\"\n#include \"ui_envinputdialog.h\"\n\n#include \"appconfig.h\"\n\n#include <QFileDialog>\n#include <QMe"
  },
  {
    "path": "ide/envinputdialog.h",
    "chars": 468,
    "preview": "#ifndef ENVINPUTDIALOG_H\n#define ENVINPUTDIALOG_H\n\n#include <QDialog>\n\nnamespace Ui {\nclass EnvInputDialog;\n}\n\nclass Env"
  },
  {
    "path": "ide/envinputdialog.ui",
    "chars": 2319,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ui version=\"4.0\">\n <class>EnvInputDialog</class>\n <widget class=\"QDialog\" name=\""
  },
  {
    "path": "ide/externaltoolmanager.cpp",
    "chars": 5708,
    "preview": "/*\n * This file is part of Embedded-IDE\n * \n * Copyright 2019 Martin Ribelotta <martinribelotta@gmail.com>\n * \n * This p"
  },
  {
    "path": "ide/externaltoolmanager.h",
    "chars": 1355,
    "preview": "/*\n * This file is part of Embedded-IDE\n * \n * Copyright 2019 Martin Ribelotta <martinribelotta@gmail.com>\n * \n * This p"
  },
  {
    "path": "ide/externaltoolmanager.ui",
    "chars": 4284,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ui version=\"4.0\">\n <class>ExternalToolManager</class>\n <widget class=\"QDialog\" n"
  },
  {
    "path": "ide/filereferencesdialog.cpp",
    "chars": 1901,
    "preview": "/*\n * This file is part of Embedded-IDE\n * \n * Copyright 2019 Martin Ribelotta <martinribelotta@gmail.com>\n * \n * This p"
  },
  {
    "path": "ide/filereferencesdialog.h",
    "chars": 1315,
    "preview": "/*\n * This file is part of Embedded-IDE\n * \n * Copyright 2019 Martin Ribelotta <martinribelotta@gmail.com>\n * \n * This p"
  },
  {
    "path": "ide/filereferencesdialog.ui",
    "chars": 1023,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ui version=\"4.0\">\n <class>FileReferencesDialog</class>\n <widget class=\"QDialog\" "
  },
  {
    "path": "ide/filesystemmanager.cpp",
    "chars": 10981,
    "preview": "/*\n * This file is part of Embedded-IDE\n * \n * Copyright 2019 Martin Ribelotta <martinribelotta@gmail.com>\n * \n * This p"
  },
  {
    "path": "ide/filesystemmanager.h",
    "chars": 1678,
    "preview": "/*\n * This file is part of Embedded-IDE\n * \n * Copyright 2019 Martin Ribelotta <martinribelotta@gmail.com>\n * \n * This p"
  },
  {
    "path": "ide/findandopenfiledialog.cpp",
    "chars": 1539,
    "preview": "#include \"findandopenfiledialog.h\"\n#include \"ui_findandopenfiledialog.h\"\n\n#include <QDirIterator>\n#include <QStandardIte"
  },
  {
    "path": "ide/findandopenfiledialog.h",
    "chars": 565,
    "preview": "#ifndef FINDANDOPENFILEDIALOG_H\n#define FINDANDOPENFILEDIALOG_H\n\n#include <QDialog>\n\nnamespace Ui {\nclass FindAndOpenFil"
  },
  {
    "path": "ide/findandopenfiledialog.ui",
    "chars": 1748,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ui version=\"4.0\">\n <class>FindAndOpenFileDialog</class>\n <widget class=\"QDialog\""
  },
  {
    "path": "ide/findinfilesdialog.cpp",
    "chars": 8541,
    "preview": "/*\n * This file is part of Embedded-IDE\n *\n * Copyright 2019 Martin Ribelotta <martinribelotta@gmail.com>\n *\n * This pro"
  },
  {
    "path": "ide/findinfilesdialog.h",
    "chars": 1512,
    "preview": "/*\n * This file is part of Embedded-IDE\n * \n * Copyright 2019 Martin Ribelotta <martinribelotta@gmail.com>\n * \n * This p"
  },
  {
    "path": "ide/findinfilesdialog.ui",
    "chars": 5966,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ui version=\"4.0\">\n <class>FindInFilesDialog</class>\n <widget class=\"QDialog\" nam"
  },
  {
    "path": "ide/findlineedit.cpp",
    "chars": 3672,
    "preview": "/*\n * This file is part of Embedded-IDE\n * \n * Copyright 2019 Martin Ribelotta <martinribelotta@gmail.com>\n * \n * This p"
  },
  {
    "path": "ide/findlineedit.h",
    "chars": 1408,
    "preview": "/*\n * This file is part of Embedded-IDE\n * \n * Copyright 2019 Martin Ribelotta <martinribelotta@gmail.com>\n * \n * This p"
  },
  {
    "path": "ide/findmakefiledialog.cpp",
    "chars": 2699,
    "preview": "#include \"findmakefiledialog.h\"\n#include \"ui_findmakefiledialog.h\"\n\n#include <QDirIterator>\n#include <QStandardItemModel"
  },
  {
    "path": "ide/findmakefiledialog.h",
    "chars": 455,
    "preview": "#ifndef FINDMAKEFILEDIALOG_H\n#define FINDMAKEFILEDIALOG_H\n\n#include <QDialog>\n\nnamespace Ui {\nclass FindMakefileDialog;\n"
  },
  {
    "path": "ide/findmakefiledialog.ui",
    "chars": 1563,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ui version=\"4.0\">\n <class>FindMakefileDialog</class>\n <widget class=\"QDialog\" na"
  },
  {
    "path": "ide/formfindreplace.cpp",
    "chars": 5199,
    "preview": "/*\n * This file is part of Embedded-IDE\n * \n * Copyright 2019 Martin Ribelotta <martinribelotta@gmail.com>\n * \n * This p"
  },
  {
    "path": "ide/formfindreplace.h",
    "chars": 1594,
    "preview": "/*\n * This file is part of Embedded-IDE\n * \n * Copyright 2019 Martin Ribelotta <martinribelotta@gmail.com>\n * \n * This p"
  },
  {
    "path": "ide/formfindreplace.ui",
    "chars": 3103,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ui version=\"4.0\">\n <class>FormFindReplace</class>\n <widget class=\"QWidget\" name="
  },
  {
    "path": "ide/icodemodelprovider.cpp",
    "chars": 2073,
    "preview": "/*\n * This file is part of Embedded-IDE\n * \n * Copyright 2019 Martin Ribelotta <martinribelotta@gmail.com>\n * \n * This p"
  },
  {
    "path": "ide/icodemodelprovider.h",
    "chars": 3106,
    "preview": "/*\n * This file is part of Embedded-IDE\n * \n * Copyright 2019 Martin Ribelotta <martinribelotta@gmail.com>\n * \n * This p"
  },
  {
    "path": "ide/ide.pro",
    "chars": 5129,
    "preview": "DESTDIR  = ../build\n\nQT += core gui widgets svg xml network concurrent uitools\n\nCONFIG += qscintilla2\nCONFIG += c++14\nCO"
  },
  {
    "path": "ide/idocumenteditor.cpp",
    "chars": 2072,
    "preview": "/*\n * This file is part of Embedded-IDE\n * \n * Copyright 2019 Martin Ribelotta <martinribelotta@gmail.com>\n * \n * This p"
  },
  {
    "path": "ide/idocumenteditor.h",
    "chars": 3702,
    "preview": "/*\n * This file is part of Embedded-IDE\n * \n * Copyright 2019 Martin Ribelotta <martinribelotta@gmail.com>\n * \n * This p"
  },
  {
    "path": "ide/imageviewer.cpp",
    "chars": 5336,
    "preview": "/*\n * This file is part of Embedded-IDE\n * \n * Copyright 2019 Martin Ribelotta <martinribelotta@gmail.com>\n * \n * This p"
  },
  {
    "path": "ide/imageviewer.h",
    "chars": 1984,
    "preview": "/*\n * This file is part of Embedded-IDE\n * \n * Copyright 2019 Martin Ribelotta <martinribelotta@gmail.com>\n * \n * This p"
  },
  {
    "path": "ide/main.cpp",
    "chars": 4527,
    "preview": "/*\n * This file is part of Embedded-IDE\n * \n * Copyright 2019 Martin Ribelotta <martinribelotta@gmail.com>\n * \n * This p"
  },
  {
    "path": "ide/mainwindow.cpp",
    "chars": 27515,
    "preview": "/*\n * This file is part of Embedded-IDE\n * \n * Copyright 2019 Martin Ribelotta <martinribelotta@gmail.com>\n * \n * This p"
  },
  {
    "path": "ide/mainwindow.h",
    "chars": 1276,
    "preview": "/*\n * This file is part of Embedded-IDE\n * \n * Copyright 2019 Martin Ribelotta <martinribelotta@gmail.com>\n * \n * This p"
  },
  {
    "path": "ide/mainwindow.ui",
    "chars": 43964,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ui version=\"4.0\">\n <class>MainWindow</class>\n <widget class=\"QWidget\" name=\"Main"
  },
  {
    "path": "ide/mapfileviewer.cpp",
    "chars": 2247,
    "preview": "/*\n * This file is part of Embedded-IDE\n * \n * Copyright 2019 Martin Ribelotta <martinribelotta@gmail.com>\n * \n * This p"
  },
  {
    "path": "ide/mapfileviewer.h",
    "chars": 1735,
    "preview": "/*\n * This file is part of Embedded-IDE\n * \n * Copyright 2019 Martin Ribelotta <martinribelotta@gmail.com>\n * \n * This p"
  },
  {
    "path": "ide/markdowneditor.cpp",
    "chars": 4741,
    "preview": "/*\n * This file is part of Embedded-IDE\n *\n * Copyright 2019 Martin Ribelotta <martinribelotta@gmail.com>\n *\n * This pro"
  },
  {
    "path": "ide/markdowneditor.h",
    "chars": 2256,
    "preview": "/*\n * This file is part of Embedded-IDE\n *\n * Copyright 2019 Martin Ribelotta <martinribelotta@gmail.com>\n *\n * This pro"
  },
  {
    "path": "ide/markdownview.cpp",
    "chars": 2617,
    "preview": "/*\n * This file is part of Embedded-IDE\n *\n * Copyright 2019 Martin Ribelotta <martinribelotta@gmail.com>\n *\n * This pro"
  },
  {
    "path": "ide/markdownview.h",
    "chars": 1112,
    "preview": "/*\n * This file is part of Embedded-IDE\n *\n * Copyright 2019 Martin Ribelotta <martinribelotta@gmail.com>\n *\n * This pro"
  },
  {
    "path": "ide/newprojectdialog.cpp",
    "chars": 9643,
    "preview": "/*\n * This file is part of Embedded-IDE\n * \n * Copyright 2019 Martin Ribelotta <martinribelotta@gmail.com>\n * \n * This p"
  },
  {
    "path": "ide/newprojectdialog.h",
    "chars": 1311,
    "preview": "/*\n * This file is part of Embedded-IDE\n * \n * Copyright 2019 Martin Ribelotta <martinribelotta@gmail.com>\n * \n * This p"
  },
  {
    "path": "ide/newprojectdialog.ui",
    "chars": 5231,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ui version=\"4.0\">\n <class>NewProjectDialog</class>\n <widget class=\"QDialog\" name"
  },
  {
    "path": "ide/newprojectfromremotedialog.cpp",
    "chars": 11866,
    "preview": "#include \"newprojectfromremotedialog.h\"\n#include \"ui_newprojectfromremotedialog.h\"\n\n#include \"appconfig.h\"\n#include \"chi"
  },
  {
    "path": "ide/newprojectfromremotedialog.h",
    "chars": 883,
    "preview": "#ifndef NEWPROJECTFROMREMOTEDIALOG_H\n#define NEWPROJECTFROMREMOTEDIALOG_H\n\n#include <QDialog>\n\n#include <memory>\n\nnamesp"
  },
  {
    "path": "ide/newprojectfromremotedialog.ui",
    "chars": 3301,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ui version=\"4.0\">\n <class>NewProjectFromRemoteDialog</class>\n <widget class=\"QDi"
  },
  {
    "path": "ide/plaintexteditor.cpp",
    "chars": 23073,
    "preview": "/*\n * This file is part of Embedded-IDE\n * \n * Copyright 2019 Martin Ribelotta <martinribelotta@gmail.com>\n * \n * This p"
  },
  {
    "path": "ide/plaintexteditor.h",
    "chars": 2236,
    "preview": "/*\n * This file is part of Embedded-IDE\n * \n * Copyright 2019 Martin Ribelotta <martinribelotta@gmail.com>\n * \n * This p"
  },
  {
    "path": "ide/processlinebufferizer.cpp",
    "chars": 1121,
    "preview": "#include \"processlinebufferizer.h\"\n\n#include <QProcess>\n\nProcessLineBufferizer::ProcessLineBufferizer(Channel ch, QProce"
  },
  {
    "path": "ide/processlinebufferizer.h",
    "chars": 574,
    "preview": "#ifndef PROCESSLINEBUFFERIZER_H\n#define PROCESSLINEBUFFERIZER_H\n\n#include <QObject>\n\nclass QProcess;\n\nclass ProcessLineB"
  },
  {
    "path": "ide/processmanager.cpp",
    "chars": 3762,
    "preview": "/*\n * This file is part of Embedded-IDE\n * \n * Copyright 2019 Martin Ribelotta <martinribelotta@gmail.com>\n * \n * This p"
  },
  {
    "path": "ide/processmanager.h",
    "chars": 2247,
    "preview": "/*\n * This file is part of Embedded-IDE\n * \n * Copyright 2019 Martin Ribelotta <martinribelotta@gmail.com>\n * \n * This p"
  },
  {
    "path": "ide/projectmanager.cpp",
    "chars": 13570,
    "preview": "/*\n * This file is part of Embedded-IDE\n * \n * Copyright 2019 Martin Ribelotta <martinribelotta@gmail.com>\n * \n * This p"
  },
  {
    "path": "ide/projectmanager.h",
    "chars": 2654,
    "preview": "/*\n * This file is part of Embedded-IDE\n * \n * Copyright 2019 Martin Ribelotta <martinribelotta@gmail.com>\n * \n * This p"
  },
  {
    "path": "ide/regexhtmltranslator.cpp",
    "chars": 1481,
    "preview": "/*\n * This file is part of Embedded-IDE\n * \n * Copyright 2019 Martin Ribelotta <martinribelotta@gmail.com>\n * \n * This p"
  },
  {
    "path": "ide/regexhtmltranslator.h",
    "chars": 1400,
    "preview": "/*\n * This file is part of Embedded-IDE\n * \n * Copyright 2019 Martin Ribelotta <martinribelotta@gmail.com>\n * \n * This p"
  },
  {
    "path": "ide/resources/default-global.json",
    "chars": 59,
    "preview": "{\n    \"workspacePath\": \"${HOME}/.embedded_ide-workspace\"\n}\n"
  },
  {
    "path": "ide/resources/default-local.json",
    "chars": 1130,
    "preview": "{\n        \"additionalPaths\": [\n            \"${APPLICATION_DIR_PATH}\"\n        ],\n        \"editor\": {\n            \"font\": "
  },
  {
    "path": "ide/resources/fonts.qrc",
    "chars": 468,
    "preview": "<RCC>\n    <qresource prefix=\"/\">\n        <file>fonts/FiraCode-Bold.ttf</file>\n        <file>fonts/FiraCode-Light.ttf</fi"
  },
  {
    "path": "ide/resources/iconactions.qrc",
    "chars": 9516,
    "preview": "<RCC>\n    <qresource prefix=\"/\">\n        <file>images/light/actions/application-exit.svg</file>\n        <file>images/lig"
  },
  {
    "path": "ide/resources/images/dark/index.theme",
    "chars": 138,
    "preview": "[Icon Theme]\nName=Dark\nComment=Icon theme dark\nDirectories=actions\n\n[actions]\nSize=22\nType=Scalable\nMinSize=1\nMaxSize=25"
  },
  {
    "path": "ide/resources/images/light/index.theme",
    "chars": 138,
    "preview": "[Icon Theme]\nName=Dark\nComment=Icon theme dark\nDirectories=actions\n\n[actions]\nSize=22\nType=Scalable\nMinSize=1\nMaxSize=25"
  },
  {
    "path": "ide/resources/kinds.qrc",
    "chars": 725,
    "preview": "<RCC>\n    <qresource prefix=\"/\">\n        <file>images/light/categories/class.svg</file>\n        <file>images/light/categ"
  },
  {
    "path": "ide/resources/mimetypes.qrc",
    "chars": 3987,
    "preview": "<RCC>\n    <qresource prefix=\"/\">\n        <file>images/light/mimetypes/application-x-executable-script.svg</file>\n       "
  },
  {
    "path": "ide/resources/reference-code.c",
    "chars": 656,
    "preview": "#include <stdio.h>\n#include \"sys/sct.h\"\n\ntypedef int (*callback_t)(void *ptr, float h);\n\nenum type_t {\n    type1, type2,"
  },
  {
    "path": "ide/resources/resources.qrc",
    "chars": 1052,
    "preview": "<RCC>\n    <qresource prefix=\"/\">\n    <file>images/light/screens/EmbeddedIDE_02.png</file>\n    <file>images/light/screens"
  },
  {
    "path": "ide/resources/styles/Bespin.xml",
    "chars": 91993,
    "preview": "<?xml version=\"1.0\" encoding=\"Windows-1252\" ?>\r\n<!--//\r\n\r\nBespin\r\nCopyright (c) 2009 Oren Farhi, Orizen Designs - http:/"
  },
  {
    "path": "ide/resources/styles/Black board.xml",
    "chars": 90359,
    "preview": "<?xml version=\"1.0\" encoding=\"Windows-1252\" ?>\r\n<!--//\r\n\r\nBlackboard\r\nCopyright (c) 2008 Fabio Zendhi Nagao <http://zend"
  },
  {
    "path": "ide/resources/styles/Choco.xml",
    "chars": 90654,
    "preview": "<?xml version=\"1.0\" encoding=\"Windows-1252\" ?>\r\n<!--//\r\n\r\nchoco\r\nCopyright (c) 2008 Fabio Zendhi Nagao <http://zend.lojc"
  },
  {
    "path": "ide/resources/styles/Deep Black.xml",
    "chars": 88403,
    "preview": "<?xml version=\"1.0\" encoding=\"Windows-1252\" ?>\r\n<!--\r\nStyle Name:         Deep Black\r\nDescription:        Based on the t"
  },
  {
    "path": "ide/resources/styles/Default.xml",
    "chars": 115128,
    "preview": "<?xml version=\"1.0\" encoding=\"Windows-1252\" ?>\r\n<NotepadPlus>\r\n    <LexerStyles>\r\n        <LexerType name=\"actionscript\""
  },
  {
    "path": "ide/resources/styles/Hello Kitty.xml",
    "chars": 88705,
    "preview": "<?xml version=\"1.0\" encoding=\"Windows-1252\" ?>\r\n<!--\r\nTheme name : Hello Kitty\r\nThis theme is not complete. If you enhan"
  },
  {
    "path": "ide/resources/styles/HotFudgeSundae.xml",
    "chars": 109386,
    "preview": "<?xml version=\"1.0\" encoding=\"Windows-1252\" ?>\r\n<!--//\r\nFile Name:           HotFudgeSundae.xml\r\nStyle Name:          Ho"
  },
  {
    "path": "ide/resources/styles/Material-Dark.xml",
    "chars": 91745,
    "preview": "<?xml version=\"1.0\" encoding=\"Windows-1252\" ?>\r\n<!--//\r\n\r\nMaterial Theme Dark\r\nCopyright (c) 2016 Ali Naderi\r\n\r\nPermissi"
  },
  {
    "path": "ide/resources/styles/Mono Industrial.xml",
    "chars": 90134,
    "preview": "<?xml version=\"1.0\" encoding=\"Windows-1252\" ?>\r\n<!--//\r\n\r\nmonoindustrial\r\nCopyright (c) 2008 Fabio Zendhi Nagao <http://"
  },
  {
    "path": "ide/resources/styles/Monokai.xml",
    "chars": 88865,
    "preview": "<?xml version=\"1.0\" encoding=\"Windows-1252\" ?>\r\n<!--//\r\n\r\nMonokai\r\nCopyright (c) 2008 Fabio Zendhi Nagao <http://zend.lo"
  },
  {
    "path": "ide/resources/styles/MossyLawn.xml",
    "chars": 107274,
    "preview": "<?xml version=\"1.0\" encoding=\"Windows-1252\" ?>\r\n<!--//\r\nFile Name:           MossyLawn.xml\r\nStyle Name:          MossyLa"
  },
  {
    "path": "ide/resources/styles/Navajo.xml",
    "chars": 107083,
    "preview": "<?xml version=\"1.0\" encoding=\"Windows-1252\" ?>\r\n<!--//\r\nFile Name:           Navajo.xml\r\nStyle Name:          Navajo\r\nDe"
  },
  {
    "path": "ide/resources/styles/Obsidian.xml",
    "chars": 92518,
    "preview": "<?xml version=\"1.0\" encoding=\"Windows-1252\" ?>\r\n<!--\r\nNotepad++ Custom Style\r\n\r\n  Style name:    Obsidian v2\r\n      Auth"
  },
  {
    "path": "ide/resources/styles/Plastic Code Wrap.xml",
    "chars": 91628,
    "preview": "<?xml version=\"1.0\" encoding=\"Windows-1252\" ?>\r\n<!--//\r\n\r\nPlasticCodeWrap\r\nCopyright (c) 2008 Fabio Zendhi Nagao <http:/"
  },
  {
    "path": "ide/resources/styles/Ruby Blue.xml",
    "chars": 71370,
    "preview": "<?xml version=\"1.0\" encoding=\"Windows-1252\" ?>\r\n<!-- \r\nNotepad++ Custom stylers\r\nStyle name: \t\tPort Ruby Blue\r\nFile name"
  },
  {
    "path": "ide/resources/styles/Solarized-light.xml",
    "chars": 107719,
    "preview": "<?xml version=\"1.0\" encoding=\"Windows-1252\" ?>\r\n<!--//\r\nFile Name:           Solarized-light.xml\r\nStyle Name:          S"
  },
  {
    "path": "ide/resources/styles/Solarized.xml",
    "chars": 107707,
    "preview": "<?xml version=\"1.0\" encoding=\"Windows-1252\" ?>\r\n<!--//\r\nFile Name:           Solarized.xml\r\nStyle Name:          Solariz"
  },
  {
    "path": "ide/resources/styles/Twilight.xml",
    "chars": 89933,
    "preview": "<?xml version=\"1.0\" encoding=\"Windows-1252\" ?>\r\n<!--//\r\n\r\nTwilight\r\nCopyright (c) 2008 Fabio Zendhi Nagao <http://zend.l"
  },
  {
    "path": "ide/resources/styles/Vibrant Ink.xml",
    "chars": 87923,
    "preview": "<?xml version=\"1.0\" encoding=\"Windows-1252\" ?>\r\n<!-- \r\nStyle Name: Port VibrantInk\r\nDescription: Based on the Textmate t"
  },
  {
    "path": "ide/resources/styles/Zenburn.xml",
    "chars": 102466,
    "preview": "<?xml version=\"1.0\" encoding=\"Windows-1252\" ?>\r\n<!--\r\nFile name:           Zenburn.xml\r\nStyle Name:          Zenburn\r\nDe"
  },
  {
    "path": "ide/resources/styles/khaki.xml",
    "chars": 107169,
    "preview": "<?xml version=\"1.0\" encoding=\"Windows-1252\" ?>\r\n<!--//\r\nFile Name:           khaki.xml\r\nStyle Name:          khaki\r\nDesc"
  },
  {
    "path": "ide/resources/styles/tomorrow.xml",
    "chars": 83825,
    "preview": "<?xml version=\"1.0\" encoding=\"Windows-1252\" ?>\n<NotepadPlus>\n    <LexerStyles>\n        <LexerType name=\"c\" desc=\"C\" ext="
  },
  {
    "path": "ide/resources/styles/vim Dark Blue.xml",
    "chars": 88118,
    "preview": "<?xml version=\"1.0\" encoding=\"Windows-1252\" ?>\r\n<NotepadPlus>\r\n    <LexerStyles>\r\n        <LexerType name=\"actionscript\""
  },
  {
    "path": "ide/resources/styles.qrc",
    "chars": 1040,
    "preview": "<RCC>\n    <qresource prefix=\"/\">\n        <file>styles/Bespin.xml</file>\n        <file>styles/Black board.xml</file>\n    "
  },
  {
    "path": "ide/resources/templates/empty.template",
    "chars": 472,
    "preview": "<html><body>\n<center><h1>Empty start project</h1></center>\n<h3><font color=blue>by Martin Ribelotta</font></h3>\n<tt>Star"
  },
  {
    "path": "ide/skeleton/bin/ftdi_rules.sh",
    "chars": 6878,
    "preview": "#!/bin/bash\nset -x\n\nerror()\n{\n  echo \"${1}\"\n  exit 1\n}\n\nmsg()\n{\n\techo \"${1}\"\n}\n\nif [ \"$(id -u)\" -ne \"0\" ]; then\n    echo"
  },
  {
    "path": "ide/skeleton/bin/qt.conf",
    "chars": 49,
    "preview": "[Paths]\nPrefix=../\nLibraries=lib\nPlugins=plugins\n"
  },
  {
    "path": "ide/skeleton/desktop-integration.sh",
    "chars": 6293,
    "preview": "#!/bin/sh\nset -e\n\nDEBUG=\n# Be verbose if $DEBUG=1 is set\nif [ ! -z \"$DEBUG\" ] ; then\n  env\n  set -x\nfi\n\nTHIS=\"$0\"\nargs=$"
  },
  {
    "path": "ide/skeleton/embedded-ide.desktop",
    "chars": 283,
    "preview": "[Desktop Entry]\nType=Application\nName=Embedded IDE\nName[es]=Embedded IDE\nComment=Makefile based IDE for embedded systems"
  },
  {
    "path": "ide/skeleton/embedded-ide.hardconf",
    "chars": 1415,
    "preview": "{\n        \"additionalPaths\": [\n            \"${APPLICATION_DIR_PATH}\"\n        ],\n        \"editor\": {\n            \"font\": "
  },
  {
    "path": "ide/skeleton/embedded-ide.sh",
    "chars": 249,
    "preview": "#!/bin/sh\nAPP_DIR=`dirname $0`\nAPP_DIR=`cd \"${APP_DIR}\";pwd`\nexport PATH=${APP_DIR}/bin:${PATH}\nexport LD_LIBRARY_PATH=\""
  }
]

// ... and 550 more files (download for full content)

About this extraction

This page contains the full source code of the martinribelotta/embedded-ide GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 750 files (15.9 MB), approximately 4.2M tokens. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!