]> git.rm.cloudns.org Git - xonotic/gmqcc.git/commitdiff
guard ]] with lex->flags.noops
authorWolfgang Bumiller <blub@speed.at>
Sat, 22 Dec 2012 19:41:02 +0000 (20:41 +0100)
committerWolfgang Bumiller <blub@speed.at>
Sat, 22 Dec 2012 19:41:02 +0000 (20:41 +0100)
lexer.c

diff --git a/lexer.c b/lexer.c
index 17fe093be8825206f85fa804013ef618d91b5123..01842cc0f5df9dc3b9ca0e912d8c87acb57c7fe5 100644 (file)
--- a/lexer.c
+++ b/lexer.c
@@ -1135,14 +1135,16 @@ int lex_do(lex_file *lex)
                 return (lex->tok.ttype = TOKEN_OPERATOR);
 
         case ']':
-            nextch = lex_getch(lex);
-            if (nextch == ']') {
-                lex_tokench(lex, ch);
-                lex_tokench(lex, nextch);
-                lex_endtoken(lex);
-                return (lex->tok.ttype = TOKEN_ATTRIBUTE_CLOSE);
+            if (lex->flags.noops) {
+                nextch = lex_getch(lex);
+                if (nextch == ']') {
+                    lex_tokench(lex, ch);
+                    lex_tokench(lex, nextch);
+                    lex_endtoken(lex);
+                    return (lex->tok.ttype = TOKEN_ATTRIBUTE_CLOSE);
+                }
+                lex_ungetch(lex, nextch);
             }
-            lex_ungetch(lex, nextch);
             /* FALL THROUGH */
         case ')':
         case ';':