as: parse: handle parenthesized exprs

This commit is contained in:
Mikael Pettersson
2020-01-12 21:22:00 +01:00
parent 09016f7e2e
commit 14eb0ad1ed

View File

@@ -630,6 +630,15 @@ expr(ScanState) ->
do_expr(ScanState, First) ->
case First of
{ok, {_Location1, ?T_LPAREN}} ->
case expr(ScanState) of
{ok, Expr} ->
case scan:token(ScanState) of
{ok, {_Location2, ?T_RPAREN}} -> {ok, Expr};
ScanRes -> badtok("expected ')'", ScanRes)
end;
{error, _Reason} = Error -> Error
end;
{ok, {_Location1, ?T_MINUS}} ->
case scan:token(ScanState) of
{ok, {_Location2, {?T_UINTEGER, UInt}}} ->