5#ifndef QQMLDOMCODEFORMATTER_P_H
6#define QQMLDOMCODEFORMATTER_P_H
24#include <QtCore/QStack>
25#include <QtCore/QList>
27#include <QtCore/QVector>
28#include <QtCore/QMetaObject>
150 return type == other.type && savedIndentDepth == other.savedIndentDepth;
157 return type == StateType::IfStatement || type == StateType::ElseClause
158 || type == StateType::Substatement || type == StateType::BindingAssignment
159 || type == StateType::BindingOrObjectdefinition;
164 return type == StateType::TopmostIntro || type == StateType::TopJs
165 || type == StateType::ObjectdefinitionOpen || type == StateType::DoStatement
166 || type == StateType::JsblockOpen || type == StateType::SubstatementOpen
167 || type == StateType::BracketOpen || type == StateType::ParenOpen
168 || type == StateType::CaseCont || type == StateType::ObjectliteralOpen;
173 return FormatTextStatus {
175 QVector<State>({ State { quint16(baseIndent), StateType::TopmostIntro } }), baseIndent
183 void pushState(StateType type, quint16 savedIndentDepth)
185 states.append(State { savedIndentDepth, type });
190 if (states.isEmpty()) {
194 State res = states.last();
230 lineTokens = tokenize(line, startState);
231 currentStatus.lexerState = tokenize.state();
234 void enterState(FormatTextStatus::StateType newState);
240 int column(
int index)
const;
247 void defaultOnEnter(FormatTextStatus::StateType newState,
int *indentDepth,
248 int *savedIndentDepth)
const;
bool operator==(const State &other) const
static bool isBracelessState(StateType type)
static FormatTextStatus initialStatus(int baseIndent=0)
void pushState(StateType type, quint16 savedIndentDepth)
State state(int belowTop=0) const
Scanner::State lexerState
static bool isExpressionEndState(StateType type)
static bool lexKindIsIdentifier(int kind)
static bool lexKindIsComment(int kind)
static bool lexKindIsInvalid(int kind)
FormatPartialStatus formatCodeLine(QStringView line, const FormatOptions &options, const FormatTextStatus &initialStatus)
int indentForLineStartingWithToken(const FormatTextStatus &oldStatus, const FormatOptions &, int tokenKind)
FormatTextStatus::State State
Q_STATIC_LOGGING_CATEGORY(lcAccessibilityCore, "qt.accessibility.core")