[Wisp-cvs] wisp/users/dig tran.py,1.61,1.62
Status: Alpha
Brought to you by:
digg
From: <di...@us...> - 2003-04-22 15:53:04
|
Update of /cvsroot/wisp/wisp/users/dig In directory sc8-pr-cvs1:/tmp/cvs-serv2935 Modified Files: tran.py Log Message: minor cleanup Index: tran.py =================================================================== RCS file: /cvsroot/wisp/wisp/users/dig/tran.py,v retrieving revision 1.61 retrieving revision 1.62 diff -u -d -r1.61 -r1.62 --- tran.py 22 Apr 2003 15:47:59 -0000 1.61 +++ tran.py 22 Apr 2003 15:52:58 -0000 1.62 @@ -76,6 +76,8 @@ if tok == '': tok = None elif tok[:2] == '#o': tok = Integer_Literal(string.atol(tok[2:], 8)) elif tok[:2] == '#x': tok = Integer_Literal(string.atol(tok[2:], 16)) + elif tok[:2] == '#/' and len(tok) == 3: + tok = Integer_Literal(ord(tok[2])) else: try: tok = Integer_Literal(string.atol(tok, 10)) except: pass @@ -171,8 +173,6 @@ global Regstack if isinstance(tok, Integer_Literal): Regstack.append(tok) - elif isinstance(tok, str) and tok[:2] == '#/' and len(tok) == 3: - Regstack.append(Integer_Literal(ord(tok[2]))) elif isinstance(tok, str): root = tok mg = match_generator(root) @@ -192,13 +192,8 @@ m[1](tok) else: m[1]() - elif mtype == 'macro': - prep.push_macro(m[1]) - elif mtype == 'simple': - Regstack.append(m[1]) - elif mtype == 'include': - fn = prep.get_token() + '.tran' - prep.push_file(fn) + elif mtype == 'macro': prep.push_macro(m[1]) + elif mtype == 'simple': Regstack.append(m[1]) else: raise 'Unknown meaning type in', `Meaning[tok]` else: raise 'bad token', tok @@ -215,7 +210,6 @@ Meaning = { 'any': ('simple', Class_Marker('any')), 'const': ('simple', Class_Marker('const')), - 'include': ('include',), 'int': ('simple', Class_Marker('int')), 'lit': ('simple', Class_Marker('lit')), 'reg': ('simple', Generic_Register), @@ -302,6 +296,9 @@ minor reg Regstack.append(Integer_Literal(Regstack.pop()[-1])) + +include|name + prep.push_file(str(name) + '.tran') ref|name Regstack.append(Symbol_Literal('&' + name)) |