| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/qml/parser/qqmljs.g |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||
|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||
| 2 | - | |||||||
| 3 | - | |||||||
| 4 | - | |||||||
| 5 | namespace QQmlJS { | - | ||||||
| 6 | - | |||||||
| 7 | class Engine; | - | ||||||
| 8 | - | |||||||
| 9 | class __attribute__((visibility("default"))) Parser: protected QQmlJSGrammar | - | ||||||
| 10 | { | - | ||||||
| 11 | public: | - | ||||||
| 12 | union Value { | - | ||||||
| 13 | int ival; | - | ||||||
| 14 | double dval; | - | ||||||
| 15 | AST::VariableScope scope; | - | ||||||
| 16 | AST::ForEachType forEachType; | - | ||||||
| 17 | AST::ArgumentList *ArgumentList; | - | ||||||
| 18 | AST::CaseBlock *CaseBlock; | - | ||||||
| 19 | AST::CaseClause *CaseClause; | - | ||||||
| 20 | AST::CaseClauses *CaseClauses; | - | ||||||
| 21 | AST::Catch *Catch; | - | ||||||
| 22 | AST::DefaultClause *DefaultClause; | - | ||||||
| 23 | AST::Elision *Elision; | - | ||||||
| 24 | AST::ExpressionNode *Expression; | - | ||||||
| 25 | AST::TemplateLiteral *Template; | - | ||||||
| 26 | AST::Finally *Finally; | - | ||||||
| 27 | AST::FormalParameterList *FormalParameterList; | - | ||||||
| 28 | AST::FunctionDeclaration *FunctionDeclaration; | - | ||||||
| 29 | AST::Node *Node; | - | ||||||
| 30 | AST::PropertyName *PropertyName; | - | ||||||
| 31 | AST::Statement *Statement; | - | ||||||
| 32 | AST::StatementList *StatementList; | - | ||||||
| 33 | AST::Block *Block; | - | ||||||
| 34 | AST::VariableDeclarationList *VariableDeclarationList; | - | ||||||
| 35 | AST::Pattern *Pattern; | - | ||||||
| 36 | AST::PatternElement *PatternElement; | - | ||||||
| 37 | AST::PatternElementList *PatternElementList; | - | ||||||
| 38 | AST::PatternProperty *PatternProperty; | - | ||||||
| 39 | AST::PatternPropertyList *PatternPropertyList; | - | ||||||
| 40 | AST::ClassElementList *ClassElementList; | - | ||||||
| 41 | - | |||||||
| 42 | AST::UiProgram *UiProgram; | - | ||||||
| 43 | AST::UiHeaderItemList *UiHeaderItemList; | - | ||||||
| 44 | AST::UiPragma *UiPragma; | - | ||||||
| 45 | AST::UiImport *UiImport; | - | ||||||
| 46 | AST::UiParameterList *UiParameterList; | - | ||||||
| 47 | AST::UiPublicMember *UiPublicMember; | - | ||||||
| 48 | AST::UiObjectDefinition *UiObjectDefinition; | - | ||||||
| 49 | AST::UiObjectInitializer *UiObjectInitializer; | - | ||||||
| 50 | AST::UiObjectBinding *UiObjectBinding; | - | ||||||
| 51 | AST::UiScriptBinding *UiScriptBinding; | - | ||||||
| 52 | AST::UiArrayBinding *UiArrayBinding; | - | ||||||
| 53 | AST::UiObjectMember *UiObjectMember; | - | ||||||
| 54 | AST::UiObjectMemberList *UiObjectMemberList; | - | ||||||
| 55 | AST::UiArrayMemberList *UiArrayMemberList; | - | ||||||
| 56 | AST::UiQualifiedId *UiQualifiedId; | - | ||||||
| 57 | AST::UiQualifiedPragmaId *UiQualifiedPragmaId; | - | ||||||
| 58 | AST::UiEnumMemberList *UiEnumMemberList; | - | ||||||
| 59 | }; | - | ||||||
| 60 | - | |||||||
| 61 | public: | - | ||||||
| 62 | Parser(Engine *engine); | - | ||||||
| 63 | ~Parser(); | - | ||||||
| 64 | - | |||||||
| 65 | - | |||||||
| 66 | bool parse() { ++functionNestingLevel; bool r = parse(T_FEED_UI_PROGRAM); --functionNestingLevel; return never executed: r;return r;never executed: }return r; | 0 | ||||||
| 67 | bool parseStatement() { return never executed: parse(T_FEED_JS_STATEMENT);return parse(T_FEED_JS_STATEMENT);never executed: }return parse(T_FEED_JS_STATEMENT); | 0 | ||||||
| 68 | bool parseExpression() { return executed 985 times by 2 tests: parse(T_FEED_JS_EXPRESSION);return parse(T_FEED_JS_EXPRESSION);Executed by:
executed 985 times by 2 tests: }return parse(T_FEED_JS_EXPRESSION);Executed by:
| 985 | ||||||
| 69 | bool parseUiObjectMember() { ++functionNestingLevel; bool r = parse(T_FEED_UI_OBJECT_MEMBER); --functionNestingLevel; return never executed: r;return r;never executed: }return r; | 0 | ||||||
| 70 | bool parseProgram() { return executed 2818020 times by 40 tests: parse(T_FEED_JS_SCRIPT);return parse(T_FEED_JS_SCRIPT);Executed by:
executed 2818020 times by 40 tests: }return parse(T_FEED_JS_SCRIPT);Executed by:
| 2818020 | ||||||
| 71 | bool parseScript() { return never executed: parse(T_FEED_JS_SCRIPT);return parse(T_FEED_JS_SCRIPT);never executed: }return parse(T_FEED_JS_SCRIPT); | 0 | ||||||
| 72 | bool parseModule() { return never executed: parse(T_FEED_JS_MODULE);return parse(T_FEED_JS_MODULE);never executed: }return parse(T_FEED_JS_MODULE); | 0 | ||||||
| 73 | - | |||||||
| 74 | AST::UiProgram *ast() const | - | ||||||
| 75 | { return never executed: AST::cast<AST::UiProgram *>(program);return AST::cast<AST::UiProgram *>(program);never executed: }return AST::cast<AST::UiProgram *>(program); | 0 | ||||||
| 76 | - | |||||||
| 77 | AST::Statement *statement() const | - | ||||||
| 78 | { | - | ||||||
| 79 | if (! program
| 0 | ||||||
| 80 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||
| 81 | - | |||||||
| 82 | return never executed: program->statementCast();return program->statementCast();never executed: return program->statementCast(); | 0 | ||||||
| 83 | } | - | ||||||
| 84 | - | |||||||
| 85 | AST::ExpressionNode *expression() const | - | ||||||
| 86 | { | - | ||||||
| 87 | if (! program
| 0 | ||||||
| 88 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||
| 89 | - | |||||||
| 90 | return never executed: program->expressionCast();return program->expressionCast();never executed: return program->expressionCast(); | 0 | ||||||
| 91 | } | - | ||||||
| 92 | - | |||||||
| 93 | AST::UiObjectMember *uiObjectMember() const | - | ||||||
| 94 | { | - | ||||||
| 95 | if (! program
| 0 | ||||||
| 96 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||
| 97 | - | |||||||
| 98 | return never executed: program->uiObjectMemberCast();return program->uiObjectMemberCast();never executed: return program->uiObjectMemberCast(); | 0 | ||||||
| 99 | } | - | ||||||
| 100 | - | |||||||
| 101 | AST::Node *rootNode() const | - | ||||||
| 102 | { return executed 2813969 times by 40 tests: program;return program;Executed by:
executed 2813969 times by 40 tests: }return program;Executed by:
| 2813969 | ||||||
| 103 | - | |||||||
| 104 | QList<DiagnosticMessage> diagnosticMessages() const | - | ||||||
| 105 | { return executed 2816740 times by 40 tests: diagnostic_messages;return diagnostic_messages;Executed by:
executed 2816740 times by 40 tests: }return diagnostic_messages;Executed by:
| 2816740 | ||||||
| 106 | - | |||||||
| 107 | inline DiagnosticMessage diagnosticMessage() const | - | ||||||
| 108 | { | - | ||||||
| 109 | for (const DiagnosticMessage &d : diagnostic_messages) { | - | ||||||
| 110 | if (d.kind != DiagnosticMessage::Warning
| 0 | ||||||
| 111 | return never executed: d;return d;never executed: return d; | 0 | ||||||
| 112 | } never executed: end of block | 0 | ||||||
| 113 | - | |||||||
| 114 | return never executed: DiagnosticMessage();return DiagnosticMessage();never executed: return DiagnosticMessage(); | 0 | ||||||
| 115 | } | - | ||||||
| 116 | - | |||||||
| 117 | inline QString errorMessage() const | - | ||||||
| 118 | { return never executed: diagnosticMessage().message;return diagnosticMessage().message;never executed: }return diagnosticMessage().message; | 0 | ||||||
| 119 | - | |||||||
| 120 | inline int errorLineNumber() const | - | ||||||
| 121 | { return never executed: diagnosticMessage().loc.startLine;return diagnosticMessage().loc.startLine;never executed: }return diagnosticMessage().loc.startLine; | 0 | ||||||
| 122 | - | |||||||
| 123 | inline int errorColumnNumber() const | - | ||||||
| 124 | { return never executed: diagnosticMessage().loc.startColumn;return diagnosticMessage().loc.startColumn;never executed: }return diagnosticMessage().loc.startColumn; | 0 | ||||||
| 125 | - | |||||||
| 126 | protected: | - | ||||||
| 127 | bool parse(int startToken); | - | ||||||
| 128 | - | |||||||
| 129 | void reallocateStack(); | - | ||||||
| 130 | - | |||||||
| 131 | inline Value &sym(int index) | - | ||||||
| 132 | { return executed 297713653 times by 147 tests: sym_stack [tos + index - 1];return sym_stack [tos + index - 1];Executed by:
executed 297713653 times by 147 tests: }return sym_stack [tos + index - 1];Executed by:
| 297713653 | ||||||
| 133 | - | |||||||
| 134 | inline QStringRef &stringRef(int index) | - | ||||||
| 135 | { return executed 103079572 times by 147 tests: string_stack [tos + index - 1];return string_stack [tos + index - 1];Executed by:
executed 103079572 times by 147 tests: }return string_stack [tos + index - 1];Executed by:
| 103079572 | ||||||
| 136 | - | |||||||
| 137 | inline AST::SourceLocation &loc(int index) | - | ||||||
| 138 | { return executed 153093373 times by 147 tests: location_stack [tos + index - 1];return location_stack [tos + index - 1];Executed by:
executed 153093373 times by 147 tests: }return location_stack [tos + index - 1];Executed by:
| 153093373 | ||||||
| 139 | - | |||||||
| 140 | AST::UiQualifiedId *reparseAsQualifiedId(AST::ExpressionNode *expr); | - | ||||||
| 141 | AST::UiQualifiedPragmaId *reparseAsQualifiedPragmaId(AST::ExpressionNode *expr); | - | ||||||
| 142 | - | |||||||
| 143 | void pushToken(int token); | - | ||||||
| 144 | int lookaheadToken(Lexer *lexer); | - | ||||||
| 145 | - | |||||||
| 146 | void syntaxError(const AST::SourceLocation &location, const char *message) { | - | ||||||
| 147 | diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, location, QLatin1String(message))); | - | ||||||
| 148 | } executed 272 times by 3 tests: end of blockExecuted by:
| 272 | ||||||
| 149 | void syntaxError(const AST::SourceLocation &location, const QString &message) { | - | ||||||
| 150 | diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, location, message)); | - | ||||||
| 151 | } executed 158 times by 2 tests: end of blockExecuted by:
| 158 | ||||||
| 152 | - | |||||||
| 153 | protected: | - | ||||||
| 154 | Engine *driver; | - | ||||||
| 155 | MemoryPool *pool; | - | ||||||
| 156 | int tos = 0; | - | ||||||
| 157 | int stack_size = 0; | - | ||||||
| 158 | Value *sym_stack = nullptr; | - | ||||||
| 159 | int *state_stack = nullptr; | - | ||||||
| 160 | AST::SourceLocation *location_stack = nullptr; | - | ||||||
| 161 | QVector<QStringRef> string_stack; | - | ||||||
| 162 | - | |||||||
| 163 | AST::Node *program = nullptr; | - | ||||||
| 164 | - | |||||||
| 165 | - | |||||||
| 166 | enum { TOKEN_BUFFER_SIZE = 5 }; | - | ||||||
| 167 | - | |||||||
| 168 | struct SavedToken { | - | ||||||
| 169 | int token; | - | ||||||
| 170 | double dval; | - | ||||||
| 171 | AST::SourceLocation loc; | - | ||||||
| 172 | QStringRef spell; | - | ||||||
| 173 | }; | - | ||||||
| 174 | - | |||||||
| 175 | int yytoken = -1; | - | ||||||
| 176 | double yylval = 0.; | - | ||||||
| 177 | QStringRef yytokenspell; | - | ||||||
| 178 | AST::SourceLocation yylloc; | - | ||||||
| 179 | AST::SourceLocation yyprevlloc; | - | ||||||
| 180 | - | |||||||
| 181 | SavedToken token_buffer[TOKEN_BUFFER_SIZE]; | - | ||||||
| 182 | SavedToken *first_token = nullptr; | - | ||||||
| 183 | SavedToken *last_token = nullptr; | - | ||||||
| 184 | - | |||||||
| 185 | int functionNestingLevel = 0; | - | ||||||
| 186 | - | |||||||
| 187 | enum CoverExpressionType { | - | ||||||
| 188 | CE_Invalid, | - | ||||||
| 189 | CE_ParenthesizedExpression, | - | ||||||
| 190 | CE_FormalParameterList | - | ||||||
| 191 | }; | - | ||||||
| 192 | AST::SourceLocation coverExpressionErrorLocation; | - | ||||||
| 193 | CoverExpressionType coverExpressionType = CE_Invalid; | - | ||||||
| 194 | - | |||||||
| 195 | QList<DiagnosticMessage> diagnostic_messages; | - | ||||||
| 196 | }; | - | ||||||
| 197 | - | |||||||
| 198 | } | - | ||||||
| 199 | - | |||||||
| 200 | - | |||||||
| Switch to Source code | Preprocessed file |