diff options
| author | xXx-caillou-xXx | 2017-12-21 10:58:59 +0100 |
|---|---|---|
| committer | jvoisin | 2017-12-21 10:58:58 +0100 |
| commit | 58d5e50ef33bbea5d1620c2a51562f68e3a0445b (patch) | |
| tree | 009da2d38a337b4d5a3af376454a3fd7e2c33278 /src | |
| parent | f2a87d34f6469af1715608412fc5454e177d0901 (diff) | |
Minor code cleanup
Diffstat (limited to 'src')
| -rw-r--r-- | src/sp_var_parser.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/sp_var_parser.c b/src/sp_var_parser.c index 6d80b39..f5d54eb 100644 --- a/src/sp_var_parser.c +++ b/src/sp_var_parser.c | |||
| @@ -62,7 +62,9 @@ static int create_var(sp_tree *tree, const char *restrict value, | |||
| 62 | var_node->next = NULL; | 62 | var_node->next = NULL; |
| 63 | var_node->idx = NULL; | 63 | var_node->idx = NULL; |
| 64 | var_node->type = _type; | 64 | var_node->type = _type; |
| 65 | // Check if a constant is a variable | 65 | /* We consider `$` as part of the variable name, to tell them appart from |
| 66 | * php's constant | ||
| 67 | */ | ||
| 66 | if (value && value[0] == VARIABLE_TOKEN && _type == CONSTANT) { | 68 | if (value && value[0] == VARIABLE_TOKEN && _type == CONSTANT) { |
| 67 | var_node->type = VAR; | 69 | var_node->type = VAR; |
| 68 | } | 70 | } |
| @@ -155,7 +157,7 @@ static int is_token_valid(sp_node_t *tokens_list, elem_type ignore, | |||
| 155 | } | 157 | } |
| 156 | 158 | ||
| 157 | static sp_tree *parse_tokens(const char * restrict str, | 159 | static sp_tree *parse_tokens(const char * restrict str, |
| 158 | sp_node_t *tokens_list) { | 160 | sp_node_t *tokens_list) { |
| 159 | size_t pos = 0; | 161 | size_t pos = 0; |
| 160 | int array_count = 0, pos_idx_start = -1; | 162 | int array_count = 0, pos_idx_start = -1; |
| 161 | elem_type ignore = 0; | 163 | elem_type ignore = 0; |
