Make IAC ignore IDL4 annotation applications:

compilers/iac/lexer.ads
- In Token_Type add T_At.

compilers/iac/lexer.adb
- In procedure Process, in then-part of `if not Initialized' add call
    New_Token (T_At, "@");
- In procedure Scan_Token (Fatal : Boolean) case-statement decoding
  Buffer (Token_Location.Scan) add handling of '@':
  - If the following token is an identifier then skip the identifier
    and whitespace that may follow it; if the following token is '('
    then seek ')' and increment Token_Location.Scan to the index after
    the ')'.  Do not modify the value of Token.
  - Otherwise set Token to T_At.
This commit is contained in:
Oliver Kellogg
2018-05-26 22:28:56 +02:00
parent 2e56d3fe5b
commit 2b691e0b96
2 changed files with 27 additions and 0 deletions

View File

@@ -660,6 +660,7 @@ package body Lexer is
New_Token (T_Semi_Colon, ";");
New_Token (T_Left_Brace, "{");
New_Token (T_Right_Brace, "}");
New_Token (T_At, "@");
New_Token (T_Colon, ":");
New_Token (T_Comma, ",");
New_Token (T_Colon_Colon, "::");
@@ -1545,6 +1546,31 @@ package body Lexer is
Token_Location.Scan := Token_Location.Scan + 1;
Token := T_Right_Brace;
when '@' =>
Token_Location.Scan := Token_Location.Scan + 1;
-- Currently, annotations are skipped.
-- They are not yet analyzed or stored.
if Is_Letter (Buffer (Token_Location.Scan)) then
while Is_Letter (Buffer (Token_Location.Scan))
or else Buffer (Token_Location.Scan) in '0' .. '9'
or else Buffer (Token_Location.Scan) = '_'
loop
Token_Location.Scan := Token_Location.Scan + 1;
end loop;
Skip_Spaces;
if Buffer (Token_Location.Scan) = '(' then
while Buffer (Token_Location.Scan) /= EOF
and then Buffer (Token_Location.Scan) /= ')' loop
Token_Location.Scan := Token_Location.Scan + 1;
end loop;
if Buffer (Token_Location.Scan) = ')' then
Token_Location.Scan := Token_Location.Scan + 1;
end if;
end if;
else
Token := T_At;
end if;
when ':' =>
Token_Location.Scan := Token_Location.Scan + 1;
if Buffer (Token_Location.Scan) = ':' then

View File

@@ -145,6 +145,7 @@ pragma Elaborate_Body (Lexer);
-- Graphic characters
T_At,
T_Colon,
T_Comma,
T_Semi_Colon,