mirror of
https://github.com/mikpe/pdp10-tools.git
synced 2026-03-10 12:48:31 +00:00
as: support line-comments starting with '#'
This commit is contained in:
4
TODO
4
TODO
@@ -43,9 +43,7 @@ Tools:
|
||||
- readelf: add support for relocs
|
||||
- readelf: add support for program headers
|
||||
- as:
|
||||
* add line-comment character, e.g. '#'
|
||||
+ use it in doc/MUUO.txt
|
||||
+ use it in as/tests/*.s
|
||||
* add C /* ... */ comments
|
||||
* support .ident:
|
||||
+ change strtab to have a finalizer which returns an image array,
|
||||
+ use standard output_section for strtab
|
||||
|
||||
19
as/scan.c
19
as/scan.c
@@ -311,6 +311,23 @@ static enum token do_number(struct scan_state *scan_state, union token_attribute
|
||||
return T_UINTEGER;
|
||||
}
|
||||
|
||||
static int do_line_comment(struct scan_state *scan_state)
|
||||
{
|
||||
for (;;) {
|
||||
int ch = scan_getchar();
|
||||
switch (ch) {
|
||||
case '\n':
|
||||
++scan_state->linenr;
|
||||
return T_NEWLINE;
|
||||
case EOF:
|
||||
badchar(scan_state, ch, "in line comment");
|
||||
return T_ERROR;
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
enum token scan_token(struct scan_state *scan_state, union token_attribute *token_attr)
|
||||
{
|
||||
int ch;
|
||||
@@ -327,6 +344,8 @@ enum token scan_token(struct scan_state *scan_state, union token_attribute *toke
|
||||
case '\n':
|
||||
++scan_state->linenr;
|
||||
return T_NEWLINE;
|
||||
case '#':
|
||||
return do_line_comment(scan_state);
|
||||
case EOF:
|
||||
return T_EOF;
|
||||
case '@':
|
||||
|
||||
Reference in New Issue
Block a user