Skip to content

Commit 9e35f2b

Browse files
committed
Implement new PICO-8 0.2.0f unary operator % (replaces @@).
1 parent 2075673 commit 9e35f2b

File tree

5 files changed

+4
-12
lines changed

5 files changed

+4
-12
lines changed

llex.c

+1-6
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ static const char *const luaX_tokens [] = {
4040
"return", "then", "true", "until", "while",
4141
"..", "...", "==", ">=", "<=", "~=", "!=", "::",
4242
"<eof>", "<number>", "<name>", "<string>", "?",
43-
"<eol>", "@@", "^^", "<<", ">>", ">>>", "<<>", ">><",
43+
"<eol>", "^^", "<<", ">>", ">>>", "<<>", ">><",
4444
"+=", "-=", "*=", "/=", "%=", "^=", "\\=", "&=", "|=",
4545
"^^=", "<<=", ">>=", ">>>=", "<<>=", ">><=", "..=",
4646
};
@@ -530,11 +530,6 @@ static int llex (LexState *ls, SemInfo *seminfo) {
530530
if (ls->current == '=') { next(ls); return TK_LSHRE; }
531531
else return TK_LSHR;
532532
}
533-
case '@': {
534-
next(ls);
535-
if (ls->current != '@') return '@';
536-
else { next(ls); return TK_DBAT; }
537-
}
538533
case ':': {
539534
next(ls);
540535
if (ls->current != ':') return ':';

llex.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ enum RESERVED {
2727
TK_RETURN, TK_THEN, TK_TRUE, TK_UNTIL, TK_WHILE,
2828
/* other terminal symbols */
2929
TK_CONCAT, TK_DOTS, TK_EQ, TK_GE, TK_LE, TK_NE, TK_NE2, TK_DBCOLON,
30-
TK_EOS, TK_NUMBER, TK_NAME, TK_STRING, TK_PRINT, TK_EOL, TK_DBAT,
30+
TK_EOS, TK_NUMBER, TK_NAME, TK_STRING, TK_PRINT, TK_EOL,
3131
TK_BXOR, TK_SHL, TK_SHR, TK_LSHR, TK_ROTL, TK_ROTR,
3232
/* these must be last and match "ORDER OPR" */
3333
TK_ADDE, TK_SUBE, TK_MULE, TK_DIVE, TK_MODE, TK_POWE, TK_IDIVE,

lopcodes.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ OP_UNM,/* A B R(A) := -R(B) */
204204
OP_BNOT,/* A B R(A) := ~R(B) */
205205
OP_NOT,/* A B R(A) := not R(B) */
206206
OP_PEEK,/* A B R(A) := @ R(B) */
207-
OP_PEEK2,/* A B R(A) := @@ R(B) */
207+
OP_PEEK2,/* A B R(A) := % R(B) */
208208
OP_PEEK4,/* A B R(A) := $ R(B) */
209209
OP_LEN,/* A B R(A) := length of R(B) */
210210

lparser.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -991,7 +991,7 @@ static UnOpr getunopr (int op) {
991991
case '-': return OPR_MINUS;
992992
case '~': return OPR_BNOT;
993993
case '@': return OPR_PEEK;
994-
case TK_DBAT: return OPR_PEEK2;
994+
case '%': return OPR_PEEK2;
995995
case '$': return OPR_PEEK4;
996996
case '#': return OPR_LEN;
997997
default: return OPR_NOUNOPR;

lua.c

-3
Original file line numberDiff line numberDiff line change
@@ -484,9 +484,6 @@ int main (int argc, char **argv) {
484484
l_message(argv[0], "cannot create state: not enough memory");
485485
return EXIT_FAILURE;
486486
}
487-
unsigned char ram[65536];
488-
for (int i = 0; i < 65536; ++i) ram[i] = i %256;
489-
lua_setpico8memory(L, ram);
490487
/* call 'pmain' in protected mode */
491488
lua_pushcfunction(L, &pmain);
492489
lua_pushinteger(L, argc); /* 1st argument */

0 commit comments

Comments
 (0)