lexer now turns '(' into an operator if noops=false

This commit is contained in:
Wolfgang (Blub) Bumiller 2012-08-18 14:26:25 +02:00
parent 1a2c3c505c
commit bc94d3f5b8
2 changed files with 11 additions and 1 deletions

11
lexer.c
View file

@ -701,9 +701,18 @@ int lex_do(lex_file *lex)
/* single-character tokens */
switch (ch)
{
case ';':
case '(':
if (!lex_tokench(lex, ch) ||
!lex_endtoken(lex))
{
return (lex->tok->ttype = TOKEN_FATAL);
}
if (lex->flags.noops)
return (lex->tok->ttype = ch);
else
return (lex->tok->ttype = TOKEN_OPERATOR);
case ')':
case ';':
case '{':
case '}':
case '[':

View file

@ -142,6 +142,7 @@ static const oper_info operators[] = {
{ "--", 1, opid3('S','-','-'), ASSOC_LEFT, 16, OP_SUFFIX},
{ ".", 2, opid1('.'), ASSOC_LEFT, 15, 0 },
{ "(", 0, opid1('('), ASSOC_LEFT, 15, OP_SUFFIX },
{ "!", 1, opid2('!', 'P'), ASSOC_RIGHT, 14, OP_PREFIX },
{ "~", 1, opid2('~', 'P'), ASSOC_RIGHT, 14, OP_PREFIX },