feat: 更好的代码填充;
This commit is contained in:
parent
f87c0970be
commit
ef8bb9aa3a
|
@ -349,11 +349,20 @@ QList<CodeInfoTip> AsCompletion::parseDocument() {
|
|||
|
||||
switch (sym.symtype) {
|
||||
case QAsCodeParser::SymbolType::Function:
|
||||
case QAsCodeParser::SymbolType::FnDef:
|
||||
tip.type = CodeInfoTip::Type::Function;
|
||||
tip.addinfo.insert(CodeInfoTip::RetType,
|
||||
QString::fromUtf8(sym.type));
|
||||
tip.addinfo.insert(CodeInfoTip::Args,
|
||||
QString::fromUtf8(sym.additonalInfo));
|
||||
for (auto &var : sym.children) {
|
||||
CodeInfoTip va;
|
||||
va.dontAddGlobal = true;
|
||||
va.name = var.name;
|
||||
va.nameSpace = QString::fromUtf8(var.scope.join("::"));
|
||||
va.type = CodeInfoTip::Type::Variable;
|
||||
ret.append(va);
|
||||
}
|
||||
break;
|
||||
case QAsCodeParser::SymbolType::Enum:
|
||||
tip.type = CodeInfoTip::Type::Enum;
|
||||
|
@ -378,7 +387,6 @@ QList<CodeInfoTip> AsCompletion::parseDocument() {
|
|||
tip.type = CodeInfoTip::Type::Variable;
|
||||
break;
|
||||
case QAsCodeParser::SymbolType::Class:
|
||||
case QAsCodeParser::SymbolType::FnDef:
|
||||
case QAsCodeParser::SymbolType::Invalid:
|
||||
continue;
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -103,6 +103,14 @@ public:
|
|||
// so, a helper function?
|
||||
QList<Symbol> parseAndIntell(qsizetype offset, const QByteArray &codes);
|
||||
|
||||
public:
|
||||
// utilities
|
||||
static bool isConstant(int tokenType);
|
||||
static bool isOperator(int tokenType);
|
||||
static bool isPreOperator(int tokenType);
|
||||
static bool isPostOperator(int tokenType);
|
||||
static bool isAssignOperator(int tokenType);
|
||||
|
||||
private:
|
||||
QList<QAsCodeParser::CodeSegment> parseScript(bool inBlock);
|
||||
|
||||
|
@ -134,8 +142,6 @@ private:
|
|||
sToken parseDataType(bool allowVariableType = false,
|
||||
bool allowAuto = false);
|
||||
sToken parseOneOf(int *tokens, int count);
|
||||
sToken parseType(bool allowConst, bool allowVariableType = false,
|
||||
bool allowAuto = false);
|
||||
|
||||
void parseNamespace();
|
||||
|
||||
|
@ -156,49 +162,29 @@ private:
|
|||
bool isClassProp = false,
|
||||
bool isGlobalVar = false);
|
||||
|
||||
QByteArray parseType(bool allowConst, bool allowVariableType = false,
|
||||
bool allowAuto = false);
|
||||
|
||||
Symbol parseFuncDefContent(const QByteArrayList &ns,
|
||||
const QByteArray &code);
|
||||
|
||||
QList<Symbol> parseClassContent(const QByteArrayList &ns,
|
||||
const QByteArray &code);
|
||||
|
||||
QList<Symbol> parseStatementBlock(const QByteArrayList &ns,
|
||||
const QByteArray &code, qsizetype end);
|
||||
|
||||
private:
|
||||
void parseStatementBlock();
|
||||
void parseStatement();
|
||||
void parseClassContent();
|
||||
void parseMixinContent();
|
||||
void parseInterfaceContent();
|
||||
Symbol parseFuncDefContent();
|
||||
void ParseReturn();
|
||||
void ParseBreak();
|
||||
void ParseContinue();
|
||||
void ParseTryCatch();
|
||||
void ParseIf();
|
||||
void ParseLambda();
|
||||
CodeSegment parseFunction(bool isMethod);
|
||||
void ParseExpressionStatement();
|
||||
void ParseListPattern();
|
||||
|
||||
void ParseAssignment();
|
||||
void ParseAssignOperator();
|
||||
void ParseSwitch();
|
||||
void ParseCase();
|
||||
void ParseFor();
|
||||
void ParseWhile();
|
||||
void ParseDoWhile();
|
||||
void ParseCondition();
|
||||
void ParseExpression();
|
||||
void ParseExprTerm();
|
||||
void ParseExprOperator();
|
||||
void ParseExprPreOp();
|
||||
void ParseExprPostOp();
|
||||
void ParseExprValue();
|
||||
|
||||
Symbol parseVirtualPropertyDecl(bool isMethod, bool isInterface);
|
||||
QList<Symbol> parseParameterListContent();
|
||||
|
||||
// parse but not get symbols
|
||||
void ParseTypeMod(bool isParam);
|
||||
void ParseFunctionCall();
|
||||
void ParseInitList();
|
||||
void ParseCast();
|
||||
void ParseVariableAccess();
|
||||
void ParseConstructCall();
|
||||
void ParseConstant();
|
||||
void parseTypeMod(bool isParam);
|
||||
|
||||
private:
|
||||
void reset();
|
||||
|
@ -221,21 +207,12 @@ private:
|
|||
private:
|
||||
bool checkTemplateType(const sToken &t);
|
||||
|
||||
void parseArgList(bool withParenthesis = true);
|
||||
|
||||
private:
|
||||
bool findTokenAfterType(sToken &nextToken);
|
||||
bool findIdentifierAfterScope(sToken &nextToken);
|
||||
bool isConstant(int tokenType);
|
||||
bool isOperator(int tokenType);
|
||||
bool isPreOperator(int tokenType);
|
||||
bool isPostOperator(int tokenType);
|
||||
bool isAssignOperator(int tokenType);
|
||||
|
||||
bool typeExist(const QString &t);
|
||||
|
||||
Symbol parseFunctionDefinition();
|
||||
|
||||
Symbol parseInterfaceMethod();
|
||||
|
||||
void ParseStringConstant();
|
||||
|
@ -248,10 +225,7 @@ private:
|
|||
|
||||
asCScriptEngine *engine;
|
||||
|
||||
// size_t _curscope = 0;
|
||||
|
||||
QByteArray _code;
|
||||
QByteArray tempString; // Used for reduzing amount of dynamic allocations
|
||||
|
||||
sToken _lastToken;
|
||||
size_t _sourcePos;
|
||||
|
|
Loading…
Reference in New Issue