comp.lang.ada
 help / color / mirror / Atom feed
From: kern@siedap.UUCP
Subject: Re: Orphaned Response
Date: Fri, 8-Aug-86 06:41:00 EDT	[thread overview]
Date: Fri Aug  8 06:41:00 1986
Message-ID: <8000005@siedap.UUCP> (raw)
In-Reply-To: 18077548@jade.UUCP

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 ("-- ");
	    }

       reply	other threads:[~1986-08-08 10:41 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <18077548@jade.UUCP>
1986-08-08 10:41 ` kern [this message]
     [not found] <679@EDU>
1986-08-07  4:58 ` Orphaned Response richw
     [not found] <1701997413@950@ucbvax.Berke>
1986-06-02 19:08 ` GOODENOUGH@
     [not found] <1701997413@576@ucbvax/nerke>
1986-06-02 18:29 ` GOODENOUGH@
     [not found] <306@telesoft.UKE>
1986-03-18 16:55 ` stt
1985-12-31 21:40 Ada '88 musings stt
1986-01-20 17:47 ` Orphaned Response stt
     [not found] <690@lll-crg.UUCP>
1985-07-26 22:35 ` gjs
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox