micro_asm.py (4512:cfa340f9d12a) | micro_asm.py (4566:a0ec2dee1a1b) |
---|---|
1# Copyright (c) 2003-2005 The Regents of The University of Michigan 2# All rights reserved. 3# 4# Redistribution and use in source and binary forms, with or without 5# modification, are permitted provided that the following conditions are 6# met: redistributions of source code must retain the above copyright 7# notice, this list of conditions and the following disclaimer; 8# redistributions in binary form must reproduce the above copyright --- 218 unchanged lines hidden (view full) --- 227def t_ANY_ID(t): 228 r'[A-Za-z_]\w*' 229 t.type = reserved_map.get(t.value, 'ID') 230 return t 231 232# Parameters are a string of text which don't contain an unescaped statement 233# statement terminator, ie a newline or semi colon. 234def t_params_PARAMS(t): | 1# Copyright (c) 2003-2005 The Regents of The University of Michigan 2# All rights reserved. 3# 4# Redistribution and use in source and binary forms, with or without 5# modification, are permitted provided that the following conditions are 6# met: redistributions of source code must retain the above copyright 7# notice, this list of conditions and the following disclaimer; 8# redistributions in binary form must reproduce the above copyright --- 218 unchanged lines hidden (view full) --- 227def t_ANY_ID(t): 228 r'[A-Za-z_]\w*' 229 t.type = reserved_map.get(t.value, 'ID') 230 return t 231 232# Parameters are a string of text which don't contain an unescaped statement 233# statement terminator, ie a newline or semi colon. 234def t_params_PARAMS(t): |
235 r'([^\n;]|((?<=\\)[\n;]))+' | 235 r'([^\n;\\]|(\\[\n;\\]))+' |
236 t.lineno += t.value.count('\n') | 236 t.lineno += t.value.count('\n') |
237 unescapeParamsRE = re.compile(r'(\\[\n;\\])') 238 def unescapeParams(mo): 239 val = mo.group(0) 240 print "About to sub %s for %s" % (val[1], val) 241 return val[1] 242 print "Looking for matches in %s" % t.value 243 t.value = unescapeParamsRE.sub(unescapeParams, t.value) |
|
237 t.lexer.begin('asm') 238 return t 239 240# Braces enter and exit micro assembly 241def t_INITIAL_LBRACE(t): 242 r'\{' 243 t.lexer.begin('asm') 244 return t --- 240 unchanged lines hidden --- | 244 t.lexer.begin('asm') 245 return t 246 247# Braces enter and exit micro assembly 248def t_INITIAL_LBRACE(t): 249 r'\{' 250 t.lexer.begin('asm') 251 return t --- 240 unchanged lines hidden --- |