---input--- /*************************************************************************** ansigenerator.cpp - description ------------------- begin : Jul 5 2004 copyright : (C) 2004 by AndrĂ© Simon email : andre.simon1@gmx.de ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #include "ansigenerator.h" using namespace std; namespace highlight { string AnsiGenerator::getOpenTag(const string&font, const string&fgCol, const string&bgCol) { ostringstream s; s << "\033["< #include #include #include #include "codegenerator.h" #include "charcodes.h" #include "version.h" namespace highlight { /** \brief This class generates ANSI escape sequences. It contains information about the resulting document structure (document header and footer), the colour system, white space handling and text formatting attributes. * @author Andre Simon */ class AnsiGenerator : public highlight::CodeGenerator { public: /** Constructor \param colourTheme Name of Colour theme to use */ AnsiGenerator( const string &colourTheme); AnsiGenerator(); ~AnsiGenerator(); /** prints document header \param title Title of the document */ string getHeader(const string & title); /** Prints document footer*/ string getFooter(); /** Prints document body*/ void printBody(); private: /** \return escaped character*/ virtual string maskCharacter(unsigned char ); /** gibt ANSI-"Tags" zurueck (Farbindex+bold+kursiv)*/ string getOpenTag(const string&font, const string&fgCol, const string&bgCol=""); string getMatchingOpenTag(unsigned int styleID); string getMatchingCloseTag(unsigned int styleID); }; } #endif /* * Copyright (c) 1998,1999,2000,2001,2002 Tal Davidson. All rights reserved. * * ASBeautifier.cpp * by Tal Davidson (davidsont@bigfoot.com) * This file is a part of "Artistic Style" - an indentater and reformatter * of C, C, C# and Java source files. * * The "Artistic Style" project, including all files needed to compile it, * is free software; you can redistribute it and/or use it and/or modify it * under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2 of the License, * or (at your option) any later version. * * This program 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. * * You should have received a copy of the GNU General Public * License along with this program. * * Patches: * 18 March 1999 - Brian Rampel - * Fixed inverse insertion of spaces vs. tabs when in -t mode. * 08 may 2004 * applied ASBeautifier.cpp.BITFIELD.patch.bz2 */ #include "compiler_defines.h" #include "ASBeautifier.h" #include #include #include #include #include #define INIT_CONTAINER(container, value) {if ( (container) != NULL ) delete (container); (container) = (value); } #define DELETE_CONTAINER(container) {if ( (container) != NULL ) delete (container) ; } #ifdef USES_NAMESPACE using namespace std; #endif #ifdef USES_NAMESPACE namespace astyle { #endif bool ASBeautifier::calledInitStatic = false; vector ASBeautifier::headers; vector ASBeautifier::nonParenHeaders; vector ASBeautifier::preBlockStatements; vector ASBeautifier::assignmentOperators; vector ASBeautifier::nonAssignmentOperators; /* * initialize the static vars */ void ASBeautifier::initStatic() { if (calledInitStatic) return; calledInitStatic = true; headers.push_back(&AS_IF); headers.push_back(&AS_ELSE); headers.push_back(&AS_FOR); headers.push_back(&AS_WHILE); headers.push_back(&AS_DO); headers.push_back(&AS_TRY); headers.push_back(&AS_CATCH); headers.push_back(&AS_FINALLY); headers.push_back(&AS_SYNCHRONIZED); headers.push_back(&AS_SWITCH); headers.push_back(&AS_CASE); headers.push_back(&AS_DEFAULT); headers.push_back(&AS_FOREACH); headers.push_back(&AS_LOCK); headers.push_back(&AS_UNSAFE); headers.push_back(&AS_FIXED); headers.push_back(&AS_GET); headers.push_back(&AS_SET); headers.push_back(&AS_ADD); headers.push_back(&AS_REMOVE); //headers.push_back(&AS_PUBLIC); //headers.push_back(&AS_PRIVATE); //headers.push_back(&AS_PROTECTED); //headers.push_back(&AS_OPERATOR); headers.push_back(&AS_TEMPLATE); headers.push_back(&AS_CONST); /**/ headers.push_back(&AS_STATIC); headers.push_back(&AS_EXTERN); nonParenHeaders.push_back(&AS_ELSE); nonParenHeaders.push_back(&AS_DO); nonParenHeaders.push_back(&AS_TRY); nonParenHeaders.push_back(&AS_FINALLY); nonParenHeaders.push_back(&AS_STATIC); nonParenHeaders.push_back(&AS_CONST); nonParenHeaders.push_back(&AS_EXTERN); nonParenHeaders.push_back(&AS_CASE); nonParenHeaders.push_back(&AS_DEFAULT); nonParenHeaders.push_back(&AS_UNSAFE); nonParenHeaders.push_back(&AS_GET); nonParenHeaders.push_back(&AS_SET); nonParenHeaders.push_back(&AS_ADD); nonParenHeaders.push_back(&AS_REMOVE); nonParenHeaders.push_back(&AS_PUBLIC); nonParenHeaders.push_back(&AS_PRIVATE); nonParenHeaders.push_back(&AS_PROTECTED); nonParenHeaders.push_back(&AS_TEMPLATE); nonParenHeaders.push_back(&AS_CONST); /// nonParenHeaders.push_back(&AS_ASM); preBlockStatements.push_back(&AS_CLASS); preBlockStatements.push_back(&AS_STRUCT); preBlockStatements.push_back(&AS_UNION); preBlockStatements.push_back(&AS_INTERFACE); preBlockStatements.push_back(&AS_NAMESPACE); preBlockStatements.push_back(&AS_THROWS); preBlockStatements.push_back(&AS_EXTERN); assignmentOperators.push_back(&AS_ASSIGN); assignmentOperators.push_back(&AS_PLUS_ASSIGN); assignmentOperators.push_back(&AS_MINUS_ASSIGN); assignmentOperators.push_back(&AS_MULT_ASSIGN); assignmentOperators.push_back(&AS_DIV_ASSIGN); assignmentOperators.push_back(&AS_MOD_ASSIGN); assignmentOperators.push_back(&AS_OR_ASSIGN); assignmentOperators.push_back(&AS_AND_ASSIGN); assignmentOperators.push_back(&AS_XOR_ASSIGN); assignmentOperators.push_back(&AS_GR_GR_GR_ASSIGN); assignmentOperators.push_back(&AS_GR_GR_ASSIGN); assignmentOperators.push_back(&AS_LS_LS_LS_ASSIGN); assignmentOperators.push_back(&AS_LS_LS_ASSIGN); assignmentOperators.push_back(&AS_RETURN); nonAssignmentOperators.push_back(&AS_EQUAL); nonAssignmentOperators.push_back(&AS_PLUS_PLUS); nonAssignmentOperators.push_back(&AS_MINUS_MINUS); nonAssignmentOperators.push_back(&AS_NOT_EQUAL); nonAssignmentOperators.push_back(&AS_GR_EQUAL); nonAssignmentOperators.push_back(&AS_GR_GR_GR); nonAssignmentOperators.push_back(&AS_GR_GR); nonAssignmentOperators.push_back(&AS_LS_EQUAL); nonAssignmentOperators.push_back(&AS_LS_LS_LS); nonAssignmentOperators.push_back(&AS_LS_LS); nonAssignmentOperators.push_back(&AS_ARROW); nonAssignmentOperators.push_back(&AS_AND); nonAssignmentOperators.push_back(&AS_OR); } /** * ASBeautifier's constructor */ ASBeautifier::ASBeautifier() { initStatic(); 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; sourceIterator = NULL; isMinimalConditinalIndentSet = false; shouldForceTabIndentation = false; setSpaceIndentation(4); setMaxInStatementIndentLength(40); setClassIndent(false); setSwitchIndent(false); setCaseIndent(false); setBlockIndent(false); setBracketIndent(false); setNamespaceIndent(false); setLabelIndent(false); setEmptyLineFill(false); setCStyle(); setPreprocessorIndent(false); } ASBeautifier::ASBeautifier(const ASBeautifier &other) { waitingBeautifierStack = NULL; activeBeautifierStack = NULL; waitingBeautifierStackLengthStack = NULL; activeBeautifierStackLengthStack = NULL; headerStack = new vector; *headerStack = *other.headerStack; tempStacks = new vector< vector* >; vector< vector* >::iterator iter; for (iter = other.tempStacks->begin(); iter != other.tempStacks->end(); ++iter) { vector *newVec = new vector; *newVec = **iter; tempStacks->push_back(newVec); } blockParenDepthStack = new vector; *blockParenDepthStack = *other.blockParenDepthStack; blockStatementStack = new vector; *blockStatementStack = *other.blockStatementStack; parenStatementStack = new vector; *parenStatementStack = *other.parenStatementStack; bracketBlockStateStack = new vector; *bracketBlockStateStack = *other.bracketBlockStateStack; inStatementIndentStack = new vector; *inStatementIndentStack = *other.inStatementIndentStack; inStatementIndentStackSizeStack = new vector; *inStatementIndentStackSizeStack = *other.inStatementIndentStackSizeStack; parenIndentStack = new vector; *parenIndentStack = *other.parenIndentStack; sourceIterator = other.sourceIterator; indentString = other.indentString; currentHeader = other.currentHeader; previousLastLineHeader = other.previousLastLineHeader; immediatelyPreviousAssignmentOp = other.immediatelyPreviousAssignmentOp; isInQuote = other.isInQuote; isInComment = other.isInComment; isInCase = other.isInCase; isInQuestion = other.isInQuestion; isInStatement =other. isInStatement; isInHeader = other.isInHeader; isCStyle = other.isCStyle; isInOperator = other.isInOperator; isInTemplate = other.isInTemplate; isInConst = other.isInConst; classIndent = other.classIndent; isInClassHeader = other.isInClassHeader; isInClassHeaderTab = other.isInClassHeaderTab; switchIndent = other.switchIndent; caseIndent = other.caseIndent; namespaceIndent = other.namespaceIndent; bracketIndent = other.bracketIndent; blockIndent = other.blockIndent; labelIndent = other.labelIndent; preprocessorIndent = other.preprocessorIndent; parenDepth = other.parenDepth; indentLength = other.indentLength; blockTabCount = other.blockTabCount; leadingWhiteSpaces = other.leadingWhiteSpaces; maxInStatementIndent = other.maxInStatementIndent; templateDepth = other.templateDepth; quoteChar = other.quoteChar; prevNonSpaceCh = other.prevNonSpaceCh; currentNonSpaceCh = other.currentNonSpaceCh; currentNonLegalCh = other.currentNonLegalCh; prevNonLegalCh = other.prevNonLegalCh; isInConditional = other.isInConditional; minConditionalIndent = other.minConditionalIndent; prevFinalLineSpaceTabCount = other.prevFinalLineSpaceTabCount; prevFinalLineTabCount = other.prevFinalLineTabCount; emptyLineFill = other.emptyLineFill; probationHeader = other.probationHeader; isInDefine = other.isInDefine; isInDefineDefinition = other.isInDefineDefinition; backslashEndsPrevLine = other.backslashEndsPrevLine; defineTabCount = other.defineTabCount; } /** * ASBeautifier's destructor */ ASBeautifier::~ASBeautifier() { DELETE_CONTAINER( headerStack ); DELETE_CONTAINER( tempStacks ); DELETE_CONTAINER( blockParenDepthStack ); DELETE_CONTAINER( blockStatementStack ); DELETE_CONTAINER( parenStatementStack ); DELETE_CONTAINER( bracketBlockStateStack ); DELETE_CONTAINER( inStatementIndentStack ); DELETE_CONTAINER( inStatementIndentStackSizeStack ); DELETE_CONTAINER( parenIndentStack ); // DELETE_CONTAINER( sourceIterator ); } /** * initialize the ASBeautifier. * * init() should be called every time a ABeautifier object is to start * beautifying a NEW source file. * init() recieves a pointer to a DYNAMICALLY CREATED ASSourceIterator object * that will be used to iterate through the source code. This object will be * deleted during the ASBeautifier's destruction, and thus should not be * deleted elsewhere. * * @param iter a pointer to the DYNAMICALLY CREATED ASSourceIterator object. */ void ASBeautifier::init(ASSourceIterator *iter) { sourceIterator = iter; init(); } /** * initialize the ASBeautifier. */ void ASBeautifier::init() { INIT_CONTAINER( waitingBeautifierStack, new vector ); INIT_CONTAINER( activeBeautifierStack, new vector ); INIT_CONTAINER( waitingBeautifierStackLengthStack, new vector ); INIT_CONTAINER( activeBeautifierStackLengthStack, new vector ); INIT_CONTAINER( headerStack, new vector ); INIT_CONTAINER( tempStacks, new vector< vector* > ); tempStacks->push_back(new vector); INIT_CONTAINER( blockParenDepthStack, new vector ); INIT_CONTAINER( blockStatementStack, new vector ); INIT_CONTAINER( parenStatementStack, new vector ); INIT_CONTAINER( bracketBlockStateStack, new vector ); bracketBlockStateStack->push_back(true); INIT_CONTAINER( inStatementIndentStack, new vector ); INIT_CONTAINER( inStatementIndentStackSizeStack, new vector ); inStatementIndentStackSizeStack->push_back(0); INIT_CONTAINER( parenIndentStack, new vector ); immediatelyPreviousAssignmentOp = NULL; previousLastLineHeader = NULL; isInQuote = false; isInComment = false; isInStatement = false; isInCase = false; isInQuestion = false; isInClassHeader = false; isInClassHeaderTab = false; isInHeader = false; isInOperator = false; isInTemplate = false; isInConst = false; isInConditional = false; templateDepth = 0; parenDepth=0; blockTabCount = 0; leadingWhiteSpaces = 0; prevNonSpaceCh = '{'; currentNonSpaceCh = '{'; prevNonLegalCh = '{'; currentNonLegalCh = '{'; prevFinalLineSpaceTabCount = 0; prevFinalLineTabCount = 0; probationHeader = NULL; backslashEndsPrevLine = false; isInDefine = false; isInDefineDefinition = false; defineTabCount = 0; } /** * set indentation style to ANSI C/C++. */ void ASBeautifier::setCStyle() { isCStyle = true; } /** * set indentation style to Java / K&R. */ void ASBeautifier::setJavaStyle() { isCStyle = false; } /** * indent using one tab per indentation */ void ASBeautifier::setTabIndentation(int length, bool forceTabs) { indentString = "\t"; indentLength = length; shouldForceTabIndentation = forceTabs; if (!isMinimalConditinalIndentSet) minConditionalIndent = indentLength * 2; } /** * 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; if (!isMinimalConditinalIndentSet) minConditionalIndent = indentLength * 2; } /** * 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 indentation between two lines in a multi-line condition. * * @param min minimal indentation length. */ void ASBeautifier::setMinConditionalIndentLength(int min) { minConditionalIndent = min; isMinimalConditinalIndentSet = true; } /** * set the state of the bracket indentation 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 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) { if (state) setBracketIndent(false); // so that we don't have both bracket and block indent 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 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, multiline #define statements will be indented. * * @param state state of option. */ void ASBeautifier::setPreprocessorIndent(bool state) { preprocessorIndent = 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; } /** * check if there are any indented lines ready to be read by nextLine() * * @return are there any indented lines ready? */ bool ASBeautifier::hasMoreLines() const { return sourceIterator->hasMoreLines(); } /** * get the next indented line. * * @return indented line. */ string ASBeautifier::nextLine() { return beautify(sourceIterator->nextLine()); } /** * 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 isInLineComment = false; bool lineStartsInComment = false; bool isInClass = false; bool isInSwitch = false; bool isImmediatelyAfterConst = false; bool isSpecialChar = false; char ch = ' '; char prevCh; string outBuffer; // the newly idented line is bufferd here int tabCount = 0; const string *lastLineHeader = NULL; bool closingBracketReached = false; int spaceTabCount = 0; char tempCh; unsigned int headerStackSize = headerStack->size(); //bool isLineInStatement = isInStatement; bool shouldIndentBrackettedLine = true; int lineOpeningBlocksNum = 0; int lineClosingBlocksNum = 0; bool previousLineProbation = (probationHeader != NULL); unsigned int i; currentHeader = NULL; lineStartsInComment = isInComment; // 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 (!isInComment) { leadingWhiteSpaces = 0; while (leadingWhiteSpacesinit(); //defineBeautifier->isInDefineDefinition = true; //defineBeautifier->beautify(""); activeBeautifierStack->push_back(defineBeautifier); } else { // the is the cloned beautifier that is in charge of indenting the #define. isInDefine = true; } } else if (preproc.COMPARE(0, 2, string("if")) == 0) { // push a new beautifier into the stack waitingBeautifierStackLengthStack->push_back(waitingBeautifierStack->size()); activeBeautifierStackLengthStack->push_back(activeBeautifierStack->size()); waitingBeautifierStack->push_back(new ASBeautifier(*this)); } else if (preproc.COMPARE(0, 4/*2*/, string("else")) == 0) { if (!waitingBeautifierStack->empty()) { // MOVE current waiting beautifier to active stack. activeBeautifierStack->push_back(waitingBeautifierStack->back()); waitingBeautifierStack->pop_back(); } } else if (preproc.COMPARE(0, 4, string("elif")) == 0) { if (!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.COMPARE(0, 5, string("endif")) == 0) { unsigned int stackLength; ASBeautifier *beautifier; if (!waitingBeautifierStackLengthStack->empty()) { stackLength = waitingBeautifierStackLengthStack->back(); waitingBeautifierStackLengthStack->pop_back(); while (waitingBeautifierStack->size() > stackLength) { beautifier = waitingBeautifierStack->back(); waitingBeautifierStack->pop_back(); delete beautifier; } } if (!activeBeautifierStackLengthStack->empty()) { stackLength = activeBeautifierStackLengthStack->back(); activeBeautifierStackLengthStack->pop_back(); while (activeBeautifierStack->size() > stackLength) { beautifier = activeBeautifierStack->back(); activeBeautifierStack->pop_back(); delete beautifier; } } } } // check if the last char is a backslash if(line.length() > 0) backslashEndsPrevLine = (line[line.length() - 1] == '\\'); else backslashEndsPrevLine = false; // 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) { string beautifiedLine; ASBeautifier *defineBeautifier; isInDefineDefinition = false; defineBeautifier = activeBeautifierStack->back(); activeBeautifierStack->pop_back(); beautifiedLine = defineBeautifier->beautify(line); delete defineBeautifier; return beautifiedLine; } // 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. if (!isInDefine && activeBeautifierStack != NULL && !activeBeautifierStack->empty()) { return activeBeautifierStack->back()->beautify(line); } // calculate preliminary indentation based on data from past lines if (!inStatementIndentStack->empty()) spaceTabCount = inStatementIndentStack->back(); for (i=0; i0 && (*headerStack)[i-1] != &AS_OPEN_BRACKET && (*headerStack)[i] == &AS_OPEN_BRACKET))) ++tabCount; if (isCStyle && !namespaceIndent && i >= 1 && (*headerStack)[i-1] == &AS_NAMESPACE && (*headerStack)[i] == &AS_OPEN_BRACKET) --tabCount; if (isCStyle && i >= 1 && (*headerStack)[i-1] == &AS_CLASS && (*headerStack)[i] == &AS_OPEN_BRACKET ) { if (classIndent) ++tabCount; 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 ) { ++tabCount; isInSwitch = true; } } if (!lineStartsInComment && isCStyle && isInClass && classIndent && headerStackSize >= 2 &&(*headerStack)[headerStackSize-2] == &AS_CLASS && (*headerStack)[headerStackSize-1] == &AS_OPEN_BRACKET && line[0] == '}') --tabCount; else if (!lineStartsInComment && isInSwitch && switchIndent && headerStackSize >= 2 && (*headerStack)[headerStackSize-2] == &AS_SWITCH && (*headerStack)[headerStackSize-1] == &AS_OPEN_BRACKET && line[0] == '}') --tabCount; if (isInClassHeader) { isInClassHeaderTab = true; tabCount += 2; } if (isInConditional) { --tabCount; } // parse characters in the current line. for (i=0; ipush_back(probationHeader); // handle the specific probation header isInConditional = (probationHeader == &AS_SYNCHRONIZED); if (probationHeader == &AS_CONST) isImmediatelyAfterConst = true; // isInConst = true; /* TODO: * There is actually no more need for the global isInConst variable. * The only reason for checking const is to see if there is a const * immediately before an open-bracket. * Since CONST is now put into probation and is checked during itspost-char, * isImmediatelyAfterConst can be set by its own... */ isInStatement = false; // if the probation comes from the previous line, then indent by 1 tab count. if (previousLineProbation && ch == '{') tabCount++; previousLineProbation = false; } // dismiss the probation header probationHeader = NULL; } prevNonSpaceCh = currentNonSpaceCh; currentNonSpaceCh = ch; if (!isLegalNameChar(ch) && ch != ',' && ch != ';' ) { prevNonLegalCh = currentNonLegalCh; currentNonLegalCh = ch; } //if (isInConst) //{ // isInConst = false; // isImmediatelyAfterConst = true; //} if (isInHeader) { isInHeader = false; currentHeader = headerStack->back(); } else currentHeader = NULL; if (isCStyle && isInTemplate && (ch == '<' || ch == '>') && findHeader(line, i, nonAssignmentOperators) == NULL) //; { if (ch == '<') { ++templateDepth; } else if (ch == '>') { if (--templateDepth <= 0) { if (isInTemplate) ch = ';'; else ch = 't'; isInTemplate = false; templateDepth = 0; } } } // handle parenthesies if (ch == '(' || ch == '[' || ch == ')' || ch == ']') { if (ch == '(' || ch == '[') { if (parenDepth == 0) { parenStatementStack->push_back(isInStatement); isInStatement = true; } parenDepth++; inStatementIndentStackSizeStack->push_back(inStatementIndentStack->size()); if (currentHeader != NULL) registerInStatementIndent(line, i, spaceTabCount, minConditionalIndent/*indentLength*2*/, true); else registerInStatementIndent(line, i, spaceTabCount, 0, true); } else if (ch == ')' || ch == ']') { parenDepth--; if (parenDepth == 0) { isInStatement = parenStatementStack->back(); parenStatementStack->pop_back(); ch = ' '; isInConditional = false; } if (!inStatementIndentStackSizeStack->empty()) { unsigned int previousIndentStackSize = inStatementIndentStackSizeStack->back(); inStatementIndentStackSizeStack->pop_back(); while (previousIndentStackSize < inStatementIndentStack->size()) inStatementIndentStack->pop_back(); if (!parenIndentStack->empty()) { int poppedIndent = parenIndentStack->back(); parenIndentStack->pop_back(); if (i == 0) spaceTabCount = poppedIndent; } } } continue; } if (ch == '{') { bool isBlockOpener = false; // first, check if '{' is a block-opener or an static-array opener isBlockOpener = ( (prevNonSpaceCh == '{' && bracketBlockStateStack->back()) || prevNonSpaceCh == '}' || prevNonSpaceCh == ')' || prevNonSpaceCh == ';' || isInClassHeader || isBlockOpener || isImmediatelyAfterConst || (isInDefine && (prevNonSpaceCh == '(' || prevNonSpaceCh == '_' || isalnum(prevNonSpaceCh))) ); isInClassHeader = false; if (!isBlockOpener && currentHeader != NULL) { for (unsigned int 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, spaceTabCount, 0, true); parenDepth++; if (i == 0) shouldIndentBrackettedLine = false; continue; } // this bracket is a block opener... ++lineOpeningBlocksNum; if (isInClassHeader) isInClassHeader = false; if (isInClassHeaderTab) { isInClassHeaderTab = false; tabCount -= 2; } blockParenDepthStack->push_back(parenDepth); blockStatementStack->push_back(isInStatement); inStatementIndentStackSizeStack->push_back(inStatementIndentStack->size()); blockTabCount += isInStatement? 1 : 0; parenDepth = 0; isInStatement = false; tempStacks->push_back(new vector); headerStack->push_back(&AS_OPEN_BRACKET); lastLineHeader = &AS_OPEN_BRACKET; // <------ continue; } //check if a header has been reached if (prevCh == ' ') { bool isIndentableHeader = true; const string *newHeader = findHeader(line, i, headers); if (newHeader != NULL) { // if we reached here, then this is a header... isInHeader = true; vector *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) { //spaceTabCount += indentLength; // to counter the opposite addition that occurs when the 'if' is registered below... 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; rpush_back(lastTempStack->back()); lastTempStack->pop_back(); } if (!closingBracketReached) tabCount += 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; rpush_back(lastTempStack->back()); lastTempStack->pop_back(); } if (!closingBracketReached) tabCount += 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; rpush_back(lastTempStack->back()); lastTempStack->pop_back(); } if (!closingBracketReached) tabCount += restackSize; } } } else if (newHeader == &AS_CASE) { isInCase = true; if (!caseIndent) --tabCount; } else if(newHeader == &AS_DEFAULT) { isInCase = true; if (!caseIndent) --tabCount; } else if (newHeader == &AS_PUBLIC || newHeader == &AS_PROTECTED || newHeader == &AS_PRIVATE) { if (isCStyle && !isInClassHeader) --tabCount; isIndentableHeader = false; } //else if ((newHeader == &STATIC || newHeader == &SYNCHRONIZED) && // !headerStack->empty() && // (headerStack->back() == &STATIC || headerStack->back() == &SYNCHRONIZED)) //{ // isIndentableHeader = false; //} else if (newHeader == &AS_STATIC || newHeader == &AS_SYNCHRONIZED || (newHeader == &AS_CONST && isCStyle)) { if (!headerStack->empty() && (headerStack->back() == &AS_STATIC || headerStack->back() == &AS_SYNCHRONIZED || headerStack->back() == &AS_CONST)) { isIndentableHeader = false; } else { isIndentableHeader = false; probationHeader = newHeader; } } else if (newHeader == &AS_CONST) { // this will be entered only if NOT in C style // since otherwise the CONST would be found to be a probstion header... //if (isCStyle) // isInConst = true; isIndentableHeader = false; } /* else if (newHeader == &OPERATOR) { if (isCStyle) isInOperator = true; isIndentableHeader = false; } */ else if (newHeader == &AS_TEMPLATE) { if (isCStyle) isInTemplate = true; isIndentableHeader = false; } if (isIndentableHeader) { // 3.2.99 //spaceTabCount-=indentLength; headerStack->push_back(newHeader); isInStatement = false; if (indexOf(nonParenHeaders, newHeader) == -1) { isInConditional = true; } lastLineHeader = newHeader; } else isInHeader = false; //lastLineHeader = newHeader; outBuffer.append(newHeader->substr(1)); i += newHeader->length() - 1; continue; } } if (isCStyle && !isalpha(prevCh) && line.COMPARE(i, 8, AS_OPERATOR) == 0 && !isalnum(line[i+8])) { isInOperator = true; outBuffer.append(AS_OPERATOR.substr(1)); i += 7; continue; } if (ch == '?') isInQuestion = true; // special handling of 'case' statements if (ch == ':') { if (line.length() > i+1 && line[i+1] == ':') // look for :: { ++i; outBuffer.append(1, ':'); ch = ' '; continue; } else if (isCStyle && isInClass && prevNonSpaceCh != ')') { // BEGIN Content of ASBeautifier.cpp.BITFIELD.patch: unsigned int chIndex; char nextCh = 0; for (chIndex = i+1; chIndex < line.length(); chIndex++) if (!isWhiteSpace(line[chIndex])) break; if (chIndex< line.length()) nextCh = line[chIndex]; int nWord =0; for (chIndex = 0; chIndex < i; chIndex++) { if (!isWhiteSpace(line[chIndex])) { nWord ++; while (!isWhiteSpace(line[++chIndex])); } } if ((nextCh >= '0' && nextCh <= '9') || (nWord >1)) continue; // END Content of ASBeautifier.cpp.BITFIELD.patch: --tabCount; // found a 'private:' or 'public:' inside a class definition // so do nothing special } else if (isCStyle && isInClassHeader) { // found a 'class A : public B' definition // so do nothing special } else if (isInQuestion) { isInQuestion = false; } else if (isCStyle && prevNonSpaceCh == ')') { isInClassHeader = true; if (i==0) tabCount += 2; } else { currentNonSpaceCh = ';'; // so that brackets after the ':' will appear as block-openers if (isInCase) { isInCase = false; ch = ';'; // from here on, treat char as ';' } // BEGIN content of ASBeautifier.cpp.BITFIELD.patch.bz2 else // bitfield or labels { unsigned int chIndex; char nextCh = 0; for (chIndex = i+1; (isCStyle && chIndex < line.length()); chIndex++) if (!isWhiteSpace(line[chIndex])) break; if (chIndex< line.length()) nextCh = line[chIndex]; int nWord =0; for (chIndex = 0; chIndex < i; chIndex++) { if (!isWhiteSpace(line[chIndex])) { nWord ++; while (!isWhiteSpace(line[++chIndex])); } } if (isCStyle && (nextCh >= '0' && nextCh <= '9') || (nWord >1)) { continue; } // END content of ASASBeautifier.cpp.BITFIELD.patch.bz2 else // is in a label (e.g. 'label1:') { if (labelIndent) --tabCount; // unindent label by one indent else tabCount = 0; // completely flush indent to left } // BEGIN content of ASASBeautifier.cpp.BITFIELD.patch.bz2 } // END content of ASASBeautifier.cpp.BITFIELD.patch.bz2 } } if ((ch == ';' || (parenDepth>0 && ch == ',')) && !inStatementIndentStackSizeStack->empty()) while ((unsigned int)inStatementIndentStackSizeStack->back() + (parenDepth>0 ? 1 : 0) < inStatementIndentStack->size()) inStatementIndentStack->pop_back(); // handle ends of statements if ( (ch == ';' && parenDepth == 0) || ch == '}'/* || (ch == ',' && parenDepth == 0)*/) { if (ch == '}') { // first check if this '}' closes a previous block, or a static array... if (!bracketBlockStateStack->empty()) { bool bracketBlockState = bracketBlockStateStack->back(); bracketBlockStateStack->pop_back(); if (!bracketBlockState) { if (!inStatementIndentStackSizeStack->empty()) { // this bracket is a static array unsigned int previousIndentStackSize = inStatementIndentStackSizeStack->back(); inStatementIndentStackSizeStack->pop_back(); while (previousIndentStackSize < inStatementIndentStack->size()) inStatementIndentStack->pop_back(); parenDepth--; if (i == 0) shouldIndentBrackettedLine = false; if (!parenIndentStack->empty()) { int poppedIndent = parenIndentStack->back(); parenIndentStack->pop_back(); if (i == 0) spaceTabCount = poppedIndent; } } continue; } } // this bracket is block closer... ++lineClosingBlocksNum; if(!inStatementIndentStackSizeStack->empty()) inStatementIndentStackSizeStack->pop_back(); if (!blockParenDepthStack->empty()) { parenDepth = blockParenDepthStack->back(); blockParenDepthStack->pop_back(); isInStatement = blockStatementStack->back(); blockStatementStack->pop_back(); if (isInStatement) blockTabCount--; } closingBracketReached = true; 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 (!tempStacks->empty()) { vector *temp = tempStacks->back(); tempStacks->pop_back(); delete temp; } } ch = ' '; // needed due to cases such as '}else{', so that headers ('else' tn tih case) will be identified... } /* * 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 begining 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; isInClassHeader = false; continue; } // check for preBlockStatements ONLY if not within parenthesies // (otherwise 'struct XXX' statements would be wrongly interpreted...) if (prevCh == ' ' && !isInTemplate && parenDepth == 0) { const string *newHeader = findHeader(line, i, preBlockStatements); if (newHeader != NULL) { isInClassHeader = true; outBuffer.append(newHeader->substr(1)); i += newHeader->length() - 1; //if (isCStyle) headerStack->push_back(newHeader); } } // Handle operators // //// // PRECHECK if a '==' or '--' or '++' operator was reached. //// // If not, then register an indent IF an assignment operator was reached. //// // The precheck is important, so that statements such as 'i--==2' are not recognized //// // to have assignment operators (here, '-=') in them . . . const string *foundAssignmentOp = NULL; const string *foundNonAssignmentOp = NULL; immediatelyPreviousAssignmentOp = NULL; // Check if an operator has been reached. foundAssignmentOp = findHeader(line, i, assignmentOperators, false); foundNonAssignmentOp = findHeader(line, i, nonAssignmentOperators, false); // Since findHeader's boundry 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) { outBuffer.append(foundNonAssignmentOp->substr(1)); i += foundNonAssignmentOp->length() - 1; } } else if (foundAssignmentOp != NULL) { if (foundAssignmentOp->length() > 1) { outBuffer.append(foundAssignmentOp->substr(1)); i += foundAssignmentOp->length() - 1; } if (!isInOperator && !isInTemplate) { registerInStatementIndent(line, i, spaceTabCount, 0, false); immediatelyPreviousAssignmentOp = foundAssignmentOp; isInStatement = true; } } /* immediatelyPreviousAssignmentOp = NULL; bool isNonAssingmentOperator = false; for (int n = 0; n < nonAssignmentOperators.size(); n++) if (line.COMPARE(i, nonAssignmentOperators[n]->length(), *(nonAssignmentOperators[n])) == 0) { if (nonAssignmentOperators[n]->length() > 1) { outBuffer.append(nonAssignmentOperators[n]->substr(1)); i += nonAssignmentOperators[n]->length() - 1; } isNonAssingmentOperator = true; break; } if (!isNonAssingmentOperator) { for (int a = 0; a < assignmentOperators.size(); a++) if (line.COMPARE(i, assignmentOperators[a]->length(), *(assignmentOperators[a])) == 0) { if (assignmentOperators[a]->length() > 1) { outBuffer.append(assignmentOperators[a]->substr(1)); i += assignmentOperators[a]->length() - 1; } if (!isInOperator && !isInTemplate) { registerInStatementIndent(line, i, spaceTabCount, 0, false); immediatelyPreviousAssignmentOp = assignmentOperators[a]; isInStatement = true; } break; } } */ if (isInOperator) isInOperator = false; } // handle special cases of unindentation: /* * 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. */ // cerr << endl << lineOpeningBlocksNum << " " << lineClosingBlocksNum << " " << previousLastLineHeader << endl; // indent #define lines with one less tab //if (isInDefine) // tabCount -= defineTabCount-1; if (!lineStartsInComment && !blockIndent && outBuffer.length()>0 && outBuffer[0]=='{' && !(lineOpeningBlocksNum > 0 && lineOpeningBlocksNum == lineClosingBlocksNum) && !(headerStack->size() > 1 && (*headerStack)[headerStack->size()-2] == &AS_OPEN_BRACKET) && shouldIndentBrackettedLine) --tabCount; else if (!lineStartsInComment && outBuffer.length()>0 && outBuffer[0]=='}' && shouldIndentBrackettedLine ) --tabCount; // correctly indent one-line-blocks... else if (!lineStartsInComment && outBuffer.length()>0 && lineOpeningBlocksNum > 0 && lineOpeningBlocksNum == lineClosingBlocksNum && previousLastLineHeader != NULL && previousLastLineHeader != &AS_OPEN_BRACKET) tabCount -= 1; //lineOpeningBlocksNum - (blockIndent ? 1 : 0); if (tabCount < 0) tabCount = 0; // take care of extra bracket indentatation option... if (bracketIndent && outBuffer.length()>0 && shouldIndentBrackettedLine) if (outBuffer[0]=='{' || outBuffer[0]=='}') tabCount++; if (isInDefine) { if (outBuffer[0] == '#') { string preproc = trim(string(outBuffer.c_str() + 1)); if (preproc.COMPARE(0, 6, string("define")) == 0) { if (!inStatementIndentStack->empty() && inStatementIndentStack->back() > 0) { defineTabCount = tabCount; } else { defineTabCount = tabCount - 1; tabCount--; } } } tabCount -= defineTabCount; } if (tabCount < 0) tabCount = 0; // finally, insert indentations into begining of line prevFinalLineSpaceTabCount = spaceTabCount; prevFinalLineTabCount = tabCount; if (shouldForceTabIndentation) { tabCount += spaceTabCount / indentLength; spaceTabCount = spaceTabCount % indentLength; } outBuffer = preLineWS(spaceTabCount,tabCount) + outBuffer; if (lastLineHeader != NULL) previousLastLineHeader = lastLineHeader; return outBuffer; } string ASBeautifier::preLineWS(int spaceTabCount, int tabCount) { string ws; for (int i=0; i 0) ws += string(" "); return ws; } /** * register an in-statement indent. */ void ASBeautifier::registerInStatementIndent(const string &line, int i, int spaceTabCount, int minIndent, bool updateParenStack) { int inStatementIndent; int remainingCharNum = line.length() - i; int nextNonWSChar = 1; nextNonWSChar = getNextProgramCharDistance(line, i); // if indent is around the last char in the line, indent instead 2 spaces from the previous indent if (nextNonWSChar == remainingCharNum) { int previousIndent = spaceTabCount; if (!inStatementIndentStack->empty()) previousIndent = inStatementIndentStack->back(); inStatementIndentStack->push_back(/*2*/ indentLength + previousIndent ); if (updateParenStack) parenIndentStack->push_back( previousIndent ); return; } if (updateParenStack) parenIndentStack->push_back(i+spaceTabCount); inStatementIndent = i + nextNonWSChar + spaceTabCount; if (i + nextNonWSChar < minIndent) inStatementIndent = minIndent + spaceTabCount; if (i + nextNonWSChar > maxInStatementIndent) inStatementIndent = indentLength*2 + spaceTabCount; if (!inStatementIndentStack->empty() && inStatementIndent < inStatementIndentStack->back()) inStatementIndent = inStatementIndentStack->back(); inStatementIndentStack->push_back(inStatementIndent); } /** * get distance to the next non-white sspace, 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) { bool inComment = false; int remainingCharNum = line.length() - i; int charDistance = 1; int ch; for (charDistance = 1; charDistance < remainingCharNum; charDistance++) { ch = line[i + charDistance]; if (inComment) { if (line.COMPARE(i + charDistance, 2, AS_CLOSE_COMMENT) == 0) { charDistance++; inComment = false; } continue; } else if (isWhiteSpace(ch)) continue; else if (ch == '/') { if (line.COMPARE(i + charDistance, 2, AS_OPEN_LINE_COMMENT) == 0) return remainingCharNum; else if (line.COMPARE(i + charDistance, 2, AS_OPEN_COMMENT) == 0) { charDistance++; inComment = true; } } else return charDistance; } return charDistance; } /** * check if a specific character can be used in a legal variable/method/class name * * @return legality of the char. * @param ch the character to be checked. */ bool ASBeautifier::isLegalNameChar(char ch) const { return (isalnum(ch) //(ch>='a' && ch<='z') || (ch>='A' && ch<='Z') || (ch>='0' && ch<='9') || || ch=='.' || ch=='_' || (!isCStyle && ch=='$') || (isCStyle && ch=='~')); } /** * check if a specific line position contains a header, out of several possible headers. * * @return a pointer to the found header. if no header was found then return NULL. */ const string *ASBeautifier::findHeader(const string &line, int i, const vector &possibleHeaders, bool checkBoundry) { int maxHeaders = possibleHeaders.size(); const string *header = NULL; int p; for (p=0; p < maxHeaders; p++) { header = possibleHeaders[p]; if (line.COMPARE(i, header->length(), *header) == 0) { // check that this is a header and not a part of a longer word // (e.g. not at its begining, not at its middle...) int lineLength = line.length(); int headerEnd = i + header->length(); char startCh = (*header)[0]; // first char of header char endCh = 0; // char just after header char prevCh = 0; // char just before header if (headerEnd < lineLength) { endCh = line[headerEnd]; } if (i > 0) { prevCh = line[i-1]; } if (!checkBoundry) { return header; } else if (prevCh != 0 && isLegalNameChar(startCh) && isLegalNameChar(prevCh)) { return NULL; } else if (headerEnd >= lineLength || !isLegalNameChar(startCh) || !isLegalNameChar(endCh)) { return header; } else { return NULL; } } } return NULL; } /** * check if a specific character can be used in a legal variable/method/class name * * @return legality of the char. * @param ch the character to be checked. */ bool ASBeautifier::isWhiteSpace(char ch) const { return (ch == ' ' || ch == '\t'); } /** * find the index number of a string element in a container of strings * * @return the index number of element in the ocntainer. -1 if element not found. * @param container a vector of strings. * @param element the element to find . */ int ASBeautifier::indexOf(vector &container, const string *element) { vector::const_iterator where; where= find(container.begin(), container.end(), element); if (where == container.end()) return -1; else return where - container.begin(); } /** * trim removes the white space surrounding a line. * * @return the trimmed line. * @param str the line to trim. */ string ASBeautifier::trim(const string &str) { int start = 0; int end = str.length() - 1; while (start < end && isWhiteSpace(str[start])) start++; while (start <= end && isWhiteSpace(str[end])) end--; string returnStr(str, start, end+1-start); return returnStr; } #ifdef USES_NAMESPACE } #endif /* * Copyright (c) 1998,1999,2000,2001,2002 Tal Davidson. All rights reserved. * * compiler_defines.h (1 January 1999) * by Tal Davidson (davidsont@bigfoot.com) * This file is a part of "Artistic Style" - an indentater and reformatter * of C, C++, C# and Java source files. * * The "Artistic Style" project, including all files needed to compile it, * is free software; you can redistribute it and/or use it and/or modify it * under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2 of the License, * or (at your option) any later version. * * This program 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. * * You should have received a copy of the GNU General Public * License along with this program. */ #ifndef ASBEAUTIFIER_H #define ASBEAUTIFIER_H #include "ASResource.h" #include "compiler_defines.h" #include "ASSourceIterator.h" #include #include using namespace std; namespace astyle { enum BracketMode { NONE_MODE, ATTACH_MODE, BREAK_MODE, BDAC_MODE }; enum BracketType { NULL_TYPE = 0, DEFINITION_TYPE = 1, COMMAND_TYPE = 2, ARRAY_TYPE = 4, SINGLE_LINE_TYPE = 8}; class ASBeautifier : protected ASResource { public: ASBeautifier(); virtual ~ASBeautifier(); virtual void init(ASSourceIterator* iter); // pointer to dynamically created iterator. virtual void init(); virtual bool hasMoreLines() const; virtual string nextLine(); virtual string beautify(const string &line); void setTabIndentation(int length = 4, bool forceTabs = false); void setSpaceIndentation(int length = 4); void setMaxInStatementIndentLength(int max); void setMinConditionalIndentLength(int min); void setClassIndent(bool state); void setSwitchIndent(bool state); void setCaseIndent(bool state); void setBracketIndent(bool state); void setBlockIndent(bool state); void setNamespaceIndent(bool state); void setLabelIndent(bool state); void setCStyle(); void setJavaStyle(); void setEmptyLineFill(bool state); void setPreprocessorIndent(bool state); protected: int getNextProgramCharDistance(const string &line, int i); bool isLegalNameChar(char ch) const; bool isWhiteSpace(char ch) const; const string *findHeader(const string &line, int i, const vector &possibleHeaders, bool checkBoundry = true); string trim(const string &str); int indexOf(vector &container, const string *element); private: ASBeautifier(const ASBeautifier ©); void operator=(ASBeautifier&); // not to be implemented void initStatic(); void registerInStatementIndent(const string &line, int i, int spaceTabCount, int minIndent, bool updateParenStack); string preLineWS(int spaceTabCount, int tabCount); static vector headers; static vector nonParenHeaders; static vector preprocessorHeaders; static vector preBlockStatements; static vector assignmentOperators; static vector nonAssignmentOperators; static bool calledInitStatic; ASSourceIterator *sourceIterator; vector *waitingBeautifierStack; vector *activeBeautifierStack; vector *waitingBeautifierStackLengthStack; vector *activeBeautifierStackLengthStack; vector *headerStack; vector< vector* > *tempStacks; vector *blockParenDepthStack; vector *blockStatementStack; vector *parenStatementStack; vector *inStatementIndentStack; vector *inStatementIndentStackSizeStack; vector *parenIndentStack; vector *bracketBlockStateStack; string indentString; const string *currentHeader; const string *previousLastLineHeader; const string *immediatelyPreviousAssignmentOp; const string *probationHeader; bool isInQuote; bool isInComment; bool isInCase; bool isInQuestion; bool isInStatement; bool isInHeader; bool isCStyle; bool isInOperator; bool isInTemplate; bool isInConst; bool isInDefine; bool isInDefineDefinition; bool classIndent; bool isInClassHeader; bool isInClassHeaderTab; bool switchIndent; bool caseIndent; bool namespaceIndent; bool bracketIndent; bool blockIndent; bool labelIndent; bool preprocessorIndent; bool isInConditional; bool isMinimalConditinalIndentSet; bool shouldForceTabIndentation; int minConditionalIndent; int parenDepth; int indentLength; int blockTabCount; unsigned int leadingWhiteSpaces; int maxInStatementIndent; int templateDepth; char quoteChar; char prevNonSpaceCh; char currentNonSpaceCh; char currentNonLegalCh; char prevNonLegalCh; int prevFinalLineSpaceTabCount; int prevFinalLineTabCount; bool emptyLineFill; bool backslashEndsPrevLine; int defineTabCount; }; } #endif /* * Copyright (c) 1998,1999,2000,2001,2002 Tal Davidson. All rights reserved. * * ASFormatter.cpp * by Tal Davidson (davidsont@bigfoot.com) * This file is a part of "Artistic Style" - an indentater and reformatter * of C, C++, C# and Java source files. * * The "Artistic Style" project, including all files needed to compile it, * is free software; you can redistribute it and/or use it and/or modify it * under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2 of the License, * or (at your option) any later version. * * This program 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. * * You should have received a copy of the GNU General Public * License along with this program. * * * Patches: * 26 November 1998 - Richard Bullington - * A correction of line-breaking in headers following '}', * was created using a variation of a patch by Richard Bullington. * 08 May 2004 * applied ASFormatter450670.patch.bz2, ASFormatter.cpp.patch.bz2, * patch1_ssvb_patch.tar.gz */ #include "compiler_defines.h" #include "ASFormatter.h" #include #include #include #include #include #define INIT_CONTAINER(container, value) {if ( (container) != NULL ) delete (container); (container) = (value); } #define DELETE_CONTAINER(container) {if ( (container) != NULL ) delete (container) ; } #define IS_A(a,b) ( ((a) & (b)) == (b)) #ifdef USES_NAMESPACE using namespace std; ---tokens--- '/***************************************************************************\n ansigenerator.cpp - description\n -------------------\n begin : Jul 5 2004\n copyright : (C) 2004 by AndrĂ© Simon\n email : andre.simon1@gmx.de\n ***************************************************************************/' Comment.Multiline '\n' Text '\n' Text '/***************************************************************************\n * *\n * This program is free software; you can redistribute it and/or modify *\n * it under the terms of the GNU General Public License as published by *\n * the Free Software Foundation; either version 2 of the License, or *\n * (at your option) any later version. *\n * *\n ***************************************************************************/' Comment.Multiline '\n' Text '\n' Text '#' Comment.Preproc 'include' Comment.Preproc ' ' Text '"ansigenerator.h"' Comment.PreprocFile '\n' Comment.Preproc '\n' Text 'using' Keyword ' ' Text 'namespace' Keyword ' ' Text 'std' Name ';' Punctuation '\n' Text '\n' Text 'namespace' Keyword ' ' Text 'highlight' Name ' ' Text '{' Punctuation '\n' Text '\n' Text '\n' Text 'string' Name ' ' Text 'AnsiGenerator' Name ':' Operator ':' Operator 'getOpenTag' Name '(' Punctuation 'const' Keyword ' ' Text 'string' Name '&' Operator 'font' Name ',' Punctuation '\n' Text ' ' Text 'const' Keyword ' ' Text 'string' Name '&' Operator 'fgCol' Name ',' Punctuation ' ' Text 'const' Keyword ' ' Text 'string' Name '&' Operator 'bgCol' Name ')' Punctuation ' ' Text '{' Punctuation '\n' Text ' ' Text 'ostringstream' Name ' ' Text 's' Name ';' Punctuation '\n' Text ' ' Text 's' Name ' ' Text '<' Operator '<' Operator ' ' Text '"' Literal.String '\\033' Literal.String.Escape '[' Literal.String '"' Literal.String '<' Operator '<' Operator 'font' Name ';' Punctuation '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation '!' Operator 'fgCol' Name '.' Punctuation 'empty' Name '(' Punctuation ')' Punctuation ')' Punctuation '\n' Text ' ' Text 's' Name '<' Operator '<' Operator '"' Literal.String ';' Literal.String '"' Literal.String '<' Operator '<' Operator 'fgCol' Name ';' Punctuation '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation '!' Operator 'bgCol' Name '.' Punctuation 'empty' Name '(' Punctuation ')' Punctuation ')' Punctuation '\n' Text ' ' Text 's' Name '<' Operator '<' Operator '"' Literal.String ';' Literal.String '"' Literal.String '<' Operator '<' Operator 'bgCol' Name ';' Punctuation '\n' Text ' ' Text 's' Name ' ' Text '<' Operator '<' Operator ' ' Text '"' Literal.String 'm' Literal.String '"' Literal.String ';' Punctuation '\n' Text ' ' Text 'return' Keyword ' ' Text 's' Name '.' Punctuation 'str' Name '(' Punctuation ')' Punctuation ';' Punctuation '\n' Text '}' Punctuation '\n' Text '\n' Text '\n' Text 'AnsiGenerator' Name ':' Operator ':' Operator 'AnsiGenerator' Name '(' Punctuation 'const' Keyword ' ' Text 'string' Name ' ' Text '&' Operator 'colourTheme' Name ')' Punctuation '\n' Text ' ' Text ':' Operator ' ' Text 'CodeGenerator' Name '(' Punctuation 'colourTheme' Name ')' Punctuation ' ' Text '{' Punctuation '\n' Text ' ' Text 'styleTagOpen' Name '.' Punctuation 'push_back' Name '(' Punctuation '"' Literal.String '"' Literal.String ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'styleTagOpen' Name '.' Punctuation 'push_back' Name '(' Punctuation 'getOpenTag' Name '(' Punctuation '"' Literal.String '00' Literal.String '"' Literal.String ',' Punctuation ' ' Text '"' Literal.String '31' Literal.String '"' Literal.String ')' Punctuation ')' Punctuation ';' Punctuation ' ' Text '//str\n' Comment.Single ' ' Text 'styleTagOpen' Name '.' Punctuation 'push_back' Name '(' Punctuation 'getOpenTag' Name '(' Punctuation '"' Literal.String '00' Literal.String '"' Literal.String ',' Punctuation ' ' Text '"' Literal.String '34' Literal.String '"' Literal.String ')' Punctuation ')' Punctuation ';' Punctuation '//number\n' Comment.Single ' ' Text 'styleTagOpen' Name '.' Punctuation 'push_back' Name '(' Punctuation 'getOpenTag' Name '(' Punctuation '"' Literal.String '00' Literal.String '"' Literal.String ',' Punctuation ' ' Text '"' Literal.String '34' Literal.String '"' Literal.String ')' Punctuation ')' Punctuation ';' Punctuation '//sl comment\n' Comment.Single ' ' Text 'styleTagOpen' Name '.' Punctuation 'push_back' Name '(' Punctuation 'getOpenTag' Name '(' Punctuation '"' Literal.String '00' Literal.String '"' Literal.String ',' Punctuation ' ' Text '"' Literal.String '34' Literal.String '"' Literal.String ')' Punctuation ')' Punctuation ';' Punctuation '//ml comment\n' Comment.Single ' ' Text 'styleTagOpen' Name '.' Punctuation 'push_back' Name '(' Punctuation 'getOpenTag' Name '(' Punctuation '"' Literal.String '00' Literal.String '"' Literal.String ',' Punctuation ' ' Text '"' Literal.String '35' Literal.String '"' Literal.String ')' Punctuation ')' Punctuation ';' Punctuation '//escapeChar\n' Comment.Single ' ' Text 'styleTagOpen' Name '.' Punctuation 'push_back' Name '(' Punctuation 'getOpenTag' Name '(' Punctuation '"' Literal.String '00' Literal.String '"' Literal.String ',' Punctuation ' ' Text '"' Literal.String '35' Literal.String '"' Literal.String ')' Punctuation ')' Punctuation ';' Punctuation '//directive\n' Comment.Single ' ' Text 'styleTagOpen' Name '.' Punctuation 'push_back' Name '(' Punctuation 'getOpenTag' Name '(' Punctuation '"' Literal.String '01' Literal.String '"' Literal.String ',' Punctuation ' ' Text '"' Literal.String '31' Literal.String '"' Literal.String ')' Punctuation ')' Punctuation ';' Punctuation '//directive string\n' Comment.Single ' ' Text 'styleTagOpen' Name '.' Punctuation 'push_back' Name '(' Punctuation 'getOpenTag' Name '(' Punctuation '"' Literal.String '00' Literal.String '"' Literal.String ',' Punctuation ' ' Text '"' Literal.String '30' Literal.String '"' Literal.String ')' Punctuation ')' Punctuation ';' Punctuation '//linenum\n' Comment.Single ' ' Text 'styleTagOpen' Name '.' Punctuation 'push_back' Name '(' Punctuation 'getOpenTag' Name '(' Punctuation '"' Literal.String '01' Literal.String '"' Literal.String ',' Punctuation ' ' Text '"' Literal.String '00' Literal.String '"' Literal.String ')' Punctuation ')' Punctuation ';' Punctuation '//symbol\n' Comment.Single '\n' Text ' ' Text 'styleTagClose' Name '.' Punctuation 'push_back' Name '(' Punctuation '"' Literal.String '"' Literal.String ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'for' Keyword ' ' Text '(' Punctuation 'int' Keyword.Type ' ' Text 'i' Name '=' Operator '1' Literal.Number.Integer ';' Punctuation 'i' Name '<' Operator 'NUMBER_BUILTIN_STYLES' Name ';' Punctuation ' ' Text 'i' Name '+' Operator '+' Operator ')' Punctuation ' ' Text '{' Punctuation '\n' Text ' ' Text 'styleTagClose' Name '.' Punctuation 'push_back' Name '(' Punctuation '"' Literal.String '\\033' Literal.String.Escape '[m' Literal.String '"' Literal.String ')' Punctuation ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text ' ' Text 'newLineTag' Name ' ' Text '=' Operator ' ' Text '"' Literal.String '\\n' Literal.String.Escape '"' Literal.String ';' Punctuation '\n' Text ' ' Text 'spacer' Name ' ' Text '=' Operator ' ' Text '"' Literal.String ' ' Literal.String '"' Literal.String ';' Punctuation '\n' Text '}' Punctuation '\n' Text '\n' Text 'AnsiGenerator' Name ':' Operator ':' Operator 'AnsiGenerator' Name '(' Punctuation ')' Punctuation ' ' Text '{' Punctuation '}' Punctuation '\n' Text 'AnsiGenerator' Name ':' Operator ':' Operator '~' Operator 'AnsiGenerator' Name '(' Punctuation ')' Punctuation ' ' Text '{' Punctuation '}' Punctuation '\n' Text '\n' Text 'string' Name ' ' Text 'AnsiGenerator' Name ':' Operator ':' Operator 'getHeader' Name '(' Punctuation 'const' Keyword ' ' Text 'string' Name ' ' Text '&' Operator ' ' Text 'title' Name ')' Punctuation ' ' Text '{' Punctuation '\n' Text ' ' Text 'return' Keyword ' ' Text 'string' Name.Function '(' Punctuation ')' Punctuation ';' Punctuation '\n' Text '}' Punctuation '\n' Text '\n' Text 'void' Keyword.Type ' ' Text 'AnsiGenerator' Name ':' Operator ':' Operator 'printBody' Name '(' Punctuation ')' Punctuation ' ' Text '{' Punctuation '\n' Text ' ' Text 'processRootState' Name '(' Punctuation ')' Punctuation ';' Punctuation '\n' Text '}' Punctuation '\n' Text '\n' Text 'string' Name ' ' Text 'AnsiGenerator' Name ':' Operator ':' Operator 'getFooter' Name '(' Punctuation ')' Punctuation ' ' Text '{' Punctuation '\n' Text ' ' Text 'return' Keyword ' ' Text 'string' Name.Function '(' Punctuation ')' Punctuation ';' Punctuation '\n' Text '}' Punctuation '\n' Text '\n' Text 'string' Name ' ' Text 'AnsiGenerator' Name ':' Operator ':' Operator 'maskCharacter' Name '(' Punctuation 'unsigned' Keyword.Type ' ' Text 'char' Keyword.Type ' ' Text 'c' Name ')' Punctuation ' ' Text '{' Punctuation '\n' Text ' ' Text 'string' Name ' ' Text 'm' Name ';' Punctuation '\n' Text ' ' Text 'm' Name '+' Operator '=' Operator 'c' Name ';' Punctuation '\n' Text ' ' Text 'return' Keyword ' ' Text 'm' Name ';' Punctuation '\n' Text '}' Punctuation '\n' Text '\n' Text 'string' Name ' ' Text 'AnsiGenerator' Name ':' Operator ':' Operator 'getMatchingOpenTag' Name '(' Punctuation 'unsigned' Keyword.Type ' ' Text 'int' Keyword.Type ' ' Text 'styleID' Name ')' Punctuation ' ' Text '{' Punctuation '\n' Text ' ' Text 'return' Keyword ' ' Text '(' Punctuation 'styleID' Name ')' Punctuation '?' Operator 'getOpenTag' Name '(' Punctuation '"' Literal.String '01' Literal.String '"' Literal.String ',' Punctuation ' ' Text '"' Literal.String '32' Literal.String '"' Literal.String ',' Punctuation ' ' Text '"' Literal.String '"' Literal.String ')' Punctuation ':' Operator 'getOpenTag' Name '(' Punctuation '"' Literal.String '00' Literal.String '"' Literal.String ',' Punctuation ' ' Text '"' Literal.String '33' Literal.String '"' Literal.String ')' Punctuation ';' Punctuation '\n' Text '}' Punctuation '\n' Text '\n' Text 'string' Name ' ' Text 'AnsiGenerator' Name ':' Operator ':' Operator 'getMatchingCloseTag' Name '(' Punctuation 'unsigned' Keyword.Type ' ' Text 'int' Keyword.Type ' ' Text 'styleID' Name ')' Punctuation ' ' Text '{' Punctuation '\n' Text ' ' Text 'return' Keyword ' ' Text '"' Literal.String '\\033' Literal.String.Escape '[m' Literal.String '"' Literal.String ';' Punctuation '\n' Text '}' Punctuation '\n' Text '\n' Text '}' Punctuation '\n' Text '/***************************************************************************\n ansicode.h - description\n -------------------\n begin : Jul 5 2004\n copyright : (C) 2004 by Andre Simon\n email : andre.simon1@gmx.de\n ***************************************************************************/' Comment.Multiline '\n' Text '\n' Text '/***************************************************************************\n * *\n * This program is free software; you can redistribute it and/or modify *\n * it under the terms of the GNU General Public License as published by *\n * the Free Software Foundation; either version 2 of the License, or *\n * (at your option) any later version. *\n * *\n ***************************************************************************/' Comment.Multiline '\n' Text '\n' Text '#' Comment.Preproc 'ifndef ANSIGENERATOR_H' Comment.Preproc '\n' Comment.Preproc '#' Comment.Preproc 'define ANSIGENERATOR_H' Comment.Preproc '\n' Comment.Preproc '\n' Text '#' Comment.Preproc 'include' Comment.Preproc ' ' Text '' Comment.PreprocFile '\n' Comment.Preproc '#' Comment.Preproc 'include' Comment.Preproc ' ' Text '' Comment.PreprocFile '\n' Comment.Preproc '#' Comment.Preproc 'include' Comment.Preproc ' ' Text '' Comment.PreprocFile '\n' Comment.Preproc '#' Comment.Preproc 'include' Comment.Preproc ' ' Text '' Comment.PreprocFile '\n' Comment.Preproc '\n' Text '#' Comment.Preproc 'include' Comment.Preproc ' ' Text '"codegenerator.h"' Comment.PreprocFile '\n' Comment.Preproc '#' Comment.Preproc 'include' Comment.Preproc ' ' Text '"charcodes.h"' Comment.PreprocFile '\n' Comment.Preproc '#' Comment.Preproc 'include' Comment.Preproc ' ' Text '"version.h"' Comment.PreprocFile '\n' Comment.Preproc '\n' Text 'namespace' Keyword ' ' Text 'highlight' Name ' ' Text '{' Punctuation '\n' Text '\n' Text '/**\n \\brief This class generates ANSI escape sequences.\n\n It contains information about the resulting document structure (document\n header and footer), the colour system, white space handling and text\n formatting attributes.\n\n* @author Andre Simon\n*/' Comment.Multiline '\n' Text '\n' Text 'class' Keyword ' ' Text 'AnsiGenerator' Name.Class ' ' Text ':' Operator ' ' Text 'public' Keyword ' ' Text 'highlight' Name ':' Operator ':' Operator 'CodeGenerator' Name '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'public' Keyword ':' Operator '\n' Text '\n' Text ' ' Text '/** Constructor\n \\param colourTheme Name of Colour theme to use\n */' Comment.Multiline '\n' Text ' ' Text 'AnsiGenerator' Name '(' Punctuation ' ' Text 'const' Keyword ' ' Text 'string' Name ' ' Text '&' Operator 'colourTheme' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'AnsiGenerator' Name '(' Punctuation ')' Punctuation ';' Punctuation '\n' Text ' ' Text '~' Operator 'AnsiGenerator' Name '(' Punctuation ')' Punctuation ';' Punctuation '\n' Text '\n' Text ' ' Text '/** prints document header\n \\param title Title of the document\n */' Comment.Multiline '\n' Text ' ' Text 'string' Name ' ' Text 'getHeader' Name.Function '(' Punctuation 'const' Keyword ' ' Text 'string' Name ' ' Text '&' Operator ' ' Text 'title' Name ')' Punctuation ';' Punctuation '\n' Text '\n' Text ' ' Text '/** Prints document footer*/' Comment.Multiline '\n' Text ' ' Text 'string' Name ' ' Text 'getFooter' Name.Function '(' Punctuation ')' Punctuation ';' Punctuation '\n' Text '\n' Text ' ' Text '/** Prints document body*/' Comment.Multiline '\n' Text ' ' Text 'void' Keyword.Type ' ' Text 'printBody' Name.Function '(' Punctuation ')' Punctuation ';' Punctuation '\n' Text '\n' Text ' ' Text 'private' Keyword ':' Operator '\n' Text '\n' Text ' ' Text '/** \\return escaped character*/' Comment.Multiline '\n' Text ' ' Text 'virtual' Keyword ' ' Text 'string' Name ' ' Text 'maskCharacter' Name '(' Punctuation 'unsigned' Keyword.Type ' ' Text 'char' Keyword.Type ' ' Text ')' Punctuation ';' Punctuation '\n' Text '\n' Text '\n' Text ' ' Text '/** gibt ANSI-"Tags" zurueck (Farbindex+bold+kursiv)*/' Comment.Multiline '\n' Text ' ' Text 'string' Name ' ' Text 'getOpenTag' Name.Function '(' Punctuation 'const' Keyword ' ' Text 'string' Name '&' Operator 'font' Name ',' Punctuation '\n' Text ' ' Text 'const' Keyword ' ' Text 'string' Name '&' Operator 'fgCol' Name ',' Punctuation ' ' Text 'const' Keyword ' ' Text 'string' Name '&' Operator 'bgCol' Name '=' Operator '"' Literal.String '"' Literal.String ')' Punctuation ';' Punctuation '\n' Text '\n' Text '\n' Text '\n' Text ' ' Text 'string' Name ' ' Text 'getMatchingOpenTag' Name.Function '(' Punctuation 'unsigned' Keyword.Type ' ' Text 'int' Keyword.Type ' ' Text 'styleID' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'string' Name ' ' Text 'getMatchingCloseTag' Name.Function '(' Punctuation 'unsigned' Keyword.Type ' ' Text 'int' Keyword.Type ' ' Text 'styleID' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text '}' Punctuation ';' Punctuation '\n' Text '\n' Text '}' Punctuation '\n' Text '#' Comment.Preproc 'endif' Comment.Preproc '\n' Comment.Preproc '/*\n * Copyright (c) 1998,1999,2000,2001,2002 Tal Davidson. All rights reserved.\n *\n * ASBeautifier.cpp\n * by Tal Davidson (davidsont@bigfoot.com)\n * This file is a part of "Artistic Style" - an indentater and reformatter\n * of C, C, C# and Java source files.\n *\n * The "Artistic Style" project, including all files needed to compile it,\n * is free software; you can redistribute it and/or use it and/or modify it\n * under the terms of the GNU General Public License as published \n * by the Free Software Foundation; either version 2 of the License, \n * or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n *\n * You should have received a copy of the GNU General Public\n * License along with this program.\n *\n * Patches:\n * 18 March 1999 - Brian Rampel -\n * Fixed inverse insertion of spaces vs. tabs when in -t mode.\n * 08 may 2004 \n * applied ASBeautifier.cpp.BITFIELD.patch.bz2\n */' Comment.Multiline '\n' Text '\n' Text '#' Comment.Preproc 'include' Comment.Preproc ' ' Text '"compiler_defines.h"' Comment.PreprocFile '\n' Comment.Preproc '#' Comment.Preproc 'include' Comment.Preproc ' ' Text '"ASBeautifier.h"' Comment.PreprocFile '\n' Comment.Preproc '\n' Text '#' Comment.Preproc 'include' Comment.Preproc ' ' Text '' Comment.PreprocFile '\n' Comment.Preproc '#' Comment.Preproc 'include' Comment.Preproc ' ' Text '' Comment.PreprocFile '\n' Comment.Preproc '#' Comment.Preproc 'include' Comment.Preproc ' ' Text '' Comment.PreprocFile '\n' Comment.Preproc '#' Comment.Preproc 'include' Comment.Preproc ' ' Text '' Comment.PreprocFile '\n' Comment.Preproc '#' Comment.Preproc 'include' Comment.Preproc ' ' Text '' Comment.PreprocFile '\n' Comment.Preproc '\n' Text '\n' Text '#' Comment.Preproc 'define INIT_CONTAINER(container, value) {if ( (container) != NULL ) delete (container); (container) = (value); }' Comment.Preproc '\n' Comment.Preproc '#' Comment.Preproc 'define DELETE_CONTAINER(container) {if ( (container) != NULL ) delete (container) ; }' Comment.Preproc '\n' Comment.Preproc '\n' Text '#' Comment.Preproc 'ifdef USES_NAMESPACE' Comment.Preproc '\n' Comment.Preproc 'using' Keyword ' ' Text 'namespace' Keyword ' ' Text 'std' Name ';' Punctuation '\n' Text '#' Comment.Preproc 'endif' Comment.Preproc '\n' Comment.Preproc '\n' Text '\n' Text '\n' Text '\n' Text '#' Comment.Preproc 'ifdef USES_NAMESPACE' Comment.Preproc '\n' Comment.Preproc 'namespace' Keyword ' ' Text 'astyle' Name '\n' Text ' ' Text '{' Punctuation '\n' Text '#' Comment.Preproc 'endif' Comment.Preproc '\n' Comment.Preproc '\n' Text ' ' Text 'bool' Keyword.Type ' ' Text 'ASBeautifier' Name ':' Operator ':' Operator 'calledInitStatic' Name ' ' Text '=' Operator ' ' Text 'false' Name.Builtin ';' Punctuation '\n' Text '\n' Text ' ' Text 'vector' Name '<' Operator 'const' Keyword ' ' Text 'string' Name '*' Operator '>' Operator ' ' Text 'ASBeautifier' Name ':' Operator ':' Operator 'headers' Name ';' Punctuation '\n' Text ' ' Text 'vector' Name '<' Operator 'const' Keyword ' ' Text 'string' Name '*' Operator '>' Operator ' ' Text 'ASBeautifier' Name ':' Operator ':' Operator 'nonParenHeaders' Name ';' Punctuation '\n' Text ' ' Text 'vector' Name '<' Operator 'const' Keyword ' ' Text 'string' Name '*' Operator '>' Operator ' ' Text 'ASBeautifier' Name ':' Operator ':' Operator 'preBlockStatements' Name ';' Punctuation '\n' Text ' ' Text 'vector' Name '<' Operator 'const' Keyword ' ' Text 'string' Name '*' Operator '>' Operator ' ' Text 'ASBeautifier' Name ':' Operator ':' Operator 'assignmentOperators' Name ';' Punctuation '\n' Text ' ' Text 'vector' Name '<' Operator 'const' Keyword ' ' Text 'string' Name '*' Operator '>' Operator ' ' Text 'ASBeautifier' Name ':' Operator ':' Operator 'nonAssignmentOperators' Name ';' Punctuation '\n' Text '\n' Text ' ' Text '/*\n * initialize the static vars\n */' Comment.Multiline '\n' Text ' ' Text 'void' Keyword.Type ' ' Text 'ASBeautifier' Name ':' Operator ':' Operator 'initStatic' Name '(' Punctuation ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'calledInitStatic' Name ')' Punctuation '\n' Text ' ' Text 'return' Keyword ';' Punctuation '\n' Text '\n' Text ' ' Text 'calledInitStatic' Name ' ' Text '=' Operator ' ' Text 'true' Name.Builtin ';' Punctuation '\n' Text '\n' Text ' ' Text 'headers' Name '.' Punctuation 'push_back' Name '(' Punctuation '&' Operator 'AS_IF' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'headers' Name '.' Punctuation 'push_back' Name '(' Punctuation '&' Operator 'AS_ELSE' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'headers' Name '.' Punctuation 'push_back' Name '(' Punctuation '&' Operator 'AS_FOR' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'headers' Name '.' Punctuation 'push_back' Name '(' Punctuation '&' Operator 'AS_WHILE' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'headers' Name '.' Punctuation 'push_back' Name '(' Punctuation '&' Operator 'AS_DO' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'headers' Name '.' Punctuation 'push_back' Name '(' Punctuation '&' Operator 'AS_TRY' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'headers' Name '.' Punctuation 'push_back' Name '(' Punctuation '&' Operator 'AS_CATCH' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'headers' Name '.' Punctuation 'push_back' Name '(' Punctuation '&' Operator 'AS_FINALLY' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'headers' Name '.' Punctuation 'push_back' Name '(' Punctuation '&' Operator 'AS_SYNCHRONIZED' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'headers' Name '.' Punctuation 'push_back' Name '(' Punctuation '&' Operator 'AS_SWITCH' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'headers' Name '.' Punctuation 'push_back' Name '(' Punctuation '&' Operator 'AS_CASE' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'headers' Name '.' Punctuation 'push_back' Name '(' Punctuation '&' Operator 'AS_DEFAULT' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'headers' Name '.' Punctuation 'push_back' Name '(' Punctuation '&' Operator 'AS_FOREACH' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'headers' Name '.' Punctuation 'push_back' Name '(' Punctuation '&' Operator 'AS_LOCK' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'headers' Name '.' Punctuation 'push_back' Name '(' Punctuation '&' Operator 'AS_UNSAFE' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'headers' Name '.' Punctuation 'push_back' Name '(' Punctuation '&' Operator 'AS_FIXED' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'headers' Name '.' Punctuation 'push_back' Name '(' Punctuation '&' Operator 'AS_GET' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'headers' Name '.' Punctuation 'push_back' Name '(' Punctuation '&' Operator 'AS_SET' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'headers' Name '.' Punctuation 'push_back' Name '(' Punctuation '&' Operator 'AS_ADD' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'headers' Name '.' Punctuation 'push_back' Name '(' Punctuation '&' Operator 'AS_REMOVE' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text '//headers.push_back(&AS_PUBLIC);\n' Comment.Single ' ' Text '//headers.push_back(&AS_PRIVATE);\n' Comment.Single ' ' Text '//headers.push_back(&AS_PROTECTED);\n' Comment.Single '\n' Text ' ' Text '//headers.push_back(&AS_OPERATOR);\n' Comment.Single ' ' Text 'headers' Name '.' Punctuation 'push_back' Name '(' Punctuation '&' Operator 'AS_TEMPLATE' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'headers' Name '.' Punctuation 'push_back' Name '(' Punctuation '&' Operator 'AS_CONST' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text '/**/' Comment.Multiline '\n' Text ' ' Text 'headers' Name '.' Punctuation 'push_back' Name '(' Punctuation '&' Operator 'AS_STATIC' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'headers' Name '.' Punctuation 'push_back' Name '(' Punctuation '&' Operator 'AS_EXTERN' Name ')' Punctuation ';' Punctuation '\n' Text '\n' Text ' ' Text 'nonParenHeaders' Name '.' Punctuation 'push_back' Name '(' Punctuation '&' Operator 'AS_ELSE' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'nonParenHeaders' Name '.' Punctuation 'push_back' Name '(' Punctuation '&' Operator 'AS_DO' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'nonParenHeaders' Name '.' Punctuation 'push_back' Name '(' Punctuation '&' Operator 'AS_TRY' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'nonParenHeaders' Name '.' Punctuation 'push_back' Name '(' Punctuation '&' Operator 'AS_FINALLY' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'nonParenHeaders' Name '.' Punctuation 'push_back' Name '(' Punctuation '&' Operator 'AS_STATIC' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'nonParenHeaders' Name '.' Punctuation 'push_back' Name '(' Punctuation '&' Operator 'AS_CONST' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'nonParenHeaders' Name '.' Punctuation 'push_back' Name '(' Punctuation '&' Operator 'AS_EXTERN' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'nonParenHeaders' Name '.' Punctuation 'push_back' Name '(' Punctuation '&' Operator 'AS_CASE' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'nonParenHeaders' Name '.' Punctuation 'push_back' Name '(' Punctuation '&' Operator 'AS_DEFAULT' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'nonParenHeaders' Name '.' Punctuation 'push_back' Name '(' Punctuation '&' Operator 'AS_UNSAFE' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'nonParenHeaders' Name '.' Punctuation 'push_back' Name '(' Punctuation '&' Operator 'AS_GET' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'nonParenHeaders' Name '.' Punctuation 'push_back' Name '(' Punctuation '&' Operator 'AS_SET' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'nonParenHeaders' Name '.' Punctuation 'push_back' Name '(' Punctuation '&' Operator 'AS_ADD' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'nonParenHeaders' Name '.' Punctuation 'push_back' Name '(' Punctuation '&' Operator 'AS_REMOVE' Name ')' Punctuation ';' Punctuation '\n' Text '\n' Text '\n' Text '\n' Text ' ' Text 'nonParenHeaders' Name '.' Punctuation 'push_back' Name '(' Punctuation '&' Operator 'AS_PUBLIC' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'nonParenHeaders' Name '.' Punctuation 'push_back' Name '(' Punctuation '&' Operator 'AS_PRIVATE' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'nonParenHeaders' Name '.' Punctuation 'push_back' Name '(' Punctuation '&' Operator 'AS_PROTECTED' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'nonParenHeaders' Name '.' Punctuation 'push_back' Name '(' Punctuation '&' Operator 'AS_TEMPLATE' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'nonParenHeaders' Name '.' Punctuation 'push_back' Name '(' Punctuation '&' Operator 'AS_CONST' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text '/// nonParenHeaders.push_back(&AS_ASM);\n' Comment.Single '\n' Text ' ' Text 'preBlockStatements' Name '.' Punctuation 'push_back' Name '(' Punctuation '&' Operator 'AS_CLASS' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'preBlockStatements' Name '.' Punctuation 'push_back' Name '(' Punctuation '&' Operator 'AS_STRUCT' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'preBlockStatements' Name '.' Punctuation 'push_back' Name '(' Punctuation '&' Operator 'AS_UNION' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'preBlockStatements' Name '.' Punctuation 'push_back' Name '(' Punctuation '&' Operator 'AS_INTERFACE' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'preBlockStatements' Name '.' Punctuation 'push_back' Name '(' Punctuation '&' Operator 'AS_NAMESPACE' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'preBlockStatements' Name '.' Punctuation 'push_back' Name '(' Punctuation '&' Operator 'AS_THROWS' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'preBlockStatements' Name '.' Punctuation 'push_back' Name '(' Punctuation '&' Operator 'AS_EXTERN' Name ')' Punctuation ';' Punctuation '\n' Text '\n' Text ' ' Text 'assignmentOperators' Name '.' Punctuation 'push_back' Name '(' Punctuation '&' Operator 'AS_ASSIGN' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'assignmentOperators' Name '.' Punctuation 'push_back' Name '(' Punctuation '&' Operator 'AS_PLUS_ASSIGN' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'assignmentOperators' Name '.' Punctuation 'push_back' Name '(' Punctuation '&' Operator 'AS_MINUS_ASSIGN' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'assignmentOperators' Name '.' Punctuation 'push_back' Name '(' Punctuation '&' Operator 'AS_MULT_ASSIGN' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'assignmentOperators' Name '.' Punctuation 'push_back' Name '(' Punctuation '&' Operator 'AS_DIV_ASSIGN' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'assignmentOperators' Name '.' Punctuation 'push_back' Name '(' Punctuation '&' Operator 'AS_MOD_ASSIGN' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'assignmentOperators' Name '.' Punctuation 'push_back' Name '(' Punctuation '&' Operator 'AS_OR_ASSIGN' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'assignmentOperators' Name '.' Punctuation 'push_back' Name '(' Punctuation '&' Operator 'AS_AND_ASSIGN' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'assignmentOperators' Name '.' Punctuation 'push_back' Name '(' Punctuation '&' Operator 'AS_XOR_ASSIGN' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'assignmentOperators' Name '.' Punctuation 'push_back' Name '(' Punctuation '&' Operator 'AS_GR_GR_GR_ASSIGN' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'assignmentOperators' Name '.' Punctuation 'push_back' Name '(' Punctuation '&' Operator 'AS_GR_GR_ASSIGN' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'assignmentOperators' Name '.' Punctuation 'push_back' Name '(' Punctuation '&' Operator 'AS_LS_LS_LS_ASSIGN' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'assignmentOperators' Name '.' Punctuation 'push_back' Name '(' Punctuation '&' Operator 'AS_LS_LS_ASSIGN' Name ')' Punctuation ';' Punctuation '\n' Text '\n' Text ' ' Text 'assignmentOperators' Name '.' Punctuation 'push_back' Name '(' Punctuation '&' Operator 'AS_RETURN' Name ')' Punctuation ';' Punctuation '\n' Text '\n' Text ' ' Text 'nonAssignmentOperators' Name '.' Punctuation 'push_back' Name '(' Punctuation '&' Operator 'AS_EQUAL' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'nonAssignmentOperators' Name '.' Punctuation 'push_back' Name '(' Punctuation '&' Operator 'AS_PLUS_PLUS' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'nonAssignmentOperators' Name '.' Punctuation 'push_back' Name '(' Punctuation '&' Operator 'AS_MINUS_MINUS' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'nonAssignmentOperators' Name '.' Punctuation 'push_back' Name '(' Punctuation '&' Operator 'AS_NOT_EQUAL' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'nonAssignmentOperators' Name '.' Punctuation 'push_back' Name '(' Punctuation '&' Operator 'AS_GR_EQUAL' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'nonAssignmentOperators' Name '.' Punctuation 'push_back' Name '(' Punctuation '&' Operator 'AS_GR_GR_GR' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'nonAssignmentOperators' Name '.' Punctuation 'push_back' Name '(' Punctuation '&' Operator 'AS_GR_GR' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'nonAssignmentOperators' Name '.' Punctuation 'push_back' Name '(' Punctuation '&' Operator 'AS_LS_EQUAL' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'nonAssignmentOperators' Name '.' Punctuation 'push_back' Name '(' Punctuation '&' Operator 'AS_LS_LS_LS' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'nonAssignmentOperators' Name '.' Punctuation 'push_back' Name '(' Punctuation '&' Operator 'AS_LS_LS' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'nonAssignmentOperators' Name '.' Punctuation 'push_back' Name '(' Punctuation '&' Operator 'AS_ARROW' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'nonAssignmentOperators' Name '.' Punctuation 'push_back' Name '(' Punctuation '&' Operator 'AS_AND' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'nonAssignmentOperators' Name '.' Punctuation 'push_back' Name '(' Punctuation '&' Operator 'AS_OR' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text '\n' Text ' ' Text "/**\n * ASBeautifier's constructor\n */" Comment.Multiline '\n' Text ' ' Text 'ASBeautifier' Name ':' Operator ':' Operator 'ASBeautifier' Name '(' Punctuation ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'initStatic' Name '(' Punctuation ')' Punctuation ';' Punctuation '\n' Text '\n' Text ' ' Text 'waitingBeautifierStack' Name ' ' Text '=' Operator ' ' Text 'NULL' Name.Builtin ';' Punctuation '\n' Text ' ' Text 'activeBeautifierStack' Name ' ' Text '=' Operator ' ' Text 'NULL' Name.Builtin ';' Punctuation '\n' Text ' ' Text 'waitingBeautifierStackLengthStack' Name ' ' Text '=' Operator ' ' Text 'NULL' Name.Builtin ';' Punctuation '\n' Text ' ' Text 'activeBeautifierStackLengthStack' Name ' ' Text '=' Operator ' ' Text 'NULL' Name.Builtin ';' Punctuation '\n' Text '\n' Text ' ' Text 'headerStack' Name ' ' Text '=' Operator ' ' Text 'NULL' Name.Builtin ';' Punctuation '\n' Text ' ' Text 'tempStacks' Name ' ' Text '=' Operator ' ' Text 'NULL' Name.Builtin ';' Punctuation '\n' Text ' ' Text 'blockParenDepthStack' Name ' ' Text '=' Operator ' ' Text 'NULL' Name.Builtin ';' Punctuation '\n' Text ' ' Text 'blockStatementStack' Name ' ' Text '=' Operator ' ' Text 'NULL' Name.Builtin ';' Punctuation '\n' Text ' ' Text 'parenStatementStack' Name ' ' Text '=' Operator ' ' Text 'NULL' Name.Builtin ';' Punctuation '\n' Text ' ' Text 'bracketBlockStateStack' Name ' ' Text '=' Operator ' ' Text 'NULL' Name.Builtin ';' Punctuation '\n' Text ' ' Text 'inStatementIndentStack' Name ' ' Text '=' Operator ' ' Text 'NULL' Name.Builtin ';' Punctuation '\n' Text ' ' Text 'inStatementIndentStackSizeStack' Name ' ' Text '=' Operator ' ' Text 'NULL' Name.Builtin ';' Punctuation '\n' Text ' ' Text 'parenIndentStack' Name ' ' Text '=' Operator ' ' Text 'NULL' Name.Builtin ';' Punctuation '\n' Text ' ' Text 'sourceIterator' Name ' ' Text '=' Operator ' ' Text 'NULL' Name.Builtin ';' Punctuation '\n' Text '\n' Text ' ' Text 'isMinimalConditinalIndentSet' Name ' ' Text '=' Operator ' ' Text 'false' Name.Builtin ';' Punctuation '\n' Text ' ' Text 'shouldForceTabIndentation' Name ' ' Text '=' Operator ' ' Text 'false' Name.Builtin ';' Punctuation '\n' Text '\n' Text ' ' Text 'setSpaceIndentation' Name '(' Punctuation '4' Literal.Number.Integer ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'setMaxInStatementIndentLength' Name '(' Punctuation '40' Literal.Number.Integer ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'setClassIndent' Name '(' Punctuation 'false' Name.Builtin ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'setSwitchIndent' Name '(' Punctuation 'false' Name.Builtin ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'setCaseIndent' Name '(' Punctuation 'false' Name.Builtin ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'setBlockIndent' Name '(' Punctuation 'false' Name.Builtin ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'setBracketIndent' Name '(' Punctuation 'false' Name.Builtin ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'setNamespaceIndent' Name '(' Punctuation 'false' Name.Builtin ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'setLabelIndent' Name '(' Punctuation 'false' Name.Builtin ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'setEmptyLineFill' Name '(' Punctuation 'false' Name.Builtin ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'setCStyle' Name '(' Punctuation ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'setPreprocessorIndent' Name '(' Punctuation 'false' Name.Builtin ')' Punctuation ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text '\n' Text ' ' Text 'ASBeautifier' Name ':' Operator ':' Operator 'ASBeautifier' Name '(' Punctuation 'const' Keyword ' ' Text 'ASBeautifier' Name ' ' Text '&' Operator 'other' Name ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'waitingBeautifierStack' Name ' ' Text '=' Operator ' ' Text 'NULL' Name.Builtin ';' Punctuation '\n' Text ' ' Text 'activeBeautifierStack' Name ' ' Text '=' Operator ' ' Text 'NULL' Name.Builtin ';' Punctuation '\n' Text ' ' Text 'waitingBeautifierStackLengthStack' Name ' ' Text '=' Operator ' ' Text 'NULL' Name.Builtin ';' Punctuation '\n' Text ' ' Text 'activeBeautifierStackLengthStack' Name ' ' Text '=' Operator ' ' Text 'NULL' Name.Builtin ';' Punctuation '\n' Text '\n' Text ' ' Text 'headerStack' Name ' ' Text '=' Operator ' ' Text 'new' Keyword ' ' Text 'vector' Name '<' Operator 'const' Keyword ' ' Text 'string' Name '*' Operator '>' Operator ';' Punctuation '\n' Text ' ' Text '*' Operator 'headerStack' Name ' ' Text '=' Operator ' ' Text '*' Operator 'other' Name '.' Punctuation 'headerStack' Name ';' Punctuation '\n' Text '\n' Text ' ' Text 'tempStacks' Name ' ' Text '=' Operator ' ' Text 'new' Keyword ' ' Text 'vector' Name '<' Operator ' ' Text 'vector' Name '<' Operator 'const' Keyword ' ' Text 'string' Name '*' Operator '>' Operator '*' Operator ' ' Text '>' Operator ';' Punctuation '\n' Text ' ' Text 'vector' Name '<' Operator ' ' Text 'vector' Name '<' Operator 'const' Keyword ' ' Text 'string' Name '*' Operator '>' Operator '*' Operator ' ' Text '>' Operator ':' Operator ':' Operator 'iterator' Name ' ' Text 'iter' Name ';' Punctuation '\n' Text ' ' Text 'for' Keyword ' ' Text '(' Punctuation 'iter' Name ' ' Text '=' Operator ' ' Text 'other' Name '.' Punctuation 'tempStacks' Name '-' Operator '>' Operator 'begin' Name '(' Punctuation ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'iter' Name ' ' Text '!' Operator '=' Operator ' ' Text 'other' Name '.' Punctuation 'tempStacks' Name '-' Operator '>' Operator 'end' Name '(' Punctuation ')' Punctuation ';' Punctuation '\n' Text ' ' Text '+' Operator '+' Operator 'iter' Name ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'vector' Name '<' Operator 'const' Keyword ' ' Text 'string' Name '*' Operator '>' Operator ' ' Text '*' Operator 'newVec' Name ' ' Text '=' Operator ' ' Text 'new' Keyword ' ' Text 'vector' Name '<' Operator 'const' Keyword ' ' Text 'string' Name '*' Operator '>' Operator ';' Punctuation '\n' Text ' ' Text '*' Operator 'newVec' Name ' ' Text '=' Operator ' ' Text '*' Operator '*' Operator 'iter' Name ';' Punctuation '\n' Text ' ' Text 'tempStacks' Name '-' Operator '>' Operator 'push_back' Name '(' Punctuation 'newVec' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text ' ' Text 'blockParenDepthStack' Name ' ' Text '=' Operator ' ' Text 'new' Keyword ' ' Text 'vector' Name '<' Operator 'int' Keyword.Type '>' Operator ';' Punctuation '\n' Text ' ' Text '*' Operator 'blockParenDepthStack' Name ' ' Text '=' Operator ' ' Text '*' Operator 'other' Name '.' Punctuation 'blockParenDepthStack' Name ';' Punctuation '\n' Text '\n' Text ' ' Text 'blockStatementStack' Name ' ' Text '=' Operator ' ' Text 'new' Keyword ' ' Text 'vector' Name '<' Operator 'bool' Keyword.Type '>' Operator ';' Punctuation '\n' Text ' ' Text '*' Operator 'blockStatementStack' Name ' ' Text '=' Operator ' ' Text '*' Operator 'other' Name '.' Punctuation 'blockStatementStack' Name ';' Punctuation '\n' Text '\n' Text ' ' Text 'parenStatementStack' Name ' ' Text '=' Operator ' ' Text 'new' Keyword ' ' Text 'vector' Name '<' Operator 'bool' Keyword.Type '>' Operator ';' Punctuation '\n' Text ' ' Text '*' Operator 'parenStatementStack' Name ' ' Text '=' Operator ' ' Text '*' Operator 'other' Name '.' Punctuation 'parenStatementStack' Name ';' Punctuation '\n' Text '\n' Text ' ' Text 'bracketBlockStateStack' Name ' ' Text '=' Operator ' ' Text 'new' Keyword ' ' Text 'vector' Name '<' Operator 'bool' Keyword.Type '>' Operator ';' Punctuation '\n' Text ' ' Text '*' Operator 'bracketBlockStateStack' Name ' ' Text '=' Operator ' ' Text '*' Operator 'other' Name '.' Punctuation 'bracketBlockStateStack' Name ';' Punctuation '\n' Text '\n' Text ' ' Text 'inStatementIndentStack' Name ' ' Text '=' Operator ' ' Text 'new' Keyword ' ' Text 'vector' Name '<' Operator 'int' Keyword.Type '>' Operator ';' Punctuation '\n' Text ' ' Text '*' Operator 'inStatementIndentStack' Name ' ' Text '=' Operator ' ' Text '*' Operator 'other' Name '.' Punctuation 'inStatementIndentStack' Name ';' Punctuation '\n' Text '\n' Text ' ' Text 'inStatementIndentStackSizeStack' Name ' ' Text '=' Operator ' ' Text 'new' Keyword ' ' Text 'vector' Name '<' Operator 'int' Keyword.Type '>' Operator ';' Punctuation '\n' Text ' ' Text '*' Operator 'inStatementIndentStackSizeStack' Name ' ' Text '=' Operator ' ' Text '*' Operator 'other' Name '.' Punctuation 'inStatementIndentStackSizeStack' Name ';' Punctuation '\n' Text '\n' Text ' ' Text 'parenIndentStack' Name ' ' Text '=' Operator ' ' Text 'new' Keyword ' ' Text 'vector' Name '<' Operator 'int' Keyword.Type '>' Operator ';' Punctuation '\n' Text ' ' Text '*' Operator 'parenIndentStack' Name ' ' Text '=' Operator ' ' Text '*' Operator 'other' Name '.' Punctuation 'parenIndentStack' Name ';' Punctuation '\n' Text '\n' Text ' ' Text 'sourceIterator' Name ' ' Text '=' Operator ' ' Text 'other' Name '.' Punctuation 'sourceIterator' Name ';' Punctuation '\n' Text '\n' Text ' ' Text 'indentString' Name ' ' Text '=' Operator ' ' Text 'other' Name '.' Punctuation 'indentString' Name ';' Punctuation '\n' Text ' ' Text 'currentHeader' Name ' ' Text '=' Operator ' ' Text 'other' Name '.' Punctuation 'currentHeader' Name ';' Punctuation '\n' Text ' ' Text 'previousLastLineHeader' Name ' ' Text '=' Operator ' ' Text 'other' Name '.' Punctuation 'previousLastLineHeader' Name ';' Punctuation '\n' Text ' ' Text 'immediatelyPreviousAssignmentOp' Name ' ' Text '=' Operator ' ' Text 'other' Name '.' Punctuation 'immediatelyPreviousAssignmentOp' Name ';' Punctuation '\n' Text ' ' Text 'isInQuote' Name ' ' Text '=' Operator ' ' Text 'other' Name '.' Punctuation 'isInQuote' Name ';' Punctuation '\n' Text ' ' Text 'isInComment' Name ' ' Text '=' Operator ' ' Text 'other' Name '.' Punctuation 'isInComment' Name ';' Punctuation '\n' Text ' ' Text 'isInCase' Name ' ' Text '=' Operator ' ' Text 'other' Name '.' Punctuation 'isInCase' Name ';' Punctuation '\n' Text ' ' Text 'isInQuestion' Name ' ' Text '=' Operator ' ' Text 'other' Name '.' Punctuation 'isInQuestion' Name ';' Punctuation '\n' Text ' ' Text 'isInStatement' Name ' ' Text '=' Operator 'other' Name '.' Punctuation ' ' Text 'isInStatement' Name ';' Punctuation '\n' Text ' ' Text 'isInHeader' Name ' ' Text '=' Operator ' ' Text 'other' Name '.' Punctuation 'isInHeader' Name ';' Punctuation '\n' Text ' ' Text 'isCStyle' Name ' ' Text '=' Operator ' ' Text 'other' Name '.' Punctuation 'isCStyle' Name ';' Punctuation '\n' Text ' ' Text 'isInOperator' Name ' ' Text '=' Operator ' ' Text 'other' Name '.' Punctuation 'isInOperator' Name ';' Punctuation '\n' Text ' ' Text 'isInTemplate' Name ' ' Text '=' Operator ' ' Text 'other' Name '.' Punctuation 'isInTemplate' Name ';' Punctuation '\n' Text ' ' Text 'isInConst' Name ' ' Text '=' Operator ' ' Text 'other' Name '.' Punctuation 'isInConst' Name ';' Punctuation '\n' Text ' ' Text 'classIndent' Name ' ' Text '=' Operator ' ' Text 'other' Name '.' Punctuation 'classIndent' Name ';' Punctuation '\n' Text ' ' Text 'isInClassHeader' Name ' ' Text '=' Operator ' ' Text 'other' Name '.' Punctuation 'isInClassHeader' Name ';' Punctuation '\n' Text ' ' Text 'isInClassHeaderTab' Name ' ' Text '=' Operator ' ' Text 'other' Name '.' Punctuation 'isInClassHeaderTab' Name ';' Punctuation '\n' Text ' ' Text 'switchIndent' Name ' ' Text '=' Operator ' ' Text 'other' Name '.' Punctuation 'switchIndent' Name ';' Punctuation '\n' Text ' ' Text 'caseIndent' Name ' ' Text '=' Operator ' ' Text 'other' Name '.' Punctuation 'caseIndent' Name ';' Punctuation '\n' Text ' ' Text 'namespaceIndent' Name ' ' Text '=' Operator ' ' Text 'other' Name '.' Punctuation 'namespaceIndent' Name ';' Punctuation '\n' Text ' ' Text 'bracketIndent' Name ' ' Text '=' Operator ' ' Text 'other' Name '.' Punctuation 'bracketIndent' Name ';' Punctuation '\n' Text ' ' Text 'blockIndent' Name ' ' Text '=' Operator ' ' Text 'other' Name '.' Punctuation 'blockIndent' Name ';' Punctuation '\n' Text ' ' Text 'labelIndent' Name ' ' Text '=' Operator ' ' Text 'other' Name '.' Punctuation 'labelIndent' Name ';' Punctuation '\n' Text ' ' Text 'preprocessorIndent' Name ' ' Text '=' Operator ' ' Text 'other' Name '.' Punctuation 'preprocessorIndent' Name ';' Punctuation '\n' Text ' ' Text 'parenDepth' Name ' ' Text '=' Operator ' ' Text 'other' Name '.' Punctuation 'parenDepth' Name ';' Punctuation '\n' Text ' ' Text 'indentLength' Name ' ' Text '=' Operator ' ' Text 'other' Name '.' Punctuation 'indentLength' Name ';' Punctuation '\n' Text ' ' Text 'blockTabCount' Name ' ' Text '=' Operator ' ' Text 'other' Name '.' Punctuation 'blockTabCount' Name ';' Punctuation '\n' Text ' ' Text 'leadingWhiteSpaces' Name ' ' Text '=' Operator ' ' Text 'other' Name '.' Punctuation 'leadingWhiteSpaces' Name ';' Punctuation '\n' Text ' ' Text 'maxInStatementIndent' Name ' ' Text '=' Operator ' ' Text 'other' Name '.' Punctuation 'maxInStatementIndent' Name ';' Punctuation '\n' Text ' ' Text 'templateDepth' Name ' ' Text '=' Operator ' ' Text 'other' Name '.' Punctuation 'templateDepth' Name ';' Punctuation '\n' Text ' ' Text 'quoteChar' Name ' ' Text '=' Operator ' ' Text 'other' Name '.' Punctuation 'quoteChar' Name ';' Punctuation '\n' Text ' ' Text 'prevNonSpaceCh' Name ' ' Text '=' Operator ' ' Text 'other' Name '.' Punctuation 'prevNonSpaceCh' Name ';' Punctuation '\n' Text ' ' Text 'currentNonSpaceCh' Name ' ' Text '=' Operator ' ' Text 'other' Name '.' Punctuation 'currentNonSpaceCh' Name ';' Punctuation '\n' Text ' ' Text 'currentNonLegalCh' Name ' ' Text '=' Operator ' ' Text 'other' Name '.' Punctuation 'currentNonLegalCh' Name ';' Punctuation '\n' Text ' ' Text 'prevNonLegalCh' Name ' ' Text '=' Operator ' ' Text 'other' Name '.' Punctuation 'prevNonLegalCh' Name ';' Punctuation '\n' Text ' ' Text 'isInConditional' Name ' ' Text '=' Operator ' ' Text 'other' Name '.' Punctuation 'isInConditional' Name ';' Punctuation '\n' Text ' ' Text 'minConditionalIndent' Name ' ' Text '=' Operator ' ' Text 'other' Name '.' Punctuation 'minConditionalIndent' Name ';' Punctuation '\n' Text ' ' Text 'prevFinalLineSpaceTabCount' Name ' ' Text '=' Operator ' ' Text 'other' Name '.' Punctuation 'prevFinalLineSpaceTabCount' Name ';' Punctuation '\n' Text ' ' Text 'prevFinalLineTabCount' Name ' ' Text '=' Operator ' ' Text 'other' Name '.' Punctuation 'prevFinalLineTabCount' Name ';' Punctuation '\n' Text ' ' Text 'emptyLineFill' Name ' ' Text '=' Operator ' ' Text 'other' Name '.' Punctuation 'emptyLineFill' Name ';' Punctuation '\n' Text ' ' Text 'probationHeader' Name ' ' Text '=' Operator ' ' Text 'other' Name '.' Punctuation 'probationHeader' Name ';' Punctuation '\n' Text ' ' Text 'isInDefine' Name ' ' Text '=' Operator ' ' Text 'other' Name '.' Punctuation 'isInDefine' Name ';' Punctuation '\n' Text ' ' Text 'isInDefineDefinition' Name ' ' Text '=' Operator ' ' Text 'other' Name '.' Punctuation 'isInDefineDefinition' Name ';' Punctuation '\n' Text ' ' Text 'backslashEndsPrevLine' Name ' ' Text '=' Operator ' ' Text 'other' Name '.' Punctuation 'backslashEndsPrevLine' Name ';' Punctuation '\n' Text ' ' Text 'defineTabCount' Name ' ' Text '=' Operator ' ' Text 'other' Name '.' Punctuation 'defineTabCount' Name ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text '\n' Text ' ' Text "/**\n * ASBeautifier's destructor\n */" Comment.Multiline '\n' Text ' ' Text 'ASBeautifier' Name ':' Operator ':' Operator '~' Operator 'ASBeautifier' Name '(' Punctuation ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'DELETE_CONTAINER' Name '(' Punctuation ' ' Text 'headerStack' Name ' ' Text ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'DELETE_CONTAINER' Name '(' Punctuation ' ' Text 'tempStacks' Name ' ' Text ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'DELETE_CONTAINER' Name '(' Punctuation ' ' Text 'blockParenDepthStack' Name ' ' Text ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'DELETE_CONTAINER' Name '(' Punctuation ' ' Text 'blockStatementStack' Name ' ' Text ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'DELETE_CONTAINER' Name '(' Punctuation ' ' Text 'parenStatementStack' Name ' ' Text ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'DELETE_CONTAINER' Name '(' Punctuation ' ' Text 'bracketBlockStateStack' Name ' ' Text ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'DELETE_CONTAINER' Name '(' Punctuation ' ' Text 'inStatementIndentStack' Name ' ' Text ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'DELETE_CONTAINER' Name '(' Punctuation ' ' Text 'inStatementIndentStackSizeStack' Name ' ' Text ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'DELETE_CONTAINER' Name '(' Punctuation ' ' Text 'parenIndentStack' Name ' ' Text ')' Punctuation ';' Punctuation '\n' Text '\n' Text ' ' Text '// DELETE_CONTAINER( sourceIterator );\n' Comment.Single ' ' Text '}' Punctuation '\n' Text '\n' Text ' ' Text "/**\n * initialize the ASBeautifier.\n *\n * init() should be called every time a ABeautifier object is to start\n * beautifying a NEW source file.\n * init() recieves a pointer to a DYNAMICALLY CREATED ASSourceIterator object\n * that will be used to iterate through the source code. This object will be\n * deleted during the ASBeautifier's destruction, and thus should not be\n * deleted elsewhere.\n *\n * @param iter a pointer to the DYNAMICALLY CREATED ASSourceIterator object.\n */" Comment.Multiline '\n' Text ' ' Text 'void' Keyword.Type ' ' Text 'ASBeautifier' Name ':' Operator ':' Operator 'init' Name '(' Punctuation 'ASSourceIterator' Name ' ' Text '*' Operator 'iter' Name ')' Punctuation '\n' Text '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'sourceIterator' Name ' ' Text '=' Operator ' ' Text 'iter' Name ';' Punctuation '\n' Text ' ' Text 'init' Name '(' Punctuation ')' Punctuation ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text '\n' Text ' ' Text '/**\n * initialize the ASBeautifier.\n */' Comment.Multiline '\n' Text ' ' Text 'void' Keyword.Type ' ' Text 'ASBeautifier' Name ':' Operator ':' Operator 'init' Name '(' Punctuation ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'INIT_CONTAINER' Name '(' Punctuation ' ' Text 'waitingBeautifierStack' Name ',' Punctuation ' ' Text 'new' Keyword ' ' Text 'vector' Name '<' Operator 'ASBeautifier' Name '*' Operator '>' Operator ' ' Text ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'INIT_CONTAINER' Name '(' Punctuation ' ' Text 'activeBeautifierStack' Name ',' Punctuation ' ' Text 'new' Keyword ' ' Text 'vector' Name '<' Operator 'ASBeautifier' Name '*' Operator '>' Operator ' ' Text ')' Punctuation ';' Punctuation '\n' Text '\n' Text ' ' Text 'INIT_CONTAINER' Name '(' Punctuation ' ' Text 'waitingBeautifierStackLengthStack' Name ',' Punctuation ' ' Text 'new' Keyword ' ' Text 'vector' Name '<' Operator 'int' Keyword.Type '>' Operator ' ' Text ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'INIT_CONTAINER' Name '(' Punctuation ' ' Text 'activeBeautifierStackLengthStack' Name ',' Punctuation ' ' Text 'new' Keyword ' ' Text 'vector' Name '<' Operator 'int' Keyword.Type '>' Operator ' ' Text ')' Punctuation ';' Punctuation '\n' Text '\n' Text ' ' Text 'INIT_CONTAINER' Name '(' Punctuation ' ' Text 'headerStack' Name ',' Punctuation ' ' Text 'new' Keyword ' ' Text 'vector' Name '<' Operator 'const' Keyword ' ' Text 'string' Name '*' Operator '>' Operator ' ' Text ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'INIT_CONTAINER' Name '(' Punctuation ' ' Text 'tempStacks' Name ',' Punctuation ' ' Text 'new' Keyword ' ' Text 'vector' Name '<' Operator ' ' Text 'vector' Name '<' Operator 'const' Keyword ' ' Text 'string' Name '*' Operator '>' Operator '*' Operator ' ' Text '>' Operator ' ' Text ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'tempStacks' Name '-' Operator '>' Operator 'push_back' Name '(' Punctuation 'new' Keyword ' ' Text 'vector' Name '<' Operator 'const' Keyword ' ' Text 'string' Name '*' Operator '>' Operator ')' Punctuation ';' Punctuation '\n' Text '\n' Text ' ' Text 'INIT_CONTAINER' Name '(' Punctuation ' ' Text 'blockParenDepthStack' Name ',' Punctuation ' ' Text 'new' Keyword ' ' Text 'vector' Name '<' Operator 'int' Keyword.Type '>' Operator ' ' Text ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'INIT_CONTAINER' Name '(' Punctuation ' ' Text 'blockStatementStack' Name ',' Punctuation ' ' Text 'new' Keyword ' ' Text 'vector' Name '<' Operator 'bool' Keyword.Type '>' Operator ' ' Text ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'INIT_CONTAINER' Name '(' Punctuation ' ' Text 'parenStatementStack' Name ',' Punctuation ' ' Text 'new' Keyword ' ' Text 'vector' Name '<' Operator 'bool' Keyword.Type '>' Operator ' ' Text ')' Punctuation ';' Punctuation '\n' Text '\n' Text ' ' Text 'INIT_CONTAINER' Name '(' Punctuation ' ' Text 'bracketBlockStateStack' Name ',' Punctuation ' ' Text 'new' Keyword ' ' Text 'vector' Name '<' Operator 'bool' Keyword.Type '>' Operator ' ' Text ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'bracketBlockStateStack' Name '-' Operator '>' Operator 'push_back' Name '(' Punctuation 'true' Name.Builtin ')' Punctuation ';' Punctuation '\n' Text '\n' Text ' ' Text 'INIT_CONTAINER' Name '(' Punctuation ' ' Text 'inStatementIndentStack' Name ',' Punctuation ' ' Text 'new' Keyword ' ' Text 'vector' Name '<' Operator 'int' Keyword.Type '>' Operator ' ' Text ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'INIT_CONTAINER' Name '(' Punctuation ' ' Text 'inStatementIndentStackSizeStack' Name ',' Punctuation ' ' Text 'new' Keyword ' ' Text 'vector' Name '<' Operator 'int' Keyword.Type '>' Operator ' ' Text ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'inStatementIndentStackSizeStack' Name '-' Operator '>' Operator 'push_back' Name '(' Punctuation '0' Literal.Number.Integer ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'INIT_CONTAINER' Name '(' Punctuation ' ' Text 'parenIndentStack' Name ',' Punctuation ' ' Text 'new' Keyword ' ' Text 'vector' Name '<' Operator 'int' Keyword.Type '>' Operator ' ' Text ')' Punctuation ';' Punctuation '\n' Text '\n' Text ' ' Text 'immediatelyPreviousAssignmentOp' Name ' ' Text '=' Operator ' ' Text 'NULL' Name.Builtin ';' Punctuation '\n' Text ' ' Text 'previousLastLineHeader' Name ' ' Text '=' Operator ' ' Text 'NULL' Name.Builtin ';' Punctuation '\n' Text '\n' Text ' ' Text 'isInQuote' Name ' ' Text '=' Operator ' ' Text 'false' Name.Builtin ';' Punctuation '\n' Text ' ' Text 'isInComment' Name ' ' Text '=' Operator ' ' Text 'false' Name.Builtin ';' Punctuation '\n' Text ' ' Text 'isInStatement' Name ' ' Text '=' Operator ' ' Text 'false' Name.Builtin ';' Punctuation '\n' Text ' ' Text 'isInCase' Name ' ' Text '=' Operator ' ' Text 'false' Name.Builtin ';' Punctuation '\n' Text ' ' Text 'isInQuestion' Name ' ' Text '=' Operator ' ' Text 'false' Name.Builtin ';' Punctuation '\n' Text ' ' Text 'isInClassHeader' Name ' ' Text '=' Operator ' ' Text 'false' Name.Builtin ';' Punctuation '\n' Text ' ' Text 'isInClassHeaderTab' Name ' ' Text '=' Operator ' ' Text 'false' Name.Builtin ';' Punctuation '\n' Text ' ' Text 'isInHeader' Name ' ' Text '=' Operator ' ' Text 'false' Name.Builtin ';' Punctuation '\n' Text ' ' Text 'isInOperator' Name ' ' Text '=' Operator ' ' Text 'false' Name.Builtin ';' Punctuation '\n' Text ' ' Text 'isInTemplate' Name ' ' Text '=' Operator ' ' Text 'false' Name.Builtin ';' Punctuation '\n' Text ' ' Text 'isInConst' Name ' ' Text '=' Operator ' ' Text 'false' Name.Builtin ';' Punctuation '\n' Text ' ' Text 'isInConditional' Name ' ' Text '=' Operator ' ' Text 'false' Name.Builtin ';' Punctuation '\n' Text ' ' Text 'templateDepth' Name ' ' Text '=' Operator ' ' Text '0' Literal.Number.Integer ';' Punctuation '\n' Text ' ' Text 'parenDepth' Name '=' Operator '0' Literal.Number.Integer ';' Punctuation '\n' Text ' ' Text 'blockTabCount' Name ' ' Text '=' Operator ' ' Text '0' Literal.Number.Integer ';' Punctuation '\n' Text ' ' Text 'leadingWhiteSpaces' Name ' ' Text '=' Operator ' ' Text '0' Literal.Number.Integer ';' Punctuation '\n' Text ' ' Text 'prevNonSpaceCh' Name ' ' Text '=' Operator ' ' Text "'" Literal.String.Char '{' Literal.String.Char "'" Literal.String.Char ';' Punctuation '\n' Text ' ' Text 'currentNonSpaceCh' Name ' ' Text '=' Operator ' ' Text "'" Literal.String.Char '{' Literal.String.Char "'" Literal.String.Char ';' Punctuation '\n' Text ' ' Text 'prevNonLegalCh' Name ' ' Text '=' Operator ' ' Text "'" Literal.String.Char '{' Literal.String.Char "'" Literal.String.Char ';' Punctuation '\n' Text ' ' Text 'currentNonLegalCh' Name ' ' Text '=' Operator ' ' Text "'" Literal.String.Char '{' Literal.String.Char "'" Literal.String.Char ';' Punctuation '\n' Text ' ' Text 'prevFinalLineSpaceTabCount' Name ' ' Text '=' Operator ' ' Text '0' Literal.Number.Integer ';' Punctuation '\n' Text ' ' Text 'prevFinalLineTabCount' Name ' ' Text '=' Operator ' ' Text '0' Literal.Number.Integer ';' Punctuation '\n' Text ' ' Text 'probationHeader' Name ' ' Text '=' Operator ' ' Text 'NULL' Name.Builtin ';' Punctuation '\n' Text ' ' Text 'backslashEndsPrevLine' Name ' ' Text '=' Operator ' ' Text 'false' Name.Builtin ';' Punctuation '\n' Text ' ' Text 'isInDefine' Name ' ' Text '=' Operator ' ' Text 'false' Name.Builtin ';' Punctuation '\n' Text ' ' Text 'isInDefineDefinition' Name ' ' Text '=' Operator ' ' Text 'false' Name.Builtin ';' Punctuation '\n' Text ' ' Text 'defineTabCount' Name ' ' Text '=' Operator ' ' Text '0' Literal.Number.Integer ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text '\n' Text ' ' Text '/**\n * set indentation style to ANSI C/C++. \n */' Comment.Multiline '\n' Text ' ' Text 'void' Keyword.Type ' ' Text 'ASBeautifier' Name ':' Operator ':' Operator 'setCStyle' Name '(' Punctuation ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'isCStyle' Name ' ' Text '=' Operator ' ' Text 'true' Name.Builtin ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text '\n' Text ' ' Text '/**\n * set indentation style to Java / K&R. \n */' Comment.Multiline '\n' Text ' ' Text 'void' Keyword.Type ' ' Text 'ASBeautifier' Name ':' Operator ':' Operator 'setJavaStyle' Name '(' Punctuation ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'isCStyle' Name ' ' Text '=' Operator ' ' Text 'false' Name.Builtin ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text '\n' Text ' ' Text '/**\n * indent using one tab per indentation\n */' Comment.Multiline '\n' Text ' ' Text 'void' Keyword.Type ' ' Text 'ASBeautifier' Name ':' Operator ':' Operator 'setTabIndentation' Name '(' Punctuation 'int' Keyword.Type ' ' Text 'length' Name ',' Punctuation ' ' Text 'bool' Keyword.Type ' ' Text 'forceTabs' Name ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'indentString' Name ' ' Text '=' Operator ' ' Text '"' Literal.String '\\t' Literal.String.Escape '"' Literal.String ';' Punctuation '\n' Text ' ' Text 'indentLength' Name ' ' Text '=' Operator ' ' Text 'length' Name ';' Punctuation '\n' Text ' ' Text 'shouldForceTabIndentation' Name ' ' Text '=' Operator ' ' Text 'forceTabs' Name ';' Punctuation '\n' Text '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation '!' Operator 'isMinimalConditinalIndentSet' Name ')' Punctuation '\n' Text ' ' Text 'minConditionalIndent' Name ' ' Text '=' Operator ' ' Text 'indentLength' Name ' ' Text '*' Operator ' ' Text '2' Literal.Number.Integer ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text '\n' Text ' ' Text '/**\n \n * indent using a number of spaces per indentation.\n *\n * @param length number of spaces per indent.\n */' Comment.Multiline '\n' Text ' ' Text 'void' Keyword.Type ' ' Text 'ASBeautifier' Name ':' Operator ':' Operator 'setSpaceIndentation' Name '(' Punctuation 'int' Keyword.Type ' ' Text 'length' Name ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'indentString' Name '=' Operator 'string' Name '(' Punctuation 'length' Name ',' Punctuation ' ' Text "'" Literal.String.Char ' ' Literal.String.Char "'" Literal.String.Char ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'indentLength' Name ' ' Text '=' Operator ' ' Text 'length' Name ';' Punctuation '\n' Text '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation '!' Operator 'isMinimalConditinalIndentSet' Name ')' Punctuation '\n' Text ' ' Text 'minConditionalIndent' Name ' ' Text '=' Operator ' ' Text 'indentLength' Name ' ' Text '*' Operator ' ' Text '2' Literal.Number.Integer ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text '\n' Text ' ' Text '/**\n * set the maximum indentation between two lines in a multi-line statement.\n *\n * @param max maximum indentation length.\n */' Comment.Multiline '\n' Text ' ' Text 'void' Keyword.Type ' ' Text 'ASBeautifier' Name ':' Operator ':' Operator 'setMaxInStatementIndentLength' Name '(' Punctuation 'int' Keyword.Type ' ' Text 'max' Name ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'maxInStatementIndent' Name ' ' Text '=' Operator ' ' Text 'max' Name ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text '\n' Text ' ' Text '/**\n * set the minimum indentation between two lines in a multi-line condition.\n *\n * @param min minimal indentation length.\n */' Comment.Multiline '\n' Text ' ' Text 'void' Keyword.Type ' ' Text 'ASBeautifier' Name ':' Operator ':' Operator 'setMinConditionalIndentLength' Name '(' Punctuation 'int' Keyword.Type ' ' Text 'min' Name ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'minConditionalIndent' Name ' ' Text '=' Operator ' ' Text 'min' Name ';' Punctuation '\n' Text ' ' Text 'isMinimalConditinalIndentSet' Name ' ' Text '=' Operator ' ' Text 'true' Name.Builtin ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text '\n' Text ' ' Text '/**\n * set the state of the bracket indentation option. If true, brackets will \n * be indented one additional indent.\n *\n * @param state state of option.\n */' Comment.Multiline '\n' Text ' ' Text 'void' Keyword.Type ' ' Text 'ASBeautifier' Name ':' Operator ':' Operator 'setBracketIndent' Name '(' Punctuation 'bool' Keyword.Type ' ' Text 'state' Name ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'bracketIndent' Name ' ' Text '=' Operator ' ' Text 'state' Name ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text '\n' Text ' ' Text '/**\n * set the state of the block indentation option. If true, entire blocks \n * will be indented one additional indent, similar to the GNU indent style.\n *\n * @param state state of option.\n */' Comment.Multiline '\n' Text ' ' Text 'void' Keyword.Type ' ' Text 'ASBeautifier' Name ':' Operator ':' Operator 'setBlockIndent' Name '(' Punctuation 'bool' Keyword.Type ' ' Text 'state' Name ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'state' Name ')' Punctuation '\n' Text ' ' Text 'setBracketIndent' Name '(' Punctuation 'false' Name.Builtin ')' Punctuation ';' Punctuation ' ' Text "// so that we don't have both bracket and block indent\n" Comment.Single ' ' Text 'blockIndent' Name ' ' Text '=' Operator ' ' Text 'state' Name ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text '\n' Text ' ' Text '/**\n * set the state of the class indentation option. If true, C++ class\n * definitions will be indented one additional indent.\n *\n * @param state state of option.\n */' Comment.Multiline '\n' Text ' ' Text 'void' Keyword.Type ' ' Text 'ASBeautifier' Name ':' Operator ':' Operator 'setClassIndent' Name '(' Punctuation 'bool' Keyword.Type ' ' Text 'state' Name ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'classIndent' Name ' ' Text '=' Operator ' ' Text 'state' Name ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text '\n' Text ' ' Text "/**\n * set the state of the switch indentation option. If true, blocks of 'switch' \n * statements will be indented one additional indent.\n *\n * @param state state of option.\n */" Comment.Multiline '\n' Text ' ' Text 'void' Keyword.Type ' ' Text 'ASBeautifier' Name ':' Operator ':' Operator 'setSwitchIndent' Name '(' Punctuation 'bool' Keyword.Type ' ' Text 'state' Name ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'switchIndent' Name ' ' Text '=' Operator ' ' Text 'state' Name ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text '\n' Text ' ' Text "/**\n * set the state of the case indentation option. If true, lines of 'case' \n * statements will be indented one additional indent.\n *\n * @param state state of option.\n */" Comment.Multiline '\n' Text ' ' Text 'void' Keyword.Type ' ' Text 'ASBeautifier' Name ':' Operator ':' Operator 'setCaseIndent' Name '(' Punctuation 'bool' Keyword.Type ' ' Text 'state' Name ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'caseIndent' Name ' ' Text '=' Operator ' ' Text 'state' Name ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text ' ' Text "/**\n * set the state of the namespace indentation option. \n * If true, blocks of 'namespace' statements will be indented one \n * additional indent. Otherwise, NO indentation will be added.\n *\n * @param state state of option.\n */" Comment.Multiline '\n' Text ' ' Text 'void' Keyword.Type ' ' Text 'ASBeautifier' Name ':' Operator ':' Operator 'setNamespaceIndent' Name '(' Punctuation 'bool' Keyword.Type ' ' Text 'state' Name ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'namespaceIndent' Name ' ' Text '=' Operator ' ' Text 'state' Name ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text '\n' Text ' ' Text '/**\n * set the state of the label indentation option. \n * If true, labels will be indented one indent LESS than the\n * current indentation level.\n * If false, labels will be flushed to the left with NO\n * indent at all.\n *\n * @param state state of option.\n */' Comment.Multiline '\n' Text ' ' Text 'void' Keyword.Type ' ' Text 'ASBeautifier' Name ':' Operator ':' Operator 'setLabelIndent' Name '(' Punctuation 'bool' Keyword.Type ' ' Text 'state' Name ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'labelIndent' Name ' ' Text '=' Operator ' ' Text 'state' Name ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text '\n' Text ' ' Text '/**\n * set the state of the preprocessor indentation option. \n * If true, multiline #define statements will be indented.\n *\n * @param state state of option.\n */' Comment.Multiline '\n' Text ' ' Text 'void' Keyword.Type ' ' Text 'ASBeautifier' Name ':' Operator ':' Operator 'setPreprocessorIndent' Name '(' Punctuation 'bool' Keyword.Type ' ' Text 'state' Name ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'preprocessorIndent' Name ' ' Text '=' Operator ' ' Text 'state' Name ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text '\n' Text ' ' Text '/**\n * set the state of the empty line fill option. \n * If true, empty lines will be filled with the whitespace.\n * of their previous lines.\n * If false, these lines will remain empty.\n *\n * @param state state of option.\n */' Comment.Multiline '\n' Text ' ' Text 'void' Keyword.Type ' ' Text 'ASBeautifier' Name ':' Operator ':' Operator 'setEmptyLineFill' Name '(' Punctuation 'bool' Keyword.Type ' ' Text 'state' Name ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'emptyLineFill' Name ' ' Text '=' Operator ' ' Text 'state' Name ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text '\n' Text ' ' Text '/**\n * check if there are any indented lines ready to be read by nextLine()\n *\n * @return are there any indented lines ready?\n */' Comment.Multiline '\n' Text ' ' Text 'bool' Keyword.Type ' ' Text 'ASBeautifier' Name ':' Operator ':' Operator 'hasMoreLines' Name '(' Punctuation ')' Punctuation ' ' Text 'const' Keyword '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'return' Keyword ' ' Text 'sourceIterator' Name '-' Operator '>' Operator 'hasMoreLines' Name '(' Punctuation ')' Punctuation ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text '\n' Text ' ' Text '/**\n * get the next indented line.\n *\n * @return indented line.\n */' Comment.Multiline '\n' Text ' ' Text 'string' Name ' ' Text 'ASBeautifier' Name ':' Operator ':' Operator 'nextLine' Name '(' Punctuation ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'return' Keyword ' ' Text 'beautify' Name.Function '(' Punctuation 'sourceIterator' Name '-' Operator '>' Operator 'nextLine' Name '(' Punctuation ')' Punctuation ')' Punctuation ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text '\n' Text ' ' Text '/**\n * beautify a line of source code.\n * every line of source code in a source code file should be sent\n * one after the other to the beautify method.\n *\n * @return the indented line.\n * @param originalLine the original unindented line.\n */' Comment.Multiline '\n' Text ' ' Text 'string' Name ' ' Text 'ASBeautifier' Name ':' Operator ':' Operator 'beautify' Name '(' Punctuation 'const' Keyword ' ' Text 'string' Name ' ' Text '&' Operator 'originalLine' Name ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'string' Name ' ' Text 'line' Name ';' Punctuation '\n' Text ' ' Text 'bool' Keyword.Type ' ' Text 'isInLineComment' Name ' ' Text '=' Operator ' ' Text 'false' Name.Builtin ';' Punctuation '\n' Text ' ' Text 'bool' Keyword.Type ' ' Text 'lineStartsInComment' Name ' ' Text '=' Operator ' ' Text 'false' Name.Builtin ';' Punctuation '\n' Text ' ' Text 'bool' Keyword.Type ' ' Text 'isInClass' Name ' ' Text '=' Operator ' ' Text 'false' Name.Builtin ';' Punctuation '\n' Text ' ' Text 'bool' Keyword.Type ' ' Text 'isInSwitch' Name ' ' Text '=' Operator ' ' Text 'false' Name.Builtin ';' Punctuation '\n' Text ' ' Text 'bool' Keyword.Type ' ' Text 'isImmediatelyAfterConst' Name ' ' Text '=' Operator ' ' Text 'false' Name.Builtin ';' Punctuation '\n' Text ' ' Text 'bool' Keyword.Type ' ' Text 'isSpecialChar' Name ' ' Text '=' Operator ' ' Text 'false' Name.Builtin ';' Punctuation '\n' Text '\n' Text ' ' Text 'char' Keyword.Type ' ' Text 'ch' Name ' ' Text '=' Operator ' ' Text "'" Literal.String.Char ' ' Literal.String.Char "'" Literal.String.Char ';' Punctuation '\n' Text ' ' Text 'char' Keyword.Type ' ' Text 'prevCh' Name ';' Punctuation '\n' Text ' ' Text 'string' Name ' ' Text 'outBuffer' Name ';' Punctuation ' ' Text '// the newly idented line is bufferd here\n' Comment.Single ' ' Text 'int' Keyword.Type ' ' Text 'tabCount' Name ' ' Text '=' Operator ' ' Text '0' Literal.Number.Integer ';' Punctuation '\n' Text ' ' Text 'const' Keyword ' ' Text 'string' Name ' ' Text '*' Operator 'lastLineHeader' Name ' ' Text '=' Operator ' ' Text 'NULL' Name.Builtin ';' Punctuation '\n' Text ' ' Text 'bool' Keyword.Type ' ' Text 'closingBracketReached' Name ' ' Text '=' Operator ' ' Text 'false' Name.Builtin ';' Punctuation '\n' Text ' ' Text 'int' Keyword.Type ' ' Text 'spaceTabCount' Name ' ' Text '=' Operator ' ' Text '0' Literal.Number.Integer ';' Punctuation '\n' Text ' ' Text 'char' Keyword.Type ' ' Text 'tempCh' Name ';' Punctuation '\n' Text ' ' Text 'unsigned' Keyword.Type ' ' Text 'int' Keyword.Type ' ' Text 'headerStackSize' Name ' ' Text '=' Operator ' ' Text 'headerStack' Name '-' Operator '>' Operator 'size' Name '(' Punctuation ')' Punctuation ';' Punctuation '\n' Text ' ' Text '//bool isLineInStatement = isInStatement;\n' Comment.Single ' ' Text 'bool' Keyword.Type ' ' Text 'shouldIndentBrackettedLine' Name ' ' Text '=' Operator ' ' Text 'true' Name.Builtin ';' Punctuation '\n' Text ' ' Text 'int' Keyword.Type ' ' Text 'lineOpeningBlocksNum' Name ' ' Text '=' Operator ' ' Text '0' Literal.Number.Integer ';' Punctuation '\n' Text ' ' Text 'int' Keyword.Type ' ' Text 'lineClosingBlocksNum' Name ' ' Text '=' Operator ' ' Text '0' Literal.Number.Integer ';' Punctuation '\n' Text ' ' Text 'bool' Keyword.Type ' ' Text 'previousLineProbation' Name ' ' Text '=' Operator ' ' Text '(' Punctuation 'probationHeader' Name ' ' Text '!' Operator '=' Operator ' ' Text 'NULL' Name.Builtin ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'unsigned' Keyword.Type ' ' Text 'int' Keyword.Type ' ' Text 'i' Name ';' Punctuation '\n' Text '\n' Text ' ' Text 'currentHeader' Name ' ' Text '=' Operator ' ' Text 'NULL' Name.Builtin ';' Punctuation '\n' Text '\n' Text ' ' Text 'lineStartsInComment' Name ' ' Text '=' Operator ' ' Text 'isInComment' Name ';' Punctuation '\n' Text '\n' Text ' ' Text '// handle and remove white spaces around the line:\n' Comment.Single ' ' Text '// If not in comment, first find out size of white space before line,\n' Comment.Single ' ' Text '// so that possible comments starting in the line continue in\n' Comment.Single ' ' Text '// relation to the preliminary white-space.\n' Comment.Single ' ' Text 'if' Keyword ' ' Text '(' Punctuation '!' Operator 'isInComment' Name ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'leadingWhiteSpaces' Name ' ' Text '=' Operator ' ' Text '0' Literal.Number.Integer ';' Punctuation '\n' Text ' ' Text 'while' Keyword ' ' Text '(' Punctuation 'leadingWhiteSpaces' Name '<' Operator 'originalLine' Name '.' Punctuation 'length' Name '(' Punctuation ')' Punctuation ' ' Text '&' Operator '&' Operator ' ' Text 'originalLine' Name '[' Punctuation 'leadingWhiteSpaces' Name ']' Punctuation ' ' Text '<' Operator '=' Operator ' ' Text '0x20' Literal.Number.Hex ')' Punctuation '\n' Text ' ' Text 'leadingWhiteSpaces' Name '+' Operator '+' Operator ';' Punctuation '\n' Text '\n' Text ' ' Text 'line' Name ' ' Text '=' Operator ' ' Text 'trim' Name '(' Punctuation 'originalLine' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text ' ' Text 'else' Keyword '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'unsigned' Keyword.Type ' ' Text 'int' Keyword.Type ' ' Text 'trimSize' Name ';' Punctuation '\n' Text ' ' Text 'for' Keyword ' ' Text '(' Punctuation 'trimSize' Name '=' Operator '0' Literal.Number.Integer ';' Punctuation '\n' Text ' ' Text 'trimSize' Name ' ' Text '<' Operator ' ' Text 'originalLine' Name '.' Punctuation 'length' Name '(' Punctuation ')' Punctuation ' ' Text '&' Operator '&' Operator ' ' Text 'trimSize' Name '<' Operator 'leadingWhiteSpaces' Name ' ' Text '&' Operator '&' Operator ' ' Text 'originalLine' Name '[' Punctuation 'trimSize' Name ']' Punctuation ' ' Text '<' Operator '=' Operator ' ' Text '0x20' Literal.Number.Hex ' ' Text ';' Punctuation '\n' Text ' ' Text 'trimSize' Name '+' Operator '+' Operator ')' Punctuation '\n' Text ' ' Text ';' Punctuation '\n' Text ' ' Text 'line' Name ' ' Text '=' Operator ' ' Text 'originalLine' Name '.' Punctuation 'substr' Name '(' Punctuation 'trimSize' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text '\n' Text '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'line' Name '.' Punctuation 'length' Name '(' Punctuation ')' Punctuation ' ' Text '=' Operator '=' Operator ' ' Text '0' Literal.Number.Integer ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'emptyLineFill' Name ')' Punctuation '\n' Text ' ' Text 'return' Keyword ' ' Text 'preLineWS' Name '(' Punctuation 'prevFinalLineSpaceTabCount' Name ',' Punctuation ' ' Text 'prevFinalLineTabCount' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'else' Keyword '\n' Text ' ' Text 'return' Keyword ' ' Text 'line' Name ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text '\n' Text ' ' Text '// handle preprocessor commands\n' Comment.Single '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'isCStyle' Name ' ' Text '&' Operator '&' Operator ' ' Text '!' Operator 'isInComment' Name ' ' Text '&' Operator '&' Operator ' ' Text '(' Punctuation 'line' Name '[' Punctuation '0' Literal.Number.Integer ']' Punctuation ' ' Text '=' Operator '=' Operator ' ' Text "'" Literal.String.Char '#' Literal.String.Char "'" Literal.String.Char ' ' Text '|' Operator '|' Operator ' ' Text 'backslashEndsPrevLine' Name ')' Punctuation ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'line' Name '[' Punctuation '0' Literal.Number.Integer ']' Punctuation ' ' Text '=' Operator '=' Operator ' ' Text "'" Literal.String.Char '#' Literal.String.Char "'" Literal.String.Char ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'string' Name ' ' Text 'preproc' Name ' ' Text '=' Operator ' ' Text 'trim' Name '(' Punctuation 'string' Name '(' Punctuation 'line' Name '.' Punctuation 'c_str' Name '(' Punctuation ')' Punctuation ' ' Text '+' Operator ' ' Text '1' Literal.Number.Integer ')' Punctuation ')' Punctuation ';' Punctuation '\n' Text '\n' Text '\n' Text ' ' Text '// When finding a multi-lined #define statement, the original beautifier\n' Comment.Single ' ' Text '// 1. sets its isInDefineDefinition flag\n' Comment.Single ' ' Text '// 2. clones a new beautifier that will be used for the actual indentation\n' Comment.Single ' ' Text '// of the #define. This clone is put into the activeBeautifierStack in order\n' Comment.Single ' ' Text '// to be called for the actual indentation.\n' Comment.Single ' ' Text '// The original beautifier will have isInDefineDefinition = true, isInDefine = false\n' Comment.Single ' ' Text '// The cloned beautifier will have isInDefineDefinition = true, isInDefine = true\n' Comment.Single ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'preprocessorIndent' Name ' ' Text '&' Operator '&' Operator ' ' Text 'preproc' Name '.' Punctuation 'COMPARE' Name '(' Punctuation '0' Literal.Number.Integer ',' Punctuation ' ' Text '6' Literal.Number.Integer ',' Punctuation ' ' Text 'string' Name '(' Punctuation '"' Literal.String 'define' Literal.String '"' Literal.String ')' Punctuation ')' Punctuation ' ' Text '=' Operator '=' Operator ' ' Text '0' Literal.Number.Integer ' ' Text '&' Operator '&' Operator ' ' Text 'line' Name '[' Punctuation 'line' Name '.' Punctuation 'length' Name '(' Punctuation ')' Punctuation ' ' Text '-' Operator ' ' Text '1' Literal.Number.Integer ']' Punctuation ' ' Text '=' Operator '=' Operator ' ' Text "'" Literal.String.Char '\\\\' Literal.String.Char "'" Literal.String.Char ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation '!' Operator 'isInDefineDefinition' Name ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'ASBeautifier' Name ' ' Text '*' Operator 'defineBeautifier' Name ';' Punctuation '\n' Text '\n' Text ' ' Text '// this is the original beautifier\n' Comment.Single ' ' Text 'isInDefineDefinition' Name ' ' Text '=' Operator ' ' Text 'true' Name.Builtin ';' Punctuation '\n' Text '\n' Text ' ' Text '// push a new beautifier into the active stack\n' Comment.Single ' ' Text '// this breautifier will be used for the indentation of this define\n' Comment.Single ' ' Text 'defineBeautifier' Name ' ' Text '=' Operator ' ' Text 'new' Keyword ' ' Text 'ASBeautifier' Name '(' Punctuation '*' Operator 'this' Keyword ')' Punctuation ';' Punctuation '\n' Text ' ' Text '//defineBeautifier->init();\n' Comment.Single ' ' Text '//defineBeautifier->isInDefineDefinition = true;\n' Comment.Single ' ' Text '//defineBeautifier->beautify("");\n' Comment.Single ' ' Text 'activeBeautifierStack' Name '-' Operator '>' Operator 'push_back' Name '(' Punctuation 'defineBeautifier' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text ' ' Text 'else' Keyword '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text '// the is the cloned beautifier that is in charge of indenting the #define.\n' Comment.Single ' ' Text 'isInDefine' Name ' ' Text '=' Operator ' ' Text 'true' Name.Builtin ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text ' ' Text 'else' Keyword ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'preproc' Name '.' Punctuation 'COMPARE' Name '(' Punctuation '0' Literal.Number.Integer ',' Punctuation ' ' Text '2' Literal.Number.Integer ',' Punctuation ' ' Text 'string' Name '(' Punctuation '"' Literal.String 'if' Literal.String '"' Literal.String ')' Punctuation ')' Punctuation ' ' Text '=' Operator '=' Operator ' ' Text '0' Literal.Number.Integer ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text '// push a new beautifier into the stack\n' Comment.Single ' ' Text 'waitingBeautifierStackLengthStack' Name '-' Operator '>' Operator 'push_back' Name '(' Punctuation 'waitingBeautifierStack' Name '-' Operator '>' Operator 'size' Name '(' Punctuation ')' Punctuation ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'activeBeautifierStackLengthStack' Name '-' Operator '>' Operator 'push_back' Name '(' Punctuation 'activeBeautifierStack' Name '-' Operator '>' Operator 'size' Name '(' Punctuation ')' Punctuation ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'waitingBeautifierStack' Name '-' Operator '>' Operator 'push_back' Name '(' Punctuation 'new' Keyword ' ' Text 'ASBeautifier' Name '(' Punctuation '*' Operator 'this' Keyword ')' Punctuation ')' Punctuation ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text ' ' Text 'else' Keyword ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'preproc' Name '.' Punctuation 'COMPARE' Name '(' Punctuation '0' Literal.Number.Integer ',' Punctuation ' ' Text '4' Literal.Number.Integer '/*2*/' Comment.Multiline ',' Punctuation ' ' Text 'string' Name '(' Punctuation '"' Literal.String 'else' Literal.String '"' Literal.String ')' Punctuation ')' Punctuation ' ' Text '=' Operator '=' Operator ' ' Text '0' Literal.Number.Integer ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation '!' Operator 'waitingBeautifierStack' Name '-' Operator '>' Operator 'empty' Name '(' Punctuation ')' Punctuation ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text '// MOVE current waiting beautifier to active stack.\n' Comment.Single ' ' Text 'activeBeautifierStack' Name '-' Operator '>' Operator 'push_back' Name '(' Punctuation 'waitingBeautifierStack' Name '-' Operator '>' Operator 'back' Name '(' Punctuation ')' Punctuation ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'waitingBeautifierStack' Name '-' Operator '>' Operator 'pop_back' Name '(' Punctuation ')' Punctuation ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text ' ' Text 'else' Keyword ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'preproc' Name '.' Punctuation 'COMPARE' Name '(' Punctuation '0' Literal.Number.Integer ',' Punctuation ' ' Text '4' Literal.Number.Integer ',' Punctuation ' ' Text 'string' Name '(' Punctuation '"' Literal.String 'elif' Literal.String '"' Literal.String ')' Punctuation ')' Punctuation ' ' Text '=' Operator '=' Operator ' ' Text '0' Literal.Number.Integer ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation '!' Operator 'waitingBeautifierStack' Name '-' Operator '>' Operator 'empty' Name '(' Punctuation ')' Punctuation ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text '// append a COPY current waiting beautifier to active stack, WITHOUT deleting the original.\n' Comment.Single ' ' Text 'activeBeautifierStack' Name '-' Operator '>' Operator 'push_back' Name '(' Punctuation ' ' Text 'new' Keyword ' ' Text 'ASBeautifier' Name '(' Punctuation ' ' Text '*' Operator '(' Punctuation 'waitingBeautifierStack' Name '-' Operator '>' Operator 'back' Name '(' Punctuation ')' Punctuation ')' Punctuation ' ' Text ')' Punctuation ' ' Text ')' Punctuation ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text ' ' Text 'else' Keyword ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'preproc' Name '.' Punctuation 'COMPARE' Name '(' Punctuation '0' Literal.Number.Integer ',' Punctuation ' ' Text '5' Literal.Number.Integer ',' Punctuation ' ' Text 'string' Name '(' Punctuation '"' Literal.String 'endif' Literal.String '"' Literal.String ')' Punctuation ')' Punctuation ' ' Text '=' Operator '=' Operator ' ' Text '0' Literal.Number.Integer ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'unsigned' Keyword.Type ' ' Text 'int' Keyword.Type ' ' Text 'stackLength' Name ';' Punctuation '\n' Text ' ' Text 'ASBeautifier' Name ' ' Text '*' Operator 'beautifier' Name ';' Punctuation '\n' Text '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation '!' Operator 'waitingBeautifierStackLengthStack' Name '-' Operator '>' Operator 'empty' Name '(' Punctuation ')' Punctuation ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'stackLength' Name ' ' Text '=' Operator ' ' Text 'waitingBeautifierStackLengthStack' Name '-' Operator '>' Operator 'back' Name '(' Punctuation ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'waitingBeautifierStackLengthStack' Name '-' Operator '>' Operator 'pop_back' Name '(' Punctuation ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'while' Keyword ' ' Text '(' Punctuation 'waitingBeautifierStack' Name '-' Operator '>' Operator 'size' Name '(' Punctuation ')' Punctuation ' ' Text '>' Operator ' ' Text 'stackLength' Name ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'beautifier' Name ' ' Text '=' Operator ' ' Text 'waitingBeautifierStack' Name '-' Operator '>' Operator 'back' Name '(' Punctuation ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'waitingBeautifierStack' Name '-' Operator '>' Operator 'pop_back' Name '(' Punctuation ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'delete' Keyword ' ' Text 'beautifier' Name ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation '!' Operator 'activeBeautifierStackLengthStack' Name '-' Operator '>' Operator 'empty' Name '(' Punctuation ')' Punctuation ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'stackLength' Name ' ' Text '=' Operator ' ' Text 'activeBeautifierStackLengthStack' Name '-' Operator '>' Operator 'back' Name '(' Punctuation ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'activeBeautifierStackLengthStack' Name '-' Operator '>' Operator 'pop_back' Name '(' Punctuation ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'while' Keyword ' ' Text '(' Punctuation 'activeBeautifierStack' Name '-' Operator '>' Operator 'size' Name '(' Punctuation ')' Punctuation ' ' Text '>' Operator ' ' Text 'stackLength' Name ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'beautifier' Name ' ' Text '=' Operator ' ' Text 'activeBeautifierStack' Name '-' Operator '>' Operator 'back' Name '(' Punctuation ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'activeBeautifierStack' Name '-' Operator '>' Operator 'pop_back' Name '(' Punctuation ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'delete' Keyword ' ' Text 'beautifier' Name ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text '\n' Text '\n' Text ' ' Text '}' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text '\n' Text ' ' Text '// check if the last char is a backslash\n' Comment.Single ' ' Text 'if' Keyword '(' Punctuation 'line' Name '.' Punctuation 'length' Name '(' Punctuation ')' Punctuation ' ' Text '>' Operator ' ' Text '0' Literal.Number.Integer ')' Punctuation '\n' Text ' ' Text 'backslashEndsPrevLine' Name ' ' Text '=' Operator ' ' Text '(' Punctuation 'line' Name '[' Punctuation 'line' Name '.' Punctuation 'length' Name '(' Punctuation ')' Punctuation ' ' Text '-' Operator ' ' Text '1' Literal.Number.Integer ']' Punctuation ' ' Text '=' Operator '=' Operator ' ' Text "'" Literal.String.Char '\\\\' Literal.String.Char "'" Literal.String.Char ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'else' Keyword '\n' Text ' ' Text 'backslashEndsPrevLine' Name ' ' Text '=' Operator ' ' Text 'false' Name.Builtin ';' Punctuation '\n' Text '\n' Text ' ' Text '// check if this line ends a multi-line #define\n' Comment.Single ' ' Text "// if so, use the #define's cloned beautifier for the line's indentation\n" Comment.Single ' ' Text '// and then remove it from the active beautifier stack and delete it.\n' Comment.Single ' ' Text 'if' Keyword ' ' Text '(' Punctuation '!' Operator 'backslashEndsPrevLine' Name ' ' Text '&' Operator '&' Operator ' ' Text 'isInDefineDefinition' Name ' ' Text '&' Operator '&' Operator ' ' Text '!' Operator 'isInDefine' Name ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'string' Name ' ' Text 'beautifiedLine' Name ';' Punctuation '\n' Text ' ' Text 'ASBeautifier' Name ' ' Text '*' Operator 'defineBeautifier' Name ';' Punctuation '\n' Text '\n' Text ' ' Text 'isInDefineDefinition' Name ' ' Text '=' Operator ' ' Text 'false' Name.Builtin ';' Punctuation '\n' Text ' ' Text 'defineBeautifier' Name ' ' Text '=' Operator ' ' Text 'activeBeautifierStack' Name '-' Operator '>' Operator 'back' Name '(' Punctuation ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'activeBeautifierStack' Name '-' Operator '>' Operator 'pop_back' Name '(' Punctuation ')' Punctuation ';' Punctuation '\n' Text '\n' Text ' ' Text 'beautifiedLine' Name ' ' Text '=' Operator ' ' Text 'defineBeautifier' Name '-' Operator '>' Operator 'beautify' Name '(' Punctuation 'line' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'delete' Keyword ' ' Text 'defineBeautifier' Name ';' Punctuation '\n' Text ' ' Text 'return' Keyword ' ' Text 'beautifiedLine' Name ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text '\n' Text ' ' Text '// unless this is a multi-line #define, return this precompiler line as is.\n' Comment.Single ' ' Text 'if' Keyword ' ' Text '(' Punctuation '!' Operator 'isInDefine' Name ' ' Text '&' Operator '&' Operator ' ' Text '!' Operator 'isInDefineDefinition' Name ')' Punctuation '\n' Text ' ' Text 'return' Keyword ' ' Text 'originalLine' Name ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text '\n' Text ' ' Text '// if there exists any worker beautifier in the activeBeautifierStack,\n' Comment.Single ' ' Text '// then use it instead of me to indent the current line.\n' Comment.Single ' ' Text 'if' Keyword ' ' Text '(' Punctuation '!' Operator 'isInDefine' Name ' ' Text '&' Operator '&' Operator ' ' Text 'activeBeautifierStack' Name ' ' Text '!' Operator '=' Operator ' ' Text 'NULL' Name.Builtin ' ' Text '&' Operator '&' Operator ' ' Text '!' Operator 'activeBeautifierStack' Name '-' Operator '>' Operator 'empty' Name '(' Punctuation ')' Punctuation ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'return' Keyword ' ' Text 'activeBeautifierStack' Name '-' Operator '>' Operator 'back' Name '(' Punctuation ')' Punctuation '-' Operator '>' Operator 'beautify' Name '(' Punctuation 'line' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text '\n' Text ' ' Text '// calculate preliminary indentation based on data from past lines\n' Comment.Single ' ' Text 'if' Keyword ' ' Text '(' Punctuation '!' Operator 'inStatementIndentStack' Name '-' Operator '>' Operator 'empty' Name '(' Punctuation ')' Punctuation ')' Punctuation '\n' Text ' ' Text 'spaceTabCount' Name ' ' Text '=' Operator ' ' Text 'inStatementIndentStack' Name '-' Operator '>' Operator 'back' Name '(' Punctuation ')' Punctuation ';' Punctuation '\n' Text '\n' Text '\n' Text ' ' Text 'for' Keyword ' ' Text '(' Punctuation 'i' Name '=' Operator '0' Literal.Number.Integer ';' Punctuation ' ' Text 'i' Name '<' Operator 'headerStackSize' Name ';' Punctuation ' ' Text 'i' Name '+' Operator '+' Operator ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'isInClass' Name ' ' Text '=' Operator ' ' Text 'false' Name.Builtin ';' Punctuation '\n' Text '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'blockIndent' Name ' ' Text '|' Operator '|' Operator ' ' Text '(' Punctuation '!' Operator '(' Punctuation 'i' Name '>' Operator '0' Literal.Number.Integer ' ' Text '&' Operator '&' Operator ' ' Text '(' Punctuation '*' Operator 'headerStack' Name ')' Punctuation '[' Punctuation 'i' Name '-1' Literal.Number.Integer ']' Punctuation ' ' Text '!' Operator '=' Operator ' ' Text '&' Operator 'AS_OPEN_BRACKET' Name '\n' Text ' ' Text '&' Operator '&' Operator ' ' Text '(' Punctuation '*' Operator 'headerStack' Name ')' Punctuation '[' Punctuation 'i' Name ']' Punctuation ' ' Text '=' Operator '=' Operator ' ' Text '&' Operator 'AS_OPEN_BRACKET' Name ')' Punctuation ')' Punctuation ')' Punctuation '\n' Text ' ' Text '+' Operator '+' Operator 'tabCount' Name ';' Punctuation '\n' Text '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'isCStyle' Name ' ' Text '&' Operator '&' Operator ' ' Text '!' Operator 'namespaceIndent' Name ' ' Text '&' Operator '&' Operator ' ' Text 'i' Name ' ' Text '>' Operator '=' Operator ' ' Text '1' Literal.Number.Integer '\n' Text ' ' Text '&' Operator '&' Operator ' ' Text '(' Punctuation '*' Operator 'headerStack' Name ')' Punctuation '[' Punctuation 'i' Name '-1' Literal.Number.Integer ']' Punctuation ' ' Text '=' Operator '=' Operator ' ' Text '&' Operator 'AS_NAMESPACE' Name '\n' Text ' ' Text '&' Operator '&' Operator ' ' Text '(' Punctuation '*' Operator 'headerStack' Name ')' Punctuation '[' Punctuation 'i' Name ']' Punctuation ' ' Text '=' Operator '=' Operator ' ' Text '&' Operator 'AS_OPEN_BRACKET' Name ')' Punctuation '\n' Text ' ' Text '-' Operator '-' Operator 'tabCount' Name ';' Punctuation '\n' Text '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'isCStyle' Name ' ' Text '&' Operator '&' Operator ' ' Text 'i' Name ' ' Text '>' Operator '=' Operator ' ' Text '1' Literal.Number.Integer '\n' Text ' ' Text '&' Operator '&' Operator ' ' Text '(' Punctuation '*' Operator 'headerStack' Name ')' Punctuation '[' Punctuation 'i' Name '-1' Literal.Number.Integer ']' Punctuation ' ' Text '=' Operator '=' Operator ' ' Text '&' Operator 'AS_CLASS' Name '\n' Text ' ' Text '&' Operator '&' Operator ' ' Text '(' Punctuation '*' Operator 'headerStack' Name ')' Punctuation '[' Punctuation 'i' Name ']' Punctuation ' ' Text '=' Operator '=' Operator ' ' Text '&' Operator 'AS_OPEN_BRACKET' Name ' ' Text ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'classIndent' Name ')' Punctuation '\n' Text ' ' Text '+' Operator '+' Operator 'tabCount' Name ';' Punctuation '\n' Text ' ' Text 'isInClass' Name ' ' Text '=' Operator ' ' Text 'true' Name.Builtin ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text '\n' Text ' ' Text '// is the switchIndent option is on, indent switch statements an additional indent.\n' Comment.Single ' ' Text 'else' Keyword ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'switchIndent' Name ' ' Text '&' Operator '&' Operator ' ' Text 'i' Name ' ' Text '>' Operator ' ' Text '1' Literal.Number.Integer ' ' Text '&' Operator '&' Operator '\n' Text ' ' Text '(' Punctuation '*' Operator 'headerStack' Name ')' Punctuation '[' Punctuation 'i' Name '-1' Literal.Number.Integer ']' Punctuation ' ' Text '=' Operator '=' Operator ' ' Text '&' Operator 'AS_SWITCH' Name ' ' Text '&' Operator '&' Operator '\n' Text ' ' Text '(' Punctuation '*' Operator 'headerStack' Name ')' Punctuation '[' Punctuation 'i' Name ']' Punctuation ' ' Text '=' Operator '=' Operator ' ' Text '&' Operator 'AS_OPEN_BRACKET' Name '\n' Text ' ' Text ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text '+' Operator '+' Operator 'tabCount' Name ';' Punctuation '\n' Text ' ' Text 'isInSwitch' Name ' ' Text '=' Operator ' ' Text 'true' Name.Builtin ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text '\n' Text ' ' Text '}' Punctuation '\n' Text '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation '!' Operator 'lineStartsInComment' Name '\n' Text ' ' Text '&' Operator '&' Operator ' ' Text 'isCStyle' Name '\n' Text ' ' Text '&' Operator '&' Operator ' ' Text 'isInClass' Name '\n' Text ' ' Text '&' Operator '&' Operator ' ' Text 'classIndent' Name '\n' Text ' ' Text '&' Operator '&' Operator ' ' Text 'headerStackSize' Name ' ' Text '>' Operator '=' Operator ' ' Text '2' Literal.Number.Integer '\n' Text ' ' Text '&' Operator '&' Operator '(' Punctuation '*' Operator 'headerStack' Name ')' Punctuation '[' Punctuation 'headerStackSize' Name '-2' Literal.Number.Integer ']' Punctuation ' ' Text '=' Operator '=' Operator ' ' Text '&' Operator 'AS_CLASS' Name '\n' Text ' ' Text '&' Operator '&' Operator ' ' Text '(' Punctuation '*' Operator 'headerStack' Name ')' Punctuation '[' Punctuation 'headerStackSize' Name '-1' Literal.Number.Integer ']' Punctuation ' ' Text '=' Operator '=' Operator ' ' Text '&' Operator 'AS_OPEN_BRACKET' Name '\n' Text ' ' Text '&' Operator '&' Operator ' ' Text 'line' Name '[' Punctuation '0' Literal.Number.Integer ']' Punctuation ' ' Text '=' Operator '=' Operator ' ' Text "'" Literal.String.Char '}' Literal.String.Char "'" Literal.String.Char ')' Punctuation '\n' Text ' ' Text '-' Operator '-' Operator 'tabCount' Name ';' Punctuation '\n' Text '\n' Text ' ' Text 'else' Keyword ' ' Text 'if' Name.Function ' ' Text '(' Punctuation '!' Operator 'lineStartsInComment' Name '\n' Text ' ' Text '&' Operator '&' Operator ' ' Text 'isInSwitch' Name '\n' Text ' ' Text '&' Operator '&' Operator ' ' Text 'switchIndent' Name '\n' Text ' ' Text '&' Operator '&' Operator ' ' Text 'headerStackSize' Name ' ' Text '>' Operator '=' Operator ' ' Text '2' Literal.Number.Integer '\n' Text ' ' Text '&' Operator '&' Operator ' ' Text '(' Punctuation '*' Operator 'headerStack' Name ')' Punctuation '[' Punctuation 'headerStackSize' Name '-2' Literal.Number.Integer ']' Punctuation ' ' Text '=' Operator '=' Operator ' ' Text '&' Operator 'AS_SWITCH' Name '\n' Text ' ' Text '&' Operator '&' Operator ' ' Text '(' Punctuation '*' Operator 'headerStack' Name ')' Punctuation '[' Punctuation 'headerStackSize' Name '-1' Literal.Number.Integer ']' Punctuation ' ' Text '=' Operator '=' Operator ' ' Text '&' Operator 'AS_OPEN_BRACKET' Name '\n' Text ' ' Text '&' Operator '&' Operator ' ' Text 'line' Name '[' Punctuation '0' Literal.Number.Integer ']' Punctuation ' ' Text '=' Operator '=' Operator ' ' Text "'" Literal.String.Char '}' Literal.String.Char "'" Literal.String.Char ')' Punctuation '\n' Text ' ' Text '-' Operator '-' Operator 'tabCount' Name ';' Punctuation '\n' Text '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'isInClassHeader' Name ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'isInClassHeaderTab' Name ' ' Text '=' Operator ' ' Text 'true' Name.Builtin ';' Punctuation '\n' Text ' ' Text 'tabCount' Name ' ' Text '+' Operator '=' Operator ' ' Text '2' Literal.Number.Integer ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'isInConditional' Name ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text '-' Operator '-' Operator 'tabCount' Name ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text '\n' Text '\n' Text ' ' Text '// parse characters in the current line.\n' Comment.Single '\n' Text ' ' Text 'for' Keyword ' ' Text '(' Punctuation 'i' Name '=' Operator '0' Literal.Number.Integer ';' Punctuation ' ' Text 'i' Name '<' Operator 'line' Name '.' Punctuation 'length' Name '(' Punctuation ')' Punctuation ';' Punctuation ' ' Text 'i' Name '+' Operator '+' Operator ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'tempCh' Name ' ' Text '=' Operator ' ' Text 'line' Name '[' Punctuation 'i' Name ']' Punctuation ';' Punctuation '\n' Text '\n' Text ' ' Text 'prevCh' Name ' ' Text '=' Operator ' ' Text 'ch' Name ';' Punctuation '\n' Text ' ' Text 'ch' Name ' ' Text '=' Operator ' ' Text 'tempCh' Name ';' Punctuation '\n' Text '\n' Text ' ' Text 'outBuffer' Name '.' Punctuation 'append' Name '(' Punctuation '1' Literal.Number.Integer ',' Punctuation ' ' Text 'ch' Name ')' Punctuation ';' Punctuation '\n' Text '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'isWhiteSpace' Name '(' Punctuation 'ch' Name ')' Punctuation ')' Punctuation '\n' Text ' ' Text 'continue' Keyword ';' Punctuation '\n' Text '\n' Text '\n' Text ' ' Text '// handle special characters (i.e. backslash+character such as \\n, \\t, ...)\n' Comment.Single ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'isSpecialChar' Name ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'isSpecialChar' Name ' ' Text '=' Operator ' ' Text 'false' Name.Builtin ';' Punctuation '\n' Text ' ' Text 'continue' Keyword ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation '!' Operator '(' Punctuation 'isInComment' Name ' ' Text '|' Operator '|' Operator ' ' Text 'isInLineComment' Name ')' Punctuation ' ' Text '&' Operator '&' Operator ' ' Text 'line' Name '.' Punctuation 'COMPARE' Name '(' Punctuation 'i' Name ',' Punctuation ' ' Text '2' Literal.Number.Integer ',' Punctuation ' ' Text 'string' Name '(' Punctuation '"' Literal.String '\\\\' Literal.String.Escape '\\\\' Literal.String.Escape '"' Literal.String ')' Punctuation ')' Punctuation ' ' Text '=' Operator '=' Operator ' ' Text '0' Literal.Number.Integer ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'outBuffer' Name '.' Punctuation 'append' Name '(' Punctuation '1' Literal.Number.Integer ',' Punctuation ' ' Text "'" Literal.String.Char '\\\\' Literal.String.Char "'" Literal.String.Char ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'i' Name '+' Operator '+' Operator ';' Punctuation '\n' Text ' ' Text 'continue' Keyword ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation '!' Operator '(' Punctuation 'isInComment' Name ' ' Text '|' Operator '|' Operator ' ' Text 'isInLineComment' Name ')' Punctuation ' ' Text '&' Operator '&' Operator ' ' Text 'ch' Name '=' Operator '=' Operator "'" Literal.String.Char '\\\\' Literal.String.Char "'" Literal.String.Char ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'isSpecialChar' Name ' ' Text '=' Operator ' ' Text 'true' Name.Builtin ';' Punctuation '\n' Text ' ' Text 'continue' Keyword ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text '\n' Text ' ' Text '// handle quotes (such as \'x\' and "Hello Dolly")\n' Comment.Single ' ' Text 'if' Keyword ' ' Text '(' Punctuation '!' Operator '(' Punctuation 'isInComment' Name ' ' Text '|' Operator '|' Operator ' ' Text 'isInLineComment' Name ')' Punctuation ' ' Text '&' Operator '&' Operator ' ' Text '(' Punctuation 'ch' Name '=' Operator '=' Operator "'" Literal.String.Char '"' Literal.String.Char "'" Literal.String.Char ' ' Text '|' Operator '|' Operator ' ' Text 'ch' Name '=' Operator '=' Operator "'" Literal.String.Char "\\'" Literal.String.Char "'" Literal.String.Char ')' Punctuation ')' Punctuation '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation '!' Operator 'isInQuote' Name ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'quoteChar' Name ' ' Text '=' Operator ' ' Text 'ch' Name ';' Punctuation '\n' Text ' ' Text 'isInQuote' Name ' ' Text '=' Operator ' ' Text 'true' Name.Builtin ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text ' ' Text 'else' Keyword ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'quoteChar' Name ' ' Text '=' Operator '=' Operator ' ' Text 'ch' Name ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'isInQuote' Name ' ' Text '=' Operator ' ' Text 'false' Name.Builtin ';' Punctuation '\n' Text ' ' Text 'isInStatement' Name ' ' Text '=' Operator ' ' Text 'true' Name.Builtin ';' Punctuation '\n' Text ' ' Text 'continue' Keyword ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'isInQuote' Name ')' Punctuation '\n' Text ' ' Text 'continue' Keyword ';' Punctuation '\n' Text '\n' Text ' ' Text '// handle comments\n' Comment.Single '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation ' ' Text '!' Operator '(' Punctuation 'isInComment' Name ' ' Text '|' Operator '|' Operator ' ' Text 'isInLineComment' Name ')' Punctuation ' ' Text '&' Operator '&' Operator ' ' Text 'line' Name '.' Punctuation 'COMPARE' Name '(' Punctuation 'i' Name ',' Punctuation ' ' Text '2' Literal.Number.Integer ',' Punctuation ' ' Text 'AS_OPEN_LINE_COMMENT' Name ')' Punctuation ' ' Text '=' Operator '=' Operator ' ' Text '0' Literal.Number.Integer ' ' Text ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'isInLineComment' Name ' ' Text '=' Operator ' ' Text 'true' Name.Builtin ';' Punctuation '\n' Text ' ' Text 'outBuffer' Name '.' Punctuation 'append' Name '(' Punctuation '1' Literal.Number.Integer ',' Punctuation ' ' Text "'" Literal.String.Char '/' Literal.String.Char "'" Literal.String.Char ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'i' Name '+' Operator '+' Operator ';' Punctuation '\n' Text ' ' Text 'continue' Keyword ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text ' ' Text 'else' Keyword ' ' Text 'if' Keyword ' ' Text '(' Punctuation ' ' Text '!' Operator '(' Punctuation 'isInComment' Name ' ' Text '|' Operator '|' Operator ' ' Text 'isInLineComment' Name ')' Punctuation ' ' Text '&' Operator '&' Operator ' ' Text 'line' Name '.' Punctuation 'COMPARE' Name '(' Punctuation 'i' Name ',' Punctuation ' ' Text '2' Literal.Number.Integer ',' Punctuation ' ' Text 'AS_OPEN_COMMENT' Name ')' Punctuation ' ' Text '=' Operator '=' Operator ' ' Text '0' Literal.Number.Integer ' ' Text ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'isInComment' Name ' ' Text '=' Operator ' ' Text 'true' Name.Builtin ';' Punctuation '\n' Text ' ' Text 'outBuffer' Name '.' Punctuation 'append' Name '(' Punctuation '1' Literal.Number.Integer ',' Punctuation ' ' Text "'" Literal.String.Char '*' Literal.String.Char "'" Literal.String.Char ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'i' Name '+' Operator '+' Operator ';' Punctuation '\n' Text ' ' Text 'continue' Keyword ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text ' ' Text 'else' Keyword ' ' Text 'if' Keyword ' ' Text '(' Punctuation ' ' Text '(' Punctuation 'isInComment' Name ' ' Text '|' Operator '|' Operator ' ' Text 'isInLineComment' Name ')' Punctuation ' ' Text '&' Operator '&' Operator ' ' Text 'line' Name '.' Punctuation 'COMPARE' Name '(' Punctuation 'i' Name ',' Punctuation ' ' Text '2' Literal.Number.Integer ',' Punctuation ' ' Text 'AS_CLOSE_COMMENT' Name ')' Punctuation ' ' Text '=' Operator '=' Operator ' ' Text '0' Literal.Number.Integer ' ' Text ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'isInComment' Name ' ' Text '=' Operator ' ' Text 'false' Name.Builtin ';' Punctuation '\n' Text ' ' Text 'outBuffer' Name '.' Punctuation 'append' Name '(' Punctuation '1' Literal.Number.Integer ',' Punctuation ' ' Text "'" Literal.String.Char '/' Literal.String.Char "'" Literal.String.Char ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'i' Name '+' Operator '+' Operator ';' Punctuation '\n' Text ' ' Text 'continue' Keyword ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'isInComment' Name '|' Operator '|' Operator 'isInLineComment' Name ')' Punctuation '\n' Text ' ' Text 'continue' Keyword ';' Punctuation '\n' Text '\n' Text ' ' Text '// if we have reached this far then we are NOT in a comment or string of special character...\n' Comment.Single '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'probationHeader' Name ' ' Text '!' Operator '=' Operator ' ' Text 'NULL' Name.Builtin ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation ' ' Text '(' Punctuation '(' Punctuation 'probationHeader' Name ' ' Text '=' Operator '=' Operator ' ' Text '&' Operator 'AS_STATIC' Name ' ' Text '|' Operator '|' Operator ' ' Text 'probationHeader' Name ' ' Text '=' Operator '=' Operator ' ' Text '&' Operator 'AS_CONST' Name ')' Punctuation ' ' Text '&' Operator '&' Operator ' ' Text 'ch' Name ' ' Text '=' Operator '=' Operator ' ' Text "'" Literal.String.Char '{' Literal.String.Char "'" Literal.String.Char ')' Punctuation '\n' Text ' ' Text '|' Operator '|' Operator ' ' Text '(' Punctuation 'probationHeader' Name ' ' Text '=' Operator '=' Operator ' ' Text '&' Operator 'AS_SYNCHRONIZED' Name ' ' Text '&' Operator '&' Operator ' ' Text 'ch' Name ' ' Text '=' Operator '=' Operator ' ' Text "'" Literal.String.Char '(' Literal.String.Char "'" Literal.String.Char ')' Punctuation ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text '// insert the probation header as a new header\n' Comment.Single ' ' Text 'isInHeader' Name ' ' Text '=' Operator ' ' Text 'true' Name.Builtin ';' Punctuation '\n' Text ' ' Text 'headerStack' Name '-' Operator '>' Operator 'push_back' Name '(' Punctuation 'probationHeader' Name ')' Punctuation ';' Punctuation '\n' Text '\n' Text ' ' Text '// handle the specific probation header\n' Comment.Single ' ' Text 'isInConditional' Name ' ' Text '=' Operator ' ' Text '(' Punctuation 'probationHeader' Name ' ' Text '=' Operator '=' Operator ' ' Text '&' Operator 'AS_SYNCHRONIZED' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'probationHeader' Name ' ' Text '=' Operator '=' Operator ' ' Text '&' Operator 'AS_CONST' Name ')' Punctuation '\n' Text ' ' Text 'isImmediatelyAfterConst' Name ' ' Text '=' Operator ' ' Text 'true' Name.Builtin ';' Punctuation '\n' Text ' ' Text '// isInConst = true;\n' Comment.Single ' ' Text '/* TODO:\n * There is actually no more need for the global isInConst variable.\n * The only reason for checking const is to see if there is a const\n * immediately before an open-bracket.\n * Since CONST is now put into probation and is checked during itspost-char,\n * isImmediatelyAfterConst can be set by its own...\n */' Comment.Multiline '\n' Text '\n' Text ' ' Text 'isInStatement' Name ' ' Text '=' Operator ' ' Text 'false' Name.Builtin ';' Punctuation '\n' Text ' ' Text '// if the probation comes from the previous line, then indent by 1 tab count.\n' Comment.Single ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'previousLineProbation' Name ' ' Text '&' Operator '&' Operator ' ' Text 'ch' Name ' ' Text '=' Operator '=' Operator ' ' Text "'" Literal.String.Char '{' Literal.String.Char "'" Literal.String.Char ')' Punctuation '\n' Text ' ' Text 'tabCount' Name '+' Operator '+' Operator ';' Punctuation '\n' Text ' ' Text 'previousLineProbation' Name ' ' Text '=' Operator ' ' Text 'false' Name.Builtin ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text '\n' Text ' ' Text '// dismiss the probation header\n' Comment.Single ' ' Text 'probationHeader' Name ' ' Text '=' Operator ' ' Text 'NULL' Name.Builtin ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text '\n' Text ' ' Text 'prevNonSpaceCh' Name ' ' Text '=' Operator ' ' Text 'currentNonSpaceCh' Name ';' Punctuation '\n' Text ' ' Text 'currentNonSpaceCh' Name ' ' Text '=' Operator ' ' Text 'ch' Name ';' Punctuation '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation '!' Operator 'isLegalNameChar' Name '(' Punctuation 'ch' Name ')' Punctuation ' ' Text '&' Operator '&' Operator ' ' Text 'ch' Name ' ' Text '!' Operator '=' Operator ' ' Text "'" Literal.String.Char ',' Literal.String.Char "'" Literal.String.Char ' ' Text '&' Operator '&' Operator ' ' Text 'ch' Name ' ' Text '!' Operator '=' Operator ' ' Text "'" Literal.String.Char ';' Literal.String.Char "'" Literal.String.Char ' ' Text ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'prevNonLegalCh' Name ' ' Text '=' Operator ' ' Text 'currentNonLegalCh' Name ';' Punctuation '\n' Text ' ' Text 'currentNonLegalCh' Name ' ' Text '=' Operator ' ' Text 'ch' Name ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text '\n' Text ' ' Text '//if (isInConst)\n' Comment.Single ' ' Text '//{\n' Comment.Single ' ' Text '// isInConst = false;\n' Comment.Single ' ' Text '// isImmediatelyAfterConst = true;\n' Comment.Single ' ' Text '//}\n' Comment.Single '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'isInHeader' Name ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'isInHeader' Name ' ' Text '=' Operator ' ' Text 'false' Name.Builtin ';' Punctuation '\n' Text ' ' Text 'currentHeader' Name ' ' Text '=' Operator ' ' Text 'headerStack' Name '-' Operator '>' Operator 'back' Name '(' Punctuation ')' Punctuation ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text ' ' Text 'else' Keyword '\n' Text ' ' Text 'currentHeader' Name ' ' Text '=' Operator ' ' Text 'NULL' Name.Builtin ';' Punctuation '\n' Text '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'isCStyle' Name ' ' Text '&' Operator '&' Operator ' ' Text 'isInTemplate' Name '\n' Text ' ' Text '&' Operator '&' Operator ' ' Text '(' Punctuation 'ch' Name ' ' Text '=' Operator '=' Operator ' ' Text "'" Literal.String.Char '<' Literal.String.Char "'" Literal.String.Char ' ' Text '|' Operator '|' Operator ' ' Text 'ch' Name ' ' Text '=' Operator '=' Operator ' ' Text "'" Literal.String.Char '>' Literal.String.Char "'" Literal.String.Char ')' Punctuation '\n' Text ' ' Text '&' Operator '&' Operator ' ' Text 'findHeader' Name '(' Punctuation 'line' Name ',' Punctuation ' ' Text 'i' Name ',' Punctuation ' ' Text 'nonAssignmentOperators' Name ')' Punctuation ' ' Text '=' Operator '=' Operator ' ' Text 'NULL' Name.Builtin ')' Punctuation ' ' Text '//;\n' Comment.Single ' ' Text '{' Punctuation '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'ch' Name ' ' Text '=' Operator '=' Operator ' ' Text "'" Literal.String.Char '<' Literal.String.Char "'" Literal.String.Char ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text '+' Operator '+' Operator 'templateDepth' Name ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text ' ' Text 'else' Keyword ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'ch' Name ' ' Text '=' Operator '=' Operator ' ' Text "'" Literal.String.Char '>' Literal.String.Char "'" Literal.String.Char ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation '-' Operator '-' Operator 'templateDepth' Name ' ' Text '<' Operator '=' Operator ' ' Text '0' Literal.Number.Integer ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'isInTemplate' Name ')' Punctuation '\n' Text ' ' Text 'ch' Name ' ' Text '=' Operator ' ' Text "'" Literal.String.Char ';' Literal.String.Char "'" Literal.String.Char ';' Punctuation '\n' Text ' ' Text 'else' Keyword '\n' Text ' ' Text 'ch' Name ' ' Text '=' Operator ' ' Text "'" Literal.String.Char 't' Literal.String.Char "'" Literal.String.Char ';' Punctuation '\n' Text ' ' Text 'isInTemplate' Name ' ' Text '=' Operator ' ' Text 'false' Name.Builtin ';' Punctuation '\n' Text ' ' Text 'templateDepth' Name ' ' Text '=' Operator ' ' Text '0' Literal.Number.Integer ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text '\n' Text ' ' Text '}' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text '\n' Text ' ' Text '// handle parenthesies\n' Comment.Single ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'ch' Name ' ' Text '=' Operator '=' Operator ' ' Text "'" Literal.String.Char '(' Literal.String.Char "'" Literal.String.Char ' ' Text '|' Operator '|' Operator ' ' Text 'ch' Name ' ' Text '=' Operator '=' Operator ' ' Text "'" Literal.String.Char '[' Literal.String.Char "'" Literal.String.Char ' ' Text '|' Operator '|' Operator ' ' Text 'ch' Name ' ' Text '=' Operator '=' Operator ' ' Text "'" Literal.String.Char ')' Literal.String.Char "'" Literal.String.Char ' ' Text '|' Operator '|' Operator ' ' Text 'ch' Name ' ' Text '=' Operator '=' Operator ' ' Text "'" Literal.String.Char ']' Literal.String.Char "'" Literal.String.Char ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'ch' Name ' ' Text '=' Operator '=' Operator ' ' Text "'" Literal.String.Char '(' Literal.String.Char "'" Literal.String.Char ' ' Text '|' Operator '|' Operator ' ' Text 'ch' Name ' ' Text '=' Operator '=' Operator ' ' Text "'" Literal.String.Char '[' Literal.String.Char "'" Literal.String.Char ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'parenDepth' Name ' ' Text '=' Operator '=' Operator ' ' Text '0' Literal.Number.Integer ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'parenStatementStack' Name '-' Operator '>' Operator 'push_back' Name '(' Punctuation 'isInStatement' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'isInStatement' Name ' ' Text '=' Operator ' ' Text 'true' Name.Builtin ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text ' ' Text 'parenDepth' Name '+' Operator '+' Operator ';' Punctuation '\n' Text '\n' Text ' ' Text 'inStatementIndentStackSizeStack' Name '-' Operator '>' Operator 'push_back' Name '(' Punctuation 'inStatementIndentStack' Name '-' Operator '>' Operator 'size' Name '(' Punctuation ')' Punctuation ')' Punctuation ';' Punctuation '\n' Text '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'currentHeader' Name ' ' Text '!' Operator '=' Operator ' ' Text 'NULL' Name.Builtin ')' Punctuation '\n' Text ' ' Text 'registerInStatementIndent' Name '(' Punctuation 'line' Name ',' Punctuation ' ' Text 'i' Name ',' Punctuation ' ' Text 'spaceTabCount' Name ',' Punctuation ' ' Text 'minConditionalIndent' Name '/*indentLength*2*/' Comment.Multiline ',' Punctuation ' ' Text 'true' Name.Builtin ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'else' Keyword '\n' Text ' ' Text 'registerInStatementIndent' Name.Function '(' Punctuation 'line' Name ',' Punctuation ' ' Text 'i' Name ',' Punctuation ' ' Text 'spaceTabCount' Name ',' Punctuation ' ' Text '0' Literal.Number.Integer ',' Punctuation ' ' Text 'true' Name.Builtin ')' Punctuation ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text ' ' Text 'else' Keyword ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'ch' Name ' ' Text '=' Operator '=' Operator ' ' Text "'" Literal.String.Char ')' Literal.String.Char "'" Literal.String.Char ' ' Text '|' Operator '|' Operator ' ' Text 'ch' Name ' ' Text '=' Operator '=' Operator ' ' Text "'" Literal.String.Char ']' Literal.String.Char "'" Literal.String.Char ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'parenDepth' Name '-' Operator '-' Operator ';' Punctuation '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'parenDepth' Name ' ' Text '=' Operator '=' Operator ' ' Text '0' Literal.Number.Integer ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'isInStatement' Name ' ' Text '=' Operator ' ' Text 'parenStatementStack' Name '-' Operator '>' Operator 'back' Name '(' Punctuation ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'parenStatementStack' Name '-' Operator '>' Operator 'pop_back' Name '(' Punctuation ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'ch' Name ' ' Text '=' Operator ' ' Text "'" Literal.String.Char ' ' Literal.String.Char "'" Literal.String.Char ';' Punctuation '\n' Text '\n' Text ' ' Text 'isInConditional' Name ' ' Text '=' Operator ' ' Text 'false' Name.Builtin ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation '!' Operator 'inStatementIndentStackSizeStack' Name '-' Operator '>' Operator 'empty' Name '(' Punctuation ')' Punctuation ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'unsigned' Keyword.Type ' ' Text 'int' Keyword.Type ' ' Text 'previousIndentStackSize' Name ' ' Text '=' Operator ' ' Text 'inStatementIndentStackSizeStack' Name '-' Operator '>' Operator 'back' Name '(' Punctuation ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'inStatementIndentStackSizeStack' Name '-' Operator '>' Operator 'pop_back' Name '(' Punctuation ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'while' Keyword ' ' Text '(' Punctuation 'previousIndentStackSize' Name ' ' Text '<' Operator ' ' Text 'inStatementIndentStack' Name '-' Operator '>' Operator 'size' Name '(' Punctuation ')' Punctuation ')' Punctuation '\n' Text ' ' Text 'inStatementIndentStack' Name '-' Operator '>' Operator 'pop_back' Name '(' Punctuation ')' Punctuation ';' Punctuation '\n' Text '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation '!' Operator 'parenIndentStack' Name '-' Operator '>' Operator 'empty' Name '(' Punctuation ')' Punctuation ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'int' Keyword.Type ' ' Text 'poppedIndent' Name ' ' Text '=' Operator ' ' Text 'parenIndentStack' Name '-' Operator '>' Operator 'back' Name '(' Punctuation ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'parenIndentStack' Name '-' Operator '>' Operator 'pop_back' Name '(' Punctuation ')' Punctuation ';' Punctuation '\n' Text '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'i' Name ' ' Text '=' Operator '=' Operator ' ' Text '0' Literal.Number.Integer ')' Punctuation '\n' Text ' ' Text 'spaceTabCount' Name ' ' Text '=' Operator ' ' Text 'poppedIndent' Name ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text '\n' Text ' ' Text 'continue' Keyword ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text '\n' Text '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'ch' Name ' ' Text '=' Operator '=' Operator ' ' Text "'" Literal.String.Char '{' Literal.String.Char "'" Literal.String.Char ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'bool' Keyword.Type ' ' Text 'isBlockOpener' Name ' ' Text '=' Operator ' ' Text 'false' Name.Builtin ';' Punctuation '\n' Text '\n' Text ' ' Text "// first, check if '{' is a block-opener or an static-array opener\n" Comment.Single ' ' Text 'isBlockOpener' Name ' ' Text '=' Operator ' ' Text '(' Punctuation ' ' Text '(' Punctuation 'prevNonSpaceCh' Name ' ' Text '=' Operator '=' Operator ' ' Text "'" Literal.String.Char '{' Literal.String.Char "'" Literal.String.Char ' ' Text '&' Operator '&' Operator ' ' Text 'bracketBlockStateStack' Name '-' Operator '>' Operator 'back' Name '(' Punctuation ')' Punctuation ')' Punctuation '\n' Text ' ' Text '|' Operator '|' Operator ' ' Text 'prevNonSpaceCh' Name ' ' Text '=' Operator '=' Operator ' ' Text "'" Literal.String.Char '}' Literal.String.Char "'" Literal.String.Char '\n' Text ' ' Text '|' Operator '|' Operator ' ' Text 'prevNonSpaceCh' Name ' ' Text '=' Operator '=' Operator ' ' Text "'" Literal.String.Char ')' Literal.String.Char "'" Literal.String.Char '\n' Text ' ' Text '|' Operator '|' Operator ' ' Text 'prevNonSpaceCh' Name ' ' Text '=' Operator '=' Operator ' ' Text "'" Literal.String.Char ';' Literal.String.Char "'" Literal.String.Char '\n' Text ' ' Text '|' Operator '|' Operator ' ' Text 'isInClassHeader' Name '\n' Text ' ' Text '|' Operator '|' Operator ' ' Text 'isBlockOpener' Name '\n' Text ' ' Text '|' Operator '|' Operator ' ' Text 'isImmediatelyAfterConst' Name '\n' Text ' ' Text '|' Operator '|' Operator ' ' Text '(' Punctuation 'isInDefine' Name ' ' Text '&' Operator '&' Operator '\n' Text ' ' Text '(' Punctuation 'prevNonSpaceCh' Name ' ' Text '=' Operator '=' Operator ' ' Text "'" Literal.String.Char '(' Literal.String.Char "'" Literal.String.Char '\n' Text ' ' Text '|' Operator '|' Operator ' ' Text 'prevNonSpaceCh' Name ' ' Text '=' Operator '=' Operator ' ' Text "'" Literal.String.Char '_' Literal.String.Char "'" Literal.String.Char '\n' Text ' ' Text '|' Operator '|' Operator ' ' Text 'isalnum' Name '(' Punctuation 'prevNonSpaceCh' Name ')' Punctuation ')' Punctuation ')' Punctuation ' ' Text ')' Punctuation ';' Punctuation '\n' Text '\n' Text ' ' Text 'isInClassHeader' Name ' ' Text '=' Operator ' ' Text 'false' Name.Builtin ';' Punctuation '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation '!' Operator 'isBlockOpener' Name ' ' Text '&' Operator '&' Operator ' ' Text 'currentHeader' Name ' ' Text '!' Operator '=' Operator ' ' Text 'NULL' Name.Builtin ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'for' Keyword ' ' Text '(' Punctuation 'unsigned' Keyword.Type ' ' Text 'int' Keyword.Type ' ' Text 'n' Name '=' Operator '0' Literal.Number.Integer ';' Punctuation ' ' Text 'n' Name ' ' Text '<' Operator ' ' Text 'nonParenHeaders' Name '.' Punctuation 'size' Name '(' Punctuation ')' Punctuation ';' Punctuation ' ' Text 'n' Name '+' Operator '+' Operator ')' Punctuation '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'currentHeader' Name ' ' Text '=' Operator '=' Operator ' ' Text 'nonParenHeaders' Name '[' Punctuation 'n' Name ']' Punctuation ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'isBlockOpener' Name ' ' Text '=' Operator ' ' Text 'true' Name.Builtin ';' Punctuation '\n' Text ' ' Text 'break' Keyword ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text ' ' Text 'bracketBlockStateStack' Name '-' Operator '>' Operator 'push_back' Name '(' Punctuation 'isBlockOpener' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation '!' Operator 'isBlockOpener' Name ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'inStatementIndentStackSizeStack' Name '-' Operator '>' Operator 'push_back' Name '(' Punctuation 'inStatementIndentStack' Name '-' Operator '>' Operator 'size' Name '(' Punctuation ')' Punctuation ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'registerInStatementIndent' Name '(' Punctuation 'line' Name ',' Punctuation ' ' Text 'i' Name ',' Punctuation ' ' Text 'spaceTabCount' Name ',' Punctuation ' ' Text '0' Literal.Number.Integer ',' Punctuation ' ' Text 'true' Name.Builtin ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'parenDepth' Name '+' Operator '+' Operator ';' Punctuation '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'i' Name ' ' Text '=' Operator '=' Operator ' ' Text '0' Literal.Number.Integer ')' Punctuation '\n' Text ' ' Text 'shouldIndentBrackettedLine' Name ' ' Text '=' Operator ' ' Text 'false' Name.Builtin ';' Punctuation '\n' Text '\n' Text ' ' Text 'continue' Keyword ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text '\n' Text ' ' Text '// this bracket is a block opener...\n' Comment.Single '\n' Text ' ' Text '+' Operator '+' Operator 'lineOpeningBlocksNum' Name ';' Punctuation '\n' Text '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'isInClassHeader' Name ')' Punctuation '\n' Text ' ' Text 'isInClassHeader' Name ' ' Text '=' Operator ' ' Text 'false' Name.Builtin ';' Punctuation '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'isInClassHeaderTab' Name ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'isInClassHeaderTab' Name ' ' Text '=' Operator ' ' Text 'false' Name.Builtin ';' Punctuation '\n' Text ' ' Text 'tabCount' Name ' ' Text '-' Operator '=' Operator ' ' Text '2' Literal.Number.Integer ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text '\n' Text ' ' Text 'blockParenDepthStack' Name '-' Operator '>' Operator 'push_back' Name '(' Punctuation 'parenDepth' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'blockStatementStack' Name '-' Operator '>' Operator 'push_back' Name '(' Punctuation 'isInStatement' Name ')' Punctuation ';' Punctuation '\n' Text '\n' Text ' ' Text 'inStatementIndentStackSizeStack' Name '-' Operator '>' Operator 'push_back' Name '(' Punctuation 'inStatementIndentStack' Name '-' Operator '>' Operator 'size' Name '(' Punctuation ')' Punctuation ')' Punctuation ';' Punctuation '\n' Text '\n' Text ' ' Text 'blockTabCount' Name ' ' Text '+' Operator '=' Operator ' ' Text 'isInStatement' Name '?' Operator ' ' Text '1' Literal.Number.Integer ' ' Text ':' Operator ' ' Text '0' Literal.Number.Integer ';' Punctuation '\n' Text ' ' Text 'parenDepth' Name ' ' Text '=' Operator ' ' Text '0' Literal.Number.Integer ';' Punctuation '\n' Text ' ' Text 'isInStatement' Name ' ' Text '=' Operator ' ' Text 'false' Name.Builtin ';' Punctuation '\n' Text '\n' Text ' ' Text 'tempStacks' Name '-' Operator '>' Operator 'push_back' Name '(' Punctuation 'new' Keyword ' ' Text 'vector' Name '<' Operator 'const' Keyword ' ' Text 'string' Name '*' Operator '>' Operator ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'headerStack' Name '-' Operator '>' Operator 'push_back' Name '(' Punctuation '&' Operator 'AS_OPEN_BRACKET' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'lastLineHeader' Name ' ' Text '=' Operator ' ' Text '&' Operator 'AS_OPEN_BRACKET' Name ';' Punctuation ' ' Text '// <------\n' Comment.Single '\n' Text ' ' Text 'continue' Keyword ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text '\n' Text ' ' Text '//check if a header has been reached\n' Comment.Single ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'prevCh' Name ' ' Text '=' Operator '=' Operator ' ' Text "'" Literal.String.Char ' ' Literal.String.Char "'" Literal.String.Char ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'bool' Keyword.Type ' ' Text 'isIndentableHeader' Name ' ' Text '=' Operator ' ' Text 'true' Name.Builtin ';' Punctuation '\n' Text ' ' Text 'const' Keyword ' ' Text 'string' Name ' ' Text '*' Operator 'newHeader' Name ' ' Text '=' Operator ' ' Text 'findHeader' Name '(' Punctuation 'line' Name ',' Punctuation ' ' Text 'i' Name ',' Punctuation ' ' Text 'headers' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'newHeader' Name ' ' Text '!' Operator '=' Operator ' ' Text 'NULL' Name.Builtin ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text '// if we reached here, then this is a header...\n' Comment.Single ' ' Text 'isInHeader' Name ' ' Text '=' Operator ' ' Text 'true' Name.Builtin ';' Punctuation '\n' Text '\n' Text ' ' Text 'vector' Name '<' Operator 'const' Keyword ' ' Text 'string' Name '*' Operator '>' Operator ' ' Text '*' Operator 'lastTempStack' Name ';' Punctuation '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'tempStacks' Name '-' Operator '>' Operator 'empty' Name '(' Punctuation ')' Punctuation ')' Punctuation '\n' Text ' ' Text 'lastTempStack' Name ' ' Text '=' Operator ' ' Text 'NULL' Name.Builtin ';' Punctuation '\n' Text ' ' Text 'else' Keyword '\n' Text ' ' Text 'lastTempStack' Name ' ' Text '=' Operator ' ' Text 'tempStacks' Name '-' Operator '>' Operator 'back' Name '(' Punctuation ')' Punctuation ';' Punctuation '\n' Text '\n' Text ' ' Text '// if a new block is opened, push a new stack into tempStacks to hold the\n' Comment.Single ' ' Text '// future list of headers in the new block.\n' Comment.Single '\n' Text ' ' Text "// take care of the special case: 'else if (...)'\n" Comment.Single ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'newHeader' Name ' ' Text '=' Operator '=' Operator ' ' Text '&' Operator 'AS_IF' Name ' ' Text '&' Operator '&' Operator ' ' Text 'lastLineHeader' Name ' ' Text '=' Operator '=' Operator ' ' Text '&' Operator 'AS_ELSE' Name ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text "//spaceTabCount += indentLength; // to counter the opposite addition that occurs when the 'if' is registered below...\n" Comment.Single ' ' Text 'headerStack' Name '-' Operator '>' Operator 'pop_back' Name '(' Punctuation ')' Punctuation ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text '\n' Text ' ' Text "// take care of 'else'\n" Comment.Single ' ' Text 'else' Keyword ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'newHeader' Name ' ' Text '=' Operator '=' Operator ' ' Text '&' Operator 'AS_ELSE' Name ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'lastTempStack' Name ' ' Text '!' Operator '=' Operator ' ' Text 'NULL' Name.Builtin ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'int' Keyword.Type ' ' Text 'indexOfIf' Name ' ' Text '=' Operator ' ' Text 'indexOf' Name '(' Punctuation '*' Operator 'lastTempStack' Name ',' Punctuation ' ' Text '&' Operator 'AS_IF' Name ')' Punctuation ';' Punctuation ' ' Text '// <---\n' Comment.Single ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'indexOfIf' Name ' ' Text '!' Operator '=' Operator ' ' Text '-1' Literal.Number.Integer ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text "// recreate the header list in headerStack up to the previous 'if'\n" Comment.Single ' ' Text '// from the temporary snapshot stored in lastTempStack.\n' Comment.Single ' ' Text 'int' Keyword.Type ' ' Text 'restackSize' Name ' ' Text '=' Operator ' ' Text 'lastTempStack' Name '-' Operator '>' Operator 'size' Name '(' Punctuation ')' Punctuation ' ' Text '-' Operator ' ' Text 'indexOfIf' Name ' ' Text '-' Operator ' ' Text '1' Literal.Number.Integer ';' Punctuation '\n' Text ' ' Text 'for' Keyword ' ' Text '(' Punctuation 'int' Keyword.Type ' ' Text 'r' Name '=' Operator '0' Literal.Number.Integer ';' Punctuation ' ' Text 'r' Name '<' Operator 'restackSize' Name ';' Punctuation ' ' Text 'r' Name '+' Operator '+' Operator ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'headerStack' Name '-' Operator '>' Operator 'push_back' Name '(' Punctuation 'lastTempStack' Name '-' Operator '>' Operator 'back' Name '(' Punctuation ')' Punctuation ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'lastTempStack' Name '-' Operator '>' Operator 'pop_back' Name '(' Punctuation ')' Punctuation ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation '!' Operator 'closingBracketReached' Name ')' Punctuation '\n' Text ' ' Text 'tabCount' Name ' ' Text '+' Operator '=' Operator ' ' Text 'restackSize' Name ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text ' ' Text "/*\n * If the above if is not true, i.e. no 'if' before the 'else',\n * then nothing beautiful will come out of this...\n * I should think about inserting an Exception here to notify the caller of this...\n */" Comment.Multiline '\n' Text ' ' Text '}' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text '\n' Text ' ' Text "// check if 'while' closes a previous 'do'\n" Comment.Single ' ' Text 'else' Keyword ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'newHeader' Name ' ' Text '=' Operator '=' Operator ' ' Text '&' Operator 'AS_WHILE' Name ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'lastTempStack' Name ' ' Text '!' Operator '=' Operator ' ' Text 'NULL' Name.Builtin ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'int' Keyword.Type ' ' Text 'indexOfDo' Name ' ' Text '=' Operator ' ' Text 'indexOf' Name '(' Punctuation '*' Operator 'lastTempStack' Name ',' Punctuation ' ' Text '&' Operator 'AS_DO' Name ')' Punctuation ';' Punctuation ' ' Text '// <---\n' Comment.Single ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'indexOfDo' Name ' ' Text '!' Operator '=' Operator ' ' Text '-1' Literal.Number.Integer ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text "// recreate the header list in headerStack up to the previous 'do'\n" Comment.Single ' ' Text '// from the temporary snapshot stored in lastTempStack.\n' Comment.Single ' ' Text 'int' Keyword.Type ' ' Text 'restackSize' Name ' ' Text '=' Operator ' ' Text 'lastTempStack' Name '-' Operator '>' Operator 'size' Name '(' Punctuation ')' Punctuation ' ' Text '-' Operator ' ' Text 'indexOfDo' Name ' ' Text '-' Operator ' ' Text '1' Literal.Number.Integer ';' Punctuation '\n' Text ' ' Text 'for' Keyword ' ' Text '(' Punctuation 'int' Keyword.Type ' ' Text 'r' Name '=' Operator '0' Literal.Number.Integer ';' Punctuation ' ' Text 'r' Name '<' Operator 'restackSize' Name ';' Punctuation ' ' Text 'r' Name '+' Operator '+' Operator ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'headerStack' Name '-' Operator '>' Operator 'push_back' Name '(' Punctuation 'lastTempStack' Name '-' Operator '>' Operator 'back' Name '(' Punctuation ')' Punctuation ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'lastTempStack' Name '-' Operator '>' Operator 'pop_back' Name '(' Punctuation ')' Punctuation ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation '!' Operator 'closingBracketReached' Name ')' Punctuation '\n' Text ' ' Text 'tabCount' Name ' ' Text '+' Operator '=' Operator ' ' Text 'restackSize' Name ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text ' ' Text "// check if 'catch' closes a previous 'try' or 'catch'\n" Comment.Single ' ' Text 'else' Keyword ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'newHeader' Name ' ' Text '=' Operator '=' Operator ' ' Text '&' Operator 'AS_CATCH' Name ' ' Text '|' Operator '|' Operator ' ' Text 'newHeader' Name ' ' Text '=' Operator '=' Operator ' ' Text '&' Operator 'AS_FINALLY' Name ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'lastTempStack' Name ' ' Text '!' Operator '=' Operator ' ' Text 'NULL' Name.Builtin ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'int' Keyword.Type ' ' Text 'indexOfTry' Name ' ' Text '=' Operator ' ' Text 'indexOf' Name '(' Punctuation '*' Operator 'lastTempStack' Name ',' Punctuation ' ' Text '&' Operator 'AS_TRY' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'indexOfTry' Name ' ' Text '=' Operator '=' Operator ' ' Text '-1' Literal.Number.Integer ')' Punctuation '\n' Text ' ' Text 'indexOfTry' Name ' ' Text '=' Operator ' ' Text 'indexOf' Name '(' Punctuation '*' Operator 'lastTempStack' Name ',' Punctuation ' ' Text '&' Operator 'AS_CATCH' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'indexOfTry' Name ' ' Text '!' Operator '=' Operator ' ' Text '-1' Literal.Number.Integer ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text "// recreate the header list in headerStack up to the previous 'try'\n" Comment.Single ' ' Text '// from the temporary snapshot stored in lastTempStack.\n' Comment.Single ' ' Text 'int' Keyword.Type ' ' Text 'restackSize' Name ' ' Text '=' Operator ' ' Text 'lastTempStack' Name '-' Operator '>' Operator 'size' Name '(' Punctuation ')' Punctuation ' ' Text '-' Operator ' ' Text 'indexOfTry' Name ' ' Text '-' Operator ' ' Text '1' Literal.Number.Integer ';' Punctuation '\n' Text ' ' Text 'for' Keyword ' ' Text '(' Punctuation 'int' Keyword.Type ' ' Text 'r' Name '=' Operator '0' Literal.Number.Integer ';' Punctuation ' ' Text 'r' Name '<' Operator 'restackSize' Name ';' Punctuation ' ' Text 'r' Name '+' Operator '+' Operator ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'headerStack' Name '-' Operator '>' Operator 'push_back' Name '(' Punctuation 'lastTempStack' Name '-' Operator '>' Operator 'back' Name '(' Punctuation ')' Punctuation ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'lastTempStack' Name '-' Operator '>' Operator 'pop_back' Name '(' Punctuation ')' Punctuation ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation '!' Operator 'closingBracketReached' Name ')' Punctuation '\n' Text ' ' Text 'tabCount' Name ' ' Text '+' Operator '=' Operator ' ' Text 'restackSize' Name ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text ' ' Text 'else' Keyword ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'newHeader' Name ' ' Text '=' Operator '=' Operator ' ' Text '&' Operator 'AS_CASE' Name ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'isInCase' Name ' ' Text '=' Operator ' ' Text 'true' Name.Builtin ';' Punctuation '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation '!' Operator 'caseIndent' Name ')' Punctuation '\n' Text ' ' Text '-' Operator '-' Operator 'tabCount' Name ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text ' ' Text 'else' Keyword ' ' Text 'if' Keyword '(' Punctuation 'newHeader' Name ' ' Text '=' Operator '=' Operator ' ' Text '&' Operator 'AS_DEFAULT' Name ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'isInCase' Name ' ' Text '=' Operator ' ' Text 'true' Name.Builtin ';' Punctuation '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation '!' Operator 'caseIndent' Name ')' Punctuation '\n' Text ' ' Text '-' Operator '-' Operator 'tabCount' Name ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text ' ' Text 'else' Keyword ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'newHeader' Name ' ' Text '=' Operator '=' Operator ' ' Text '&' Operator 'AS_PUBLIC' Name ' ' Text '|' Operator '|' Operator ' ' Text 'newHeader' Name ' ' Text '=' Operator '=' Operator ' ' Text '&' Operator 'AS_PROTECTED' Name ' ' Text '|' Operator '|' Operator ' ' Text 'newHeader' Name ' ' Text '=' Operator '=' Operator ' ' Text '&' Operator 'AS_PRIVATE' Name ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'isCStyle' Name ' ' Text '&' Operator '&' Operator ' ' Text '!' Operator 'isInClassHeader' Name ')' Punctuation '\n' Text ' ' Text '-' Operator '-' Operator 'tabCount' Name ';' Punctuation '\n' Text ' ' Text 'isIndentableHeader' Name ' ' Text '=' Operator ' ' Text 'false' Name.Builtin ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text ' ' Text '//else if ((newHeader == &STATIC || newHeader == &SYNCHRONIZED) &&\n' Comment.Single ' ' Text '// !headerStack->empty() &&\n' Comment.Single ' ' Text '// (headerStack->back() == &STATIC || headerStack->back() == &SYNCHRONIZED))\n' Comment.Single ' ' Text '//{\n' Comment.Single ' ' Text '// isIndentableHeader = false;\n' Comment.Single ' ' Text '//}\n' Comment.Single ' ' Text 'else' Keyword ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'newHeader' Name ' ' Text '=' Operator '=' Operator ' ' Text '&' Operator 'AS_STATIC' Name '\n' Text ' ' Text '|' Operator '|' Operator ' ' Text 'newHeader' Name ' ' Text '=' Operator '=' Operator ' ' Text '&' Operator 'AS_SYNCHRONIZED' Name '\n' Text ' ' Text '|' Operator '|' Operator ' ' Text '(' Punctuation 'newHeader' Name ' ' Text '=' Operator '=' Operator ' ' Text '&' Operator 'AS_CONST' Name ' ' Text '&' Operator '&' Operator ' ' Text 'isCStyle' Name ')' Punctuation ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation '!' Operator 'headerStack' Name '-' Operator '>' Operator 'empty' Name '(' Punctuation ')' Punctuation ' ' Text '&' Operator '&' Operator '\n' Text ' ' Text '(' Punctuation 'headerStack' Name '-' Operator '>' Operator 'back' Name '(' Punctuation ')' Punctuation ' ' Text '=' Operator '=' Operator ' ' Text '&' Operator 'AS_STATIC' Name '\n' Text ' ' Text '|' Operator '|' Operator ' ' Text 'headerStack' Name '-' Operator '>' Operator 'back' Name '(' Punctuation ')' Punctuation ' ' Text '=' Operator '=' Operator ' ' Text '&' Operator 'AS_SYNCHRONIZED' Name '\n' Text ' ' Text '|' Operator '|' Operator ' ' Text 'headerStack' Name '-' Operator '>' Operator 'back' Name '(' Punctuation ')' Punctuation ' ' Text '=' Operator '=' Operator ' ' Text '&' Operator 'AS_CONST' Name ')' Punctuation ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'isIndentableHeader' Name ' ' Text '=' Operator ' ' Text 'false' Name.Builtin ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text ' ' Text 'else' Keyword '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'isIndentableHeader' Name ' ' Text '=' Operator ' ' Text 'false' Name.Builtin ';' Punctuation '\n' Text ' ' Text 'probationHeader' Name ' ' Text '=' Operator ' ' Text 'newHeader' Name ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text ' ' Text 'else' Keyword ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'newHeader' Name ' ' Text '=' Operator '=' Operator ' ' Text '&' Operator 'AS_CONST' Name ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text '// this will be entered only if NOT in C style\n' Comment.Single ' ' Text '// since otherwise the CONST would be found to be a probstion header...\n' Comment.Single '\n' Text ' ' Text '//if (isCStyle)\n' Comment.Single ' ' Text '// isInConst = true;\n' Comment.Single ' ' Text 'isIndentableHeader' Name ' ' Text '=' Operator ' ' Text 'false' Name.Builtin ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text ' ' Text '/*\n else if (newHeader == &OPERATOR)\n {\n if (isCStyle)\n isInOperator = true;\n isIndentableHeader = false;\n }\n */' Comment.Multiline '\n' Text ' ' Text 'else' Keyword ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'newHeader' Name ' ' Text '=' Operator '=' Operator ' ' Text '&' Operator 'AS_TEMPLATE' Name ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'isCStyle' Name ')' Punctuation '\n' Text ' ' Text 'isInTemplate' Name ' ' Text '=' Operator ' ' Text 'true' Name.Builtin ';' Punctuation '\n' Text ' ' Text 'isIndentableHeader' Name ' ' Text '=' Operator ' ' Text 'false' Name.Builtin ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text '\n' Text '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'isIndentableHeader' Name ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text '// 3.2.99\n' Comment.Single ' ' Text '//spaceTabCount-=indentLength;\n' Comment.Single ' ' Text 'headerStack' Name '-' Operator '>' Operator 'push_back' Name '(' Punctuation 'newHeader' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'isInStatement' Name ' ' Text '=' Operator ' ' Text 'false' Name.Builtin ';' Punctuation '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'indexOf' Name '(' Punctuation 'nonParenHeaders' Name ',' Punctuation ' ' Text 'newHeader' Name ')' Punctuation ' ' Text '=' Operator '=' Operator ' ' Text '-1' Literal.Number.Integer ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'isInConditional' Name ' ' Text '=' Operator ' ' Text 'true' Name.Builtin ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text ' ' Text 'lastLineHeader' Name ' ' Text '=' Operator ' ' Text 'newHeader' Name ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text ' ' Text 'else' Keyword '\n' Text ' ' Text 'isInHeader' Name ' ' Text '=' Operator ' ' Text 'false' Name.Builtin ';' Punctuation '\n' Text '\n' Text ' ' Text '//lastLineHeader = newHeader;\n' Comment.Single '\n' Text ' ' Text 'outBuffer' Name '.' Punctuation 'append' Name '(' Punctuation 'newHeader' Name '-' Operator '>' Operator 'substr' Name '(' Punctuation '1' Literal.Number.Integer ')' Punctuation ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'i' Name ' ' Text '+' Operator '=' Operator ' ' Text 'newHeader' Name '-' Operator '>' Operator 'length' Name '(' Punctuation ')' Punctuation ' ' Text '-' Operator ' ' Text '1' Literal.Number.Integer ';' Punctuation '\n' Text '\n' Text ' ' Text 'continue' Keyword ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'isCStyle' Name ' ' Text '&' Operator '&' Operator ' ' Text '!' Operator 'isalpha' Name '(' Punctuation 'prevCh' Name ')' Punctuation '\n' Text ' ' Text '&' Operator '&' Operator ' ' Text 'line' Name '.' Punctuation 'COMPARE' Name '(' Punctuation 'i' Name ',' Punctuation ' ' Text '8' Literal.Number.Integer ',' Punctuation ' ' Text 'AS_OPERATOR' Name ')' Punctuation ' ' Text '=' Operator '=' Operator ' ' Text '0' Literal.Number.Integer ' ' Text '&' Operator '&' Operator ' ' Text '!' Operator 'isalnum' Name '(' Punctuation 'line' Name '[' Punctuation 'i' Name '+' Operator '8' Literal.Number.Integer ']' Punctuation ')' Punctuation ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'isInOperator' Name ' ' Text '=' Operator ' ' Text 'true' Name.Builtin ';' Punctuation '\n' Text ' ' Text 'outBuffer' Name '.' Punctuation 'append' Name '(' Punctuation 'AS_OPERATOR' Name '.' Punctuation 'substr' Name '(' Punctuation '1' Literal.Number.Integer ')' Punctuation ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'i' Name ' ' Text '+' Operator '=' Operator ' ' Text '7' Literal.Number.Integer ';' Punctuation '\n' Text ' ' Text 'continue' Keyword ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'ch' Name ' ' Text '=' Operator '=' Operator ' ' Text "'" Literal.String.Char '?' Literal.String.Char "'" Literal.String.Char ')' Punctuation '\n' Text ' ' Text 'isInQuestion' Name ' ' Text '=' Operator ' ' Text 'true' Name.Builtin ';' Punctuation '\n' Text '\n' Text '\n' Text ' ' Text "// special handling of 'case' statements\n" Comment.Single ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'ch' Name ' ' Text '=' Operator '=' Operator ' ' Text "'" Literal.String.Char ':' Literal.String.Char "'" Literal.String.Char ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'line' Name '.' Punctuation 'length' Name '(' Punctuation ')' Punctuation ' ' Text '>' Operator ' ' Text 'i' Name '+' Operator '1' Literal.Number.Integer ' ' Text '&' Operator '&' Operator ' ' Text 'line' Name '[' Punctuation 'i' Name '+' Operator '1' Literal.Number.Integer ']' Punctuation ' ' Text '=' Operator '=' Operator ' ' Text "'" Literal.String.Char ':' Literal.String.Char "'" Literal.String.Char ')' Punctuation ' ' Text '// look for ::\n' Comment.Single ' ' Text '{' Punctuation '\n' Text ' ' Text '+' Operator '+' Operator 'i' Name ';' Punctuation '\n' Text ' ' Text 'outBuffer' Name '.' Punctuation 'append' Name '(' Punctuation '1' Literal.Number.Integer ',' Punctuation ' ' Text "'" Literal.String.Char ':' Literal.String.Char "'" Literal.String.Char ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'ch' Name ' ' Text '=' Operator ' ' Text "'" Literal.String.Char ' ' Literal.String.Char "'" Literal.String.Char ';' Punctuation '\n' Text ' ' Text 'continue' Keyword ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text '\n' Text ' ' Text 'else' Keyword ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'isCStyle' Name ' ' Text '&' Operator '&' Operator ' ' Text 'isInClass' Name ' ' Text '&' Operator '&' Operator ' ' Text 'prevNonSpaceCh' Name ' ' Text '!' Operator '=' Operator ' ' Text "'" Literal.String.Char ')' Literal.String.Char "'" Literal.String.Char ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text '// BEGIN Content of ASBeautifier.cpp.BITFIELD.patch:\n' Comment.Single ' \n ' Text 'unsigned' Keyword.Type ' ' Text 'int' Keyword.Type ' ' Text 'chIndex' Name ';' Punctuation '\n' Text ' \t\t\t ' Text 'char' Keyword.Type ' ' Text 'nextCh' Name ' ' Text '=' Operator ' ' Text '0' Literal.Number.Integer ';' Punctuation '\n' Text ' ' Text 'for' Keyword ' ' Text '(' Punctuation 'chIndex' Name ' ' Text '=' Operator ' ' Text 'i' Name '+' Operator '1' Literal.Number.Integer ';' Punctuation ' ' Text 'chIndex' Name ' ' Text '<' Operator ' ' Text 'line' Name '.' Punctuation 'length' Name '(' Punctuation ')' Punctuation ';' Punctuation ' ' Text 'chIndex' Name '+' Operator '+' Operator ')' Punctuation '\n' Text ' \t\t' Text 'if' Keyword ' ' Text '(' Punctuation '!' Operator 'isWhiteSpace' Name '(' Punctuation 'line' Name '[' Punctuation 'chIndex' Name ']' Punctuation ')' Punctuation ')' Punctuation '\n' Text '\t\t\t\t\t\t' Text 'break' Keyword ';' Punctuation '\n' Text '\t\t\t\t\t' Text 'if' Keyword ' ' Text '(' Punctuation 'chIndex' Name '<' Operator ' ' Text 'line' Name '.' Punctuation 'length' Name '(' Punctuation ')' Punctuation ')' Punctuation '\n' Text ' \t\t\t\t\t' Text 'nextCh' Name ' ' Text '=' Operator ' ' Text 'line' Name '[' Punctuation 'chIndex' Name ']' Punctuation ';' Punctuation '\n' Text '\t\t\t\t' Text 'int' Keyword.Type ' ' Text 'nWord' Name ' ' Text '=' Operator '0' Literal.Number.Integer ';' Punctuation '\n' Text ' \t\t\t' Text 'for' Keyword ' ' Text '(' Punctuation 'chIndex' Name ' ' Text '=' Operator ' ' Text '0' Literal.Number.Integer ';' Punctuation ' ' Text 'chIndex' Name ' ' Text '<' Operator ' ' Text 'i' Name ';' Punctuation ' ' Text 'chIndex' Name '+' Operator '+' Operator ')' Punctuation '\n' Text '\t\t\t\t' Text '{' Punctuation '\n' Text '\t\t\t\t\t' Text 'if' Keyword ' ' Text '(' Punctuation '!' Operator 'isWhiteSpace' Name '(' Punctuation 'line' Name '[' Punctuation 'chIndex' Name ']' Punctuation ')' Punctuation ')' Punctuation '\n' Text '\t\t\t\t\t' Text '{' Punctuation '\n' Text '\t\t\t\t\t\t' Text 'nWord' Name ' ' Text '+' Operator '+' Operator ';' Punctuation '\n' Text '\t\t\t\t\t\t' Text 'while' Keyword ' ' Text '(' Punctuation '!' Operator 'isWhiteSpace' Name '(' Punctuation 'line' Name '[' Punctuation '+' Operator '+' Operator 'chIndex' Name ']' Punctuation ')' Punctuation ')' Punctuation ';' Punctuation '\n' Text '\t\t\t\t\t' Text '}' Punctuation '\t\t\t\t\t\t\t\t\t\n\t\t\t\t' Text '}' Punctuation '\n' Text '\t\t\t\t' Text 'if' Keyword ' ' Text '(' Punctuation '(' Punctuation 'nextCh' Name ' ' Text '>' Operator '=' Operator ' ' Text "'" Literal.String.Char '0' Literal.String.Char "'" Literal.String.Char ' ' Text '&' Operator '&' Operator ' ' Text 'nextCh' Name ' ' Text '<' Operator '=' Operator ' ' Text "'" Literal.String.Char '9' Literal.String.Char "'" Literal.String.Char ')' Punctuation ' ' Text '|' Operator '|' Operator ' ' Text '(' Punctuation 'nWord' Name ' ' Text '>' Operator '1' Literal.Number.Integer ')' Punctuation ')' Punctuation '\n' Text '\t\t\t\t\t' Text 'continue' Keyword ';' Punctuation '\n' Text ' ' Text '// END Content of ASBeautifier.cpp.BITFIELD.patch:\n' Comment.Single ' \n ' Text '-' Operator '-' Operator 'tabCount' Name ';' Punctuation '\n' Text ' ' Text "// found a 'private:' or 'public:' inside a class definition\n" Comment.Single ' ' Text '// so do nothing special\n' Comment.Single ' ' Text '}' Punctuation '\n' Text '\n' Text ' ' Text 'else' Keyword ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'isCStyle' Name ' ' Text '&' Operator '&' Operator ' ' Text 'isInClassHeader' Name ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text '\n' Text ' ' Text "// found a 'class A : public B' definition\n" Comment.Single ' ' Text '// so do nothing special\n' Comment.Single ' ' Text '}' Punctuation '\n' Text '\n' Text ' ' Text 'else' Keyword ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'isInQuestion' Name ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'isInQuestion' Name ' ' Text '=' Operator ' ' Text 'false' Name.Builtin ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text ' ' Text 'else' Keyword ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'isCStyle' Name ' ' Text '&' Operator '&' Operator ' ' Text 'prevNonSpaceCh' Name ' ' Text '=' Operator '=' Operator ' ' Text "'" Literal.String.Char ')' Literal.String.Char "'" Literal.String.Char ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'isInClassHeader' Name ' ' Text '=' Operator ' ' Text 'true' Name.Builtin ';' Punctuation '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'i' Name '=' Operator '=' Operator '0' Literal.Number.Integer ')' Punctuation '\n' Text ' ' Text 'tabCount' Name ' ' Text '+' Operator '=' Operator ' ' Text '2' Literal.Number.Integer ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text ' ' Text 'else' Keyword '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'currentNonSpaceCh' Name ' ' Text '=' Operator ' ' Text "'" Literal.String.Char ';' Literal.String.Char "'" Literal.String.Char ';' Punctuation ' ' Text "// so that brackets after the ':' will appear as block-openers\n" Comment.Single ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'isInCase' Name ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'isInCase' Name ' ' Text '=' Operator ' ' Text 'false' Name.Builtin ';' Punctuation '\n' Text ' ' Text 'ch' Name ' ' Text '=' Operator ' ' Text "'" Literal.String.Char ';' Literal.String.Char "'" Literal.String.Char ';' Punctuation ' ' Text "// from here on, treat char as ';'\n" Comment.Single ' ' Text '}' Punctuation ' \n ' Text '// BEGIN content of ASBeautifier.cpp.BITFIELD.patch.bz2\n' Comment.Single ' ' Text 'else' Keyword ' ' Text '// bitfield or labels\n' Comment.Single '\t\t\t\t\t\t\t\t' Text '{' Punctuation '\n' Text '\t\t\t\t' Text 'unsigned' Keyword.Type ' ' Text 'int' Keyword.Type ' ' Text 'chIndex' Name ';' Punctuation '\n' Text '\t\t\t\t' Text 'char' Keyword.Type ' ' Text 'nextCh' Name ' ' Text '=' Operator ' ' Text '0' Literal.Number.Integer ';' Punctuation '\n' Text '\t\t\t\t' Text 'for' Keyword ' ' Text '(' Punctuation 'chIndex' Name ' ' Text '=' Operator ' ' Text 'i' Name '+' Operator '1' Literal.Number.Integer ';' Punctuation ' ' Text '(' Punctuation 'isCStyle' Name ' ' Text '&' Operator '&' Operator ' ' Text 'chIndex' Name ' ' Text '<' Operator ' ' Text 'line' Name '.' Punctuation 'length' Name '(' Punctuation ')' Punctuation ')' Punctuation ';' Punctuation ' ' Text 'chIndex' Name '+' Operator '+' Operator ')' Punctuation '\n' Text '\t\t\t\t\t' Text 'if' Keyword ' ' Text '(' Punctuation '!' Operator 'isWhiteSpace' Name '(' Punctuation 'line' Name '[' Punctuation 'chIndex' Name ']' Punctuation ')' Punctuation ')' Punctuation '\n' Text '\t\t\t\t\t\t' Text 'break' Keyword ';' Punctuation '\n' Text '\t\t\t\t' Text 'if' Keyword ' ' Text '(' Punctuation 'chIndex' Name '<' Operator ' ' Text 'line' Name '.' Punctuation 'length' Name '(' Punctuation ')' Punctuation ')' Punctuation '\n' Text '\t\t\t\t\t' Text 'nextCh' Name ' ' Text '=' Operator ' ' Text 'line' Name '[' Punctuation 'chIndex' Name ']' Punctuation ';' Punctuation '\n' Text '\n' Text ' \t\t\t' Text 'int' Keyword.Type ' ' Text 'nWord' Name ' ' Text '=' Operator '0' Literal.Number.Integer ';' Punctuation '\n' Text ' \t\t\t\t' Text 'for' Keyword ' ' Text '(' Punctuation 'chIndex' Name ' ' Text '=' Operator ' ' Text '0' Literal.Number.Integer ';' Punctuation ' ' Text 'chIndex' Name ' ' Text '<' Operator ' ' Text 'i' Name ';' Punctuation ' ' Text 'chIndex' Name '+' Operator '+' Operator ')' Punctuation '\n' Text '\t\t\t\t' Text '{' Punctuation '\n' Text '\t\t\t\t\t' Text 'if' Keyword ' ' Text '(' Punctuation '!' Operator 'isWhiteSpace' Name '(' Punctuation 'line' Name '[' Punctuation 'chIndex' Name ']' Punctuation ')' Punctuation ')' Punctuation '\n' Text '\t\t\t\t\t' Text '{' Punctuation '\n' Text '\t\t\t\t\t\t' Text 'nWord' Name ' ' Text '+' Operator '+' Operator ';' Punctuation '\n' Text '\t\t\t\t\t\t' Text 'while' Keyword ' ' Text '(' Punctuation '!' Operator 'isWhiteSpace' Name '(' Punctuation 'line' Name '[' Punctuation '+' Operator '+' Operator 'chIndex' Name ']' Punctuation ')' Punctuation ')' Punctuation ';' Punctuation '\n' Text '\t\t\t\t\t' Text '}' Punctuation '\t\t\t\t\t\t\t\t\t\n\t\t\t\t' Text '}' Punctuation '\n' Text ' \t\t' Text 'if' Keyword ' ' Text '(' Punctuation 'isCStyle' Name ' ' Text '&' Operator '&' Operator ' ' Text '(' Punctuation 'nextCh' Name ' ' Text '>' Operator '=' Operator ' ' Text "'" Literal.String.Char '0' Literal.String.Char "'" Literal.String.Char ' ' Text '&' Operator '&' Operator ' ' Text 'nextCh' Name ' ' Text '<' Operator '=' Operator ' ' Text "'" Literal.String.Char '9' Literal.String.Char "'" Literal.String.Char ')' Punctuation ' ' Text '|' Operator '|' Operator ' ' Text '(' Punctuation 'nWord' Name ' ' Text '>' Operator '1' Literal.Number.Integer ')' Punctuation ')' Punctuation '\n' Text '\t\t\t\t' Text '{' Punctuation '\n' Text '\t\t\t\t\t' Text 'continue' Keyword ';' Punctuation '\n' Text '\t\t\t\t' Text '}' Punctuation '\n' Text ' ' Text '// END content of ASASBeautifier.cpp.BITFIELD.patch.bz2\n' Comment.Single '\n' Text ' ' Text 'else' Keyword ' ' Text "// is in a label (e.g. 'label1:')\n" Comment.Single ' ' Text '{' Punctuation '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'labelIndent' Name ')' Punctuation '\n' Text ' ' Text '-' Operator '-' Operator 'tabCount' Name ';' Punctuation ' ' Text '// unindent label by one indent\n' Comment.Single ' ' Text 'else' Keyword '\n' Text ' ' Text 'tabCount' Name ' ' Text '=' Operator ' ' Text '0' Literal.Number.Integer ';' Punctuation ' ' Text '// completely flush indent to left\n' Comment.Single ' ' Text '}' Punctuation '\n' Text '\n' Text ' ' Text '// BEGIN content of ASASBeautifier.cpp.BITFIELD.patch.bz2\n' Comment.Single ' ' Text '}' Punctuation '\n' Text ' ' Text '// END content of ASASBeautifier.cpp.BITFIELD.patch.bz2\n' Comment.Single '\n' Text ' ' Text '}' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation '(' Punctuation 'ch' Name ' ' Text '=' Operator '=' Operator ' ' Text "'" Literal.String.Char ';' Literal.String.Char "'" Literal.String.Char ' ' Text '|' Operator '|' Operator ' ' Text '(' Punctuation 'parenDepth' Name '>' Operator '0' Literal.Number.Integer ' ' Text '&' Operator '&' Operator ' ' Text 'ch' Name ' ' Text '=' Operator '=' Operator ' ' Text "'" Literal.String.Char ',' Literal.String.Char "'" Literal.String.Char ')' Punctuation ')' Punctuation ' ' Text '&' Operator '&' Operator ' ' Text '!' Operator 'inStatementIndentStackSizeStack' Name '-' Operator '>' Operator 'empty' Name '(' Punctuation ')' Punctuation ')' Punctuation '\n' Text ' ' Text 'while' Keyword ' ' Text '(' Punctuation '(' Punctuation 'unsigned' Keyword.Type ' ' Text 'int' Keyword.Type ')' Punctuation 'inStatementIndentStackSizeStack' Name '-' Operator '>' Operator 'back' Name '(' Punctuation ')' Punctuation ' ' Text '+' Operator ' ' Text '(' Punctuation 'parenDepth' Name '>' Operator '0' Literal.Number.Integer ' ' Text '?' Operator ' ' Text '1' Literal.Number.Integer ' ' Text ':' Operator ' ' Text '0' Literal.Number.Integer ')' Punctuation ' ' Text '<' Operator ' ' Text 'inStatementIndentStack' Name '-' Operator '>' Operator 'size' Name '(' Punctuation ')' Punctuation ')' Punctuation '\n' Text ' ' Text 'inStatementIndentStack' Name '-' Operator '>' Operator 'pop_back' Name '(' Punctuation ')' Punctuation ';' Punctuation '\n' Text '\n' Text '\n' Text ' ' Text '// handle ends of statements\n' Comment.Single ' ' Text 'if' Keyword ' ' Text '(' Punctuation ' ' Text '(' Punctuation 'ch' Name ' ' Text '=' Operator '=' Operator ' ' Text "'" Literal.String.Char ';' Literal.String.Char "'" Literal.String.Char ' ' Text '&' Operator '&' Operator ' ' Text 'parenDepth' Name ' ' Text '=' Operator '=' Operator ' ' Text '0' Literal.Number.Integer ')' Punctuation ' ' Text '|' Operator '|' Operator ' ' Text 'ch' Name ' ' Text '=' Operator '=' Operator ' ' Text "'" Literal.String.Char '}' Literal.String.Char "'" Literal.String.Char "/* || (ch == ',' && parenDepth == 0)*/" Comment.Multiline ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'ch' Name ' ' Text '=' Operator '=' Operator ' ' Text "'" Literal.String.Char '}' Literal.String.Char "'" Literal.String.Char ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text "// first check if this '}' closes a previous block, or a static array...\n" Comment.Single ' ' Text 'if' Keyword ' ' Text '(' Punctuation '!' Operator 'bracketBlockStateStack' Name '-' Operator '>' Operator 'empty' Name '(' Punctuation ')' Punctuation ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'bool' Keyword.Type ' ' Text 'bracketBlockState' Name ' ' Text '=' Operator ' ' Text 'bracketBlockStateStack' Name '-' Operator '>' Operator 'back' Name '(' Punctuation ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'bracketBlockStateStack' Name '-' Operator '>' Operator 'pop_back' Name '(' Punctuation ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation '!' Operator 'bracketBlockState' Name ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation '!' Operator 'inStatementIndentStackSizeStack' Name '-' Operator '>' Operator 'empty' Name '(' Punctuation ')' Punctuation ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text '// this bracket is a static array\n' Comment.Single '\n' Text ' ' Text 'unsigned' Keyword.Type ' ' Text 'int' Keyword.Type ' ' Text 'previousIndentStackSize' Name ' ' Text '=' Operator ' ' Text 'inStatementIndentStackSizeStack' Name '-' Operator '>' Operator 'back' Name '(' Punctuation ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'inStatementIndentStackSizeStack' Name '-' Operator '>' Operator 'pop_back' Name '(' Punctuation ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'while' Keyword ' ' Text '(' Punctuation 'previousIndentStackSize' Name ' ' Text '<' Operator ' ' Text 'inStatementIndentStack' Name '-' Operator '>' Operator 'size' Name '(' Punctuation ')' Punctuation ')' Punctuation '\n' Text ' ' Text 'inStatementIndentStack' Name '-' Operator '>' Operator 'pop_back' Name '(' Punctuation ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'parenDepth' Name '-' Operator '-' Operator ';' Punctuation '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'i' Name ' ' Text '=' Operator '=' Operator ' ' Text '0' Literal.Number.Integer ')' Punctuation '\n' Text ' ' Text 'shouldIndentBrackettedLine' Name ' ' Text '=' Operator ' ' Text 'false' Name.Builtin ';' Punctuation '\n' Text '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation '!' Operator 'parenIndentStack' Name '-' Operator '>' Operator 'empty' Name '(' Punctuation ')' Punctuation ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'int' Keyword.Type ' ' Text 'poppedIndent' Name ' ' Text '=' Operator ' ' Text 'parenIndentStack' Name '-' Operator '>' Operator 'back' Name '(' Punctuation ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'parenIndentStack' Name '-' Operator '>' Operator 'pop_back' Name '(' Punctuation ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'i' Name ' ' Text '=' Operator '=' Operator ' ' Text '0' Literal.Number.Integer ')' Punctuation '\n' Text ' ' Text 'spaceTabCount' Name ' ' Text '=' Operator ' ' Text 'poppedIndent' Name ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text ' ' Text 'continue' Keyword ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text '\n' Text ' ' Text '// this bracket is block closer...\n' Comment.Single '\n' Text ' ' Text '+' Operator '+' Operator 'lineClosingBlocksNum' Name ';' Punctuation '\n' Text '\n' Text ' ' Text 'if' Keyword '(' Punctuation '!' Operator 'inStatementIndentStackSizeStack' Name '-' Operator '>' Operator 'empty' Name '(' Punctuation ')' Punctuation ')' Punctuation '\n' Text ' ' Text 'inStatementIndentStackSizeStack' Name '-' Operator '>' Operator 'pop_back' Name '(' Punctuation ')' Punctuation ';' Punctuation '\n' Text '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation '!' Operator 'blockParenDepthStack' Name '-' Operator '>' Operator 'empty' Name '(' Punctuation ')' Punctuation ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'parenDepth' Name ' ' Text '=' Operator ' ' Text 'blockParenDepthStack' Name '-' Operator '>' Operator 'back' Name '(' Punctuation ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'blockParenDepthStack' Name '-' Operator '>' Operator 'pop_back' Name '(' Punctuation ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'isInStatement' Name ' ' Text '=' Operator ' ' Text 'blockStatementStack' Name '-' Operator '>' Operator 'back' Name '(' Punctuation ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'blockStatementStack' Name '-' Operator '>' Operator 'pop_back' Name '(' Punctuation ')' Punctuation ';' Punctuation '\n' Text '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'isInStatement' Name ')' Punctuation '\n' Text ' ' Text 'blockTabCount' Name '-' Operator '-' Operator ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text '\n' Text ' ' Text 'closingBracketReached' Name ' ' Text '=' Operator ' ' Text 'true' Name.Builtin ';' Punctuation '\n' Text ' ' Text 'int' Keyword.Type ' ' Text 'headerPlace' Name ' ' Text '=' Operator ' ' Text 'indexOf' Name '(' Punctuation '*' Operator 'headerStack' Name ',' Punctuation ' ' Text '&' Operator 'AS_OPEN_BRACKET' Name ')' Punctuation ';' Punctuation ' ' Text '// <---\n' Comment.Single ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'headerPlace' Name ' ' Text '!' Operator '=' Operator ' ' Text '-1' Literal.Number.Integer ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'const' Keyword ' ' Text 'string' Name ' ' Text '*' Operator 'popped' Name ' ' Text '=' Operator ' ' Text 'headerStack' Name '-' Operator '>' Operator 'back' Name '(' Punctuation ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'while' Keyword ' ' Text '(' Punctuation 'popped' Name ' ' Text '!' Operator '=' Operator ' ' Text '&' Operator 'AS_OPEN_BRACKET' Name ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'headerStack' Name '-' Operator '>' Operator 'pop_back' Name '(' Punctuation ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'popped' Name ' ' Text '=' Operator ' ' Text 'headerStack' Name '-' Operator '>' Operator 'back' Name '(' Punctuation ')' Punctuation ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text ' ' Text 'headerStack' Name '-' Operator '>' Operator 'pop_back' Name '(' Punctuation ')' Punctuation ';' Punctuation '\n' Text '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation '!' Operator 'tempStacks' Name '-' Operator '>' Operator 'empty' Name '(' Punctuation ')' Punctuation ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'vector' Name '<' Operator 'const' Keyword ' ' Text 'string' Name '*' Operator '>' Operator ' ' Text '*' Operator 'temp' Name ' ' Text '=' Operator ' ' Text 'tempStacks' Name '-' Operator '>' Operator 'back' Name '(' Punctuation ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'tempStacks' Name '-' Operator '>' Operator 'pop_back' Name '(' Punctuation ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'delete' Keyword ' ' Text 'temp' Name ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text '\n' Text '\n' Text ' ' Text 'ch' Name ' ' Text '=' Operator ' ' Text "'" Literal.String.Char ' ' Literal.String.Char "'" Literal.String.Char ';' Punctuation ' ' Text "// needed due to cases such as '}else{', so that headers ('else' tn tih case) will be identified...\n" Comment.Single ' ' Text '}' Punctuation '\n' Text '\n' Text ' ' Text "/*\n * Create a temporary snapshot of the current block's header-list in the\n * uppermost inner stack in tempStacks, and clear the headerStack up to\n * the begining of the block.\n * Thus, the next future statement will think it comes one indent past\n * the block's '{' unless it specifically checks for a companion-header\n * (such as a previous 'if' for an 'else' header) within the tempStacks,\n * and recreates the temporary snapshot by manipulating the tempStacks.\n */" Comment.Multiline '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation '!' Operator 'tempStacks' Name '-' Operator '>' Operator 'back' Name '(' Punctuation ')' Punctuation '-' Operator '>' Operator 'empty' Name '(' Punctuation ')' Punctuation ')' Punctuation '\n' Text ' ' Text 'while' Keyword ' ' Text '(' Punctuation '!' Operator 'tempStacks' Name '-' Operator '>' Operator 'back' Name '(' Punctuation ')' Punctuation '-' Operator '>' Operator 'empty' Name '(' Punctuation ')' Punctuation ')' Punctuation '\n' Text ' ' Text 'tempStacks' Name '-' Operator '>' Operator 'back' Name '(' Punctuation ')' Punctuation '-' Operator '>' Operator 'pop_back' Name '(' Punctuation ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'while' Keyword ' ' Text '(' Punctuation '!' Operator 'headerStack' Name '-' Operator '>' Operator 'empty' Name '(' Punctuation ')' Punctuation ' ' Text '&' Operator '&' Operator ' ' Text 'headerStack' Name '-' Operator '>' Operator 'back' Name '(' Punctuation ')' Punctuation ' ' Text '!' Operator '=' Operator ' ' Text '&' Operator 'AS_OPEN_BRACKET' Name ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'tempStacks' Name '-' Operator '>' Operator 'back' Name '(' Punctuation ')' Punctuation '-' Operator '>' Operator 'push_back' Name '(' Punctuation 'headerStack' Name '-' Operator '>' Operator 'back' Name '(' Punctuation ')' Punctuation ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'headerStack' Name '-' Operator '>' Operator 'pop_back' Name '(' Punctuation ')' Punctuation ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'parenDepth' Name ' ' Text '=' Operator '=' Operator ' ' Text '0' Literal.Number.Integer ' ' Text '&' Operator '&' Operator ' ' Text 'ch' Name ' ' Text '=' Operator '=' Operator ' ' Text "'" Literal.String.Char ';' Literal.String.Char "'" Literal.String.Char ')' Punctuation '\n' Text ' ' Text 'isInStatement' Name '=' Operator 'false' Name.Builtin ';' Punctuation '\n' Text '\n' Text ' ' Text 'isInClassHeader' Name ' ' Text '=' Operator ' ' Text 'false' Name.Builtin ';' Punctuation '\n' Text '\n' Text ' ' Text 'continue' Keyword ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text '\n' Text '\n' Text ' ' Text '// check for preBlockStatements ONLY if not within parenthesies\n' Comment.Single ' ' Text "// (otherwise 'struct XXX' statements would be wrongly interpreted...)\n" Comment.Single ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'prevCh' Name ' ' Text '=' Operator '=' Operator ' ' Text "'" Literal.String.Char ' ' Literal.String.Char "'" Literal.String.Char ' ' Text '&' Operator '&' Operator ' ' Text '!' Operator 'isInTemplate' Name ' ' Text '&' Operator '&' Operator ' ' Text 'parenDepth' Name ' ' Text '=' Operator '=' Operator ' ' Text '0' Literal.Number.Integer ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'const' Keyword ' ' Text 'string' Name ' ' Text '*' Operator 'newHeader' Name ' ' Text '=' Operator ' ' Text 'findHeader' Name '(' Punctuation 'line' Name ',' Punctuation ' ' Text 'i' Name ',' Punctuation ' ' Text 'preBlockStatements' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'newHeader' Name ' ' Text '!' Operator '=' Operator ' ' Text 'NULL' Name.Builtin ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'isInClassHeader' Name ' ' Text '=' Operator ' ' Text 'true' Name.Builtin ';' Punctuation '\n' Text ' ' Text 'outBuffer' Name '.' Punctuation 'append' Name '(' Punctuation 'newHeader' Name '-' Operator '>' Operator 'substr' Name '(' Punctuation '1' Literal.Number.Integer ')' Punctuation ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'i' Name ' ' Text '+' Operator '=' Operator ' ' Text 'newHeader' Name '-' Operator '>' Operator 'length' Name '(' Punctuation ')' Punctuation ' ' Text '-' Operator ' ' Text '1' Literal.Number.Integer ';' Punctuation '\n' Text ' ' Text '//if (isCStyle)\n' Comment.Single ' ' Text 'headerStack' Name '-' Operator '>' Operator 'push_back' Name '(' Punctuation 'newHeader' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text '\n' Text ' ' Text '// Handle operators\n' Comment.Single ' ' Text '//\n' Comment.Single '\n' Text ' ' Text "//// // PRECHECK if a '==' or '--' or '++' operator was reached.\n" Comment.Single ' ' Text '//// // If not, then register an indent IF an assignment operator was reached.\n' Comment.Single ' ' Text "//// // The precheck is important, so that statements such as 'i--==2' are not recognized\n" Comment.Single ' ' Text "//// // to have assignment operators (here, '-=') in them . . .\n" Comment.Single '\n' Text ' ' Text 'const' Keyword ' ' Text 'string' Name ' ' Text '*' Operator 'foundAssignmentOp' Name ' ' Text '=' Operator ' ' Text 'NULL' Name.Builtin ';' Punctuation '\n' Text ' ' Text 'const' Keyword ' ' Text 'string' Name ' ' Text '*' Operator 'foundNonAssignmentOp' Name ' ' Text '=' Operator ' ' Text 'NULL' Name.Builtin ';' Punctuation '\n' Text '\n' Text ' ' Text 'immediatelyPreviousAssignmentOp' Name ' ' Text '=' Operator ' ' Text 'NULL' Name.Builtin ';' Punctuation '\n' Text '\n' Text ' ' Text '// Check if an operator has been reached.\n' Comment.Single ' ' Text 'foundAssignmentOp' Name ' ' Text '=' Operator ' ' Text 'findHeader' Name '(' Punctuation 'line' Name ',' Punctuation ' ' Text 'i' Name ',' Punctuation ' ' Text 'assignmentOperators' Name ',' Punctuation ' ' Text 'false' Name.Builtin ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'foundNonAssignmentOp' Name ' ' Text '=' Operator ' ' Text 'findHeader' Name '(' Punctuation 'line' Name ',' Punctuation ' ' Text 'i' Name ',' Punctuation ' ' Text 'nonAssignmentOperators' Name ',' Punctuation ' ' Text 'false' Name.Builtin ')' Punctuation ';' Punctuation '\n' Text '\n' Text ' ' Text "// Since findHeader's boundry checking was not used above, it is possible\n" Comment.Single ' ' Text '// that both an assignment op and a non-assignment op where found,\n' Comment.Single ' ' Text "// e.g. '>>' and '>>='. If this is the case, treat the LONGER one as the\n" Comment.Single ' ' Text '// found operator.\n' Comment.Single ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'foundAssignmentOp' Name ' ' Text '!' Operator '=' Operator ' ' Text 'NULL' Name.Builtin ' ' Text '&' Operator '&' Operator ' ' Text 'foundNonAssignmentOp' Name ' ' Text '!' Operator '=' Operator ' ' Text 'NULL' Name.Builtin ')' Punctuation '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'foundAssignmentOp' Name '-' Operator '>' Operator 'length' Name '(' Punctuation ')' Punctuation ' ' Text '<' Operator ' ' Text 'foundNonAssignmentOp' Name '-' Operator '>' Operator 'length' Name '(' Punctuation ')' Punctuation ')' Punctuation '\n' Text ' ' Text 'foundAssignmentOp' Name ' ' Text '=' Operator ' ' Text 'NULL' Name.Builtin ';' Punctuation '\n' Text ' ' Text 'else' Keyword '\n' Text ' ' Text 'foundNonAssignmentOp' Name ' ' Text '=' Operator ' ' Text 'NULL' Name.Builtin ';' Punctuation '\n' Text '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'foundNonAssignmentOp' Name ' ' Text '!' Operator '=' Operator ' ' Text 'NULL' Name.Builtin ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'foundNonAssignmentOp' Name '-' Operator '>' Operator 'length' Name '(' Punctuation ')' Punctuation ' ' Text '>' Operator ' ' Text '1' Literal.Number.Integer ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'outBuffer' Name '.' Punctuation 'append' Name '(' Punctuation 'foundNonAssignmentOp' Name '-' Operator '>' Operator 'substr' Name '(' Punctuation '1' Literal.Number.Integer ')' Punctuation ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'i' Name ' ' Text '+' Operator '=' Operator ' ' Text 'foundNonAssignmentOp' Name '-' Operator '>' Operator 'length' Name '(' Punctuation ')' Punctuation ' ' Text '-' Operator ' ' Text '1' Literal.Number.Integer ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text '\n' Text ' ' Text 'else' Keyword ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'foundAssignmentOp' Name ' ' Text '!' Operator '=' Operator ' ' Text 'NULL' Name.Builtin ')' Punctuation '\n' Text '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'foundAssignmentOp' Name '-' Operator '>' Operator 'length' Name '(' Punctuation ')' Punctuation ' ' Text '>' Operator ' ' Text '1' Literal.Number.Integer ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'outBuffer' Name '.' Punctuation 'append' Name '(' Punctuation 'foundAssignmentOp' Name '-' Operator '>' Operator 'substr' Name '(' Punctuation '1' Literal.Number.Integer ')' Punctuation ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'i' Name ' ' Text '+' Operator '=' Operator ' ' Text 'foundAssignmentOp' Name '-' Operator '>' Operator 'length' Name '(' Punctuation ')' Punctuation ' ' Text '-' Operator ' ' Text '1' Literal.Number.Integer ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation '!' Operator 'isInOperator' Name ' ' Text '&' Operator '&' Operator ' ' Text '!' Operator 'isInTemplate' Name ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'registerInStatementIndent' Name '(' Punctuation 'line' Name ',' Punctuation ' ' Text 'i' Name ',' Punctuation ' ' Text 'spaceTabCount' Name ',' Punctuation ' ' Text '0' Literal.Number.Integer ',' Punctuation ' ' Text 'false' Name.Builtin ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'immediatelyPreviousAssignmentOp' Name ' ' Text '=' Operator ' ' Text 'foundAssignmentOp' Name ';' Punctuation '\n' Text ' ' Text 'isInStatement' Name ' ' Text '=' Operator ' ' Text 'true' Name.Builtin ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text '\n' Text ' ' Text '/*\n immediatelyPreviousAssignmentOp = NULL;\n bool isNonAssingmentOperator = false;\n for (int n = 0; n < nonAssignmentOperators.size(); n++)\n if (line.COMPARE(i, nonAssignmentOperators[n]->length(), *(nonAssignmentOperators[n])) == 0)\n {\n if (nonAssignmentOperators[n]->length() > 1)\n {\n outBuffer.append(nonAssignmentOperators[n]->substr(1));\n i += nonAssignmentOperators[n]->length() - 1;\n }\n isNonAssingmentOperator = true;\n break;\n }\n if (!isNonAssingmentOperator)\n {\n for (int a = 0; a < assignmentOperators.size(); a++)\n if (line.COMPARE(i, assignmentOperators[a]->length(), *(assignmentOperators[a])) == 0)\n {\n if (assignmentOperators[a]->length() > 1)\n {\n outBuffer.append(assignmentOperators[a]->substr(1));\n i += assignmentOperators[a]->length() - 1;\n }\n \n if (!isInOperator && !isInTemplate)\n {\n registerInStatementIndent(line, i, spaceTabCount, 0, false);\n immediatelyPreviousAssignmentOp = assignmentOperators[a];\n isInStatement = true;\n }\n break;\n }\n }\n */' Comment.Multiline '\n' Text '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'isInOperator' Name ')' Punctuation '\n' Text ' ' Text 'isInOperator' Name ' ' Text '=' Operator ' ' Text 'false' Name.Builtin ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text '\n' Text ' ' Text '// handle special cases of unindentation:\n' Comment.Single '\n' Text ' ' Text '/*\n * if \'{\' doesn\'t follow an immediately previous \'{\' in the headerStack\n * (but rather another header such as "for" or "if", then unindent it\n * by one indentation relative to its block.\n */' Comment.Multiline '\n' Text ' ' Text '// cerr << endl << lineOpeningBlocksNum << " " << lineClosingBlocksNum << " " << previousLastLineHeader << endl;\n' Comment.Single '\n' Text ' ' Text '// indent #define lines with one less tab\n' Comment.Single ' ' Text '//if (isInDefine)\n' Comment.Single ' ' Text '// tabCount -= defineTabCount-1;\n' Comment.Single '\n' Text '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation '!' Operator 'lineStartsInComment' Name '\n' Text ' ' Text '&' Operator '&' Operator ' ' Text '!' Operator 'blockIndent' Name '\n' Text ' ' Text '&' Operator '&' Operator ' ' Text 'outBuffer' Name '.' Punctuation 'length' Name '(' Punctuation ')' Punctuation '>' Operator '0' Literal.Number.Integer '\n' Text ' ' Text '&' Operator '&' Operator ' ' Text 'outBuffer' Name '[' Punctuation '0' Literal.Number.Integer ']' Punctuation '=' Operator '=' Operator "'" Literal.String.Char '{' Literal.String.Char "'" Literal.String.Char '\n' Text ' ' Text '&' Operator '&' Operator ' ' Text '!' Operator '(' Punctuation 'lineOpeningBlocksNum' Name ' ' Text '>' Operator ' ' Text '0' Literal.Number.Integer ' ' Text '&' Operator '&' Operator ' ' Text 'lineOpeningBlocksNum' Name ' ' Text '=' Operator '=' Operator ' ' Text 'lineClosingBlocksNum' Name ')' Punctuation '\n' Text ' ' Text '&' Operator '&' Operator ' ' Text '!' Operator '(' Punctuation 'headerStack' Name '-' Operator '>' Operator 'size' Name '(' Punctuation ')' Punctuation ' ' Text '>' Operator ' ' Text '1' Literal.Number.Integer ' ' Text '&' Operator '&' Operator ' ' Text '(' Punctuation '*' Operator 'headerStack' Name ')' Punctuation '[' Punctuation 'headerStack' Name '-' Operator '>' Operator 'size' Name '(' Punctuation ')' Punctuation '-2' Literal.Number.Integer ']' Punctuation ' ' Text '=' Operator '=' Operator ' ' Text '&' Operator 'AS_OPEN_BRACKET' Name ')' Punctuation '\n' Text ' ' Text '&' Operator '&' Operator ' ' Text 'shouldIndentBrackettedLine' Name ')' Punctuation '\n' Text ' ' Text '-' Operator '-' Operator 'tabCount' Name ';' Punctuation '\n' Text '\n' Text ' ' Text 'else' Keyword ' ' Text 'if' Name.Function ' ' Text '(' Punctuation '!' Operator 'lineStartsInComment' Name '\n' Text ' ' Text '&' Operator '&' Operator ' ' Text 'outBuffer' Name '.' Punctuation 'length' Name '(' Punctuation ')' Punctuation '>' Operator '0' Literal.Number.Integer '\n' Text ' ' Text '&' Operator '&' Operator ' ' Text 'outBuffer' Name '[' Punctuation '0' Literal.Number.Integer ']' Punctuation '=' Operator '=' Operator "'" Literal.String.Char '}' Literal.String.Char "'" Literal.String.Char '\n' Text ' ' Text '&' Operator '&' Operator ' ' Text 'shouldIndentBrackettedLine' Name ' ' Text ')' Punctuation '\n' Text ' ' Text '-' Operator '-' Operator 'tabCount' Name ';' Punctuation '\n' Text '\n' Text ' ' Text '// correctly indent one-line-blocks...\n' Comment.Single ' ' Text 'else' Keyword ' ' Text 'if' Name.Function ' ' Text '(' Punctuation '!' Operator 'lineStartsInComment' Name '\n' Text ' ' Text '&' Operator '&' Operator ' ' Text 'outBuffer' Name '.' Punctuation 'length' Name '(' Punctuation ')' Punctuation '>' Operator '0' Literal.Number.Integer '\n' Text ' ' Text '&' Operator '&' Operator ' ' Text 'lineOpeningBlocksNum' Name ' ' Text '>' Operator ' ' Text '0' Literal.Number.Integer '\n' Text ' ' Text '&' Operator '&' Operator ' ' Text 'lineOpeningBlocksNum' Name ' ' Text '=' Operator '=' Operator ' ' Text 'lineClosingBlocksNum' Name '\n' Text ' ' Text '&' Operator '&' Operator ' ' Text 'previousLastLineHeader' Name ' ' Text '!' Operator '=' Operator ' ' Text 'NULL' Name.Builtin '\n' Text ' ' Text '&' Operator '&' Operator ' ' Text 'previousLastLineHeader' Name ' ' Text '!' Operator '=' Operator ' ' Text '&' Operator 'AS_OPEN_BRACKET' Name ')' Punctuation '\n' Text ' ' Text 'tabCount' Name ' ' Text '-' Operator '=' Operator ' ' Text '1' Literal.Number.Integer ';' Punctuation ' ' Text '//lineOpeningBlocksNum - (blockIndent ? 1 : 0);\n' Comment.Single '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'tabCount' Name ' ' Text '<' Operator ' ' Text '0' Literal.Number.Integer ')' Punctuation '\n' Text ' ' Text 'tabCount' Name ' ' Text '=' Operator ' ' Text '0' Literal.Number.Integer ';' Punctuation '\n' Text '\n' Text ' ' Text '// take care of extra bracket indentatation option...\n' Comment.Single ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'bracketIndent' Name ' ' Text '&' Operator '&' Operator ' ' Text 'outBuffer' Name '.' Punctuation 'length' Name '(' Punctuation ')' Punctuation '>' Operator '0' Literal.Number.Integer ' ' Text '&' Operator '&' Operator ' ' Text 'shouldIndentBrackettedLine' Name ')' Punctuation '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'outBuffer' Name '[' Punctuation '0' Literal.Number.Integer ']' Punctuation '=' Operator '=' Operator "'" Literal.String.Char '{' Literal.String.Char "'" Literal.String.Char ' ' Text '|' Operator '|' Operator ' ' Text 'outBuffer' Name '[' Punctuation '0' Literal.Number.Integer ']' Punctuation '=' Operator '=' Operator "'" Literal.String.Char '}' Literal.String.Char "'" Literal.String.Char ')' Punctuation '\n' Text ' ' Text 'tabCount' Name '+' Operator '+' Operator ';' Punctuation '\n' Text '\n' Text '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'isInDefine' Name ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'outBuffer' Name '[' Punctuation '0' Literal.Number.Integer ']' Punctuation ' ' Text '=' Operator '=' Operator ' ' Text "'" Literal.String.Char '#' Literal.String.Char "'" Literal.String.Char ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'string' Name ' ' Text 'preproc' Name ' ' Text '=' Operator ' ' Text 'trim' Name '(' Punctuation 'string' Name '(' Punctuation 'outBuffer' Name '.' Punctuation 'c_str' Name '(' Punctuation ')' Punctuation ' ' Text '+' Operator ' ' Text '1' Literal.Number.Integer ')' Punctuation ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'preproc' Name '.' Punctuation 'COMPARE' Name '(' Punctuation '0' Literal.Number.Integer ',' Punctuation ' ' Text '6' Literal.Number.Integer ',' Punctuation ' ' Text 'string' Name '(' Punctuation '"' Literal.String 'define' Literal.String '"' Literal.String ')' Punctuation ')' Punctuation ' ' Text '=' Operator '=' Operator ' ' Text '0' Literal.Number.Integer ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation '!' Operator 'inStatementIndentStack' Name '-' Operator '>' Operator 'empty' Name '(' Punctuation ')' Punctuation '\n' Text ' ' Text '&' Operator '&' Operator ' ' Text 'inStatementIndentStack' Name '-' Operator '>' Operator 'back' Name '(' Punctuation ')' Punctuation ' ' Text '>' Operator ' ' Text '0' Literal.Number.Integer ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'defineTabCount' Name ' ' Text '=' Operator ' ' Text 'tabCount' Name ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text ' ' Text 'else' Keyword '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'defineTabCount' Name ' ' Text '=' Operator ' ' Text 'tabCount' Name ' ' Text '-' Operator ' ' Text '1' Literal.Number.Integer ';' Punctuation '\n' Text ' ' Text 'tabCount' Name '-' Operator '-' Operator ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text '\n' Text ' ' Text 'tabCount' Name ' ' Text '-' Operator '=' Operator ' ' Text 'defineTabCount' Name ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'tabCount' Name ' ' Text '<' Operator ' ' Text '0' Literal.Number.Integer ')' Punctuation '\n' Text ' ' Text 'tabCount' Name ' ' Text '=' Operator ' ' Text '0' Literal.Number.Integer ';' Punctuation '\n' Text '\n' Text '\n' Text ' ' Text '// finally, insert indentations into begining of line\n' Comment.Single '\n' Text ' ' Text 'prevFinalLineSpaceTabCount' Name ' ' Text '=' Operator ' ' Text 'spaceTabCount' Name ';' Punctuation '\n' Text ' ' Text 'prevFinalLineTabCount' Name ' ' Text '=' Operator ' ' Text 'tabCount' Name ';' Punctuation '\n' Text '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'shouldForceTabIndentation' Name ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'tabCount' Name ' ' Text '+' Operator '=' Operator ' ' Text 'spaceTabCount' Name ' ' Text '/' Operator ' ' Text 'indentLength' Name ';' Punctuation '\n' Text ' ' Text 'spaceTabCount' Name ' ' Text '=' Operator ' ' Text 'spaceTabCount' Name ' ' Text '%' Operator ' ' Text 'indentLength' Name ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text '\n' Text ' ' Text 'outBuffer' Name ' ' Text '=' Operator ' ' Text 'preLineWS' Name '(' Punctuation 'spaceTabCount' Name ',' Punctuation 'tabCount' Name ')' Punctuation ' ' Text '+' Operator ' ' Text 'outBuffer' Name ';' Punctuation '\n' Text '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'lastLineHeader' Name ' ' Text '!' Operator '=' Operator ' ' Text 'NULL' Name.Builtin ')' Punctuation '\n' Text ' ' Text 'previousLastLineHeader' Name ' ' Text '=' Operator ' ' Text 'lastLineHeader' Name ';' Punctuation '\n' Text '\n' Text ' ' Text 'return' Keyword ' ' Text 'outBuffer' Name ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text '\n' Text '\n' Text ' ' Text 'string' Name ' ' Text 'ASBeautifier' Name ':' Operator ':' Operator 'preLineWS' Name '(' Punctuation 'int' Keyword.Type ' ' Text 'spaceTabCount' Name ',' Punctuation ' ' Text 'int' Keyword.Type ' ' Text 'tabCount' Name ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'string' Name ' ' Text 'ws' Name ';' Punctuation '\n' Text '\n' Text ' ' Text 'for' Keyword ' ' Text '(' Punctuation 'int' Keyword.Type ' ' Text 'i' Name '=' Operator '0' Literal.Number.Integer ';' Punctuation ' ' Text 'i' Name '<' Operator 'tabCount' Name ';' Punctuation ' ' Text 'i' Name '+' Operator '+' Operator ')' Punctuation '\n' Text ' ' Text 'ws' Name ' ' Text '+' Operator '=' Operator ' ' Text 'indentString' Name ';' Punctuation '\n' Text '\n' Text ' ' Text 'while' Keyword ' ' Text '(' Punctuation '(' Punctuation 'spaceTabCount' Name '-' Operator '-' Operator ')' Punctuation ' ' Text '>' Operator ' ' Text '0' Literal.Number.Integer ')' Punctuation '\n' Text ' ' Text 'ws' Name ' ' Text '+' Operator '=' Operator ' ' Text 'string' Name '(' Punctuation '"' Literal.String ' ' Literal.String '"' Literal.String ')' Punctuation ';' Punctuation '\n' Text '\n' Text ' ' Text 'return' Keyword ' ' Text 'ws' Name ';' Punctuation '\n' Text '\n' Text ' ' Text '}' Punctuation '\n' Text '\n' Text ' ' Text '/**\n * register an in-statement indent.\n */' Comment.Multiline '\n' Text ' ' Text 'void' Keyword.Type ' ' Text 'ASBeautifier' Name ':' Operator ':' Operator 'registerInStatementIndent' Name '(' Punctuation 'const' Keyword ' ' Text 'string' Name ' ' Text '&' Operator 'line' Name ',' Punctuation ' ' Text 'int' Keyword.Type ' ' Text 'i' Name ',' Punctuation ' ' Text 'int' Keyword.Type ' ' Text 'spaceTabCount' Name ',' Punctuation '\n' Text ' ' Text 'int' Keyword.Type ' ' Text 'minIndent' Name ',' Punctuation ' ' Text 'bool' Keyword.Type ' ' Text 'updateParenStack' Name ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'int' Keyword.Type ' ' Text 'inStatementIndent' Name ';' Punctuation '\n' Text ' ' Text 'int' Keyword.Type ' ' Text 'remainingCharNum' Name ' ' Text '=' Operator ' ' Text 'line' Name '.' Punctuation 'length' Name '(' Punctuation ')' Punctuation ' ' Text '-' Operator ' ' Text 'i' Name ';' Punctuation '\n' Text ' ' Text 'int' Keyword.Type ' ' Text 'nextNonWSChar' Name ' ' Text '=' Operator ' ' Text '1' Literal.Number.Integer ';' Punctuation '\n' Text '\n' Text ' ' Text 'nextNonWSChar' Name ' ' Text '=' Operator ' ' Text 'getNextProgramCharDistance' Name '(' Punctuation 'line' Name ',' Punctuation ' ' Text 'i' Name ')' Punctuation ';' Punctuation '\n' Text '\n' Text ' ' Text '// if indent is around the last char in the line, indent instead 2 spaces from the previous indent\n' Comment.Single ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'nextNonWSChar' Name ' ' Text '=' Operator '=' Operator ' ' Text 'remainingCharNum' Name ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'int' Keyword.Type ' ' Text 'previousIndent' Name ' ' Text '=' Operator ' ' Text 'spaceTabCount' Name ';' Punctuation '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation '!' Operator 'inStatementIndentStack' Name '-' Operator '>' Operator 'empty' Name '(' Punctuation ')' Punctuation ')' Punctuation '\n' Text ' ' Text 'previousIndent' Name ' ' Text '=' Operator ' ' Text 'inStatementIndentStack' Name '-' Operator '>' Operator 'back' Name '(' Punctuation ')' Punctuation ';' Punctuation '\n' Text '\n' Text ' ' Text 'inStatementIndentStack' Name '-' Operator '>' Operator 'push_back' Name '(' Punctuation '/*2*/' Comment.Multiline ' ' Text 'indentLength' Name ' ' Text '+' Operator ' ' Text 'previousIndent' Name ' ' Text ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'updateParenStack' Name ')' Punctuation '\n' Text ' ' Text 'parenIndentStack' Name '-' Operator '>' Operator 'push_back' Name '(' Punctuation ' ' Text 'previousIndent' Name ' ' Text ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'return' Keyword ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'updateParenStack' Name ')' Punctuation '\n' Text ' ' Text 'parenIndentStack' Name '-' Operator '>' Operator 'push_back' Name '(' Punctuation 'i' Name '+' Operator 'spaceTabCount' Name ')' Punctuation ';' Punctuation '\n' Text '\n' Text ' ' Text 'inStatementIndent' Name ' ' Text '=' Operator ' ' Text 'i' Name ' ' Text '+' Operator ' ' Text 'nextNonWSChar' Name ' ' Text '+' Operator ' ' Text 'spaceTabCount' Name ';' Punctuation '\n' Text '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'i' Name ' ' Text '+' Operator ' ' Text 'nextNonWSChar' Name ' ' Text '<' Operator ' ' Text 'minIndent' Name ')' Punctuation '\n' Text ' ' Text 'inStatementIndent' Name ' ' Text '=' Operator ' ' Text 'minIndent' Name ' ' Text '+' Operator ' ' Text 'spaceTabCount' Name ';' Punctuation '\n' Text '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'i' Name ' ' Text '+' Operator ' ' Text 'nextNonWSChar' Name ' ' Text '>' Operator ' ' Text 'maxInStatementIndent' Name ')' Punctuation '\n' Text ' ' Text 'inStatementIndent' Name ' ' Text '=' Operator ' ' Text 'indentLength' Name '*' Operator '2' Literal.Number.Integer ' ' Text '+' Operator ' ' Text 'spaceTabCount' Name ';' Punctuation '\n' Text '\n' Text '\n' Text '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation '!' Operator 'inStatementIndentStack' Name '-' Operator '>' Operator 'empty' Name '(' Punctuation ')' Punctuation ' ' Text '&' Operator '&' Operator '\n' Text ' ' Text 'inStatementIndent' Name ' ' Text '<' Operator ' ' Text 'inStatementIndentStack' Name '-' Operator '>' Operator 'back' Name '(' Punctuation ')' Punctuation ')' Punctuation '\n' Text ' ' Text 'inStatementIndent' Name ' ' Text '=' Operator ' ' Text 'inStatementIndentStack' Name '-' Operator '>' Operator 'back' Name '(' Punctuation ')' Punctuation ';' Punctuation '\n' Text '\n' Text ' ' Text 'inStatementIndentStack' Name '-' Operator '>' Operator 'push_back' Name '(' Punctuation 'inStatementIndent' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text '\n' Text ' ' Text '/**\n * get distance to the next non-white sspace, non-comment character in the line.\n * if no such character exists, return the length remaining to the end of the line.\n */' Comment.Multiline '\n' Text ' ' Text 'int' Keyword.Type ' ' Text 'ASBeautifier' Name ':' Operator ':' Operator 'getNextProgramCharDistance' Name '(' Punctuation 'const' Keyword ' ' Text 'string' Name ' ' Text '&' Operator 'line' Name ',' Punctuation ' ' Text 'int' Keyword.Type ' ' Text 'i' Name ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'bool' Keyword.Type ' ' Text 'inComment' Name ' ' Text '=' Operator ' ' Text 'false' Name.Builtin ';' Punctuation '\n' Text ' ' Text 'int' Keyword.Type ' ' Text 'remainingCharNum' Name ' ' Text '=' Operator ' ' Text 'line' Name '.' Punctuation 'length' Name '(' Punctuation ')' Punctuation ' ' Text '-' Operator ' ' Text 'i' Name ';' Punctuation '\n' Text ' ' Text 'int' Keyword.Type ' ' Text 'charDistance' Name ' ' Text '=' Operator ' ' Text '1' Literal.Number.Integer ';' Punctuation '\n' Text ' ' Text 'int' Keyword.Type ' ' Text 'ch' Name ';' Punctuation '\n' Text '\n' Text ' ' Text 'for' Keyword ' ' Text '(' Punctuation 'charDistance' Name ' ' Text '=' Operator ' ' Text '1' Literal.Number.Integer ';' Punctuation ' ' Text 'charDistance' Name ' ' Text '<' Operator ' ' Text 'remainingCharNum' Name ';' Punctuation ' ' Text 'charDistance' Name '+' Operator '+' Operator ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'ch' Name ' ' Text '=' Operator ' ' Text 'line' Name '[' Punctuation 'i' Name ' ' Text '+' Operator ' ' Text 'charDistance' Name ']' Punctuation ';' Punctuation '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'inComment' Name ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'line' Name '.' Punctuation 'COMPARE' Name '(' Punctuation 'i' Name ' ' Text '+' Operator ' ' Text 'charDistance' Name ',' Punctuation ' ' Text '2' Literal.Number.Integer ',' Punctuation ' ' Text 'AS_CLOSE_COMMENT' Name ')' Punctuation ' ' Text '=' Operator '=' Operator ' ' Text '0' Literal.Number.Integer ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'charDistance' Name '+' Operator '+' Operator ';' Punctuation '\n' Text ' ' Text 'inComment' Name ' ' Text '=' Operator ' ' Text 'false' Name.Builtin ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text ' ' Text 'continue' Keyword ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text ' ' Text 'else' Keyword ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'isWhiteSpace' Name '(' Punctuation 'ch' Name ')' Punctuation ')' Punctuation '\n' Text ' ' Text 'continue' Keyword ';' Punctuation '\n' Text ' ' Text 'else' Keyword ' ' Text 'if' Name.Function ' ' Text '(' Punctuation 'ch' Name ' ' Text '=' Operator '=' Operator ' ' Text "'" Literal.String.Char '/' Literal.String.Char "'" Literal.String.Char ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'line' Name '.' Punctuation 'COMPARE' Name '(' Punctuation 'i' Name ' ' Text '+' Operator ' ' Text 'charDistance' Name ',' Punctuation ' ' Text '2' Literal.Number.Integer ',' Punctuation ' ' Text 'AS_OPEN_LINE_COMMENT' Name ')' Punctuation ' ' Text '=' Operator '=' Operator ' ' Text '0' Literal.Number.Integer ')' Punctuation '\n' Text ' ' Text 'return' Keyword ' ' Text 'remainingCharNum' Name ';' Punctuation '\n' Text ' ' Text 'else' Keyword ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'line' Name '.' Punctuation 'COMPARE' Name '(' Punctuation 'i' Name ' ' Text '+' Operator ' ' Text 'charDistance' Name ',' Punctuation ' ' Text '2' Literal.Number.Integer ',' Punctuation ' ' Text 'AS_OPEN_COMMENT' Name ')' Punctuation ' ' Text '=' Operator '=' Operator ' ' Text '0' Literal.Number.Integer ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'charDistance' Name '+' Operator '+' Operator ';' Punctuation '\n' Text ' ' Text 'inComment' Name ' ' Text '=' Operator ' ' Text 'true' Name.Builtin ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text ' ' Text 'else' Keyword '\n' Text ' ' Text 'return' Keyword ' ' Text 'charDistance' Name ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text '\n' Text ' ' Text 'return' Keyword ' ' Text 'charDistance' Name ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text '\n' Text '\n' Text ' ' Text '/**\n * check if a specific character can be used in a legal variable/method/class name\n *\n * @return legality of the char.\n * @param ch the character to be checked.\n */' Comment.Multiline '\n' Text ' ' Text 'bool' Keyword.Type ' ' Text 'ASBeautifier' Name ':' Operator ':' Operator 'isLegalNameChar' Name '(' Punctuation 'char' Keyword.Type ' ' Text 'ch' Name ')' Punctuation ' ' Text 'const' Keyword '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'return' Keyword ' ' Text '(' Punctuation 'isalnum' Name '(' Punctuation 'ch' Name ')' Punctuation ' ' Text "//(ch>='a' && ch<='z') || (ch>='A' && ch<='Z') || (ch>='0' && ch<='9') ||\n" Comment.Single ' ' Text '|' Operator '|' Operator ' ' Text 'ch' Name '=' Operator '=' Operator "'" Literal.String.Char '.' Literal.String.Char "'" Literal.String.Char ' ' Text '|' Operator '|' Operator ' ' Text 'ch' Name '=' Operator '=' Operator "'" Literal.String.Char '_' Literal.String.Char "'" Literal.String.Char ' ' Text '|' Operator '|' Operator ' ' Text '(' Punctuation '!' Operator 'isCStyle' Name ' ' Text '&' Operator '&' Operator ' ' Text 'ch' Name '=' Operator '=' Operator "'" Literal.String.Char '$' Literal.String.Char "'" Literal.String.Char ')' Punctuation ' ' Text '|' Operator '|' Operator ' ' Text '(' Punctuation 'isCStyle' Name ' ' Text '&' Operator '&' Operator ' ' Text 'ch' Name '=' Operator '=' Operator "'" Literal.String.Char '~' Literal.String.Char "'" Literal.String.Char ')' Punctuation ')' Punctuation ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text '\n' Text '\n' Text ' ' Text '/**\n * check if a specific line position contains a header, out of several possible headers.\n *\n * @return a pointer to the found header. if no header was found then return NULL.\n */' Comment.Multiline '\n' Text ' ' Text 'const' Keyword ' ' Text 'string' Name ' ' Text '*' Operator 'ASBeautifier' Name ':' Operator ':' Operator 'findHeader' Name '(' Punctuation 'const' Keyword ' ' Text 'string' Name ' ' Text '&' Operator 'line' Name ',' Punctuation ' ' Text 'int' Keyword.Type ' ' Text 'i' Name ',' Punctuation ' ' Text 'const' Keyword ' ' Text 'vector' Name '<' Operator 'const' Keyword ' ' Text 'string' Name '*' Operator '>' Operator ' ' Text '&' Operator 'possibleHeaders' Name ',' Punctuation ' ' Text 'bool' Keyword.Type ' ' Text 'checkBoundry' Name ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'int' Keyword.Type ' ' Text 'maxHeaders' Name ' ' Text '=' Operator ' ' Text 'possibleHeaders' Name '.' Punctuation 'size' Name '(' Punctuation ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'const' Keyword ' ' Text 'string' Name ' ' Text '*' Operator 'header' Name ' ' Text '=' Operator ' ' Text 'NULL' Name.Builtin ';' Punctuation '\n' Text ' ' Text 'int' Keyword.Type ' ' Text 'p' Name ';' Punctuation '\n' Text '\n' Text ' ' Text 'for' Keyword ' ' Text '(' Punctuation 'p' Name '=' Operator '0' Literal.Number.Integer ';' Punctuation ' ' Text 'p' Name ' ' Text '<' Operator ' ' Text 'maxHeaders' Name ';' Punctuation ' ' Text 'p' Name '+' Operator '+' Operator ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'header' Name ' ' Text '=' Operator ' ' Text 'possibleHeaders' Name '[' Punctuation 'p' Name ']' Punctuation ';' Punctuation '\n' Text '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'line' Name '.' Punctuation 'COMPARE' Name '(' Punctuation 'i' Name ',' Punctuation ' ' Text 'header' Name '-' Operator '>' Operator 'length' Name '(' Punctuation ')' Punctuation ',' Punctuation ' ' Text '*' Operator 'header' Name ')' Punctuation ' ' Text '=' Operator '=' Operator ' ' Text '0' Literal.Number.Integer ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text '// check that this is a header and not a part of a longer word\n' Comment.Single ' ' Text '// (e.g. not at its begining, not at its middle...)\n' Comment.Single '\n' Text ' ' Text 'int' Keyword.Type ' ' Text 'lineLength' Name ' ' Text '=' Operator ' ' Text 'line' Name '.' Punctuation 'length' Name '(' Punctuation ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'int' Keyword.Type ' ' Text 'headerEnd' Name ' ' Text '=' Operator ' ' Text 'i' Name ' ' Text '+' Operator ' ' Text 'header' Name '-' Operator '>' Operator 'length' Name '(' Punctuation ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'char' Keyword.Type ' ' Text 'startCh' Name ' ' Text '=' Operator ' ' Text '(' Punctuation '*' Operator 'header' Name ')' Punctuation '[' Punctuation '0' Literal.Number.Integer ']' Punctuation ';' Punctuation ' ' Text '// first char of header\n' Comment.Single ' ' Text 'char' Keyword.Type ' ' Text 'endCh' Name ' ' Text '=' Operator ' ' Text '0' Literal.Number.Integer ';' Punctuation ' ' Text '// char just after header\n' Comment.Single ' ' Text 'char' Keyword.Type ' ' Text 'prevCh' Name ' ' Text '=' Operator ' ' Text '0' Literal.Number.Integer ';' Punctuation ' ' Text '// char just before header\n' Comment.Single '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'headerEnd' Name ' ' Text '<' Operator ' ' Text 'lineLength' Name ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'endCh' Name ' ' Text '=' Operator ' ' Text 'line' Name '[' Punctuation 'headerEnd' Name ']' Punctuation ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'i' Name ' ' Text '>' Operator ' ' Text '0' Literal.Number.Integer ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'prevCh' Name ' ' Text '=' Operator ' ' Text 'line' Name '[' Punctuation 'i' Name '-1' Literal.Number.Integer ']' Punctuation ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation '!' Operator 'checkBoundry' Name ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'return' Keyword ' ' Text 'header' Name ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text ' ' Text 'else' Keyword ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'prevCh' Name ' ' Text '!' Operator '=' Operator ' ' Text '0' Literal.Number.Integer '\n' Text ' ' Text '&' Operator '&' Operator ' ' Text 'isLegalNameChar' Name '(' Punctuation 'startCh' Name ')' Punctuation '\n' Text ' ' Text '&' Operator '&' Operator ' ' Text 'isLegalNameChar' Name '(' Punctuation 'prevCh' Name ')' Punctuation ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'return' Keyword ' ' Text 'NULL' Name.Builtin ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text ' ' Text 'else' Keyword ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'headerEnd' Name ' ' Text '>' Operator '=' Operator ' ' Text 'lineLength' Name '\n' Text ' ' Text '|' Operator '|' Operator ' ' Text '!' Operator 'isLegalNameChar' Name '(' Punctuation 'startCh' Name ')' Punctuation '\n' Text ' ' Text '|' Operator '|' Operator ' ' Text '!' Operator 'isLegalNameChar' Name '(' Punctuation 'endCh' Name ')' Punctuation ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'return' Keyword ' ' Text 'header' Name ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text ' ' Text 'else' Keyword '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'return' Keyword ' ' Text 'NULL' Name.Builtin ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text '\n' Text ' ' Text 'return' Keyword ' ' Text 'NULL' Name.Builtin ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text '\n' Text '\n' Text ' ' Text '/**\n * check if a specific character can be used in a legal variable/method/class name\n *\n * @return legality of the char.\n * @param ch the character to be checked.\n */' Comment.Multiline '\n' Text ' ' Text 'bool' Keyword.Type ' ' Text 'ASBeautifier' Name ':' Operator ':' Operator 'isWhiteSpace' Name '(' Punctuation 'char' Keyword.Type ' ' Text 'ch' Name ')' Punctuation ' ' Text 'const' Keyword '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'return' Keyword ' ' Text '(' Punctuation 'ch' Name ' ' Text '=' Operator '=' Operator ' ' Text "'" Literal.String.Char ' ' Literal.String.Char "'" Literal.String.Char ' ' Text '|' Operator '|' Operator ' ' Text 'ch' Name ' ' Text '=' Operator '=' Operator ' ' Text "'" Literal.String.Char '\\t' Literal.String.Char "'" Literal.String.Char ')' Punctuation ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text '\n' Text ' ' Text '/**\n * find the index number of a string element in a container of strings\n *\n * @return the index number of element in the ocntainer. -1 if element not found.\n * @param container a vector of strings.\n * @param element the element to find .\n */' Comment.Multiline '\n' Text ' ' Text 'int' Keyword.Type ' ' Text 'ASBeautifier' Name ':' Operator ':' Operator 'indexOf' Name '(' Punctuation 'vector' Name '<' Operator 'const' Keyword ' ' Text 'string' Name '*' Operator '>' Operator ' ' Text '&' Operator 'container' Name ',' Punctuation ' ' Text 'const' Keyword ' ' Text 'string' Name ' ' Text '*' Operator 'element' Name ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'vector' Name '<' Operator 'const' Keyword ' ' Text 'string' Name '*' Operator '>' Operator ':' Operator ':' Operator 'const_iterator' Name ' ' Text 'where' Name ';' Punctuation '\n' Text '\n' Text ' ' Text 'where' Name '=' Operator ' ' Text 'find' Name '(' Punctuation 'container' Name '.' Punctuation 'begin' Name '(' Punctuation ')' Punctuation ',' Punctuation ' ' Text 'container' Name '.' Punctuation 'end' Name '(' Punctuation ')' Punctuation ',' Punctuation ' ' Text 'element' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'if' Keyword ' ' Text '(' Punctuation 'where' Name ' ' Text '=' Operator '=' Operator ' ' Text 'container' Name '.' Punctuation 'end' Name '(' Punctuation ')' Punctuation ')' Punctuation '\n' Text ' ' Text 'return' Keyword ' ' Text '-1' Literal.Number.Integer ';' Punctuation '\n' Text ' ' Text 'else' Keyword '\n' Text ' ' Text 'return' Keyword ' ' Text 'where' Name ' ' Text '-' Operator ' ' Text 'container' Name '.' Punctuation 'begin' Name '(' Punctuation ')' Punctuation ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text '\n' Text ' ' Text '/**\n * trim removes the white space surrounding a line.\n *\n * @return the trimmed line.\n * @param str the line to trim.\n */' Comment.Multiline '\n' Text ' ' Text 'string' Name ' ' Text 'ASBeautifier' Name ':' Operator ':' Operator 'trim' Name '(' Punctuation 'const' Keyword ' ' Text 'string' Name ' ' Text '&' Operator 'str' Name ')' Punctuation '\n' Text ' ' Text '{' Punctuation '\n' Text '\n' Text ' ' Text 'int' Keyword.Type ' ' Text 'start' Name ' ' Text '=' Operator ' ' Text '0' Literal.Number.Integer ';' Punctuation '\n' Text ' ' Text 'int' Keyword.Type ' ' Text 'end' Name ' ' Text '=' Operator ' ' Text 'str' Name '.' Punctuation 'length' Name '(' Punctuation ')' Punctuation ' ' Text '-' Operator ' ' Text '1' Literal.Number.Integer ';' Punctuation '\n' Text '\n' Text ' ' Text 'while' Keyword ' ' Text '(' Punctuation 'start' Name ' ' Text '<' Operator ' ' Text 'end' Name ' ' Text '&' Operator '&' Operator ' ' Text 'isWhiteSpace' Name '(' Punctuation 'str' Name '[' Punctuation 'start' Name ']' Punctuation ')' Punctuation ')' Punctuation '\n' Text ' ' Text 'start' Name '+' Operator '+' Operator ';' Punctuation '\n' Text '\n' Text ' ' Text 'while' Keyword ' ' Text '(' Punctuation 'start' Name ' ' Text '<' Operator '=' Operator ' ' Text 'end' Name ' ' Text '&' Operator '&' Operator ' ' Text 'isWhiteSpace' Name '(' Punctuation 'str' Name '[' Punctuation 'end' Name ']' Punctuation ')' Punctuation ')' Punctuation '\n' Text ' ' Text 'end' Name '-' Operator '-' Operator ';' Punctuation '\n' Text '\n' Text ' ' Text 'string' Name ' ' Text 'returnStr' Name.Function '(' Punctuation 'str' Name ',' Punctuation ' ' Text 'start' Name ',' Punctuation ' ' Text 'end' Name '+' Operator '1' Literal.Number.Integer '-' Operator 'start' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'return' Keyword ' ' Text 'returnStr' Name ';' Punctuation '\n' Text ' ' Text '}' Punctuation '\n' Text '\n' Text '#' Comment.Preproc 'ifdef USES_NAMESPACE' Comment.Preproc '\n' Comment.Preproc '}' Punctuation '\n' Text '#' Comment.Preproc 'endif' Comment.Preproc '\n' Comment.Preproc '/*\n * Copyright (c) 1998,1999,2000,2001,2002 Tal Davidson. All rights reserved.\n *\n * compiler_defines.h (1 January 1999)\n * by Tal Davidson (davidsont@bigfoot.com)\n * This file is a part of "Artistic Style" - an indentater and reformatter\n * of C, C++, C# and Java source files.\n *\n * The "Artistic Style" project, including all files needed to compile it,\n * is free software; you can redistribute it and/or use it and/or modify it\n * under the terms of the GNU General Public License as published \n * by the Free Software Foundation; either version 2 of the License, \n * or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n *\n * You should have received a copy of the GNU General Public\n * License along with this program.\n */' Comment.Multiline '\n' Text '\n' Text '\n' Text '#' Comment.Preproc 'ifndef ASBEAUTIFIER_H' Comment.Preproc '\n' Comment.Preproc '#' Comment.Preproc 'define ASBEAUTIFIER_H' Comment.Preproc '\n' Comment.Preproc '\n' Text '#' Comment.Preproc 'include' Comment.Preproc ' ' Text '"ASResource.h"' Comment.PreprocFile '\n' Comment.Preproc '#' Comment.Preproc 'include' Comment.Preproc ' ' Text '"compiler_defines.h"' Comment.PreprocFile '\n' Comment.Preproc '#' Comment.Preproc 'include' Comment.Preproc ' ' Text '"ASSourceIterator.h"' Comment.PreprocFile '\n' Comment.Preproc '\n' Text '#' Comment.Preproc 'include' Comment.Preproc ' ' Text '' Comment.PreprocFile '\n' Comment.Preproc '#' Comment.Preproc 'include' Comment.Preproc ' ' Text '' Comment.PreprocFile '\n' Comment.Preproc '\n' Text '\n' Text 'using' Keyword ' ' Text 'namespace' Keyword ' ' Text 'std' Name ';' Punctuation '\n' Text '\n' Text 'namespace' Keyword ' ' Text 'astyle' Name '\n' Text ' ' Text '{' Punctuation '\n' Text '\n' Text ' ' Text 'enum' Keyword ' ' Text 'BracketMode' Name.Class ' ' Text '{' Punctuation ' ' Text 'NONE_MODE' Name ',' Punctuation ' ' Text 'ATTACH_MODE' Name ',' Punctuation ' ' Text 'BREAK_MODE' Name ',' Punctuation ' ' Text 'BDAC_MODE' Name ' ' Text '}' Punctuation ';' Punctuation '\n' Text ' ' Text 'enum' Keyword ' ' Text 'BracketType' Name.Class ' ' Text '{' Punctuation ' ' Text 'NULL_TYPE' Name ' ' Text '=' Operator ' ' Text '0' Literal.Number.Integer ',' Punctuation '\n' Text ' ' Text 'DEFINITION_TYPE' Name ' ' Text '=' Operator ' ' Text '1' Literal.Number.Integer ',' Punctuation '\n' Text ' ' Text 'COMMAND_TYPE' Name ' ' Text '=' Operator ' ' Text '2' Literal.Number.Integer ',' Punctuation '\n' Text ' ' Text 'ARRAY_TYPE' Name ' ' Text '=' Operator ' ' Text '4' Literal.Number.Integer ',' Punctuation '\n' Text ' ' Text 'SINGLE_LINE_TYPE' Name ' ' Text '=' Operator ' ' Text '8' Literal.Number.Integer '}' Punctuation ';' Punctuation '\n' Text '\n' Text '\n' Text ' ' Text 'class' Keyword ' ' Text 'ASBeautifier' Name.Class ' ' Text ':' Operator ' ' Text 'protected' Keyword ' ' Text 'ASResource' Name '\n' Text ' ' Text '{' Punctuation '\n' Text ' ' Text 'public' Keyword ':' Operator '\n' Text ' ' Text 'ASBeautifier' Name '(' Punctuation ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'virtual' Keyword ' ' Text '~' Operator 'ASBeautifier' Name '(' Punctuation ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'virtual' Keyword ' ' Text 'void' Keyword.Type ' ' Text 'init' Name '(' Punctuation 'ASSourceIterator' Name '*' Operator ' ' Text 'iter' Name ')' Punctuation ';' Punctuation ' ' Text '// pointer to dynamically created iterator.\n' Comment.Single ' ' Text 'virtual' Keyword ' ' Text 'void' Keyword.Type ' ' Text 'init' Name '(' Punctuation ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'virtual' Keyword ' ' Text 'bool' Keyword.Type ' ' Text 'hasMoreLines' Name '(' Punctuation ')' Punctuation ' ' Text 'const' Keyword ';' Punctuation '\n' Text ' ' Text 'virtual' Keyword ' ' Text 'string' Name ' ' Text 'nextLine' Name '(' Punctuation ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'virtual' Keyword ' ' Text 'string' Name ' ' Text 'beautify' Name '(' Punctuation 'const' Keyword ' ' Text 'string' Name ' ' Text '&' Operator 'line' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'void' Keyword.Type ' ' Text 'setTabIndentation' Name.Function '(' Punctuation 'int' Keyword.Type ' ' Text 'length' Name ' ' Text '=' Operator ' ' Text '4' Literal.Number.Integer ',' Punctuation ' ' Text 'bool' Keyword.Type ' ' Text 'forceTabs' Name ' ' Text '=' Operator ' ' Text 'false' Name.Builtin ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'void' Keyword.Type ' ' Text 'setSpaceIndentation' Name.Function '(' Punctuation 'int' Keyword.Type ' ' Text 'length' Name ' ' Text '=' Operator ' ' Text '4' Literal.Number.Integer ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'void' Keyword.Type ' ' Text 'setMaxInStatementIndentLength' Name.Function '(' Punctuation 'int' Keyword.Type ' ' Text 'max' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'void' Keyword.Type ' ' Text 'setMinConditionalIndentLength' Name.Function '(' Punctuation 'int' Keyword.Type ' ' Text 'min' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'void' Keyword.Type ' ' Text 'setClassIndent' Name.Function '(' Punctuation 'bool' Keyword.Type ' ' Text 'state' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'void' Keyword.Type ' ' Text 'setSwitchIndent' Name.Function '(' Punctuation 'bool' Keyword.Type ' ' Text 'state' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'void' Keyword.Type ' ' Text 'setCaseIndent' Name.Function '(' Punctuation 'bool' Keyword.Type ' ' Text 'state' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'void' Keyword.Type ' ' Text 'setBracketIndent' Name.Function '(' Punctuation 'bool' Keyword.Type ' ' Text 'state' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'void' Keyword.Type ' ' Text 'setBlockIndent' Name.Function '(' Punctuation 'bool' Keyword.Type ' ' Text 'state' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'void' Keyword.Type ' ' Text 'setNamespaceIndent' Name.Function '(' Punctuation 'bool' Keyword.Type ' ' Text 'state' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'void' Keyword.Type ' ' Text 'setLabelIndent' Name.Function '(' Punctuation 'bool' Keyword.Type ' ' Text 'state' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'void' Keyword.Type ' ' Text 'setCStyle' Name.Function '(' Punctuation ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'void' Keyword.Type ' ' Text 'setJavaStyle' Name.Function '(' Punctuation ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'void' Keyword.Type ' ' Text 'setEmptyLineFill' Name.Function '(' Punctuation 'bool' Keyword.Type ' ' Text 'state' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'void' Keyword.Type ' ' Text 'setPreprocessorIndent' Name.Function '(' Punctuation 'bool' Keyword.Type ' ' Text 'state' Name ')' Punctuation ';' Punctuation '\n' Text '\n' Text '\n' Text ' ' Text 'protected' Keyword ':' Operator '\n' Text ' ' Text 'int' Keyword.Type ' ' Text 'getNextProgramCharDistance' Name '(' Punctuation 'const' Keyword ' ' Text 'string' Name ' ' Text '&' Operator 'line' Name ',' Punctuation ' ' Text 'int' Keyword.Type ' ' Text 'i' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'bool' Keyword.Type ' ' Text 'isLegalNameChar' Name.Function '(' Punctuation 'char' Keyword.Type ' ' Text 'ch' Name ')' Punctuation ' ' Text 'const' Keyword ';' Punctuation '\n' Text ' ' Text 'bool' Keyword.Type ' ' Text 'isWhiteSpace' Name.Function '(' Punctuation 'char' Keyword.Type ' ' Text 'ch' Name ')' Punctuation ' ' Text 'const' Keyword ';' Punctuation '\n' Text ' ' Text 'const' Keyword ' ' Text 'string' Name ' ' Text '*' Operator 'findHeader' Name '(' Punctuation 'const' Keyword ' ' Text 'string' Name ' ' Text '&' Operator 'line' Name ',' Punctuation ' ' Text 'int' Keyword.Type ' ' Text 'i' Name ',' Punctuation '\n' Text ' ' Text 'const' Keyword ' ' Text 'vector' Name '<' Operator 'const' Keyword ' ' Text 'string' Name '*' Operator '>' Operator ' ' Text '&' Operator 'possibleHeaders' Name ',' Punctuation '\n' Text ' ' Text 'bool' Keyword.Type ' ' Text 'checkBoundry' Name ' ' Text '=' Operator ' ' Text 'true' Name.Builtin ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'string' Name ' ' Text 'trim' Name.Function '(' Punctuation 'const' Keyword ' ' Text 'string' Name ' ' Text '&' Operator 'str' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'int' Keyword.Type ' ' Text 'indexOf' Name.Function '(' Punctuation 'vector' Name '<' Operator 'const' Keyword ' ' Text 'string' Name '*' Operator '>' Operator ' ' Text '&' Operator 'container' Name ',' Punctuation ' ' Text 'const' Keyword ' ' Text 'string' Name ' ' Text '*' Operator 'element' Name ')' Punctuation ';' Punctuation '\n' Text '\n' Text ' ' Text 'private' Keyword ':' Operator '\n' Text ' ' Text 'ASBeautifier' Name '(' Punctuation 'const' Keyword ' ' Text 'ASBeautifier' Name ' ' Text '&' Operator 'copy' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'void' Keyword.Type ' ' Text 'operator' Keyword '=' Operator '(' Punctuation 'ASBeautifier' Name '&' Operator ')' Punctuation ';' Punctuation ' ' Text '// not to be implemented\n' Comment.Single '\n' Text ' ' Text 'void' Keyword.Type ' ' Text 'initStatic' Name.Function '(' Punctuation ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'void' Keyword.Type ' ' Text 'registerInStatementIndent' Name.Function '(' Punctuation 'const' Keyword ' ' Text 'string' Name ' ' Text '&' Operator 'line' Name ',' Punctuation ' ' Text 'int' Keyword.Type ' ' Text 'i' Name ',' Punctuation ' ' Text 'int' Keyword.Type ' ' Text 'spaceTabCount' Name ',' Punctuation '\n' Text ' ' Text 'int' Keyword.Type ' ' Text 'minIndent' Name ',' Punctuation ' ' Text 'bool' Keyword.Type ' ' Text 'updateParenStack' Name ')' Punctuation ';' Punctuation '\n' Text ' ' Text 'string' Name ' ' Text 'preLineWS' Name.Function '(' Punctuation 'int' Keyword.Type ' ' Text 'spaceTabCount' Name ',' Punctuation ' ' Text 'int' Keyword.Type ' ' Text 'tabCount' Name ')' Punctuation ';' Punctuation '\n' Text '\n' Text ' ' Text 'static' Keyword ' ' Text 'vector' Name '<' Operator 'const' Keyword ' ' Text 'string' Name '*' Operator '>' Operator ' ' Text 'headers' Name ';' Punctuation '\n' Text ' ' Text 'static' Keyword ' ' Text 'vector' Name '<' Operator 'const' Keyword ' ' Text 'string' Name '*' Operator '>' Operator ' ' Text 'nonParenHeaders' Name ';' Punctuation '\n' Text ' ' Text 'static' Keyword ' ' Text 'vector' Name '<' Operator 'const' Keyword ' ' Text 'string' Name '*' Operator '>' Operator ' ' Text 'preprocessorHeaders' Name ';' Punctuation '\n' Text ' ' Text 'static' Keyword ' ' Text 'vector' Name '<' Operator 'const' Keyword ' ' Text 'string' Name '*' Operator '>' Operator ' ' Text 'preBlockStatements' Name ';' Punctuation '\n' Text ' ' Text 'static' Keyword ' ' Text 'vector' Name '<' Operator 'const' Keyword ' ' Text 'string' Name '*' Operator '>' Operator ' ' Text 'assignmentOperators' Name ';' Punctuation '\n' Text ' ' Text 'static' Keyword ' ' Text 'vector' Name '<' Operator 'const' Keyword ' ' Text 'string' Name '*' Operator '>' Operator ' ' Text 'nonAssignmentOperators' Name ';' Punctuation '\n' Text '\n' Text ' ' Text 'static' Keyword ' ' Text 'bool' Keyword.Type ' ' Text 'calledInitStatic' Name ';' Punctuation '\n' Text '\n' Text ' ' Text 'ASSourceIterator' Name ' ' Text '*' Operator 'sourceIterator' Name ';' Punctuation '\n' Text ' ' Text 'vector' Name '<' Operator 'ASBeautifier' Name '*' Operator '>' Operator ' ' Text '*' Operator 'waitingBeautifierStack' Name ';' Punctuation '\n' Text ' ' Text 'vector' Name '<' Operator 'ASBeautifier' Name '*' Operator '>' Operator ' ' Text '*' Operator 'activeBeautifierStack' Name ';' Punctuation '\n' Text ' ' Text 'vector' Name '<' Operator 'int' Keyword.Type '>' Operator ' ' Text '*' Operator 'waitingBeautifierStackLengthStack' Name ';' Punctuation '\n' Text ' ' Text 'vector' Name '<' Operator 'int' Keyword.Type '>' Operator ' ' Text '*' Operator 'activeBeautifierStackLengthStack' Name ';' Punctuation '\n' Text ' ' Text 'vector' Name '<' Operator 'const' Keyword ' ' Text 'string' Name '*' Operator '>' Operator ' ' Text '*' Operator 'headerStack' Name ';' Punctuation '\n' Text ' ' Text 'vector' Name '<' Operator ' ' Text 'vector' Name '<' Operator 'const' Keyword ' ' Text 'string' Name '*' Operator '>' Operator '*' Operator ' ' Text '>' Operator ' ' Text '*' Operator 'tempStacks' Name ';' Punctuation '\n' Text ' ' Text 'vector' Name '<' Operator 'int' Keyword.Type '>' Operator ' ' Text '*' Operator 'blockParenDepthStack' Name ';' Punctuation '\n' Text ' ' Text 'vector' Name '<' Operator 'bool' Keyword.Type '>' Operator ' ' Text '*' Operator 'blockStatementStack' Name ';' Punctuation '\n' Text ' ' Text 'vector' Name '<' Operator 'bool' Keyword.Type '>' Operator ' ' Text '*' Operator 'parenStatementStack' Name ';' Punctuation '\n' Text ' ' Text 'vector' Name '<' Operator 'int' Keyword.Type '>' Operator ' ' Text '*' Operator 'inStatementIndentStack' Name ';' Punctuation '\n' Text ' ' Text 'vector' Name '<' Operator 'int' Keyword.Type '>' Operator ' ' Text '*' Operator 'inStatementIndentStackSizeStack' Name ';' Punctuation '\n' Text ' ' Text 'vector' Name '<' Operator 'int' Keyword.Type '>' Operator ' ' Text '*' Operator 'parenIndentStack' Name ';' Punctuation '\n' Text ' ' Text 'vector' Name '<' Operator 'bool' Keyword.Type '>' Operator ' ' Text '*' Operator 'bracketBlockStateStack' Name ';' Punctuation '\n' Text ' ' Text 'string' Name ' ' Text 'indentString' Name ';' Punctuation '\n' Text ' ' Text 'const' Keyword ' ' Text 'string' Name ' ' Text '*' Operator 'currentHeader' Name ';' Punctuation '\n' Text ' ' Text 'const' Keyword ' ' Text 'string' Name ' ' Text '*' Operator 'previousLastLineHeader' Name ';' Punctuation '\n' Text ' ' Text 'const' Keyword ' ' Text 'string' Name ' ' Text '*' Operator 'immediatelyPreviousAssignmentOp' Name ';' Punctuation '\n' Text ' ' Text 'const' Keyword ' ' Text 'string' Name ' ' Text '*' Operator 'probationHeader' Name ';' Punctuation '\n' Text ' ' Text 'bool' Keyword.Type ' ' Text 'isInQuote' Name ';' Punctuation '\n' Text ' ' Text 'bool' Keyword.Type ' ' Text 'isInComment' Name ';' Punctuation '\n' Text ' ' Text 'bool' Keyword.Type ' ' Text 'isInCase' Name ';' Punctuation '\n' Text ' ' Text 'bool' Keyword.Type ' ' Text 'isInQuestion' Name ';' Punctuation '\n' Text ' ' Text 'bool' Keyword.Type ' ' Text 'isInStatement' Name ';' Punctuation '\n' Text ' ' Text 'bool' Keyword.Type ' ' Text 'isInHeader' Name ';' Punctuation '\n' Text ' ' Text 'bool' Keyword.Type ' ' Text 'isCStyle' Name ';' Punctuation '\n' Text ' ' Text 'bool' Keyword.Type ' ' Text 'isInOperator' Name ';' Punctuation '\n' Text ' ' Text 'bool' Keyword.Type ' ' Text 'isInTemplate' Name ';' Punctuation '\n' Text ' ' Text 'bool' Keyword.Type ' ' Text 'isInConst' Name ';' Punctuation '\n' Text ' ' Text 'bool' Keyword.Type ' ' Text 'isInDefine' Name ';' Punctuation '\n' Text ' ' Text 'bool' Keyword.Type ' ' Text 'isInDefineDefinition' Name ';' Punctuation '\n' Text ' ' Text 'bool' Keyword.Type ' ' Text 'classIndent' Name ';' Punctuation '\n' Text ' ' Text 'bool' Keyword.Type ' ' Text 'isInClassHeader' Name ';' Punctuation '\n' Text ' ' Text 'bool' Keyword.Type ' ' Text 'isInClassHeaderTab' Name ';' Punctuation '\n' Text ' ' Text 'bool' Keyword.Type ' ' Text 'switchIndent' Name ';' Punctuation '\n' Text ' ' Text 'bool' Keyword.Type ' ' Text 'caseIndent' Name ';' Punctuation '\n' Text ' ' Text 'bool' Keyword.Type ' ' Text 'namespaceIndent' Name ';' Punctuation '\n' Text ' ' Text 'bool' Keyword.Type ' ' Text 'bracketIndent' Name ';' Punctuation '\n' Text ' ' Text 'bool' Keyword.Type ' ' Text 'blockIndent' Name ';' Punctuation '\n' Text ' ' Text 'bool' Keyword.Type ' ' Text 'labelIndent' Name ';' Punctuation '\n' Text ' ' Text 'bool' Keyword.Type ' ' Text 'preprocessorIndent' Name ';' Punctuation '\n' Text ' ' Text 'bool' Keyword.Type ' ' Text 'isInConditional' Name ';' Punctuation '\n' Text ' ' Text 'bool' Keyword.Type ' ' Text 'isMinimalConditinalIndentSet' Name ';' Punctuation '\n' Text ' ' Text 'bool' Keyword.Type ' ' Text 'shouldForceTabIndentation' Name ';' Punctuation '\n' Text ' ' Text 'int' Keyword.Type ' ' Text 'minConditionalIndent' Name ';' Punctuation '\n' Text ' ' Text 'int' Keyword.Type ' ' Text 'parenDepth' Name ';' Punctuation '\n' Text ' ' Text 'int' Keyword.Type ' ' Text 'indentLength' Name ';' Punctuation '\n' Text ' ' Text 'int' Keyword.Type ' ' Text 'blockTabCount' Name ';' Punctuation '\n' Text ' ' Text 'unsigned' Keyword.Type ' ' Text 'int' Keyword.Type ' ' Text 'leadingWhiteSpaces' Name ';' Punctuation '\n' Text ' ' Text 'int' Keyword.Type ' ' Text 'maxInStatementIndent' Name ';' Punctuation '\n' Text ' ' Text 'int' Keyword.Type ' ' Text 'templateDepth' Name ';' Punctuation '\n' Text ' ' Text 'char' Keyword.Type ' ' Text 'quoteChar' Name ';' Punctuation '\n' Text ' ' Text 'char' Keyword.Type ' ' Text 'prevNonSpaceCh' Name ';' Punctuation '\n' Text ' ' Text 'char' Keyword.Type ' ' Text 'currentNonSpaceCh' Name ';' Punctuation '\n' Text ' ' Text 'char' Keyword.Type ' ' Text 'currentNonLegalCh' Name ';' Punctuation '\n' Text ' ' Text 'char' Keyword.Type ' ' Text 'prevNonLegalCh' Name ';' Punctuation '\n' Text ' ' Text 'int' Keyword.Type ' ' Text 'prevFinalLineSpaceTabCount' Name ';' Punctuation '\n' Text ' ' Text 'int' Keyword.Type ' ' Text 'prevFinalLineTabCount' Name ';' Punctuation '\n' Text ' ' Text 'bool' Keyword.Type ' ' Text 'emptyLineFill' Name ';' Punctuation '\n' Text ' ' Text 'bool' Keyword.Type ' ' Text 'backslashEndsPrevLine' Name ';' Punctuation '\n' Text ' ' Text 'int' Keyword.Type ' ' Text 'defineTabCount' Name ';' Punctuation '\n' Text ' ' Text '}' Punctuation ';' Punctuation '\n' Text '}' Punctuation '\n' Text '\n' Text '#' Comment.Preproc 'endif' Comment.Preproc '\n' Comment.Preproc '/*\n * Copyright (c) 1998,1999,2000,2001,2002 Tal Davidson. All rights reserved.\n *\n * ASFormatter.cpp\n * by Tal Davidson (davidsont@bigfoot.com)\n * This file is a part of "Artistic Style" - an indentater and reformatter\n * of C, C++, C# and Java source files.\n *\n * The "Artistic Style" project, including all files needed to compile it,\n * is free software; you can redistribute it and/or use it and/or modify it\n * under the terms of the GNU General Public License as published \n * by the Free Software Foundation; either version 2 of the License, \n * or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n *\n * You should have received a copy of the GNU General Public\n * License along with this program.\n *\n *\n * Patches:\n * 26 November 1998 - Richard Bullington -\n * A correction of line-breaking in headers following \'}\',\n \n * was created using a variation of a patch by Richard Bullington.\n * 08 May 2004\n * applied ASFormatter450670.patch.bz2, ASFormatter.cpp.patch.bz2,\n * patch1_ssvb_patch.tar.gz\n */' Comment.Multiline '\n' Text '\n' Text '#' Comment.Preproc 'include' Comment.Preproc ' ' Text '"compiler_defines.h"' Comment.PreprocFile '\n' Comment.Preproc '#' Comment.Preproc 'include' Comment.Preproc ' ' Text '"ASFormatter.h"' Comment.PreprocFile '\n' Comment.Preproc '\n' Text '\n' Text '#' Comment.Preproc 'include' Comment.Preproc ' ' Text '' Comment.PreprocFile '\n' Comment.Preproc '#' Comment.Preproc 'include' Comment.Preproc ' ' Text '' Comment.PreprocFile '\n' Comment.Preproc '#' Comment.Preproc 'include' Comment.Preproc ' ' Text '' Comment.PreprocFile '\n' Comment.Preproc '#' Comment.Preproc 'include' Comment.Preproc ' ' Text '' Comment.PreprocFile '\n' Comment.Preproc '#' Comment.Preproc 'include' Comment.Preproc ' ' Text '' Comment.PreprocFile '\n' Comment.Preproc '\n' Text '\n' Text '#' Comment.Preproc 'define INIT_CONTAINER(container, value) {if ( (container) != NULL ) delete (container); (container) = (value); }' Comment.Preproc '\n' Comment.Preproc '#' Comment.Preproc 'define DELETE_CONTAINER(container) {if ( (container) != NULL ) delete (container) ; }' Comment.Preproc '\n' Comment.Preproc '#' Comment.Preproc 'define IS_A(a,b) ( ((a) & (b)) == (b))' Comment.Preproc '\n' Comment.Preproc '#' Comment.Preproc 'ifdef USES_NAMESPACE' Comment.Preproc '\n' Comment.Preproc 'using' Keyword ' ' Text 'namespace' Keyword ' ' Text 'std' Name ';' Punctuation '\n' Text