ejp@ausmelb.oz (Esmond Pitt) (05/10/88)
1. Some things Vern left out of his flex.1 'man' page:
- Lex has no comment facility. Flex does:
lines beginning with '#' are ignored within a flex script.
- You mustn't modify yytext[] or yyleng within a flex action.
- If you refer to yytext outside your script, it's
extern char *yytext.
In lex it's
extern char yytext[];
- If you provide your own yywrap() routine, #undef yywrap first.
- In 'lex', ^ and $ aren't metacharacters within a name expansion.
Flex has the same problem, or feature ...
2. A request: could a 'flex' scanner have something #define'd to help in
configuring scripts for 'lex' or 'flex', e.g. # define FLEX?
3. Bug: The pattern
"DATA"([ \n;,])+/("."|[ \n;,])
which arises in one of my scripts after name expansion, is incorrectly
treated as having variable length head & tail & is thus rejected. The
action for the rule for '|' in parse.y always treats the result as
variable length regardless of reality.
4. Bug: the following script for 80-column Cobol card images
gets 'NULL in input' under flex -f or -F, even after the '-f/-F' patch.
It works under 'lex', but slowly!
%%
" "*.{8}\n.{6}[^-] {
/*
** Delete trailing blanks & columns 73..80 from non-continued line
*/
fputs(&yytext[yyleng-8],yyout);
}
.{8}$ {
/*
** Delete columns 73..80 from any other line
*/
;
}
--
Esmond Pitt, Austec International Ltd
...!uunet.UU.NET!munnari!ausmelb!ejp,ejp@ausmelb.ozvern%lbl-pistachio@LBL-RTSG.ARPA (Vern Paxson) (05/11/88)
I'll incorporate the notes Esmond mentioned into the upcoming release's man page, along with a #define to distinguish between flex- and lex-generated scanners. Thanks for the suggestions. Regarding: > 3. Bug: The pattern > > "DATA"([ \n;,])+/("."|[ \n;,]) > > which arises in one of my scripts after name expansion, is incorrectly > treated as having variable length head & tail & is thus rejected. While this is a valid bug, it's a bit of a pain to fix. I was hoping that it would rarely arise and then in most cases would be easy enough to work around. Note that the above pattern can also be written: "DATA"([ \n;,])+/[ .\n;,] which will then be accepted by flex. I will add the bug to the man page. > 4. Bug: the following script for 80-column Cobol card images > gets 'NULL in input' under flex -f or -F, even after the '-f/-F' patch. > ... I could not get this bug to repeat. Esmond, if can you send me more details regarding the failure (and possibly the flex output file), I may be able to trace it down. Vern Vern Paxson vern@lbl-csam.arpa Real Time Systems ucbvax!lbl-csam.arpa!vern Lawrence Berkeley Laboratory (415) 486-6411