Skip to content

Commit

Permalink
synchronized with internal version 03.07.2021
Browse files Browse the repository at this point in the history
implemented support of:
  * import parser,
  * string interpolation,
  * operator 'not in'
  * operator := (assignment inside an expression)

9 new warnings:

    278, "forbidden-function",
    "It is forbidden to call '%s' function."

    279, "mismatch-loop-variable",
    "The variable used in for-loop does not match the initialized one."

    280, "forbidden-parent-dir",
    "Access to the parent directory is forbidden in this function."

    281, "unwanted-modification",
    "Function '%s' modifies object. You probably didn't want to modify the object here."

    282, "inexpr-assign-priority",
    "Operator ':=' has lower priority. Perhaps parentheses are missing?"

    283, "useless-null-coalescing",
    "The expression to the right of the '??""' is null."

    284, "can-be-simplified",
    "Expression can be simplified."

    285, "expr-cannot-be-null",
    "The expression to the left of the '%s' cannot be null."

    286, "func-in-expression",
    "Function used in expression."
  • Loading branch information
a.borisov committed Jul 3, 2021
1 parent 9d5fab5 commit 9a28a62
Show file tree
Hide file tree
Showing 57 changed files with 1,571 additions and 158 deletions.
37 changes: 37 additions & 0 deletions compilation_context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,42 @@ AnalyzerMessage analyzer_messages[] =
277, "space-at-eol",
"Whitespace at the end of line."
},
{
278, "forbidden-function",
"It is forbidden to call '%s' function."
},
{
279, "mismatch-loop-variable",
"The variable used in for-loop does not match the initialized one."
},
{
280, "forbidden-parent-dir",
"Access to the parent directory is forbidden in this function."
},
{
281, "unwanted-modification",
"Function '%s' modifies object. You probably didn't want to modify the object here."
},
{
282, "inexpr-assign-priority",
"Operator ':=' has lower priority. Perhaps parentheses are missing?"
},
{
283, "useless-null-coalescing",
"The expression to the right of the '??""' is null."
},
{
284, "can-be-simplified",
"Expression can be simplified."
},
{
285, "expr-cannot-be-null",
"The expression to the left of the '%s' cannot be null."
},
{
286, "func-in-expression",
"Function used in expression."
},
};


Expand All @@ -353,6 +389,7 @@ CompilationContext::CompilationContext()
isError = false;
isWarning = false;
outputMode = OM_FULL;
firstLineAfterImport = 0;
}


Expand Down
3 changes: 3 additions & 0 deletions compilation_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <string>
#include <vector>
#include <stdio.h>
#include "quirrel/importParser/importParser.h"

bool is_utf8_bom(const char * ptr, int i);

Expand Down Expand Up @@ -69,11 +70,13 @@ class CompilationContext
std::string fileDir;
std::string code;
std::vector<int> shownWarningsAndErrors;
std::vector<sqimportparser::ModuleImport> imports;
static std::vector<CompilerMessage> compilerMessages;
static const char * redirectMessagesToJson;
static void setErrorLevel(int error_level);
static int getErrorLevel();
static void clearErrorLevel();
int firstLineAfterImport;
bool isError;
bool isWarning;
OutputMode outputMode;
Expand Down
3 changes: 3 additions & 0 deletions json_output.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ bool get_tokens_as_string(Lexer & lexer, string & s)
s += buf;
s += "}";
first = false;

if (tok.type == TK_EOF)
break;
}

s += "]";
Expand Down
Loading

0 comments on commit 9a28a62

Please sign in to comment.