Skip to content

Commit

Permalink
-enter now supports creating nested namespaces properly
Browse files Browse the repository at this point in the history
  • Loading branch information
gatesphere committed Aug 19, 2014
1 parent 5b11e9d commit 0579181
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion silica.leo
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ expanded="peckj.20131219081918.4271,peckj.20131219081918.4289,peckj.201312190819
<v t="peckj.20131224101941.5049" a="E"><vh>modules</vh>
<v t="peckj.20131224101941.5051"><vh>@file modules/__init__.py</vh></v>
<v t="peckj.20131224101941.5050" a="E"
expanded="peckj.20131224101941.5056,peckj.20140402084328.4761,"><vh>@file modules/home.py</vh></v>
expanded="peckj.20131224101941.5056,peckj.20140402084328.4761,peckj.20140402084328.4760,"><vh>@file modules/home.py</vh></v>
</v>
</v>
<v t="peckj.20131219081918.4173"><vh>Code (silica)</vh>
Expand Down
19 changes: 12 additions & 7 deletions silica/core/sglobals.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,13 +136,18 @@ def new_token(token, value, t_type):
tokentable[ns][token.lower()] = (value, t_type)
#@+node:peckj.20131219081918.4214: *3* new_namespace
def new_namespace(name):
new_namespace_name = '::'.join(current_namespace + [name])
ns = tokentable.get(new_namespace_name, None)
if ns is None:
# namespace doesn't exist, so create it
ns = {}
tokentable[new_namespace_name] = ns
current_namespace.append(name)
if '::' in name:
components = name.split('::')
else:
components = [name]
for namespace in components:
new_namespace_name = '::'.join(current_namespace + [namespace])
ns = tokentable.get(new_namespace_name, None)
if ns is None:
# namespace doesn't exist, so create it
ns = {}
tokentable[new_namespace_name] = ns
current_namespace.append(namespace)
#@+node:peckj.20131218082219.4108: ** lookup methods
#@+node:peckj.20131218082219.4109: *3* get_mode
def get_mode(name):
Expand Down

0 comments on commit 0579181

Please sign in to comment.