static struct parser_state * pstate
static struct type * type_for_char(struct parser_state *, ULONGEST)
static struct obstack temp_parse_space
static std::vector< std::unique_ptr< gdb_mpz > > int_storage
static void yyunput(int c, char *buf_ptr)
#define BEFORE_QUAL_QUOTE
static void canonicalizeNumeral(char *s1, const char *)
static bool returned_complete
static int processAttribute(const char *)
static int subseqMatch(const char *subseq, const char *str)
static int processInt(struct parser_state *, const char *, const char *, const char *)
static void rewind_to_char(int)
static struct stoken processId(const char *, int)
static void lexer_init(FILE *inp)
static struct stoken processString(const char *, int)
dummy_function ada_flex_use[]
static struct @5 attributes[]
static int processReal(struct parser_state *, const char *)
static int find_dot_all(const char *)
static char numbuf[NUMERAL_WIDTH]
constexpr std::string_view s1
constexpr std::string_view s2
void add_completions(completion_list &&list)
std::vector< gdb::unique_xmalloc_ptr< char > > completion_list
int gdbarch_long_long_bit(struct gdbarch *gdbarch)
int gdbarch_int_bit(struct gdbarch *gdbarch)
int gdbarch_long_bit(struct gdbarch *gdbarch)
enum bfd_endian type_byte_order(const struct type *type)
const struct builtin_type * builtin_type(struct gdbarch *gdbarch)
struct type * language_lookup_primitive_type(const struct language_defn *la, struct gdbarch *gdbarch, const char *name)
bool parse_float(const char *p, int len, const struct type *type, gdb_byte *data)
bool fits_in_type(int n_sign, ULONGEST n, int type_bits, bool type_signed_p)
bool complete(struct expression *exp, completion_tracker &tracker) override
struct type * builtin_unsigned_long_long
struct type * builtin_unsigned_long
const struct language_defn * language()
struct gdbarch * gdbarch()
void write(gdb::array_view< gdb_byte > buf, enum bfd_endian byte_order, bool unsigned_p) const
28NUM10 ({DIG}({DIG}|_)*)
30NUM16 ({HEXDIG}({HEXDIG}|_)*)
33ID ({LETTER}({LETTER}|{DIG}|[\x80-\xff])*|"<"{LETTER}({LETTER}|{DIG})*">")
36GRAPHIC [a-z0-9 #&'()*+,-./:;<>=_|!$%?@\[\]\\^`{}~]
37OPER ([-+*/=<>&]|"<="|">="|"**"|"/="|"and"|"or"|"xor"|"not"|"mod"|"rem"|"abs")
49#include "diagnostics.h"
57DIAGNOSTIC_IGNORE_DEPRECATED_REGISTER
59#define NUMERAL_WIDTH 256
60#define LONGEST_SIGN ((ULONGEST) 1 << (sizeof(LONGEST) * HOST_CHAR_BIT - 1))
75#define YY_DECL static int yylex ( void )
89#define COMPLETE_CHAR '\001'
92#define YY_INPUT(BUF, RESULT, MAX_SIZE) \
93 if ( *pstate->lexptr == '\000' ) \
95 if (pstate->parse_completion && !returned_complete) \
97 returned_complete = true; \
98 *(BUF) = COMPLETE_CHAR; \
102 (RESULT) = YY_NULL; \
106 *(BUF) = *pstate->lexptr == COMPLETE_CHAR ? ' ' : *pstate->lexptr; \
108 pstate->lexptr += 1; \
116%option case-insensitive interactive nodefault noyywrap
128 char *e_ptr = strrchr (
numbuf,
'e');
138{NUM10}"#"{HEXDIG}({HEXDIG}|_)*"#"{POSEXP} {
140 char *e_ptr = strrchr (
numbuf,
'e');
151{NUM10}(l{0,2}f)?"#"{HEXDIG}({HEXDIG}|_)*"#" {
163{NUM10}"."{NUM10}{EXP} {
173{NUM10}"#"{NUM16}"."{NUM16}"#"{EXP} {
174 error (_(
"Based real literals not implemented yet."));
177{NUM10}"#"{NUM16}"."{NUM16}"#" {
178 error (_(
"Based real literals not implemented yet."));
181<INITIAL>"'"({GRAPHIC}|\")"'" {
187<INITIAL>"'[\""{HEXDIG}{2,}"\"]'" {
188 ULONGEST v = strtoulst (
yytext+3,
nullptr, 16);
189 yylval.typed_char.val = v;
197\"({GRAPHIC}|"[\""({HEXDIG}{2,}|\")"\"]")*\" {
203 error (_(
"ill-formed or non-terminated string literal"));
256"=>" {
return ARROW; }
264<BEFORE_QUAL_QUOTE>"'"/{NOT_COMPLETE} {
BEGIN INITIAL;
return '\''; }
266[-&*+{}@/:<>=|;\[\]] {
return yytext[0]; }
290"."{WHITE}*{ID}{COMPLETE}? {
297"."{WHITE}*{COMPLETE} {
303{ID}({WHITE}*"."{WHITE}*({ID}|\"{OPER}\"))*(" "*"'"|{COMPLETE})? {
311 else if (all_posn >= 0)
321"'"[^']+"'"{WHITE}*:: {
331"$"({LETTER}|{DIG}|"$")* {
339. { error (_(
"Invalid character '%s' in expression."),
yytext); }
360 for (; *
s2 !=
'\000';
s2 += 1)
380 const char *num0,
const char *exp0)
388 int floating_point_l_count = -1;
395 base = strtol (
base0, &end_of_base, 10);
396 if (base < 2 || base > 16)
397 error (_(
"Invalid base: %d."), base);
398 while (*end_of_base ==
'l')
400 ++floating_point_l_count;
404 gdb_assert (floating_point_l_count == -1 || *end_of_base ==
'f');
405 if (*end_of_base ==
'f')
408 ++floating_point_l_count;
411 gdb_assert (*end_of_base ==
'#');
417 exp = strtol(exp0, (
char **) NULL, 10);
420 while (isxdigit (*num0))
422 int dig = fromhex (*num0);
424 error (_(
"Invalid digit `%c' in based literal"), *num0);
436 if (floating_point_l_count > -1)
438 struct type *fp_type;
439 if (floating_point_l_count == 0)
443 else if (floating_point_l_count == 1)
450 gdb_assert (floating_point_l_count == 2);
456 yylval.typed_val_float.type = fp_type;
457 result.
write (gdb::make_array_view (
yylval.typed_val_float.val,
488 "long_long_long_integer");
493 "unsigned_long_long_long_integer");
495 error (_(
"Integer literal out of range"));
507 yylval.typed_val_float.type,
508 yylval.typed_val_float.val);
537 while (len > 0 && isspace (name0[len-1]))
540 if (name0[0] ==
'<' || strstr (name0,
"___") != NULL)
542 strncpy (
name, name0, len);
548 bool in_quotes =
false;
558 name[i++] = name0[i0++];
559 else if (isalnum (name0[i0]))
561 name[i] = tolower (name0[i0]);
564 else if (isspace (name0[i0]))
566 else if (name0[i0] ==
'\'')
570 name[i++] = name0[i0++];
571 in_quotes = !in_quotes;
574 name[i++] = name0[i0++];
591 const char *lim = text + len;
599 if (p[0] ==
'[' && p[1] ==
'"' && p+2 < lim)
609 ULONGEST chr = strtoulst (p + 2, &end, 16);
611 error (_(
"wide strings are not yet supported"));
637 for (i = 0; str[i] !=
'\000'; i++)
644 while (isspace (str[i]));
646 if (strncasecmp (str + i,
"all", 3) == 0
647 && !isalnum (str[i + 3]) && str[i + 3] !=
'_')
659 if (subseq[0] ==
'\0')
661 else if (str[0] ==
'\0')
663 else if (tolower (subseq[0]) == tolower (str[0]))
697 gdb_assert (*str ==
'\'');
699 while (isspace (*str))
702 int len = strlen (str);
708 yylval.sval.length = len - 1;
713 if (strcasecmp (str, item.name) == 0)
716 gdb::optional<int> found;
720 if (!found.has_value ())
723 error (_(
"ambiguous attribute name: `%s'"), str);
725 if (!found.has_value ())
726 error (_(
"unrecognized attribute: `%s'"), str);
738 if (strncasecmp (item.name,
m_name.c_str (),
m_name.length ()) == 0)
739 output.emplace_back (xstrdup (item.name));