Allow underscores in identifiers.
authorJens Vollinga <jensv@nikhef.nl>
Wed, 15 Jul 2009 03:19:07 +0000 (05:19 +0200)
committerJens Vollinga <jensv@nikhef.nl>
Wed, 15 Jul 2009 06:31:40 +0000 (08:31 +0200)
(cherry picked from commit 619879b5bd86a99334affe1f05d17616cc2c1898)

ginac/parser/lexer.cpp

index 1cc2f49..cc3be3d 100644 (file)
@@ -43,12 +43,12 @@ int lexer::gettok()
        // Skip any whitespace.
        c = skipspace(input, c, line_num);
 
-       // identifier: [a-zA-Z][a-zA-Z0-9]*
+       // identifier: [a-zA-Z][a-zA-Z0-9_]*
        if (isalpha(c)) { 
                str = c;
                do {
                        c = input->get();
-                       if (isalnum(c))
+                       if ( isalnum(c) || c=='_' )
                                str += c;
                        else
                                break;