Skip to content

Commit 63f180a

Browse files
committed
Simplify ASCII, remove parser logic and move ASCII support to world and lexer.
1 parent 55c8397 commit 63f180a

File tree

135 files changed

+1133
-323
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

135 files changed

+1133
-323
lines changed

collections.c

-26
Original file line numberDiff line numberDiff line change
@@ -381,32 +381,6 @@ ctr_object* ctr_array_pop(ctr_object* myself, ctr_argument* argumentList) {
381381
return *(myself->value.avalue->elements + myself->value.avalue->head);
382382
}
383383

384-
/**
385-
* @def
386-
* [ List ] - [ Number ]
387-
*
388-
* @example
389-
* ☞ x ≔ List ← 1 ; 2 ; 3.
390-
* ✎ write: x, stop.
391-
* ☞ x - 1.
392-
* ✎ write: x, stop.
393-
*/
394-
ctr_object* ctr_array_delete(ctr_object* myself, ctr_argument* argumentList) {
395-
ctr_size index = ctr_internal_cast2number(argumentList->object)->value.nvalue;
396-
ctr_size length = (ctr_size) myself->value.avalue->head - myself->value.avalue->tail;
397-
ctr_size i;
398-
ctr_size found = 0;
399-
index--;
400-
for( i = index; i < length; i ++ ) {
401-
*(myself->value.avalue->elements + i) = *(myself->value.avalue->elements + (i+1));
402-
found = 1;
403-
}
404-
if (found) {
405-
myself->value.avalue->head--;
406-
}
407-
return myself;
408-
}
409-
410384
/**
411385
* @def
412386
* [ List ] shift

i18n/hy/extra.dict

+4
Original file line numberDiff line numberDiff line change
@@ -107,4 +107,8 @@ t "talisker:" "talisker."
107107
t "springbank:" "springbank."
108108
t "glenfarclas:" "glenfarclas."
109109
t "hello:" "hello."
110+
t "!=:" "!=."
111+
t ">=:" ">=."
112+
t "<=:" "<=."
113+
t "<<:" "<<."
110114

i18n/nl2/dictionary.h

+10-10
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#define CTR_DICT_CODEGEN_MAP_PUT "zet:"
33
#define CTR_DICT_CODEGEN_MAP_PUT_AT " bij:"
44
#define CTR_DICT_CODEGEN_ARRAY_NEW "Reeks nieuw "
5-
#define CTR_DICT_CODEGEN_ARRAY_NEW_PUSH "Reeks << "
5+
#define CTR_DICT_CODEGEN_ARRAY_NEW_PUSH "Reeks "
66
#define CTR_DICT_END_OF_LINE "."
77
#define CTR_DICT_NIL "Niets"
88
#define CTR_DICT_BOOLEAN "Boolean"
@@ -17,23 +17,23 @@
1717
#define CTR_DICT_PROGRAM "Programma"
1818
#define CTR_DICT_FILE "Bestand"
1919
#define CTR_DICT_MOMENT "Moment"
20-
#define CTR_DICT_VAR_ICON "maak"
20+
#define CTR_DICT_VAR_ICON ">>"
2121
#define CTR_DICT_ME_ICON "zelf"
2222
#define CTR_DICT_MY_ICON "eigen"
23-
#define CTR_DICT_BULLET "->"
24-
#define CTR_DICT_SYMBOL_EQUALS "=="
23+
#define CTR_DICT_BULLET "~"
24+
#define CTR_DICT_SYMBOL_EQUALS "="
2525
#define CTR_DICT_PLUS "+"
2626
#define CTR_DICT_MINUS "-"
27-
#define CTR_DICT_MULTIPLIER "*"
28-
#define CTR_DICT_DIVISION "/"
27+
#define CTR_DICT_MULTIPLIER "×"
28+
#define CTR_DICT_DIVISION "÷"
2929
#define CTR_DICT_GREATER ">"
3030
#define CTR_DICT_LESS "<"
3131
#define CTR_DICT_AT_SYMBOL "?"
3232
#define CTR_DICT_PEN_ICON "Uit"
33-
#define CTR_DICT_NEW_ARRAY_AND_PUSH_SYMBOL "<<"
34-
#define CTR_DICT_GREATER_OR_EQUAL_SYMBOL ">="
35-
#define CTR_DICT_LESS_OR_EQUAL_SYMBOL "<="
36-
#define CTR_DICT_UNEQUALS_SYMBOL "!="
33+
#define CTR_DICT_NEW_ARRAY_AND_PUSH_SYMBOL ""
34+
#define CTR_DICT_GREATER_OR_EQUAL_SYMBOL ""
35+
#define CTR_DICT_LESS_OR_EQUAL_SYMBOL ""
36+
#define CTR_DICT_UNEQUALS_SYMBOL ""
3737
#define CTR_DICT_NEW "nieuw"
3838
#define CTR_DICT_EQUALS "gelijk:"
3939
#define CTR_DICT_AND "en:"

lexer.c

+7
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,9 @@ uint8_t ctr_clex_is_delimiter( char* code ) {
8181
if (strncmp(code, CTR_DICT_ASSIGN, ctr_clex_keyword_assignment_len) == 0) {
8282
return 1;
8383
}
84+
if (strncmp(code, ":=", ctr_clex_keyword_assignment_len) == 0) {
85+
return 1;
86+
}
8487
if (strncmp(code, CTR_DICT_MESSAGE_CHAIN, ctr_clex_keyword_chain_len) == 0 ) {
8588
return 1;
8689
}
@@ -267,6 +270,10 @@ int ctr_clex_tok() {
267270
ctr_code += ctr_clex_keyword_assignment_len;
268271
return CTR_TOKEN_ASSIGNMENT;
269272
}
273+
if (strncmp(ctr_code, ":=", 2)==0) {
274+
ctr_code += 2;
275+
return CTR_TOKEN_ASSIGNMENT;
276+
}
270277
if (c == ctr_clex_param_prefix_char) { ctr_code++; return CTR_TOKEN_COLON; }
271278
if (strncmp(ctr_code, CTR_DICT_RETURN, ctr_clex_keyword_return_len)==0
272279
&& *(ctr_code+ctr_clex_keyword_return_len)==' '

makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
CFLAGS = -O2 -g -mtune=native -Wpedantic -Wall -D CTRLANG=${ISO} -D INCLUDETESTS -D ASCIICOMPAT
1+
CFLAGS = -O2 -g -mtune=native -Wpedantic -Wall -D CTRLANG=${ISO} -D INCLUDETESTS
22
OBJS = test.o siphash.o utf8.o memory.o util.o base.o collections.o file.o system.o \
33
world.o lexer.o parser.o walker.o translator.o citrine.o
44
prefix ?= /usr

makefile.bsd

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
CFLAGS = -O2 -std=c99 -mtune=native -Wall -D CTRLANG=${ISO} -D PATH_MAX=1024 -D INCLUDETESTS -D ASCIICOMPAT
1+
CFLAGS = -O2 -std=c99 -mtune=native -Wall -D CTRLANG=${ISO} -D PATH_MAX=1024 -D INCLUDETESTS
22
OBJS = test.o siphash.o utf8.o memory.o util.o base.o collections.o file.o system.o \
33
world.o lexer.o parser.o walker.o translator.o citrine.o
44

makefile.haiku

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
CFLAGS = -g -mtune=native -Wall -D CTRLANG=${ISO} -D INCLUDETESTS -D ASCIICOMPAT
1+
CFLAGS = -g -mtune=native -Wall -D CTRLANG=${ISO} -D INCLUDETESTS
22
OBJS = test.o siphash.o utf8.o memory.o util.o base.o collections.o file.o system.o \
33
world.o lexer.o parser.o walker.o translator.o citrine.o
44
prefix ?= /usr

makefile.mac

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
CFLAGS = -O2 -std=c99 -mtune=native -Wall -D CTRLANG=${ISO} -D PATH_MAX=1024 \
2-
-D REPLACE_PLUGIN_SYSTEM -D MACOS_PLUGIN_SYSTEM -D ASCIICOMPAT
2+
-D REPLACE_PLUGIN_SYSTEM -D MACOS_PLUGIN_SYSTEM
33
OBJS = test.o siphash.o utf8.o memory.o util.o base.o collections.o file.o system.o \
44
world.o lexer.o parser.o walker.o translator.o citrine.o portability.o
55

makefile.win32

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#Usage: ISO=... CC=i686-w64-mingw32-gcc-8.3-win32 DLLTOOL=i686-w64-mingw32-dlltool make -f makefile.win32
22
#Usage with mk: CC=i686-w64-mingw32-gcc-8.3-win32 DLLTOOL=i686-w64-mingw32-dlltool MAKEFILE=makefile.win32 ./mk.sh
3-
CFLAGS = -O2 -g -mtune=native -Wall -D CTRLANG=${ISO} -D INCLUDETESTS -D WIN -D ASCIICOMPAT -D WIN32_BIT \
3+
CFLAGS = -O2 -g -mtune=native -Wall -D CTRLANG=${ISO} -D INCLUDETESTS -D WIN -D WIN32_BIT \
44
-D REPLACE_PROGRAM_PASSWORD -D WINDOWS_PROGRAM_PASSWORD\
55
-D REPLACE_PLUGIN_SYSTEM -D WINDOWS_PLUGIN_SYSTEM\
66
-D REPLACE_CLOCK_WAIT -D WINDOWS_CLOCK_WAIT\

makefile.win64

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#Usage: ISO=... CC=x86_64-w64-mingw32-gcc-8.3-win32 DLLTOOL=x86_64-w64-mingw32-dlltool make -f makefile.win64
22
#Usage with mk: CC=x86_64-w64-mingw32-gcc-8.3-win32 DLLTOOL=x86_64-w64-mingw32-dlltool MAKEFILE=makefile.win64 ./mk.sh
3-
CFLAGS = -O2 -g -mtune=native -Wall -D CTRLANG=${ISO} -D INCLUDETESTS -D ASCIICOMPAT -D WIN \
3+
CFLAGS = -O2 -g -mtune=native -Wall -D CTRLANG=${ISO} -D INCLUDETESTS -D WIN \
44
-D REPLACE_ERROR_SYSTEM -D WINDOWS_ERROR_SYSTEM\
55
-D REPLACE_PROGRAM_PASSWORD -D WINDOWS_PROGRAM_PASSWORD\
66
-D REPLACE_PLUGIN_SYSTEM -D WINDOWS_PLUGIN_SYSTEM\

parser.c

+5-7
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,7 @@ ctr_tnode* ctr_cparse_message(int mode) {
9393
memcpy(msg, s, msgpartlen);
9494
ulen = ctr_getutf8len(msg, msgpartlen);
9595
lookAhead = ctr_clex_tok(); ctr_clex_putback();
96-
int is_single_uchar = (ulen == 1 && lookAhead != CTR_TOKEN_COLON);
97-
int is_single_uchar_in_ascii_form = 0;
98-
#ifdef ASCIICOMPAT
99-
is_single_uchar_in_ascii_form = (ulen == 2 && lookAhead != CTR_TOKEN_COLON && (msg[1] == '=' || msg[1] == '<' || msg[1] == '>'));
100-
#endif
101-
isBin = (is_single_uchar || is_single_uchar_in_ascii_form);
96+
isBin = (ulen == 1 && lookAhead != CTR_TOKEN_COLON);
10297
if (mode == 2 && isBin) {
10398
ctr_clex_putback();
10499
return m;
@@ -373,7 +368,10 @@ ctr_tnode* ctr_cparse_ref() {
373368
r->modifier = 1;
374369
r->vlen = ctr_clex_tok_value_length();
375370
}
376-
if (strncmp(ctr_clex_keyword_var_icon, tmp, ctr_clex_keyword_var_icon_len)==0 && r->vlen == ctr_clex_keyword_var_icon_len) {
371+
if (
372+
(strncmp(">>", tmp, 2)==0 && r->vlen == 2) ||
373+
(strncmp(ctr_clex_keyword_var_icon, tmp, ctr_clex_keyword_var_icon_len)==0 && r->vlen == ctr_clex_keyword_var_icon_len)
374+
) {
377375
int t = ctr_clex_tok();
378376
if (t != CTR_TOKEN_REF) {
379377
ctr_cparse_emit_error_unexpected( t, CTR_ERR_EXP_VAR );

tests/exp/af/test0226af.exp

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,9 @@
1-
0
2-
0
1+
Ja
2+
Ja
3+
Ja
4+
Ja
5+
Ja
6+
Ja
7+
Ja
8+
Ja
9+
Ja

tests/exp/am/test0226am.exp

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,9 @@
1-
0
2-
0
1+
አዎ
2+
አዎ
3+
አዎ
4+
አዎ
5+
አዎ
6+
አዎ
7+
አዎ
8+
አዎ
9+
አዎ

tests/exp/ar/test0226ar.exp

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,9 @@
1-
0
2-
0
1+
نعم
2+
نعم
3+
نعم
4+
نعم
5+
نعم
6+
نعم
7+
نعم
8+
نعم
9+
نعم

tests/exp/az/test0226az.exp

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,9 @@
1-
0
2-
0
1+
Doğru
2+
Doğru
3+
Doğru
4+
Doğru
5+
Doğru
6+
Doğru
7+
Doğru
8+
Doğru
9+
Doğru

tests/exp/be/test0226be.exp

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,9 @@
1-
0
2-
0
1+
Праўда
2+
Праўда
3+
Праўда
4+
Праўда
5+
Праўда
6+
Праўда
7+
Праўда
8+
Праўда
9+
Праўда

tests/exp/bg/test0226bg.exp

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,9 @@
1-
0
2-
0
1+
Вярно
2+
Вярно
3+
Вярно
4+
Вярно
5+
Вярно
6+
Вярно
7+
Вярно
8+
Вярно
9+
Вярно

tests/exp/bn/test0226bn.exp

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,9 @@
1-
0
2-
0
1+
সত্য
2+
সত্য
3+
সত্য
4+
সত্য
5+
সত্য
6+
সত্য
7+
সত্য
8+
সত্য
9+
সত্য

tests/exp/bs/test0226bs.exp

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,9 @@
1-
0
2-
0
1+
Istinito
2+
Istinito
3+
Istinito
4+
Istinito
5+
Istinito
6+
Istinito
7+
Istinito
8+
Istinito
9+
Istinito

tests/exp/ca/test0226ca.exp

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,9 @@
1-
0
2-
0
1+
És cert
2+
És cert
3+
És cert
4+
És cert
5+
És cert
6+
És cert
7+
És cert
8+
És cert
9+
És cert

tests/exp/ceb/test0226ceb.exp

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,9 @@
1-
0
2-
0
1+
Tinuod
2+
Tinuod
3+
Tinuod
4+
Tinuod
5+
Tinuod
6+
Tinuod
7+
Tinuod
8+
Tinuod
9+
Tinuod

tests/exp/co/test0226co.exp

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,9 @@
1-
0
2-
0
1+
Hè vera
2+
Hè vera
3+
Hè vera
4+
Hè vera
5+
Hè vera
6+
Hè vera
7+
Hè vera
8+
Hè vera
9+
Hè vera

tests/exp/cs/test0226cs.exp

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,9 @@
1-
0
2-
0
1+
Pravda
2+
Pravda
3+
Pravda
4+
Pravda
5+
Pravda
6+
Pravda
7+
Pravda
8+
Pravda
9+
Pravda

tests/exp/cy/test0226cy.exp

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,9 @@
1-
0
2-
0
1+
Gwir
2+
Gwir
3+
Gwir
4+
Gwir
5+
Gwir
6+
Gwir
7+
Gwir
8+
Gwir
9+
Gwir

tests/exp/da/test0226da.exp

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,9 @@
1-
0
2-
0
1+
Rigtigt
2+
Rigtigt
3+
Rigtigt
4+
Rigtigt
5+
Rigtigt
6+
Rigtigt
7+
Rigtigt
8+
Rigtigt
9+
Rigtigt

tests/exp/de/test0226de.exp

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,9 @@
1-
0
2-
0
1+
Ja
2+
Ja
3+
Ja
4+
Ja
5+
Ja
6+
Ja
7+
Ja
8+
Ja
9+
Ja

tests/exp/el/test0226el.exp

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,9 @@
1-
0
2-
0
1+
Αληθής
2+
Αληθής
3+
Αληθής
4+
Αληθής
5+
Αληθής
6+
Αληθής
7+
Αληθής
8+
Αληθής
9+
Αληθής

tests/exp/en/test0226en.exp

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,9 @@
1-
0
2-
0
1+
Yes
2+
Yes
3+
Yes
4+
Yes
5+
Yes
6+
Yes
7+
Yes
8+
Yes
9+
Yes

0 commit comments

Comments
 (0)