MCPcopy Create free account
hub / github.com/dirkvranckaert/AndroidDecompiler / parseCurrentLine

Method parseCurrentLine

astyle/src/ASBeautifier.cpp:2135–3265  ·  view source on GitHub ↗

* Parse the current line to update indentCount and spaceIndentCount. */

Source from the content-addressed store, hash-verified

2133 * Parse the current line to update indentCount and spaceIndentCount.
2134 */
2135void ASBeautifier::parseCurrentLine(const string &line)
2136{
2137 bool isInLineComment = false;
2138 bool isInOperator = false;
2139 bool isSpecialChar = false;
2140 bool haveCaseIndent = false;
2141 bool haveAssignmentThisLine = false;
2142 bool closingBracketReached = false;
2143 bool previousLineProbation = (probationHeader != NULL);
2144 char ch = ' ';
2145 int tabIncrementIn = 0;
2146
2147 for (size_t i = 0; i < line.length(); i++)
2148 {
2149 ch = line[i];
2150
2151 if (isInBeautifySQL)
2152 continue;
2153
2154 if (isWhiteSpace(ch))
2155 {
2156 if (ch == '\t')
2157 tabIncrementIn += convertTabToSpaces(i, tabIncrementIn);
2158 continue;
2159 }
2160
2161 // handle special characters (i.e. backslash+character such as \n, \t, ...)
2162
2163 if (isInQuote && !isInVerbatimQuote)
2164 {
2165 if (isSpecialChar)
2166 {
2167 isSpecialChar = false;
2168 continue;
2169 }
2170 if (line.compare(i, 2, "\\\\") == 0)
2171 {
2172 i++;
2173 continue;
2174 }
2175 if (ch == '\\')
2176 {
2177 if (peekNextChar(line, i) == ' ') // is this '\' at end of line
2178 haveLineContinuationChar = true;
2179 else
2180 isSpecialChar = true;
2181 continue;
2182 }
2183 }
2184 else if (isInDefine && ch == '\\')
2185 continue;
2186
2187 // handle quotes (such as 'x' and "Hello Dolly")
2188 if (!(isInComment || isInLineComment) && (ch == '"' || ch == '\''))
2189 {
2190 if (!isInQuote)
2191 {
2192 quoteChar = ch;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected