Article View: net.lang.ada
Article #905Re: Orphaned Response
From: kern
Date: Fri, 08 Aug 1986 10:41
Date: Fri, 08 Aug 1986 10:41
53 lines
2233 bytes
2233 bytes
I am interested in the LEX/YACC sources too.
Here are two little lex sources I wrote, though I am a
newcomer to unix. The first is to translate all characters
into upper case except Ada reserved words, comments and
strings. (I forgot character literals.)
Known bugs: Character literals are translated,
first word of text sometimes treated erroneously
The second is to remove/add comment starters "--" to lines.
(To enable i.e. adjustment procedures in comment blocks.)
Horst
Mailing address: mcvax!unido!ztivax!siedap!kern
SEP [ \n()*+-./:;<=>|&]
KEYW (abort|abs|access|all|and|array|at|begin|accept|body|case|constant|declare|delay|delta|digits|do|else|elsif|end|entry|exception|exit|for|function|generic|goto|if|in|is|limited|loop|mod|new|not|null|of|or|others|out|package|pragma|private|procedure|raise|raise|range|record|rem|renames|return|reverse|select|separate|subtype|task|terminate|then|type|use|when|while|with|xor)
%%
^{KEYW}/{SEP} ECHO;
{SEP}{KEYW}/{SEP} ECHO;
[a-z] putchar (yytext [0] + 'A' - 'a');
--.* |
\"[^"\n]*\" |
[^a-z] ECHO;
--------------------- 2nd crime---------------------
%START TAB
%%
^[ \t]*-- { int i;
for (i=0; i<yyleng-2; i++)
output (yytext[i]);
printf (" ");
}
^[^ \t] |
^" "[^ ] |
^" "[^ ] {
printf ("-- ");
output (yytext[yyleng-1]);
}
^\t+ {for ( ; yyleng>1; yyleng--)
output ('\t');
BEGIN TAB;
}
<TAB>" "* ECHO;
<TAB>[^ ] {printf (" -- ");
ECHO;
BEGIN 0;
}
^" "* { int i;
for (i=0; i<yyleng-3; i++)
output (' ');
printf ("-- ");
}
Technical Details
Message-ID:
<8000005@siedap.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!mnetor!seismo!mcvax!unido!siedap!kernReferences:
<18077548@jade.UUCP>Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!mcvax!unido!siedap!kern From: kern@siedap.UUCP Newsgroups: net.lang.ada Subject: Re: Orphaned Response Message-ID: <8000005@siedap.UUCP> Date: Fri, 8-Aug-86 06:41:00 EDT Article-I.D.: siedap.8000005 Posted: Fri Aug 8 06:41:00 1986 Date-Received: Wed, 13-Aug-86 06:22:13 EDT References: <18077548@jade.UUCP> Lines: 53 Nf-ID: #R:jade:18077548:siedap:8000005:37777777600:1666 Nf-From: siedap!kern Aug 8 10:41:00 1986