mirror of
https://github.com/lua/lua.git
synced 2025-01-28 06:03:00 +08:00
new opcodes for '>' and '>='
This commit is contained in:
parent
8c22057b2e
commit
0a5dce5704
6
lua.stx
6
lua.stx
@ -1,6 +1,6 @@
|
|||||||
%{
|
%{
|
||||||
|
|
||||||
char *rcs_luastx = "$Id: lua.stx,v 3.1 1994/11/02 20:30:53 roberto Exp $";
|
char *rcs_luastx = "$Id: lua.stx,v 3.2 1994/11/03 22:32:42 roberto Exp $";
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@ -464,10 +464,10 @@ expr1 : expr { if ($1 == 0) code_byte(1); }
|
|||||||
expr : '(' expr ')' { $$ = $2; }
|
expr : '(' expr ')' { $$ = $2; }
|
||||||
| expr1 EQ expr1 { code_byte(EQOP); $$ = 1; }
|
| expr1 EQ expr1 { code_byte(EQOP); $$ = 1; }
|
||||||
| expr1 '<' expr1 { code_byte(LTOP); $$ = 1; }
|
| expr1 '<' expr1 { code_byte(LTOP); $$ = 1; }
|
||||||
| expr1 '>' expr1 { code_byte(LEOP); code_byte(NOTOP); $$ = 1; }
|
| expr1 '>' expr1 { code_byte(GTOP); $$ = 1; }
|
||||||
| expr1 NE expr1 { code_byte(EQOP); code_byte(NOTOP); $$ = 1; }
|
| expr1 NE expr1 { code_byte(EQOP); code_byte(NOTOP); $$ = 1; }
|
||||||
| expr1 LE expr1 { code_byte(LEOP); $$ = 1; }
|
| expr1 LE expr1 { code_byte(LEOP); $$ = 1; }
|
||||||
| expr1 GE expr1 { code_byte(LTOP); code_byte(NOTOP); $$ = 1; }
|
| expr1 GE expr1 { code_byte(GEOP); $$ = 1; }
|
||||||
| expr1 '+' expr1 { code_byte(ADDOP); $$ = 1; }
|
| expr1 '+' expr1 { code_byte(ADDOP); $$ = 1; }
|
||||||
| expr1 '-' expr1 { code_byte(SUBOP); $$ = 1; }
|
| expr1 '-' expr1 { code_byte(SUBOP); $$ = 1; }
|
||||||
| expr1 '*' expr1 { code_byte(MULTOP); $$ = 1; }
|
| expr1 '*' expr1 { code_byte(MULTOP); $$ = 1; }
|
||||||
|
5
opcode.h
5
opcode.h
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
** TeCGraf - PUC-Rio
|
** TeCGraf - PUC-Rio
|
||||||
** $Id: opcode.h,v 3.1 1994/11/02 20:30:53 roberto Exp roberto $
|
** $Id: opcode.h,v 3.2 1994/11/04 10:47:49 roberto Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef opcode_h
|
#ifndef opcode_h
|
||||||
@ -74,6 +74,8 @@ typedef enum
|
|||||||
EQOP,
|
EQOP,
|
||||||
LTOP,
|
LTOP,
|
||||||
LEOP,
|
LEOP,
|
||||||
|
GTOP,
|
||||||
|
GEOP,
|
||||||
ADDOP,
|
ADDOP,
|
||||||
SUBOP,
|
SUBOP,
|
||||||
MULTOP,
|
MULTOP,
|
||||||
@ -159,5 +161,6 @@ char *lua_lasttext (void); /* from "lex.c" module */
|
|||||||
int yylex (void); /* from "lex.c" module */
|
int yylex (void); /* from "lex.c" module */
|
||||||
Byte *lua_parse (void); /* from "lua.stx" module */
|
Byte *lua_parse (void); /* from "lua.stx" module */
|
||||||
void lua_travstack (void (*fn)(Object *));
|
void lua_travstack (void (*fn)(Object *));
|
||||||
|
void luaI_setfallback (void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user