aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/fortran/ChangeLog6
-rw-r--r--gcc/fortran/primary.c43
2 files changed, 42 insertions, 7 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index f7baaa8..0a27333 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -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>
diff --git a/gcc/fortran/primary.c b/gcc/fortran/primary.c
index 199cc59..2be27d7 100644
--- a/gcc/fortran/primary.c
+++ b/gcc/fortran/primary.c
@@ -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;