gdb: LoongArch: Remove nonportable #include
[binutils-gdb.git] / gdb / ada-lex.l
index 40e450bf6790ff377cfcf52e5bd82886fa3d8012..33a08eaa93b8cb1b30a1915da5e82feeda5f815f 100644 (file)
@@ -108,8 +108,6 @@ static bool returned_complete = false;
       pstate->lexptr += 1;                                             \
     }
 
-static int find_dot_all (const char *);
-
 /* Depth of parentheses.  */
 static int paren_depth;
 
@@ -265,7 +263,7 @@ false               { return FALSEKEYWORD; }
 
 <BEFORE_QUAL_QUOTE>"'"/{NOT_COMPLETE} { BEGIN INITIAL; return '\''; }
 
-[-&*+./:<>=|;\[\]] { return yytext[0]; }
+[-&*+{}@/:<>=|;\[\]] { return yytext[0]; }
 
 ","            { if (paren_depth == 0 && pstate->comma_terminates)
                    {
@@ -289,14 +287,20 @@ false             { return FALSEKEYWORD; }
                    }
                }
 
-"."{WHITE}*all  { return DOT_ALL; }
-
-"."{WHITE}*{ID} {
+"."{WHITE}*{ID}{COMPLETE}? {
                  yylval.sval = processId (yytext+1, yyleng-1);
+                 if (yytext[yyleng - 1] == COMPLETE_CHAR)
+                   return DOT_COMPLETE;
                  return DOT_ID;
                }
 
-{ID}({WHITE}*"."{WHITE}*({ID}|\"{OPER}\"))*(" "*"'")?  {
+"."{WHITE}*{COMPLETE} {
+                 yylval.sval.ptr = "";
+                 yylval.sval.length = 0;
+                 return DOT_COMPLETE;
+               }
+
+{ID}({WHITE}*"."{WHITE}*({ID}|\"{OPER}\"))*(" "*"'"|{COMPLETE})?  {
                   int all_posn = find_dot_all (yytext);
 
                   if (all_posn == -1 && yytext[yyleng-1] == '\'')
@@ -306,8 +310,9 @@ false               { return FALSEKEYWORD; }
                    }
                   else if (all_posn >= 0)
                    yyless (all_posn);
+                 bool is_completion = yytext[yyleng - 1] == COMPLETE_CHAR;
                   yylval.sval = processId (yytext, yyleng);
-                  return NAME;
+                  return is_completion ? NAME_COMPLETE : NAME;
                }
 
 
@@ -321,8 +326,6 @@ false               { return FALSEKEYWORD; }
 
 "::"            { return COLONCOLON; }
 
-[{}@]          { return yytext[0]; }
-
        /* REGISTERS AND GDB CONVENIENCE VARIABLES */
 
 "$"({LETTER}|{DIG}|"$")*  {
@@ -459,11 +462,11 @@ processInt (struct parser_state *par_state, const char *base0,
       return FLOAT;
     }
 
-  gdb_mpz maxval (ULONGEST_MAX / base);
+  gdb_mpz maxval (ULONGEST_MAX);
   if (mpz_cmp (result.val, maxval.val) > 0)
     error (_("Integer literal out of range"));
 
-  LONGEST value = result.as_integer<LONGEST> ();
+  ULONGEST value = result.as_integer<ULONGEST> ();
   if ((value >> (gdbarch_int_bit (par_state->gdbarch ())-1)) == 0)
     yylval.typed_val.type = type_int (par_state);
   else if ((value >> (gdbarch_long_bit (par_state->gdbarch ())-1)) == 0)
@@ -545,7 +548,12 @@ processId (const char *name0, int len)
   i = i0 = 0;
   while (i0 < len)
     {
-      if (in_quotes)
+      if (name0[i0] == COMPLETE_CHAR)
+       {
+         /* Just ignore.  */
+         ++i0;
+       }
+      else if (in_quotes)
        name[i++] = name0[i0++];
       else if (isalnum (name0[i0]))
        {