зеркало из https://github.com/mozilla/gecko-dev.git
Bug 762758 - Implement underscore-escape in xpidl parser r=khuey
This commit is contained in:
Родитель
86293f97fa
Коммит
7625c2a0a5
|
@ -198,6 +198,8 @@ class NameMap(object):
|
||||||
def set(self, object):
|
def set(self, object):
|
||||||
if object.name in builtinMap:
|
if object.name in builtinMap:
|
||||||
raise IDLError("name '%s' is a builtin and cannot be redeclared" % (object.name), object.location)
|
raise IDLError("name '%s' is a builtin and cannot be redeclared" % (object.name), object.location)
|
||||||
|
if object.name.startswith("_"):
|
||||||
|
object.name = object.name[1:]
|
||||||
if object.name in self._d:
|
if object.name in self._d:
|
||||||
old = self._d[object.name]
|
old = self._d[object.name]
|
||||||
if old == object: return
|
if old == object: return
|
||||||
|
@ -1118,7 +1120,7 @@ class IDLParser(object):
|
||||||
t_IID.__doc__ = r'%(c)s{8}-%(c)s{4}-%(c)s{4}-%(c)s{4}-%(c)s{12}' % {'c': hexchar}
|
t_IID.__doc__ = r'%(c)s{8}-%(c)s{4}-%(c)s{4}-%(c)s{4}-%(c)s{12}' % {'c': hexchar}
|
||||||
|
|
||||||
def t_IDENTIFIER(self, t):
|
def t_IDENTIFIER(self, t):
|
||||||
r'(unsigned\ long\ long|unsigned\ short|unsigned\ long|long\ long)(?![A-Za-z][A-Za-z_0-9])|[A-Za-z][A-Za-z_0-9]*'
|
r'(unsigned\ long\ long|unsigned\ short|unsigned\ long|long\ long)(?!_?[A-Za-z][A-Za-z_0-9])|_?[A-Za-z][A-Za-z_0-9]*'
|
||||||
t.type = self.keywords.get(t.value, 'IDENTIFIER')
|
t.type = self.keywords.get(t.value, 'IDENTIFIER')
|
||||||
return t
|
return t
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче