# HG changeset patch # User jwe # Date 824444696 0 # Node ID d329b8ea86e8b30d8c245afc8ea713baebfbd960 # Parent 41ff3c38af7e4727ad71ab8352d0bd845851fc56 [project @ 1996-02-16 04:24:22 by jwe] diff --git a/src/symtab.cc b/src/symtab.cc --- a/src/symtab.cc +++ b/src/symtab.cc @@ -29,6 +29,8 @@ #include #endif +#include + #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++ *** diff --git a/src/symtab.h b/src/symtab.h --- 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 /*