mirror of
https://github.com/sfall-team/sslc.git
synced 2026-07-27 16:52:49 -07:00
Added an alternative (C-style) assignment operator
This commit is contained in:
@@ -291,6 +291,11 @@ static int expect(int what, int hit, int miss) {
|
||||
else { ungetChar(); return miss; }
|
||||
}
|
||||
|
||||
/* added for alternative assignment operator '=' */
|
||||
static int expectAssign(int what, int hit, int miss) {
|
||||
return (getChar() == what) ? hit : miss;
|
||||
}
|
||||
|
||||
static int validSymbolChar(int c) {
|
||||
return (c >= 'a' && c <= 'z') ||
|
||||
(c >= 'A' && c <= 'Z') ||
|
||||
@@ -674,9 +679,13 @@ top:
|
||||
ret = T_CONSTANT;
|
||||
break;
|
||||
|
||||
/* added for alternative assignment operator '=' */
|
||||
#define EXPECT_ASSIGN(c, x, y, z) case x: ret = expectAssign(x, y, z); break;
|
||||
EXPECT_ASSIGN('=', '=', T_EQUAL, T_ASSIGN);
|
||||
|
||||
#define EXPECT(x, y, z) case x: ret = expect(y, z, x); break;
|
||||
EXPECT(':', '=', T_ASSIGN);
|
||||
EXPECT('=', '=', T_EQUAL);
|
||||
// EXPECT('=', '=', T_EQUAL);
|
||||
EXPECT('>', '=', T_GREATER_EQUAL);
|
||||
EXPECT('<', '=', T_LESS_EQUAL);
|
||||
EXPECT('!', '=', T_NOT_EQUAL);
|
||||
|
||||
Reference in New Issue
Block a user