Changeset View
Changeset View
Standalone View
Standalone View
addons/symbolviewer/ecma_parser.cpp
Show First 20 Lines • Show All 125 Lines • ▼ Show 20 Line(s) | 125 | else { | |||
---|---|---|---|---|---|
126 | identifier += current; | 126 | identifier += current; | ||
127 | } | 127 | } | ||
128 | } | 128 | } | ||
129 | // trim whitespace | 129 | // trim whitespace | ||
130 | identifier = identifier.trimmed(); | 130 | identifier = identifier.trimmed(); | ||
131 | // get the node to add the class entry to | 131 | // get the node to add the class entry to | ||
132 | if ((m_treeOn->isChecked()) && (! nodes.isEmpty())) { | 132 | if ((m_treeOn->isChecked()) && (! nodes.isEmpty())) { | ||
133 | node = new QTreeWidgetItem(nodes.last()); | 133 | node = new QTreeWidgetItem(nodes.last()); | ||
134 | if (m_plugin->expandedOn) m_symbols->expandItem(node); | 134 | if (m_expandOn->isChecked()) m_symbols->expandItem(node); | ||
135 | } | 135 | } | ||
136 | else { | 136 | else { | ||
137 | node = new QTreeWidgetItem(m_symbols); | 137 | node = new QTreeWidgetItem(m_symbols); | ||
138 | } | 138 | } | ||
139 | // add an entry for the class | 139 | // add an entry for the class | ||
140 | node->setText(0, identifier); | 140 | node->setText(0, identifier); | ||
141 | node->setIcon(0, QIcon(cls)); | 141 | node->setIcon(0, QIcon(cls)); | ||
142 | node->setText(1, QString::number(line, 10)); | 142 | node->setText(1, QString::number(line, 10)); | ||
143 | if (m_plugin->expandedOn) m_symbols->expandItem(node); | 143 | if (m_expandOn->isChecked()) m_symbols->expandItem(node); | ||
144 | } // (look for classes) | 144 | } // (look for classes) | ||
145 | 145 | | |||
146 | // look for function definitions | 146 | // look for function definitions | ||
147 | if ((current == QLatin1Char('f')) && (stripped.indexOf(QLatin1String("function"), c) == c)) { | 147 | if ((current == QLatin1Char('f')) && (stripped.indexOf(QLatin1String("function"), c) == c)) { | ||
148 | function_start = c; | 148 | function_start = c; | ||
149 | c += 8; | 149 | c += 8; | ||
150 | // look for the beginning of the parameters | 150 | // look for the beginning of the parameters | ||
151 | identifier.clear(); | 151 | identifier.clear(); | ||
▲ Show 20 Lines • Show All 65 Lines • ▼ Show 20 Line(s) | 202 | if (identifier.length() > 0) { | |||
217 | } | 217 | } | ||
218 | // mark root-level functions as classes | 218 | // mark root-level functions as classes | ||
219 | else { | 219 | else { | ||
220 | node->setIcon(0, QIcon(cls)); | 220 | node->setIcon(0, QIcon(cls)); | ||
221 | } | 221 | } | ||
222 | // add the function | 222 | // add the function | ||
223 | node->setText(0, identifier); | 223 | node->setText(0, identifier); | ||
224 | node->setText(1, QString::number(line, 10)); | 224 | node->setText(1, QString::number(line, 10)); | ||
225 | if (m_plugin->expandedOn) m_symbols->expandItem(node); | 225 | if (m_expandOn->isChecked()) m_symbols->expandItem(node); | ||
226 | } | 226 | } | ||
227 | } // (look for functions) | 227 | } // (look for functions) | ||
228 | 228 | | |||
229 | 229 | | |||
230 | // look for QML id: .... | 230 | // look for QML id: .... | ||
231 | if (stripped.midRef(c, 3) == QLatin1String("id:")) { | 231 | if (stripped.midRef(c, 3) == QLatin1String("id:")) { | ||
232 | c += 3; | 232 | c += 3; | ||
233 | identifier.clear(); | 233 | identifier.clear(); | ||
Show All 24 Lines | 257 | else | |||
258 | node = new QTreeWidgetItem(m_symbols); | 258 | node = new QTreeWidgetItem(m_symbols); | ||
259 | 259 | | |||
260 | // mark the node as a class | 260 | // mark the node as a class | ||
261 | node->setIcon(0, QIcon(cls)); | 261 | node->setIcon(0, QIcon(cls)); | ||
262 | 262 | | |||
263 | // add the id | 263 | // add the id | ||
264 | node->setText(0, identifier); | 264 | node->setText(0, identifier); | ||
265 | node->setText(1, QString::number(line, 10)); | 265 | node->setText(1, QString::number(line, 10)); | ||
266 | if (m_plugin->expandedOn) m_symbols->expandItem(node); | 266 | if (m_expandOn->isChecked()) m_symbols->expandItem(node); | ||
267 | } | 267 | } | ||
268 | } | 268 | } | ||
269 | 269 | | |||
270 | // keep track of brace depth | 270 | // keep track of brace depth | ||
271 | if (current == QLatin1Char('{')) { | 271 | if (current == QLatin1Char('{')) { | ||
272 | brace_depth++; | 272 | brace_depth++; | ||
273 | // if a node has been added at this level or above, | 273 | // if a node has been added at this level or above, | ||
274 | // use it to extend the stack | 274 | // use it to extend the stack | ||
Show All 19 Lines |