Merge branch 'msvc-project-and-compatibility' of git://github.com/MarcoLizza/wren into MarcoLizza-msvc-project-and-compatibility
This commit is contained in:
+12
-1
@@ -29,7 +29,12 @@
|
||||
//
|
||||
// Defaults to on.
|
||||
#ifndef WREN_COMPUTED_GOTO
|
||||
#define WREN_COMPUTED_GOTO 1
|
||||
#ifdef _MSC_VER
|
||||
// No computed gotos in Visual Studio.
|
||||
#define WREN_COMPUTED_GOTO 0
|
||||
#else
|
||||
#define WREN_COMPUTED_GOTO 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// If true, loads the "IO" class in the standard library.
|
||||
@@ -127,4 +132,10 @@
|
||||
|
||||
#endif
|
||||
|
||||
// The Microsoft compiler does not sport the "inline" modifier when
|
||||
// compiling in plain-C
|
||||
#if defined( _MSC_VER ) && !defined(__cplusplus)
|
||||
#define inline _inline
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
+17
-5
@@ -594,7 +594,7 @@ static void readUnicodeEscape(Parser* parser)
|
||||
break;
|
||||
}
|
||||
|
||||
char digit = readHexDigit(parser);
|
||||
int digit = readHexDigit(parser);
|
||||
if (digit == -1)
|
||||
{
|
||||
lexError(parser, "Invalid Unicode escape sequence.");
|
||||
@@ -2576,7 +2576,10 @@ void statement(Compiler* compiler)
|
||||
return;
|
||||
}
|
||||
|
||||
if (match(compiler, TOKEN_FOR)) return forStatement(compiler);
|
||||
if (match(compiler, TOKEN_FOR)) {
|
||||
forStatement(compiler);
|
||||
return;
|
||||
}
|
||||
|
||||
if (match(compiler, TOKEN_IF))
|
||||
{
|
||||
@@ -2629,7 +2632,10 @@ void statement(Compiler* compiler)
|
||||
return;
|
||||
}
|
||||
|
||||
if (match(compiler, TOKEN_WHILE)) return whileStatement(compiler);
|
||||
if (match(compiler, TOKEN_WHILE)) {
|
||||
whileStatement(compiler);
|
||||
return;
|
||||
}
|
||||
|
||||
// Expression statement.
|
||||
expression(compiler);
|
||||
@@ -2798,8 +2804,14 @@ static void variableDefinition(Compiler* compiler)
|
||||
// like the non-curly body of an if or while.
|
||||
void definition(Compiler* compiler)
|
||||
{
|
||||
if (match(compiler, TOKEN_CLASS)) return classDefinition(compiler);
|
||||
if (match(compiler, TOKEN_VAR)) return variableDefinition(compiler);
|
||||
if (match(compiler, TOKEN_CLASS)) {
|
||||
classDefinition(compiler);
|
||||
return;
|
||||
}
|
||||
if (match(compiler, TOKEN_VAR)) {
|
||||
variableDefinition(compiler);
|
||||
return;
|
||||
}
|
||||
|
||||
block(compiler);
|
||||
}
|
||||
|
||||
+3
-3
@@ -112,7 +112,7 @@ typedef struct
|
||||
Obj obj;
|
||||
// Does not include the null terminator.
|
||||
int length;
|
||||
char value[];
|
||||
char value[0];
|
||||
} ObjString;
|
||||
|
||||
// The dynamically allocated data structure for a variable that has been used
|
||||
@@ -260,7 +260,7 @@ typedef struct
|
||||
ObjFn* fn;
|
||||
|
||||
// The upvalues this function has closed over.
|
||||
Upvalue* upvalues[];
|
||||
Upvalue* upvalues[0];
|
||||
} ObjClosure;
|
||||
|
||||
typedef enum
|
||||
@@ -323,7 +323,7 @@ struct sObjClass
|
||||
typedef struct
|
||||
{
|
||||
Obj obj;
|
||||
Value fields[];
|
||||
Value fields[0];
|
||||
} ObjInstance;
|
||||
|
||||
typedef struct
|
||||
|
||||
Reference in New Issue
Block a user