diff options
author | Father Chrysostomos <sprout@cpan.org> | 2013-06-26 18:03:04 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2013-06-26 18:05:02 -0700 |
commit | 9700e2d38d91e6678fcdf9d5c39ddd5ec7ad6867 (patch) | |
tree | 3d608816dd8dfd8152040a6a061ed6446d54b04c /parser.h | |
parent | 43fdf692884d7d7101eac00b3deb3bf5766fe378 (diff) | |
download | perl-9700e2d38d91e6678fcdf9d5c39ddd5ec7ad6867.tar.gz |
[perl #117535, #76910] Fix bogus ambiguity warnings
‘Ambiguous use of * resolved as operator *’: This message can occur in
cases where there is no multiplication operator, so what it is saying
is completely wrong.
When the lexer parses a bareword, it looks at the previous character
and warns if it happens to match /[*%&]/, so foo**bar and foo&&bar
result in this warning, as does print $%foo.
The purpose of the code is to catch *bar *bar or &black &sheep.
To avoid false positives, when emitting one of the three operators
* % & the lexer can record that fact, so when it sees a bareword pre-
ceded by one of those three characters, instead of guessing that the
infix operator was used, it will *know*.
The test cases added also trigger ‘Bareword found where operator
expected’. I don’t know whether that should change, but at least the
current behaviour is tested, so we will know when it does change.
Diffstat (limited to 'parser.h')
-rw-r--r-- | parser.h | 1 |
1 files changed, 1 insertions, 0 deletions
@@ -128,6 +128,7 @@ typedef struct yy_parser { U8 lex_flags; PERL_BITFIELD16 in_pod:1; /* lexer is within a =pod section */ PERL_BITFIELD16 filtered:1; /* source filters in evalbytes */ + PERL_BITFIELD16 saw_infix_sigil:1; /* saw & or * or % operator */ } yy_parser; /* flags for lexer API */ |