primary.c (match_logical_constant_string): New function to match a ".true." or a ".false.".
* primary.c (match_logical_constant_string): New function to match a ".true." or a ".false.". (match_logical_constant): Use it instead of gfc_match_strings. From-SVN: r127620
This commit is contained in:
parent
db07c51013
commit
500f8f7b5f
2 changed files with 42 additions and 7 deletions
|
@ -1,3 +1,9 @@
|
|||
2007-08-18 Roger Sayle <roger@eyesopen.com>
|
||||
|
||||
* primary.c (match_logical_constant_string): New function to match
|
||||
a ".true." or a ".false.".
|
||||
(match_logical_constant): Use it instead of gfc_match_strings.
|
||||
|
||||
2007-08-18 Paul Thomas <pault@gcc.gnu.org>
|
||||
Janus Weil <jaydub66@gmail.com>
|
||||
|
||||
|
|
|
@ -977,21 +977,50 @@ no_match:
|
|||
}
|
||||
|
||||
|
||||
/* Match a .true. or .false. Returns 1 if a .true. was found,
|
||||
0 if a .false. was found, and -1 otherwise. */
|
||||
static int
|
||||
match_logical_constant_string (void)
|
||||
{
|
||||
locus orig_loc = gfc_current_locus;
|
||||
|
||||
gfc_gobble_whitespace ();
|
||||
if (gfc_next_char () == '.')
|
||||
{
|
||||
int ch = gfc_next_char();
|
||||
if (ch == 'f')
|
||||
{
|
||||
if (gfc_next_char () == 'a'
|
||||
&& gfc_next_char () == 'l'
|
||||
&& gfc_next_char () == 's'
|
||||
&& gfc_next_char () == 'e'
|
||||
&& gfc_next_char () == '.')
|
||||
/* Matched ".false.". */
|
||||
return 0;
|
||||
}
|
||||
else if (ch == 't')
|
||||
{
|
||||
if (gfc_next_char () == 'r'
|
||||
&& gfc_next_char () == 'u'
|
||||
&& gfc_next_char () == 'e'
|
||||
&& gfc_next_char () == '.')
|
||||
/* Matched ".true.". */
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
gfc_current_locus = orig_loc;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Match a .true. or .false. */
|
||||
|
||||
static match
|
||||
match_logical_constant (gfc_expr **result)
|
||||
{
|
||||
static mstring logical_ops[] = {
|
||||
minit (".false.", 0),
|
||||
minit (".true.", 1),
|
||||
minit (NULL, -1)
|
||||
};
|
||||
|
||||
gfc_expr *e;
|
||||
int i, kind;
|
||||
|
||||
i = gfc_match_strings (logical_ops);
|
||||
i = match_logical_constant_string ();
|
||||
if (i == -1)
|
||||
return MATCH_NO;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue