as: add support for .string directive

This commit is contained in:
Mikael Pettersson
2023-10-07 16:43:16 +02:00
parent 1b39e2dc92
commit 3c3fbae342
3 changed files with 8 additions and 0 deletions

View File

@@ -50,6 +50,7 @@ stmt(ScanState) ->
{ok, {Location, ?T_DOT_SECTION}} -> dot_section(ScanState, Location);
{ok, {Location, ?T_DOT_SHORT}} -> dot_short(ScanState, Location);
{ok, {Location, ?T_DOT_SIZE}} -> dot_size(ScanState, Location);
{ok, {Location, ?T_DOT_STRING}} -> dot_string(ScanState, Location);
{ok, {Location, ?T_DOT_SUBSECTION}} -> dot_subsection(ScanState, Location);
{ok, {Location, ?T_DOT_TEXT}} -> dot_text(ScanState, Location);
{ok, {Location, ?T_DOT_TYPE}} -> dot_type(ScanState, Location);
@@ -379,6 +380,9 @@ dot_size(ScanState, Location) ->
ScanRes -> badtok("junk after .size", ScanRes)
end.
dot_string(ScanState, Location) -> % .string is essentially an alias for .asciz
dot_ascii(ScanState, Location, ".string", _Z = true).
dot_subsection(ScanState, Location) ->
case scan:token(ScanState) of
{ok, {_Location1, {?T_UINTEGER, Nr}}} ->

View File

@@ -44,6 +44,7 @@ from_symbol(Name) ->
".section" -> ?T_DOT_SECTION;
".short" -> ?T_DOT_SHORT;
".size" -> ?T_DOT_SIZE;
".string" -> ?T_DOT_STRING;
".subsection" -> ?T_DOT_SUBSECTION;
".text" -> ?T_DOT_TEXT;
".type" -> ?T_DOT_TYPE;
@@ -71,6 +72,7 @@ format(Token) ->
?T_DOT_SECTION -> ".section";
?T_DOT_SHORT -> ".short";
?T_DOT_SIZE -> ".size";
?T_DOT_STRING -> ".string";
?T_DOT_SUBSECTION -> ".subsection";
?T_DOT_TEXT -> ".text";
?T_DOT_TYPE -> ".type";

View File

@@ -41,6 +41,7 @@
-define(T_DOT_SECTION, 'T_DOT_SECTION'). % .section
-define(T_DOT_SHORT, 'T_DOT_SHORT'). % .short
-define(T_DOT_SIZE, 'T_DOT_SIZE'). % .size
-define(T_DOT_STRING, 'T_DOT_STRING'). % .string
-define(T_DOT_SUBSECTION, 'T_DOT_SUBSECTION'). % .subsection
-define(T_DOT_TEXT, 'T_DOT_TEXT'). % .text
-define(T_DOT_TYPE, 'T_DOT_TYPE'). % .type
@@ -85,6 +86,7 @@
| ?T_DOT_SECTION
| ?T_DOT_SHORT
| ?T_DOT_SIZE
| ?T_DOT_STRING
| ?T_DOT_SUBSECTION
| ?T_DOT_TEXT
| ?T_DOT_TYPE