txlt.l revision 1.6
1	void munchit(char *);
2%%
3.\.l\ [._A-Za-z][A-Za-z0-9_.]*/\,	{printf("%c.l",yytext[0]);munchit(yytext+3);}
4.\.w\ [._A-Za-z][A-Za-z0-9_.]*/\,	{printf("%c.w",yytext[0]);munchit(yytext+3);}
5\..*\n					printf("%s", yytext);
6pea[ 	][._A-Za-z][A-Za-z0-9_.]*$	{printf("pea");munchit(yytext+3);}
7\ [._A-Za-z][A-Za-z0-9_.]*/\,		munchit(yytext);
8.					putchar(*yytext);
9%%
10/*	$NetBSD: txlt.l,v 1.6 2015/02/03 19:58:41 aymeric Exp $	*/
11
12#include <string.h>
13
14void
15munchit(char *s) {
16
17	putchar(*s++);
18	if ((!strncmp(s, "fp", 2) ||
19	    !strncmp(s, "sp", 2) ||
20	    ((*s == 'a')  || (*s == 'd')) && ((s[1]-'0')<=7)) &&
21	    (s[2] == 0 || s[2] == ','))
22		printf("%s", s);
23	else
24		printf("%%pc@(%s)",s);
25}
26
27int
28main(void) {
29	while (yylex() != 0)
30		;
31
32	return 0;
33}
34