mirror of
https://github.com/wren-lang/wren.git
synced 2026-01-11 22:28:45 +01:00
crunched BOM skipping
This commit is contained in:
@ -3417,26 +3417,25 @@ ObjFn* wrenCompile(WrenVM* vm, ObjModule* module, const char* source,
|
||||
bool isExpression, bool printErrors)
|
||||
{
|
||||
// Skip potential UTF-8 BOM
|
||||
size_t sourceOffset = 0;
|
||||
if (source[0] == (char) 0xef && source[1] == (char) 0xbb && source[2] == (char) 0xbf)
|
||||
if (strncmp(source, "\xEF\xBB\xBF", 3) == 0)
|
||||
{
|
||||
sourceOffset = 3;
|
||||
source += 3;
|
||||
}
|
||||
|
||||
Parser parser;
|
||||
parser.vm = vm;
|
||||
parser.module = module;
|
||||
parser.source = source + sourceOffset;
|
||||
parser.source = source;
|
||||
|
||||
parser.tokenStart = source + sourceOffset;
|
||||
parser.currentChar = source + sourceOffset;
|
||||
parser.tokenStart = source;
|
||||
parser.currentChar = source;
|
||||
parser.currentLine = 1;
|
||||
parser.numParens = 0;
|
||||
|
||||
// Zero-init the current token. This will get copied to previous when
|
||||
// advance() is called below.
|
||||
parser.current.type = TOKEN_ERROR;
|
||||
parser.current.start = source + sourceOffset;
|
||||
parser.current.start = source;
|
||||
parser.current.length = 0;
|
||||
parser.current.line = 0;
|
||||
parser.current.value = UNDEFINED_VAL;
|
||||
|
||||
Reference in New Issue
Block a user