isa_parser.py (6728:5037062422c8) | isa_parser.py (6866:0dd40ed15354) |
---|---|
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 --- 114 unchanged lines hidden (view full) --- 123 124 def t_ID(self, t): 125 r'[A-Za-z_]\w*' 126 t.type = self.reserved_map.get(t.value, 'ID') 127 return t 128 129 # Integer literal 130 def t_INTLIT(self, 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 --- 114 unchanged lines hidden (view full) --- 123 124 def t_ID(self, t): 125 r'[A-Za-z_]\w*' 126 t.type = self.reserved_map.get(t.value, 'ID') 127 return t 128 129 # Integer literal 130 def t_INTLIT(self, t): |
131 r'(0x[\da-fA-F]+)|\d+' | 131 r'-?(0x[\da-fA-F]+)|\d+' |
132 try: 133 t.value = int(t.value,0) 134 except ValueError: 135 error(t.lexer.lineno, 'Integer value "%s" too large' % t.value) 136 t.value = 0 137 return t 138 139 # String literal. Note that these use only single quotes, and --- 1905 unchanged lines hidden --- | 132 try: 133 t.value = int(t.value,0) 134 except ValueError: 135 error(t.lexer.lineno, 'Integer value "%s" too large' % t.value) 136 t.value = 0 137 return t 138 139 # String literal. Note that these use only single quotes, and --- 1905 unchanged lines hidden --- |