Commit 57f7466b authored by Chris Müller's avatar Chris Müller
Browse files

fix last crystal artifacts and add if statements

parent 949912ab
...@@ -12,7 +12,6 @@ set(CHERRY_VERSION 0.1) ...@@ -12,7 +12,6 @@ set(CHERRY_VERSION 0.1)
include_directories(crystal/include) include_directories(crystal/include)
include_directories(include) include_directories(include)
add_subdirectory(crystal)
add_subdirectory(source) add_subdirectory(source)
add_subdirectory(test) add_subdirectory(test)
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
#pragma once #pragma once
#include "cherry/runtime.h" #include "cherry/runtime.h"
#include <crystal/standard.h> #include "cherry/standard.h"
#include <stdlib.h> #include <stdlib.h>
#include <stdint.h> #include <stdint.h>
...@@ -30,15 +30,15 @@ struct org_cherry_array; ...@@ -30,15 +30,15 @@ struct org_cherry_array;
struct org_cherry_context { struct org_cherry_context {
const char* filename; const char* filename;
const byte_t* begin; const cy_byte_t* begin;
const byte_t* src; const cy_byte_t* src;
struct org_cherry_array* buffer; struct org_cherry_array* buffer;
cy_flags_t flags; cy_flags_t flags;
}; };
struct org_cherry_context* org_cherry_context(const byte_t* source, const char* filename, cy_flags_t flags); struct org_cherry_context* org_cherry_context(const cy_byte_t* source, const char* filename, cy_flags_t flags);
struct org_cherry_context* org_cherry_context_repl(const byte_t* source); struct org_cherry_context* org_cherry_context_repl(const cy_byte_t* source);
void org_cherry_error(struct org_cherry_context* context, const char* format, ...); void org_cherry_error(struct org_cherry_context* context, const char* format, ...);
...@@ -64,13 +64,13 @@ enum org_cherry_tok { ...@@ -64,13 +64,13 @@ enum org_cherry_tok {
}; };
const byte_t* org_cherry_tok_to_string(enum org_cherry_tok token); const cy_byte_t* org_cherry_tok_to_string(enum org_cherry_tok token);
enum org_cherry_tok org_cherry_lex(struct org_cherry_context* context); enum org_cherry_tok org_cherry_lex(struct org_cherry_context* context);
const byte_t* org_cherry_pos(struct org_cherry_context* context); const cy_byte_t* org_cherry_pos(struct org_cherry_context* context);
void org_cherry_rewind(struct org_cherry_context* context, const byte_t* pos); void org_cherry_rewind(struct org_cherry_context* context, const cy_byte_t* pos);
const byte_t* org_cherry_token_string(struct org_cherry_context* context); const cy_byte_t* org_cherry_token_string(struct org_cherry_context* context);
size_t org_cherry_token_length(struct org_cherry_context* context); size_t org_cherry_token_length(struct org_cherry_context* context);
struct org_cherry_value* org_cherry_read(struct org_cherry_context* context); struct org_cherry_value* org_cherry_read(struct org_cherry_context* context);
...@@ -139,8 +139,6 @@ extern struct org_cherry_value* org_cherry_symbol_quote; ...@@ -139,8 +139,6 @@ extern struct org_cherry_value* org_cherry_symbol_quote;
extern struct org_cherry_value* org_cherry_symbol_define; extern struct org_cherry_value* org_cherry_symbol_define;
extern struct org_cherry_value* org_cherry_symbol_lambda; extern struct org_cherry_value* org_cherry_symbol_lambda;
extern struct org_cherry_value* org_cherry_symbol_if; extern struct org_cherry_value* org_cherry_symbol_if;
extern struct org_cherry_value* org_cherry_symbol_cond;
extern struct org_cherry_value* org_cherry_symbol_else;
...@@ -148,6 +146,10 @@ extern struct org_cherry_value* org_cherry_symbol_else; ...@@ -148,6 +146,10 @@ extern struct org_cherry_value* org_cherry_symbol_else;
// Evaluation // Evaluation
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
#define IS_FALSE(obj) (IS_BOOLEAN(obj) && !obj->boolean_value)
#define IS_TRUE(obj) (!IS_FALSE(obj))
#define IS_SELF_EVALUATING(value) \ #define IS_SELF_EVALUATING(value) \
(IS_BOOLEAN(value) || IS_FIXNUM(value) || IS_CHAR(value) || IS_STRING(value) || IS_FLOAT(value)) (IS_BOOLEAN(value) || IS_FIXNUM(value) || IS_CHAR(value) || IS_STRING(value) || IS_FLOAT(value))
...@@ -166,12 +168,6 @@ extern struct org_cherry_value* org_cherry_symbol_else; ...@@ -166,12 +168,6 @@ extern struct org_cherry_value* org_cherry_symbol_else;
#define IS_IF(value) \ #define IS_IF(value) \
IS_TAGGED(value, org_cherry_symbol_if) IS_TAGGED(value, org_cherry_symbol_if)
#define IS_COND(value) \
IS_TAGGED(value, org_cherry_symbol_cond)
#define IS_ELSE(value) \
IS_TAGGED(value, org_cherry_symbol_else)
#define IS_LAMBDA(value) \ #define IS_LAMBDA(value) \
IS_TAGGED(value, org_cherry_symbol_lambda) IS_TAGGED(value, org_cherry_symbol_lambda)
......
...@@ -12,7 +12,7 @@ int main(int argc, char** argv) ...@@ -12,7 +12,7 @@ int main(int argc, char** argv)
struct org_cherry_symbollist* env = org_cherry_symbollist(); struct org_cherry_symbollist* env = org_cherry_symbollist();
while(1) { while(1) {
byte_t* line = (byte_t*) readline("> "); cy_byte_t* line = (cy_byte_t*) readline("> ");
struct org_cherry_context* context = org_cherry_context_repl(line); struct org_cherry_context* context = org_cherry_context_repl(line);
struct org_cherry_value* exp = org_cherry_read(context); struct org_cherry_value* exp = org_cherry_read(context);
......
...@@ -102,19 +102,38 @@ org_cherry_apply(struct org_cherry_value* operator, struct org_cherry_value* ope ...@@ -102,19 +102,38 @@ org_cherry_apply(struct org_cherry_value* operator, struct org_cherry_value* ope
} }
static struct org_cherry_value*
org_cherry_eval_if(struct org_cherry_symbollist* env, struct org_cherry_value* value)
{
if(IS_NULL(value))
return org_cherry_false;
if(IS_TRUE(org_cherry_eval(env, HEAD(value))))
return !IS_NULL(TAIL(value)) ? org_cherry_eval(env, HEAD(TAIL(value))) : org_cherry_false;
else if(!IS_NULL(TAIL(TAIL(value))))
return org_cherry_eval(env, HEAD(TAIL(TAIL(value))));
else
return org_cherry_false;
}
struct org_cherry_value* struct org_cherry_value*
org_cherry_eval(struct org_cherry_symbollist* env, struct org_cherry_value* value) org_cherry_eval(struct org_cherry_symbollist* env, struct org_cherry_value* value)
{ {
if(IS_SELF_EVALUATING(value)) if(IS_SELF_EVALUATING(value))
return value; return value;
else if(IS_VARIABLE(value)) else if(IS_VARIABLE(value)) {
return org_cherry_env_lookup(env, value); if(org_cherry_env_lookup(env, value))
else if(IS_QUOTE(value)) return org_cherry_true;
else
return org_cherry_false;
} else if(IS_QUOTE(value))
return TEXT_OF_QUOTATION(value); return TEXT_OF_QUOTATION(value);
else if(IS_DEFINE(value)) else if(IS_DEFINE(value))
return org_cherry_eval_define(env, value); return org_cherry_eval_define(env, value);
else if(IS_LAMBDA(value)) else if(IS_LAMBDA(value))
return org_cherry_procedure(env, HEAD(TAIL(value)), TAIL(TAIL(value))); return org_cherry_procedure(env, HEAD(TAIL(value)), TAIL(TAIL(value)));
else if(IS_IF(value))
return org_cherry_eval_if(env, TAIL(value));
else if(IS_APPLICATION(value)) else if(IS_APPLICATION(value))
return org_cherry_apply(org_cherry_eval(env, HEAD(value)), org_cherry_eval_values(env, TAIL(value))); return org_cherry_apply(org_cherry_eval(env, HEAD(value)), org_cherry_eval_values(env, TAIL(value)));
......
...@@ -27,13 +27,13 @@ ...@@ -27,13 +27,13 @@
#include <gc.h> #include <gc.h>
struct org_cherry_context* struct org_cherry_context*
org_cherry_context(const byte_t* source, const char* filename, cy_flags_t flags) org_cherry_context(const cy_byte_t* source, const char* filename, cy_flags_t flags)
{ {
struct org_cherry_context* context = GC_MALLOC(sizeof(struct org_cherry_context)); struct org_cherry_context* context = GC_MALLOC(sizeof(struct org_cherry_context));
context->filename = filename; context->filename = filename;
context->begin = source; context->begin = source;
context->src = (byte_t*) source; context->src = (cy_byte_t*) source;
context->buffer = org_cherry_array_new(sizeof(byte_t)); context->buffer = org_cherry_array_new(sizeof(cy_byte_t));
context->flags = flags; context->flags = flags;
return context; return context;
...@@ -41,7 +41,7 @@ org_cherry_context(const byte_t* source, const char* filename, cy_flags_t flags) ...@@ -41,7 +41,7 @@ org_cherry_context(const byte_t* source, const char* filename, cy_flags_t flags)
struct org_cherry_context* struct org_cherry_context*
org_cherry_context_repl(const byte_t* source) org_cherry_context_repl(const cy_byte_t* source)
{ {
return org_cherry_context(source, 0, CY_SUPRESS_COMMENTS); return org_cherry_context(source, 0, CY_SUPRESS_COMMENTS);
} }
...@@ -67,13 +67,13 @@ org_cherry_error(struct org_cherry_context* context, const char* format, ...) ...@@ -67,13 +67,13 @@ org_cherry_error(struct org_cherry_context* context, const char* format, ...)
struct Mapping { struct Mapping {
byte_t* string; cy_byte_t* string;
enum org_cherry_tok value; enum org_cherry_tok value;
}; };
const byte_t* const cy_byte_t*
org_cherry_tok_to_string(enum org_cherry_tok token) org_cherry_tok_to_string(enum org_cherry_tok token)
{ {
switch(token) { switch(token) {
...@@ -127,8 +127,8 @@ static enum org_cherry_tok ...@@ -127,8 +127,8 @@ static enum org_cherry_tok
lex_float(struct org_cherry_context* context) lex_float(struct org_cherry_context* context)
{ {
struct org_cherry_array* buffer = context->buffer; struct org_cherry_array* buffer = context->buffer;
const byte_t* p = context->src; const cy_byte_t* p = context->src;
unicode_t ch = org_cherry_utf8_get(p); cy_unicode_t ch = org_cherry_utf8_get(p);
enum FloatState state = FP_START; enum FloatState state = FP_START;
...@@ -219,8 +219,8 @@ static enum org_cherry_tok ...@@ -219,8 +219,8 @@ static enum org_cherry_tok
lex_number(struct org_cherry_context* context) lex_number(struct org_cherry_context* context)
{ {
struct org_cherry_array* buffer = context->buffer; struct org_cherry_array* buffer = context->buffer;
const byte_t* p = context->src; const cy_byte_t* p = context->src;
unicode_t ch = org_cherry_utf8_get(p); cy_unicode_t ch = org_cherry_utf8_get(p);
enum org_cherry_tok token = TOK_DEC; enum org_cherry_tok token = TOK_DEC;
enum NumberState state = INT_START; enum NumberState state = INT_START;
...@@ -329,8 +329,8 @@ lex_character(struct org_cherry_context* context) ...@@ -329,8 +329,8 @@ lex_character(struct org_cherry_context* context)
assert(context != 0); assert(context != 0);
struct org_cherry_array* buffer = context->buffer; struct org_cherry_array* buffer = context->buffer;
byte_t* p = org_cherry_utf8_next(context->src); cy_byte_t* p = org_cherry_utf8_next(context->src);
unicode_t ch = org_cherry_utf8_get(p); cy_unicode_t ch = org_cherry_utf8_get(p);
enum CharState state = CHAR_EAT; enum CharState state = CHAR_EAT;
int unicount = 0; int unicount = 0;
...@@ -405,8 +405,8 @@ lex_string(struct org_cherry_context* context) ...@@ -405,8 +405,8 @@ lex_string(struct org_cherry_context* context)
struct org_cherry_array* buffer = context->buffer; struct org_cherry_array* buffer = context->buffer;
enum StringState state = STR_EAT; enum StringState state = STR_EAT;
byte_t* p = org_cherry_utf8_next(context->src); cy_byte_t* p = org_cherry_utf8_next(context->src);
unicode_t ch = org_cherry_utf8_get(p); cy_unicode_t ch = org_cherry_utf8_get(p);
int unicount = 0; int unicount = 0;
while(ch != '\0') { while(ch != '\0') {
...@@ -493,8 +493,8 @@ static enum org_cherry_tok ...@@ -493,8 +493,8 @@ static enum org_cherry_tok
lex_comment(struct org_cherry_context* context) lex_comment(struct org_cherry_context* context)
{ {
struct org_cherry_array* buffer = context->buffer; struct org_cherry_array* buffer = context->buffer;
const byte_t* p = context->src; const cy_byte_t* p = context->src;
unicode_t ch = org_cherry_utf8_get(p); cy_unicode_t ch = org_cherry_utf8_get(p);
while(ch != '\0' && ch != '\r' && ch != '\n') { while(ch != '\0' && ch != '\r' && ch != '\n') {
org_cherry_array_append(buffer, p, org_cherry_utf8_codepoints(p)); org_cherry_array_append(buffer, p, org_cherry_utf8_codepoints(p));
...@@ -512,7 +512,7 @@ lex_comment(struct org_cherry_context* context) ...@@ -512,7 +512,7 @@ lex_comment(struct org_cherry_context* context)
static int static int
is_symbol_character(unicode_t ch) is_symbol_character(cy_unicode_t ch)
{ {
return org_cherry_unicode_isalnum(ch) || return org_cherry_unicode_isalnum(ch) ||
ch == '+' || ch == '-' || ch == '*' || ch == '/' || ch == '%' || ch == '+' || ch == '-' || ch == '*' || ch == '/' || ch == '%' ||
...@@ -524,8 +524,8 @@ static enum org_cherry_tok ...@@ -524,8 +524,8 @@ static enum org_cherry_tok
lex_symbol(struct org_cherry_context* context) lex_symbol(struct org_cherry_context* context)
{ {
struct org_cherry_array* buffer = context->buffer; struct org_cherry_array* buffer = context->buffer;
const byte_t* p = context->src; const cy_byte_t* p = context->src;
unicode_t ch = org_cherry_utf8_get(p); cy_unicode_t ch = org_cherry_utf8_get(p);
while(is_symbol_character(ch)) { while(is_symbol_character(ch)) {
org_cherry_array_append(buffer, p, org_cherry_utf8_codepoints(p)); org_cherry_array_append(buffer, p, org_cherry_utf8_codepoints(p));
...@@ -538,7 +538,7 @@ lex_symbol(struct org_cherry_context* context) ...@@ -538,7 +538,7 @@ lex_symbol(struct org_cherry_context* context)
org_cherry_array_append(buffer, "\0", 1); org_cherry_array_append(buffer, "\0", 1);
byte_t* sym = org_cherry_array_get(buffer, 0); cy_byte_t* sym = org_cherry_array_get(buffer, 0);
if (strcmp(sym, "true") == 0) if (strcmp(sym, "true") == 0)
return TOK_TRUE; return TOK_TRUE;
...@@ -560,11 +560,11 @@ org_cherry_lex(struct org_cherry_context* context) ...@@ -560,11 +560,11 @@ org_cherry_lex(struct org_cherry_context* context)
assert(context != 0); assert(context != 0);
while(TRUE) { while(TRUE) {
const byte_t* p = context->src; const cy_byte_t* p = context->src;
org_cherry_array_clear(context->buffer); org_cherry_array_clear(context->buffer);
unicode_t ch = org_cherry_utf8_get(p); cy_unicode_t ch = org_cherry_utf8_get(p);
if(org_cherry_unicode_isspace(ch)) { if(org_cherry_unicode_isspace(ch)) {
p = org_cherry_utf8_next(p); p = org_cherry_utf8_next(p);
...@@ -617,7 +617,7 @@ org_cherry_lex(struct org_cherry_context* context) ...@@ -617,7 +617,7 @@ org_cherry_lex(struct org_cherry_context* context)
return TOK_EOF; return TOK_EOF;
} }
const byte_t* const cy_byte_t*
org_cherry_pos(struct org_cherry_context* context) org_cherry_pos(struct org_cherry_context* context)
{ {
assert(context != 0); assert(context != 0);
...@@ -625,7 +625,7 @@ org_cherry_pos(struct org_cherry_context* context) ...@@ -625,7 +625,7 @@ org_cherry_pos(struct org_cherry_context* context)
} }
void void
org_cherry_rewind(struct org_cherry_context* context, const byte_t* pos) org_cherry_rewind(struct org_cherry_context* context, const cy_byte_t* pos)
{ {
assert(context != 0); assert(context != 0);
assert(context->begin <= pos && pos <= context->src); assert(context->begin <= pos && pos <= context->src);
...@@ -634,12 +634,12 @@ org_cherry_rewind(struct org_cherry_context* context, const byte_t* pos) ...@@ -634,12 +634,12 @@ org_cherry_rewind(struct org_cherry_context* context, const byte_t* pos)
} }
const byte_t* const cy_byte_t*
org_cherry_token_string(struct org_cherry_context* context) org_cherry_token_string(struct org_cherry_context* context)
{ {
assert(context->buffer != 0); assert(context->buffer != 0);
return (const byte_t*) org_cherry_array_get(context->buffer, 0); return (const cy_byte_t*) org_cherry_array_get(context->buffer, 0);
} }
...@@ -655,7 +655,7 @@ org_cherry_token_length(struct org_cherry_context* context) ...@@ -655,7 +655,7 @@ org_cherry_token_length(struct org_cherry_context* context)
static struct org_cherry_value* static struct org_cherry_value*
org_cherry_read_pair(struct org_cherry_context* context) org_cherry_read_pair(struct org_cherry_context* context)
{ {
const byte_t* pos; const cy_byte_t* pos;
enum org_cherry_tok tok; enum org_cherry_tok tok;
struct org_cherry_value* head; struct org_cherry_value* head;
struct org_cherry_value* tail; struct org_cherry_value* tail;
......
...@@ -33,9 +33,7 @@ struct org_cherry_value* org_cherry_false; ...@@ -33,9 +33,7 @@ struct org_cherry_value* org_cherry_false;
struct org_cherry_value* org_cherry_symbol_define; struct org_cherry_value* org_cherry_symbol_define;
struct org_cherry_value* org_cherry_symbol_lambda; struct org_cherry_value* org_cherry_symbol_lambda;
struct org_cherry_value* org_cherry_symbol_cond;
struct org_cherry_value* org_cherry_symbol_if; struct org_cherry_value* org_cherry_symbol_if;
struct org_cherry_value* org_cherry_symbol_else;
struct org_cherry_value* org_cherry_symbol_quote; struct org_cherry_value* org_cherry_symbol_quote;
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
...@@ -316,8 +314,6 @@ org_cherry_initialize(struct org_cherry_pair* arguments) ...@@ -316,8 +314,6 @@ org_cherry_initialize(struct org_cherry_pair* arguments)
org_cherry_symbol_define = org_cherry_symbol("define"); org_cherry_symbol_define = org_cherry_symbol("define");
org_cherry_symbol_lambda = org_cherry_symbol("lambda"); org_cherry_symbol_lambda = org_cherry_symbol("lambda");
org_cherry_symbol_if = org_cherry_symbol("if"); org_cherry_symbol_if = org_cherry_symbol("if");
org_cherry_symbol_cond = org_cherry_symbol("cond");
org_cherry_symbol_else = org_cherry_symbol("else");
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
......
...@@ -21,9 +21,9 @@ ...@@ -21,9 +21,9 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
static void test_lex_fixnum(const_pointer data) static void test_lex_fixnum(cy_const_pointer_t data)
{ {
byte_t* fixnum = "0 5 0xFF 0xFFFF 1000 0777 0b0001 0b00011111"; cy_byte_t* fixnum = "0 5 0xFF 0xFFFF 1000 0777 0b0001 0b00011111";
struct org_cherry_context* c = org_cherry_context_repl(fixnum); struct org_cherry_context* c = org_cherry_context_repl(fixnum);
assert(org_cherry_lex(c) == TOK_DEC); assert(org_cherry_lex(c) == TOK_DEC);
...@@ -52,9 +52,9 @@ static void test_lex_fixnum(const_pointer data) ...@@ -52,9 +52,9 @@ static void test_lex_fixnum(const_pointer data)
} }
static void test_lex_float(const_pointer data) static void test_lex_float(cy_const_pointer_t data)
{ {
byte_t* fixnum = "1.0 4e+1 5e-10 1.0e20"; cy_byte_t* fixnum = "1.0 4e+1 5e-10 1.0e20";
struct org_cherry_context* c = org_cherry_context_repl(fixnum); struct org_cherry_context* c = org_cherry_context_repl(fixnum);
assert(org_cherry_lex(c) == TOK_FLOAT); assert(org_cherry_lex(c) == TOK_FLOAT);
...@@ -71,9 +71,9 @@ static void test_lex_float(const_pointer data) ...@@ -71,9 +71,9 @@ static void test_lex_float(const_pointer data)
} }
static void test_lex_string(const_pointer data) static void test_lex_string(cy_const_pointer_t data)
{ {
byte_t* str = " \"asdf\" \"test\\uFFFF\\UFFFFFFFF\\n\" "; cy_byte_t* str = " \"asdf\" \"test\\uFFFF\\UFFFFFFFF\\n\" ";
struct org_cherry_context* c = org_cherry_context_repl(str); struct org_cherry_context* c = org_cherry_context_repl(str);
assert(org_cherry_lex(c) == TOK_STRING); assert(org_cherry_lex(c) == TOK_STRING);
...@@ -84,9 +84,9 @@ static void test_lex_string(const_pointer data) ...@@ -84,9 +84,9 @@ static void test_lex_string(const_pointer data)
} }
static void test_lex_comment(const_pointer data) static void test_lex_comment(cy_const_pointer_t data)
{ {
byte_t* comment = "; comment\n"; cy_byte_t* comment = "; comment\n";
struct org_cherry_context* c = org_cherry_context(comment, 0, CY_DEFAULT); struct org_cherry_context* c = org_cherry_context(comment, 0, CY_DEFAULT);
assert(org_cherry_lex(c) == TOK_COMMENT); assert(org_cherry_lex(c) == TOK_COMMENT);
...@@ -94,9 +94,9 @@ static void test_lex_comment(const_pointer data) ...@@ -94,9 +94,9 @@ static void test_lex_comment(const_pointer data)
} }
static void test_lex_symbols(const_pointer data) static void test_lex_symbols(cy_const_pointer_t data)
{ {
byte_t* str = " true false null? + - "; cy_byte_t* str = " true false null? + - ";
struct org_cherry_context* c = org_cherry_context_repl(str); struct org_cherry_context* c = org_cherry_context_repl(str);
assert(org_cherry_lex(c) == TOK_TRUE); assert(org_cherry_lex(c) == TOK_TRUE);
...@@ -113,9 +113,9 @@ static void test_lex_symbols(const_pointer data) ...@@ -113,9 +113,9 @@ static void test_lex_symbols(const_pointer data)
} }
static void test_lex_characters(const_pointer data) static void test_lex_characters(cy_const_pointer_t data)
{ {
byte_t* str = " \\a \\A \\uFFFF \\newline \\space "; cy_byte_t* str = " \\a \\A \\uFFFF \\newline \\space ";
struct org_cherry_context* c = org_cherry_context_repl(str); struct org_cherry_context* c = org_cherry_context_repl(str);
assert(org_cherry_lex(c) == TOK_CHAR); assert(org_cherry_lex(c) == TOK_CHAR);
...@@ -135,9 +135,9 @@ static void test_lex_characters(const_pointer data) ...@@ -135,9 +135,9 @@ static void test_lex_characters(const_pointer data)
} }
static void test_lex_core(const_pointer data) static void test_lex_core(cy_const_pointer_t data)
{ {
byte_t* str = " [ ] ( ) . ' "; cy_byte_t* str = " [ ] ( ) . ' ";
struct org_cherry_context* c = org_cherry_context_repl(str); struct org_cherry_context* c = org_cherry_context_repl(str);
assert(org_cherry_lex(c) == TOK_SQUARELEFTBRACE); assert(org_cherry_lex(c) == TOK_SQUARELEFTBRACE);
...@@ -149,14 +149,14 @@ static void test_lex_core(const_pointer data) ...@@ -149,14 +149,14 @@ static void test_lex_core(const_pointer data)
assert(org_cherry_lex(c) == TOK_EOF); assert(org_cherry_lex(c) == TOK_EOF);
} }
static void test_lex_rewind(const_pointer data) static void test_lex_rewind(cy_const_pointer_t data)
{ {
byte_t* str = " [ ] ( ) . ' "; cy_byte_t* str = " [ ] ( ) . ' ";
struct org_cherry_context* c = org_cherry_context_repl(str); struct org_cherry_context* c = org_cherry_context_repl(str);
assert(org_cherry_lex(c) == TOK_SQUARELEFTBRACE); assert(org_cherry_lex(c) == TOK_SQUARELEFTBRACE);
const byte_t* position = org_cherry_pos(c); const cy_byte_t* position = org_cherry_pos(c);
assert(org_cherry_lex(c) == TOK_SQUARERIGHTBRACE); assert(org_cherry_lex(c) == TOK_SQUARERIGHTBRACE);
assert(org_cherry_lex(c) == TOK_ROUNDLEFTBRACE); assert(org_cherry_lex(c) == TOK_ROUNDLEFTBRACE);
......