diff options
author | Pierre-Marie de Rodat <derodat@adacore.com> | 2015-08-19 17:12:48 +0200 |
---|---|---|
committer | Pierre-Marie de Rodat <derodat@adacore.com> | 2015-08-20 10:12:24 +0200 |
commit | af39b3270a1385027b2a5d145b9ba7564bd39f7a (patch) | |
tree | d8376e96f1f09543651fe48bb625603aa410fc1d /gdb/dwarf2read.c | |
parent | 9215b98bb27c071386a277f5578dbb17569a1471 (diff) | |
download | gdb-af39b3270a1385027b2a5d145b9ba7564bd39f7a.zip gdb-af39b3270a1385027b2a5d145b9ba7564bd39f7a.tar.gz gdb-af39b3270a1385027b2a5d145b9ba7564bd39f7a.tar.bz2 |
[Ada] Fix parsing for expressions with attributes and characters
Before this change, trying to evaluate the following Ada expression
yielded a syntax error, even though it's completely legal:
(gdb) p s'first = 'a'
Error in expression, near `'.
The problem lies in the lexer (gdb/ada-lex.l): at the point we reach "'a'",
we're still in the BEFORE_QUAL_QUOTE start condition (the mechanism to
distinguish character literals from other "tick" usages: qualified
expressions and attributes), so we consider that this quote is actually a
separate "tick".
This changes resets the start condition to INITIAL in the
{TICK}[a-zA-Z][a-zA-Z]+ rule (for attributes): attributes activate this
BEFORE_QUAL_QUOTE condition and in this case the above rule is always
executed rather than the <BEFORE_QUAL_QUOTE>"'" one (in flex, it's
always the longest match that is chosen). We now have instead:
(gdb) p s'first = 'a'
$1 = true
gdb/ChangeLog:
* ada-lex.l: Reset the start condition to INITIAL in the rule
that matches attributes.
gdb/testsuite/ChangeLog:
* gdb.ada/attr_ref_and_charlit.exp: New testcase.
* gdb.ada/attr_ref_and_charlit/foo.adb: New file.
Tested on x86_64-linux, no regression.
Diffstat (limited to 'gdb/dwarf2read.c')
0 files changed, 0 insertions, 0 deletions