aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/module.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/fortran/module.c')
-rw-r--r--gcc/fortran/module.c42
1 files changed, 41 insertions, 1 deletions
diff --git a/gcc/fortran/module.c b/gcc/fortran/module.c
index 714fbd9..33e7df7 100644
--- a/gcc/fortran/module.c
+++ b/gcc/fortran/module.c
@@ -1234,6 +1234,13 @@ get_module_locus (module_locus *m)
m->pos = module_pos;
}
+/* Peek at the next character in the module. */
+
+static int
+module_peek_char (void)
+{
+ return module_content[module_pos];
+}
/* Get the next character in the module, updating our reckoning of
where we are. */
@@ -1314,7 +1321,19 @@ parse_string (void)
static void
parse_integer (int c)
{
- atom_int = c - '0';
+ int sign = 1;
+
+ atom_int = 0;
+ switch (c)
+ {
+ case ('-'):
+ sign = -1;
+ case ('+'):
+ break;
+ default:
+ atom_int = c - '0';
+ break;
+ }
for (;;)
{
@@ -1328,6 +1347,7 @@ parse_integer (int c)
atom_int = 10 * atom_int + c - '0';
}
+ atom_int *= sign;
}
@@ -1401,6 +1421,16 @@ parse_atom (void)
parse_integer (c);
return ATOM_INTEGER;
+ case '+':
+ case '-':
+ if (ISDIGIT (module_peek_char ()))
+ {
+ parse_integer (c);
+ return ATOM_INTEGER;
+ }
+ else
+ bad_module ("Bad name");
+
case 'a':
case 'b':
case 'c':
@@ -1504,6 +1534,16 @@ peek_atom (void)
module_unget_char ();
return ATOM_INTEGER;
+ case '+':
+ case '-':
+ if (ISDIGIT (module_peek_char ()))
+ {
+ module_unget_char ();
+ return ATOM_INTEGER;
+ }
+ else
+ bad_module ("Bad name");
+
case 'a':
case 'b':
case 'c':