as: parse: stmt_after_uinteger/3: move out of insn parsing block, correct diagnostic

This commit is contained in:
Mikael Pettersson 2020-01-12 16:16:58 +01:00
parent 1f89281c1e
commit dae3d2d768

View File

@ -105,6 +105,13 @@ stmt(ScanState) ->
%% This means that "opcode (...)" is interpreted as having a displacement but no
%% index. Use "opcode 0(index)" if an index with zero displacement is needed.
%% <stmt> ::= <uinteger> . ":"
stmt_after_uinteger(ScanState, Location, UInt) ->
case scan:token(ScanState) of
{ok, {_Location, ?T_COLON}} -> {ok, {Location, #s_local_label{number = UInt}}};
ScanRes -> badtok("junk after local label", ScanRes)
end.
stmt_after_symbol(ScanState, Location, Name) ->
case scan:token(ScanState) of
{ok, {_Location, ?T_COLON}} -> {ok, {Location, #s_label{name = Name}}};
@ -116,13 +123,6 @@ stmt_after_symbol(ScanState, Location, Name) ->
ScanRes -> badtok("junk after symbol", ScanRes)
end.
%% <stmt> ::= <uinteger> . ":"
stmt_after_uinteger(ScanState, Location, UInt) ->
case scan:token(ScanState) of
{ok, {_Location, ?T_COLON}} -> {ok, {Location, #s_local_label{number = UInt}}};
ScanRes -> badtok("junk after symbol", ScanRes)
end.
%% Seen "<symbol> <uinteger>". The <uinteger> is the <accumulator> if followed
%% by ",", otherwise (the start of) the <displacement>.
insn_uint(ScanState, Location, Name, UInt) ->