toni@erix.UUCP (Toni Roth) (07/30/85)
I've written a nroff/troff macro package for formatting standard documents. Now I'm trying to use lex to make an "interface" to the user, so he won't have to learn *roff. As an example: if he wants a new line, he writes ":nl." in his document. This is to be translated to ".NL". The problem is that this ":nl." can appear anywhere in the text Look at these examples: 1: text text text text:nl.text text text text 2: text text text text :nl. text text text text 3: text text text text :nl.text text text text 4: text text text text :nl. text text text text I want them all to result in this: text text text text .NL text text text text I could of course write something like: "\n:nl.\n" printf("\n.NL\n"); "\n:nl." printf("\n.NL\n"); ":nl.\n" printf("\n.NL\n"); ":nl." printf("\n.NL\n"); But as the action is the same, I believe there is one pattern that covers all four of these (I don't want ":nl." more than once in the pattern and I want the action part as easy as now). How do I write this pattern? Thanks in advance!