Skip to content
Permalink
Browse files

終端記号追加

- "<<" (TK_LS)
- ">>" (TK_RS)
  • Loading branch information...
masu-mi committed Oct 22, 2013
1 parent d10f3cf commit 3b601929ee2d6fd5ba87e31ad7f8795abe4a7047
Showing with 8 additions and 6 deletions.
  1. +7 −5 llex.c
  2. +1 −1 llex.h
12 llex.c
@@ -38,7 +38,7 @@ const char *const luaX_tokens [] = {
"and", "break", "do", "else", "elseif",
"end", "false", "for", "function", "if",
"in", "local", "nil", "not", "or", "repeat",
"return", "then", "true", "until", "while",
"return", "then", "true", "until", "while", "<<", ">>",
"..", "...", "==", ">=", "<=", "~=",
"<number>", "<name>", "<string>", "<eof>",
NULL
@@ -375,13 +375,15 @@ static int llex (LexState *ls, SemInfo *seminfo) {
}
case '<': {
next(ls);
if (ls->current != '=') return '<';
else { next(ls); return TK_LE; }
if (ls->current != '=' && ls->current != '<' ) return '<';
else if (ls->current != '<') { next(ls); return TK_LE; }
else { next(ls); return TK_LS; }
}
case '>': {
next(ls);
if (ls->current != '=') return '>';
else { next(ls); return TK_GE; }
if (ls->current != '=' && ls->current != '>' ) return '>';
else if (ls->current != '>') { next(ls); return TK_GE; }
else { next(ls); return TK_RS; }
}
case '~': {
next(ls);
2 llex.h
@@ -26,7 +26,7 @@ enum RESERVED {
TK_AND = FIRST_RESERVED, TK_BREAK,
TK_DO, TK_ELSE, TK_ELSEIF, TK_END, TK_FALSE, TK_FOR, TK_FUNCTION,
TK_IF, TK_IN, TK_LOCAL, TK_NIL, TK_NOT, TK_OR, TK_REPEAT,
TK_RETURN, TK_THEN, TK_TRUE, TK_UNTIL, TK_WHILE,
TK_RETURN, TK_THEN, TK_TRUE, TK_UNTIL, TK_WHILE, TK_LS, TK_RS,
/* other terminal symbols */
TK_CONCAT, TK_DOTS, TK_EQ, TK_GE, TK_LE, TK_NE, TK_NUMBER,
TK_NAME, TK_STRING, TK_EOS

0 comments on commit 3b60192

Please sign in to comment.
You can’t perform that action at this time.