src/variables.cc

changeset 86
43fe4be38a58
parent 85
264a61e9eba0
child 87
8f65914e7046
equal deleted inserted replaced
85:264a61e9eba0 86:43fe4be38a58
27 */ 27 */
28 28
29 #include <stdio.h> 29 #include <stdio.h>
30 #include <stdlib.h> 30 #include <stdlib.h>
31 #include <string.h> 31 #include <string.h>
32 #include "object_writer.h"
33 #include "stringtable.h" 32 #include "stringtable.h"
34 #include "variables.h" 33 #include "variables.h"
35 #include "parser.h" 34 #include "parser.h"
36 35
37 list<script_variable> g_GlobalVariables; 36 list<script_variable> g_GlobalVariables;
47 error ("variables cannot be string\n"); 46 error ("variables cannot be string\n");
48 47
49 // Check that the variable is valid 48 // Check that the variable is valid
50 if (find_command_by_name (name)) 49 if (find_command_by_name (name))
51 error ("name of variable-to-be `%s` conflicts with that of a command", name.chars()); 50 error ("name of variable-to-be `%s` conflicts with that of a command", name.chars());
52
53 if (IsKeyword (name))
54 error ("name of variable-to-be `%s` is a keyword", name.chars());
55 51
56 if (g_GlobalVariables.size() >= g_max_global_vars) 52 if (g_GlobalVariables.size() >= g_max_global_vars)
57 error ("too many global variables!"); 53 error ("too many global variables!");
58 54
59 for (int i = 0; i < g_GlobalVariables.size(); i++) 55 for (int i = 0; i < g_GlobalVariables.size(); i++)

mercurial