changeset 1962:d329b8ea86e8

[project @ 1996-02-16 04:24:22 by jwe]
author jwe
date Fri, 16 Feb 1996 04:24:56 +0000
parents 41ff3c38af7e
children 665a44bb6a56
files src/symtab.cc src/symtab.h
diffstat 2 files changed, 19 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/symtab.cc
+++ b/src/symtab.cc
@@ -29,6 +29,8 @@
 #include <config.h>
 #endif
 
+#include <cctype>
+
 #include "oct-glob.h"
 #include "str-vec.h"
 
@@ -1156,6 +1158,21 @@
   return h;
 }
 
+// Return nonzero if S is a valid identifier.
+
+int
+valid_identifier (const char *s)
+{
+  if (! s || ! (isalnum (*s) || *s == '_'))
+     return 0;
+
+  while (*++s != '\0')
+    if (! (isalnum (*s) || *s == '_'))
+      return 0;
+
+  return 1;
+}
+
 /*
 ;;; Local Variables: ***
 ;;; mode: C++ ***
--- a/src/symtab.h
+++ b/src/symtab.h
@@ -328,6 +328,8 @@
   symbol_record table[HASH_TABLE_SIZE];
 };
 
+extern int valid_identifier (const char *s);
+
 #endif
 
 /*