Add indent-with-non-tab for *.[ly] in gdb/.gitattributes.
Fix whitespace in the *.[ly] files in gdb, and add these files to the clean
list in gdb/contrib/check-whitespace-pre-commit.py.
Tested on x86_64-linux.
Approved-By: Tom Tromey <tom@tromey.com>
configure -whitespace
aclocal.m4 -whitespace
+
+# Tab-indented files.
+
+*.[ly] whitespace=space-before-tab,indent-with-non-tab,trailing-space
}
%type <lval> positional_list component_groups component_associations
-%type <lval> aggregate_component_list
+%type <lval> aggregate_component_list
%type <tval> var_or_type type_prefix opt_type_prefix
%token <typed_val> INT NULL_PTR
%left '*' '/' MOD REM
%right STARSTAR ABS NOT
-/* Artificial token to give NAME => ... and NAME | priority over reducing
+/* Artificial token to give NAME => ... and NAME | priority over reducing
NAME to <primary> and to give <primary>' priority over reducing <primary>
to <simple_exp>. */
%nonassoc VAR
primary '(' simple_exp DOTDOT simple_exp ')'
{ ada_wrap3<ada_ternop_slice_operation> (); }
| var_or_type '(' simple_exp DOTDOT simple_exp ')'
- { if ($1 == NULL)
+ { if ($1 == NULL)
ada_wrap3<ada_ternop_slice_operation> ();
else
error (_("Cannot slice a type"));
/* The following rule causes a conflict with the type conversion
var_or_type (exp)
- To get around it, we give '(' higher priority and add bridge rules for
+ To get around it, we give '(' higher priority and add bridge rules for
var_or_type (exp, exp, ...)
var_or_type (exp .. exp)
We also have the action for var_or_type(exp) generate a function call
pstate->push_new<ada_aggregate_operation>
(pop_component ());
}
- ;
+ ;
primary : '@'
{
primary : '{' var_or_type '}' primary %prec '.'
/* GDB extension */
- {
+ {
if ($2 == NULL)
error (_("Type required within braces in coercion"));
operation_up arg = ada_pop ();
pstate->push_new<ada_binop_in_bounds_operation>
(std::move (lhs), std::move (rhs), $5);
}
- | simple_exp IN var_or_type %prec TICK_ACCESS
- {
+ | simple_exp IN var_or_type %prec TICK_ACCESS
+ {
if ($3 == NULL)
error (_("Right operand of 'in' must be type"));
operation_up arg = ada_pop ();
(std::move (lhs), std::move (rhs), $6);
ada_wrap<unary_logical_not_operation> ();
}
- | simple_exp NOT IN var_or_type %prec TICK_ACCESS
- {
+ | simple_exp NOT IN var_or_type %prec TICK_ACCESS
+ {
if ($4 == NULL)
error (_("Right operand of 'in' must be type"));
operation_up arg = ada_pop ();
;
and_exp :
- relation _AND_ relation
+ relation _AND_ relation
{ ada_wrap2<bitwise_and_operation>
(BINOP_BITWISE_AND); }
| and_exp _AND_ relation
;
or_exp :
- relation OR relation
+ relation OR relation
{ ada_wrap2<bitwise_ior_operation>
(BINOP_BITWISE_IOR); }
| or_exp OR relation
(BINOP_BITWISE_XOR); }
;
-/* Primaries can denote types (OP_TYPE). In cases such as
+/* Primaries can denote types (OP_TYPE). In cases such as
primary TICK_ADDRESS, where a type would be invalid, it will be
caught when evaluate_subexp in ada-lang.c tries to evaluate the
primary, expecting a value. Precedence rules resolve the ambiguity
in NAME TICK_ACCESS in favor of shifting to form a var_or_type. A
construct such as aType'access'access will again cause an error when
- aType'access evaluates to a type that evaluate_subexp attempts to
+ aType'access evaluates to a type that evaluate_subexp attempts to
evaluate. */
primary : primary TICK_ACCESS
{ ada_addrof (); }
type_prefix :
var_or_type
- {
+ {
if ($1 == NULL)
error (_("Prefix must be type"));
$$ = $1;
;
primary : STRING
- {
+ {
pstate->push_new<ada_string_operation>
(copy_name ($1));
}
$1,
$2);
}
- | NAME TICK_ACCESS
- {
+ | NAME TICK_ACCESS
+ {
$$ = write_var_or_type (pstate, NULL, $1);
if ($$ == NULL)
ada_addrof ();
$$ = lookup_pointer_type ($$);
}
| block NAME TICK_ACCESS
- {
+ {
$$ = write_var_or_type (pstate, $1, $2);
if ($$ == NULL)
ada_addrof ();
push_component<ada_positional_component>
(0, ada_pop ());
$$ = 1;
- }
+ }
| positional_list exp ','
{
push_component<ada_positional_component>
($1, ada_pop ());
- $$ = $1 + 1;
+ $$ = $1 + 1;
}
;
/* We use this somewhat obscure definition in order to handle NAME => and
NAME | differently from exp => and exp |. ARROW and '|' have a precedence
- above that of the reduction of NAME to var_or_type. By delaying
- decisions until after the => or '|', we convert the ambiguity to a
+ above that of the reduction of NAME to var_or_type. By delaying
+ decisions until after the => or '|', we convert the ambiguity to a
resolved shift/reduce conflict. */
component_associations :
NAME ARROW exp
ada_wrap<ada_wrapped_operation> ();
}
-/* Emit expression corresponding to the renamed object named
+/* Emit expression corresponding to the renamed object named
designated by RENAMED_ENTITY[0 .. RENAMED_ENTITY_LEN-1] in the
context of ORIG_LEFT_CONTEXT, to which is applied the operations
encoded by RENAMING_EXPR. MAX_DEPTH is the maximum number of
cascaded renamings to allow. If ORIG_LEFT_CONTEXT is null, it
- defaults to the currently selected block. ORIG_SYMBOL is the
+ defaults to the currently selected block. ORIG_SYMBOL is the
symbol that originally encoded the renaming. It is needed only
because its prefix also qualifies any index variables used to index
or slice an array. It should not be necessary once we go to the
int i;
int preferred_index;
struct type *preferred_type;
-
+
preferred_index = -1; preferred_type = NULL;
for (i = 0; i < syms.size (); i += 1)
switch (syms[i].symbol->loc_class ())
/* Check to see if we have a regular definition of this
type that just didn't happen to have been read yet. */
struct symbol *sym;
- char *expanded_name =
+ char *expanded_name =
(char *) alloca (strlen (name) + sizeof ("standard__"));
strcpy (expanded_name, "standard__");
strcat (expanded_name, name);
{
const char *p = chop_separator (sels);
sels = p;
- while (*sels != '\0' && *sels != '.'
+ while (*sels != '\0' && *sels != '.'
&& (sels[0] != '_' || sels[1] != '_'))
sels += 1;
operation_up arg = ada_pop ();
return type->field (fieldno).type ();
subfield_name = field_name;
- while (*subfield_name != '\0' && *subfield_name != '.'
+ while (*subfield_name != '\0' && *subfield_name != '.'
&& (subfield_name[0] != '_' || subfield_name[1] != '_'))
subfield_name += 1;
return NULL;
}
-/* Look up NAME0 (an unencoded identifier or dotted name) in BLOCK (or
+/* Look up NAME0 (an unencoded identifier or dotted name) in BLOCK (or
expression_block_context if NULL). If it denotes a type, return
that type. Otherwise, write expression code to evaluate it as an
object and return NULL. In this second case, NAME0 will, in general,
have the form <name>(.<selector_name>)*, where <name> is an object
or renaming encoded in the debugging data. Calls error if no
prefix <name> matches a name in the debugging data (i.e., matches
- either a complete name or, as a wild-card match, the final
+ either a complete name or, as a wild-card match, the final
identifier). */
static struct type*
for (depth = 0; depth < MAX_RENAMING_CHAIN_LENGTH; depth += 1)
{
int tail_index;
-
+
tail_index = name_len;
while (tail_index > 0)
{
renaming_sym = type_sym;
else if (syms.size () == 1)
renaming_sym = syms[0].symbol;
- else
+ else
renaming_sym = NULL;
switch (ada_parse_renaming (renaming_sym, &renaming,
encoded_name = new_name;
name_len = renaming_len + name_len - tail_index;
goto TryAfterRenaming;
- }
+ }
case ADA_OBJECT_RENAMING:
write_object_renaming (par_state, block, renaming, renaming_len,
renaming_expr, MAX_RENAMING_CHAIN_LENGTH);
if (type_sym != NULL)
{
struct type *field_type;
-
+
if (tail_index == name_len)
return type_sym->type ();
= get_symbol_field_type (type_sym, encoded_name + tail_index);
if (field_type != NULL)
return field_type;
- else
+ else
error (_("Invalid attempt to select from type: \"%s\"."),
name0.ptr);
}
}
if (tail_index == name_len
- && strncmp (encoded_name, "standard__",
+ && strncmp (encoded_name, "standard__",
sizeof ("standard__") - 1) == 0)
error (_("No definition of \"%s\" found."), name0.ptr);
tail_index = chop_selector (encoded_name, tail_index);
- }
+ }
else
{
write_ambiguous_var (par_state, block, encoded_name,
error (_("No definition of \"%s\" in current context."), name0.ptr);
else
error (_("No definition of \"%s\" in specified context."), name0.ptr);
-
+
TryAfterRenaming: ;
}
As a result, in the (one hopes) rare case that one writes an
aggregate such as (R => 42) where R renames an object or is an
ambiguous name, one must write instead ((R) => 42). */
-
+
static void
write_name_assoc (struct parser_state *par_state, struct stoken name)
{
static struct type *
type_system_address (struct parser_state *par_state)
{
- struct type *type
+ struct type *type
= language_lookup_primitive_type (par_state->language (),
par_state->gdbarch (),
"system__address");
}
{NUM10}"#"{NUM16}"."{NUM16}"#"{EXP} {
- error (_("Based real literals not implemented yet."));
+ error (_("Based real literals not implemented yet."));
}
{NUM10}"#"{NUM16}"."{NUM16}"#" {
- error (_("Based real literals not implemented yet."));
+ error (_("Based real literals not implemented yet."));
}
<INITIAL>"'"({GRAPHIC}|\")"'" {
}
<INITIAL>"'[\""{HEXDIG}{2,}"\"]'" {
- ULONGEST v = strtoulst (yytext+3, nullptr, 16);
+ ULONGEST v = strtoulst (yytext+3, nullptr, 16);
yylval.typed_char.val = v;
- yylval.typed_char.type = type_for_char (pstate, v);
+ yylval.typed_char.type = type_for_char (pstate, v);
return CHARLIT;
}
digits here. Currently there's no support for wide or
wide-wide strings. */
\"({GRAPHIC}|"[\""({HEXDIG}{2,}|\")"\"]")*\" {
- yylval.sval = processString (yytext+1, yyleng-2);
+ yylval.sval = processString (yytext+1, yyleng-2);
return STRING;
}
\" {
- error (_("ill-formed or non-terminated string literal"));
+ error (_("ill-formed or non-terminated string literal"));
}
if {
- rewind_to_char ('i');
+ rewind_to_char ('i');
return 0;
}
task {
- rewind_to_char ('t');
+ rewind_to_char ('t');
return 0;
}
thread{WHITE}+{DIG} {
- /* This keyword signals the end of the expression and
- will be processed separately. */
- rewind_to_char ('t');
+ /* This keyword signals the end of the expression and
+ will be processed separately. */
+ rewind_to_char ('t');
return 0;
}
true { return TRUEKEYWORD; }
false { return FALSEKEYWORD; }
- /* ATTRIBUTES */
+ /* ATTRIBUTES */
{TICK}([a-z][a-z_]*)?{COMPLETE}? { BEGIN INITIAL; return processAttribute (yytext); }
return 0;
}
else
- {
+ {
ada_parser->paren_depth -= 1;
return ')';
}
}
"."{WHITE}*{ID}{COMPLETE}? {
- yylval.sval = processId (yytext+1, yyleng-1);
+ yylval.sval = processId (yytext+1, yyleng-1);
if (yytext[yyleng - 1] == COMPLETE_CHAR)
return DOT_COMPLETE;
- return DOT_ID;
+ return DOT_ID;
}
"."{WHITE}*{COMPLETE} {
}
{ID}({WHITE}*"."{WHITE}*({ID}|\"{OPER}\"))*(" "*"'"|{COMPLETE})? {
- int all_posn = find_dot_all (yytext);
+ int all_posn = find_dot_all (yytext);
- if (all_posn == -1 && yytext[yyleng-1] == '\'')
+ if (all_posn == -1 && yytext[yyleng-1] == '\'')
{
BEGIN BEFORE_QUAL_QUOTE;
yyless (yyleng-1);
}
- else if (all_posn >= 0)
+ else if (all_posn >= 0)
yyless (all_posn);
bool is_completion = yytext[yyleng - 1] == COMPLETE_CHAR;
- yylval.sval = processId (yytext, yyleng);
- return is_completion ? NAME_COMPLETE : NAME;
- }
+ yylval.sval = processId (yytext, yyleng);
+ return is_completion ? NAME_COMPLETE : NAME;
+ }
/* GDB EXPRESSION CONSTRUCTS */
"'"[^']+"'"{WHITE}*:: {
- yyless (yyleng - 2);
+ yyless (yyleng - 2);
yylval.sval = processId (yytext, yyleng);
return NAME;
}
}
/* Return TEXT[0..LEN-1], a string literal without surrounding quotes,
- with special hex character notations replaced with characters.
+ with special hex character notations replaced with characters.
Result valid until the next call to ada_parse. */
static struct stoken
while (p < lim)
{
if (p[0] == '[' && p[1] == '"' && p+2 < lim)
- {
- if (p[2] == '"') /* "...["""]... */
- {
- *q = '"';
+ {
+ if (p[2] == '"') /* "...["""]... */
+ {
+ *q = '"';
p += 4;
}
- else
+ else
{
const char *end;
ULONGEST chr = strtoulst (p + 2, &end, 16);
*q = (char) chr;
p = end + 1;
}
- }
+ }
else
- *q = *p;
+ *q = *p;
q += 1;
p += 1;
}
/* Dummy definition to suppress warnings about unused static definitions. */
typedef void (*dummy_function) ();
-dummy_function ada_flex_use[] =
-{
+dummy_function ada_flex_use[] =
+{
(dummy_function) yyunput
};
the parser can't tell whether NAME_OR_INT is a name_not_typename (=variable,
=exp) or just an exp. If name_not_typename was ever used in an lvalue
context where only a name could occur, this might be useful.
- | NAME_OR_INT
+ | NAME_OR_INT
*/
| oper
{
filename. However, if the name was quoted, then it is better
to check for a filename or a block, since this is the only
way the user has of requiring the extension to be used. */
- if ((is_a_field_of_this.type == NULL && !is_after_structop)
+ if ((is_a_field_of_this.type == NULL && !is_after_structop)
|| is_quoted_name)
{
/* See if it's a file name. */
import subprocess
import sys
-re_clean = re.compile("(^(gdb/testsuite/|gdbsupport/|gdbserver/)|[.](m4|ac|[ch])$)")
+re_clean = re.compile("(^(gdb/testsuite/|gdbsupport/|gdbserver/)|[.](m4|ac|[chly])$)")
re_clean_exclude = re.compile("^(gdb/symfile.c|gdb/cli/cli-cmds.c)$")
clean = []
| direct_declarator_1
/* Function local variable or type. The typespec to
- our left is the type of the containing function.
+ our left is the type of the containing function.
This should be OK, because function local types
can not be templates, so the return types of their
members will not be mangled. If they are hopefully
state->fill_comp (DEMANGLE_COMPONENT_TRINARY_ARG2, $3, $5)));
}
;
-
+
exp : INT
;
;
/* C++. */
-exp : TRUEKEYWORD
+exp : TRUEKEYWORD
{ struct demangle_component *i;
i = state->make_name ("1", 1);
$$ = state->fill_comp (DEMANGLE_COMPONENT_LITERAL,
}
;
-exp : FALSEKEYWORD
+exp : FALSEKEYWORD
{ struct demangle_component *i;
i = state->make_name ("0", 1);
$$ = state->fill_comp (DEMANGLE_COMPONENT_LITERAL,
c = c_tolower (p[len - 1]);
if (c == 'f')
- {
- len--;
- type = make_builtin_type ("float");
- }
+ {
+ len--;
+ type = make_builtin_type ("float");
+ }
else if (c == 'l')
{
len--;
state->lexptr += 2; \
lvalp->opname = string; \
return token; \
- }
+ }
#define HANDLE_TOKEN3(string, token) \
if (state->lexptr[1] == string[1] && state->lexptr[2] == string[2]) \
state->lexptr += 3; \
lvalp->opname = string; \
return token; \
- }
+ }
/* Read one token, getting characters through LEXPTR. */
{
pstate->parse_error (msg);
}
-
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-/* This was blantantly ripped off the C expression parser, please
- be aware of that as you look at its basic structure -FMB */
+/* This was blantantly ripped off the C expression parser, please
+ be aware of that as you look at its basic structure -FMB */
/* Parse a F77 expression from text in a string,
and return the result as a struct expression pointer.
with include files (<malloc.h> and <stdlib.h> for example) just became
too messy, particularly when such includes can be inserted at random
times by the parser generator. */
-
+
%{
#include "expression.h"
int, YYSTYPE *);
%}
-%type <voidval> exp type_exp start variable
+%type <voidval> exp type_exp start variable
%type <tval> type typebase
%type <tvec> nonempty_typelist
/* %type <bval> block */
%token <sval> STRING_LITERAL
%token <lval> BOOLEAN_LITERAL
-%token <ssym> NAME
+%token <ssym> NAME
%token <tsym> TYPENAME
%token <voidval> COMPLETE
%type <sval> name
E.g. "c" when input_radix==16. Depending on the parse, it will be
turned into a name or into a number. */
-%token <ssym> NAME_OR_INT
+%token <ssym> NAME_OR_INT
%token SIZEOF KIND
%token ERROR
%token REAL_KEYWORD REAL_S4_KEYWORD REAL_S8_KEYWORD REAL_S16_KEYWORD
%token COMPLEX_KEYWORD COMPLEX_S4_KEYWORD COMPLEX_S8_KEYWORD
%token COMPLEX_S16_KEYWORD
-%token BOOL_AND BOOL_OR BOOL_NOT
+%token BOOL_AND BOOL_OR BOOL_NOT
%token SINGLE DOUBLE PRECISION
-%token <lval> CHARACTER
+%token <lval> CHARACTER
%token <sval> DOLLAR_VARIABLE
%left '*' '/'
%right STARSTAR
%right '%'
-%right UNARY
+%right UNARY
%right '('
\f
{ pstate->wrap<fortran_kind_operation> (); }
;
-/* No more explicit array operators, we treat everything in F77 as
- a function call. The disambiguation as to whether we are
- doing a subscript operation or a function call is done
+/* No more explicit array operators, we treat everything in F77 as
+ a function call. The disambiguation as to whether we are
+ doing a subscript operation or a function call is done
later in eval.c. */
-exp : exp '('
+exp : exp '('
{ pstate->start_arglist (); }
- arglist ')'
+ arglist ')'
{
std::vector<operation_up> args
= pstate->pop_vector (pstate->end_arglist ());
arglist : subrange
{ pstate->arglist_len = 1; }
;
-
+
arglist : arglist ',' exp %prec ABOVE_COMMA
{ pstate->arglist_len++; }
;
}
;
-complexnum: exp ',' exp
- { }
+complexnum: exp ',' exp
+ { }
;
exp : '(' complexnum ')'
int array_size;
struct type *follow_type = $1;
struct type *range_type;
-
+
while (!done)
switch (type_stack->pop ())
{
{ $$ = parse_f_type (pstate)->builtin_integer; }
| INT_S8_KEYWORD
{ $$ = parse_f_type (pstate)->builtin_integer_s8; }
- | CHARACTER
+ | CHARACTER
{ $$ = parse_f_type (pstate)->builtin_character; }
- | LOGICAL_S1_KEYWORD
+ | LOGICAL_S1_KEYWORD
{ $$ = parse_f_type (pstate)->builtin_logical_s1; }
| LOGICAL_S2_KEYWORD
{ $$ = parse_f_type (pstate)->builtin_logical_s2; }
{ $$ = parse_f_type (pstate)->builtin_logical; }
| LOGICAL_S8_KEYWORD
{ $$ = parse_f_type (pstate)->builtin_logical_s8; }
- | REAL_KEYWORD
+ | REAL_KEYWORD
{ $$ = parse_f_type (pstate)->builtin_real; }
| REAL_S4_KEYWORD
{ $$ = parse_f_type (pstate)->builtin_real; }
{ $$ = parse_f_type (pstate)->builtin_complex; }
| COMPLEX_S8_KEYWORD
{ $$ = parse_f_type (pstate)->builtin_complex_s8; }
- | COMPLEX_S16_KEYWORD
+ | COMPLEX_S16_KEYWORD
{ $$ = parse_f_type (pstate)->builtin_complex_s16;
if ($$->code () == TYPE_CODE_ERROR)
error (_("unsupported type %s"),
the parser can't tell whether NAME_OR_INT is a name_not_typename (=variable,
=exp) or just an exp. If name_not_typename was ever used in an lvalue
context where only a name could occur, this might be useful.
- | NAME_OR_INT
+ | NAME_OR_INT
*/
;
len -= 2;
}
break;
-
+
case 't':
case 'T':
case 'd':
len -= 2;
}
break;
-
+
default:
base = 8;
break;
}
-
+
while (len-- > 0)
{
c = *p++;
range_error (_("Overflow on numeric constant."));
prevn = n;
}
-
+
/* If the number is too big to be an int, or it's got an l suffix
then it's a long. Work out if this has to be a long by
shifting right and seeing if anything remains, and the
target int size is different to the target long size.
-
+
In the expression below, we could have tested
(n >> gdbarch_int_bit (parse_gdbarch))
to see if it was zero,
unsigned_type = parse_type (par_state)->builtin_unsigned_long;
signed_type = parse_type (par_state)->builtin_long;
}
- else
+ else
{
bits_available = gdbarch_int_bit (par_state->gdbarch ());
unsigned_type = parse_type (par_state)->builtin_unsigned_int;
signed_type = parse_type (par_state)->builtin_int;
- }
+ }
high_bit = ((ULONGEST)1) << (bits_available - 1);
-
+
if (RANGE_CHECK
&& ((n >> 2) >> (bits_available - 2)))
range_error (_("Overflow on numeric constant."));
putithere->typed_val.val = n;
-
+
/* If the high bit of the worked out type is set then this number
has to be unsigned. */
-
- if (unsigned_p || (n & high_bit))
+
+ if (unsigned_p || (n & high_bit))
putithere->typed_val.type = unsigned_type;
- else
+ else
putithere->typed_val.type = signed_type;
-
+
return INT;
}
/* Implementation of a dynamically expandable buffer for processing input
characters acquired through lexptr and building a value to return in
- yylval. Ripped off from ch-exp.y */
+ yylval. Ripped off from ch-exp.y */
static char *tempbuf; /* Current buffer contents */
static int tempbufsize; /* Size of allocated buffer */
tempbuf = (char *) realloc (tempbuf, tempbufsize);
}
-/* Blatantly ripped off from ch-exp.y. This routine recognizes F77
+/* Blatantly ripped off from ch-exp.y. This routine recognizes F77
string-literals.
-
+
Recognize a string literal. A string literal is a nonzero sequence
of characters enclosed in matching single quotes, except that
a single character inside single quotes is a character literal, which
last_was_structop = false;
retry:
-
+
pstate->prev_lexptr = pstate->lexptr;
-
+
tokstart = pstate->lexptr;
/* First of all, let us make sure we are not dealing with the
else if (pstate->parse_completion && saw_structop)
return COMPLETE;
return 0;
-
+
case ' ':
case '\t':
case '\n':
pstate->lexptr++;
goto retry;
-
+
case '\'':
token = match_string_literal ();
if (token != 0)
return (token);
break;
-
+
case '(':
paren_depth++;
pstate->lexptr++;
return c;
-
+
case ')':
if (paren_depth == 0)
return 0;
paren_depth--;
pstate->lexptr++;
return c;
-
+
case ',':
if (pstate->comma_terminates && paren_depth == 0)
return 0;
pstate->lexptr++;
return c;
-
+
case '.':
/* Might be a floating point number. */
if (pstate->lexptr[1] < '0' || pstate->lexptr[1] > '9')
goto symbol; /* Nope, must be a symbol. */
[[fallthrough]];
-
+
case '0':
case '1':
case '2':
int got_dot = 0, got_e = 0, got_d = 0, toktype;
const char *p = tokstart;
int hex = input_radix > 10;
-
+
if (c == '0' && (p[1] == 'x' || p[1] == 'X'))
{
p += 2;
p += 2;
hex = 0;
}
-
+
for (;; ++p)
{
if (!hex && !got_e && (*p == 'e' || *p == 'E'))
pstate->lexptr++;
return c;
}
-
+
if (!(c == '_' || c == '$' || c ==':'
|| (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')))
/* We must have come across a bad character (e.g. ';'). */
error (_("Invalid character '%c' in expression."), c);
-
+
namelen = 0;
for (c = tokstart[namelen];
(c == '_' || c == '$' || c == ':' || (c >= '0' && c <= '9')
- || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'));
+ || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'));
c = tokstart[++namelen]);
-
- /* The token "if" terminates the expression and is NOT
+
+ /* The token "if" terminates the expression and is NOT
removed from the input stream. */
-
+
if (namelen == 2 && tokstart[0] == 'i' && tokstart[1] == 'f')
return 0;
-
+
pstate->lexptr += namelen;
-
+
/* Catch specific keywords. */
for (const auto &keyword : f_keywords)
yylval.sval.ptr = tokstart;
yylval.sval.length = namelen;
-
+
if (*tokstart == '$')
return DOLLAR_VARIABLE;
&& ((tokstart[0] >= 'a' && tokstart[0] < 'a' + input_radix - 10)
|| (tokstart[0] >= 'A' && tokstart[0] < 'A' + input_radix - 10)))
{
- YYSTYPE newlval; /* Its value is ignored. */
+ YYSTYPE newlval; /* Its value is ignored. */
hextype = parse_number (pstate, tokstart, namelen, 0, &newlval);
if (hextype == INT)
{
with include files (<malloc.h> and <stdlib.h> for example) just became
too messy, particularly when such includes can be inserted at random
times by the parser generator. */
-
+
%{
#include "expression.h"
%type <voidval> exp type_exp start set
%type <voidval> variable
%type <tval> type
-%type <bval> block
-%type <sym> fblock
+%type <bval> block
+%type <sym> fblock
%token <lval> INT HEX ERROR
%token <ulval> UINT M2_TRUE M2_FALSE CHAR
%right '^' DOT '[' '('
%right NOT '~'
%left COLONCOLON QID
-/* This is not an actual token ; it is used for precedence.
+/* This is not an actual token ; it is used for precedence.
%right QID
*/
non_empty_arglist
: non_empty_arglist ',' exp %prec ABOVE_COMMA
- { pstate->arglist_len++; }
- ;
+ { pstate->arglist_len++; }
+ ;
/* GDB construct */
exp : '{' type '}' exp %prec UNARY
;
/* This will be used for extensions later. Like adding modules. */
-block : fblock
+block : fblock
{ $$ = $1->value_block (); }
;
SEARCH_VFT, 0).symbol;
$$ = sym;}
;
-
+
/* GDB scope operator */
fblock : block COLONCOLON BLOCKNAME
intvar);
current_type = val->type ();
}
- }
- ;
+ }
+ ;
exp : SIZEOF '(' type ')' %prec UNARY
{
the parser can't tell whether NAME_OR_INT is a name_not_typename (=variable,
=exp) or just an exp. If name_not_typename was ever used in an lvalue
context where only a name could occur, this might be useful.
- | NAME_OR_INT
+ | NAME_OR_INT
*/
;
{
yylval.lval = 1;
free (uptokstart);
- return TRUEKEYWORD;
+ return TRUEKEYWORD;
}
if (strcmp (uptokstart, "SELF") == 0)
{
&& ((tokstart[0] >= 'a' && tokstart[0] < 'a' + input_radix - 10)
|| (tokstart[0] >= 'A' && tokstart[0] < 'A' + input_radix - 10)))
{
- YYSTYPE newlval; /* Its value is ignored. */
+ YYSTYPE newlval; /* Its value is ignored. */
hextype = parse_number (pstate, tokstart, namelen, 0, &newlval);
if (hextype == INT)
{