🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.bugs.4bsd
Article #1184

Re: Bug in lex?!?

#1184
From: Esmond Pitt
Date: Wed, 14 Sep 1988 01:00
26 lines
1236 bytes
In article <14373@hc.DSPO.GOV> siegel@hc.DSPO.GOV (josh Siegel) writes:
> (I have only tested this under SunOS 4.0 and BSD4.3)
>
> The following code makes lex produce C code with a syntax error in it:
> -----
> W	[ \t]+	
> %%
> ^{W}%	{ }
> %%

This also happens on a Pyramid under both att & bsd universes (i.e.
both lex's), probably because '%' is a special character to lex.
^{W}"%" also fails.

However the example works correctly & is in somewhat better (safer)
style if the definition of W is written as:

	W	([ \t]+)

Lex definitions should _always_ be parenthesised, for the same reason
that #defines which yield expressions should always parenthesise them:
to ensure that the apparent and real precedences are the same.

-- 
Esmond Pitt, Austec International Ltd
...!uunet.UU.NET!munnari!ausmelb!ejp,ejp@ausmelb.oz
Technical Details
Message-ID: <759@ausmelb.oz>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!munnari!mulga!ausmelb!ejp
References: <14373@hc.DSPO.GOV>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!munnari!mulga!ausmelb!ejp
From: ejp@ausmelb.oz (Esmond Pitt)
Newsgroups: comp.bugs.4bsd
Subject: Re: Bug in lex?!?
Summary: yes indeed + better workaround
Message-ID: <759@ausmelb.oz>
Date: 14 Sep 88 01:00:57 GMT
References: <14373@hc.DSPO.GOV>
Reply-To: ejp@ausmelb.oz (Esmond Pitt)
Organization: Austec International Limited, Melbourne
Lines: 26