diff --git a/compiler.c b/compiler.c index 1d15a56..956ad8c 100644 --- a/compiler.c +++ b/compiler.c @@ -581,9 +581,19 @@ static void unary(int canAssign) { } static void string(int canAssign) { + /* TODO: needs to handle escape sequences */ emitConstant(OBJECT_VAL(copyString(parser.previous.start + 1, parser.previous.length - 2))); } +/* TODO +static void codepoint(int canAssign) { + // Convert utf8 bytes to single codepoint; error on multiple codepoints. + // Emit as constant Integer value? Or as separate Codepoint value? + // The latter could add to strings as utf8 bytes, but compare to + // Integers as the numerical value... +} +*/ + #define EMIT_CONSTANT_OP(opc, arg) do { if (arg < 256) { emitBytes(opc, arg); } \ else { emitBytes(opc ## _LONG, arg >> 16); emitBytes(arg >> 8, arg); } } while (0) @@ -637,7 +647,7 @@ ParseRule rules[] = { [TOKEN_IDENTIFIER] = {variable, NULL, PREC_NONE}, [TOKEN_STRING] = {string, NULL, PREC_NONE}, [TOKEN_NUMBER] = {number, NULL, PREC_NONE}, - [TOKEN_CODEPOINT] = {NULL, NULL, PREC_NONE}, /* should be equivalent to number */ + [TOKEN_CODEPOINT] = {NULL, NULL, PREC_NONE}, /* TODO */ [TOKEN_AND] = {NULL, and_, PREC_AND}, [TOKEN_CLASS] = {NULL, NULL, PREC_NONE}, [TOKEN_ELSE] = {NULL, NULL, PREC_NONE}, diff --git a/scanner.c b/scanner.c index 13d16a0..00e5ebf 100644 --- a/scanner.c +++ b/scanner.c @@ -176,7 +176,6 @@ static KrkTokenType identifierType() { switch (*scanner.start) { case 'a': return checkKeyword(1, "nd", TOKEN_AND); case 'c': return checkKeyword(1, "lass", TOKEN_CLASS); - case 'b': return checkKeyword(1, "lock", TOKEN_BLOCK); case 'd': return checkKeyword(1, "ef", TOKEN_DEF); case 'e': return checkKeyword(1, "lse", TOKEN_ELSE); case 'f': return checkKeyword(1, "or", TOKEN_FOR); diff --git a/scanner.h b/scanner.h index 9f5b647..039e33e 100644 --- a/scanner.h +++ b/scanner.h @@ -36,7 +36,6 @@ typedef enum { TOKEN_INDENTATION, - TOKEN_BLOCK, /* temporary XXX remove me */ TOKEN_RETRY, TOKEN_EOL,