Allow qstr's with non-ident chars, construct good identifier for them.

Also, add qstr's for string appearing in unix REPL loop, gross effect
being less allocations for each command run.
This commit is contained in:
Paul Sokolovsky
2014-01-24 00:22:00 +02:00
parent d552db426b
commit ab5d08280b
3 changed files with 22 additions and 12 deletions

View File

@@ -18,7 +18,7 @@ scope_t *scope_new(scope_kind_t kind, mp_parse_node_t pn, qstr source_file, uint
scope->source_file = source_file;
switch (kind) {
case SCOPE_MODULE:
scope->simple_name = QSTR_FROM_STR_STATIC("<module>");
scope->simple_name = MP_QSTR__lt_module_gt_;
break;
case SCOPE_FUNCTION:
case SCOPE_CLASS:
@@ -26,19 +26,19 @@ scope_t *scope_new(scope_kind_t kind, mp_parse_node_t pn, qstr source_file, uint
scope->simple_name = MP_PARSE_NODE_LEAF_ARG(((mp_parse_node_struct_t*)pn)->nodes[0]);
break;
case SCOPE_LAMBDA:
scope->simple_name = QSTR_FROM_STR_STATIC("<lambda>");
scope->simple_name = MP_QSTR__lt_lambda_gt_;
break;
case SCOPE_LIST_COMP:
scope->simple_name = QSTR_FROM_STR_STATIC("<listcomp>");
scope->simple_name = MP_QSTR__lt_listcomp_gt_;
break;
case SCOPE_DICT_COMP:
scope->simple_name = QSTR_FROM_STR_STATIC("<dictcomp>");
scope->simple_name = MP_QSTR__lt_dictcomp_gt_;
break;
case SCOPE_SET_COMP:
scope->simple_name = QSTR_FROM_STR_STATIC("<setcomp>");
scope->simple_name = MP_QSTR__lt_setcomp_gt_;
break;
case SCOPE_GEN_EXPR:
scope->simple_name = QSTR_FROM_STR_STATIC("<genexpr>");
scope->simple_name = MP_QSTR__lt_genexpr_gt_;
break;
default:
assert(0);