Sync webidl-parser to m-c to pick up Bug 742141. r=me a=me

This commit is contained in:
Kyle Huey 2012-05-01 23:23:45 -04:00
parent eb98c92b84
commit 258b1d3648
3 changed files with 27 additions and 8 deletions

View File

@ -1659,7 +1659,7 @@ class IDLMethod(IDLInterfaceMember, IDLScope):
class Tokenizer(object):
tokens = [
"INTEGER",
"FLOAT",
"FLOATLITERAL",
"IDENTIFIER",
"STRING",
"WHITESPACE",
@ -1679,7 +1679,7 @@ class Tokenizer(object):
filename=self._filename))
return t
def t_FLOAT(self, t):
def t_FLOATLITERAL(self, t):
r'-?(([0-9]+\.[0-9]*|[0-9]*\.[0-9]+)([Ee][+-]?[0-9]+)?|[0-9]+[Ee][+-]?[0-9]+)'
assert False
return t
@ -1741,7 +1741,7 @@ class Tokenizer(object):
"boolean": "BOOLEAN",
"byte": "BYTE",
"double": "DOUBLE",
"float": "FLOAT_",
"float": "FLOAT",
"long": "LONG",
"object": "OBJECT",
"octet": "OCTET",
@ -2043,7 +2043,7 @@ class Parser(Tokenizer):
def p_ConstValueFloat(self, p):
"""
ConstValue : FLOAT
ConstValue : FLOATLITERAL
"""
assert False
pass
@ -2464,7 +2464,7 @@ class Parser(Tokenizer):
def p_Other(self, p):
"""
Other : INTEGER
| FLOAT
| FLOATLITERAL
| IDENTIFIER
| STRING
| OTHER
@ -2489,7 +2489,7 @@ class Parser(Tokenizer):
| DOUBLE
| EXCEPTION
| FALSE
| FLOAT_
| FLOAT
| GETTER
| IMPLEMENTS
| INHERIT

View File

@ -21,7 +21,9 @@ def WebIDLTest(parser, harness):
("::TestAttr%s::rstr", "rstr", "String%s", True),
("::TestAttr%s::obj", "obj", "Object%s", False),
("::TestAttr%s::robj", "robj", "Object%s", True),
("::TestAttr%s::object", "object", "Object%s", False)]
("::TestAttr%s::object", "object", "Object%s", False),
("::TestAttr%s::f", "f", "Float%s", False),
("::TestAttr%s::rf", "rf", "Float%s", True)]
parser.parse("""
interface TestAttr {
@ -46,6 +48,8 @@ def WebIDLTest(parser, harness):
attribute object obj;
readonly attribute object robj;
attribute object _object;
attribute float f;
readonly attribute float rf;
};
interface TestAttrNullable {
@ -70,6 +74,8 @@ def WebIDLTest(parser, harness):
attribute object? obj;
readonly attribute object? robj;
attribute object? _object;
attribute float? f;
readonly attribute float? rf;
};
interface TestAttrArray {
@ -94,6 +100,8 @@ def WebIDLTest(parser, harness):
attribute object[] obj;
readonly attribute object[] robj;
attribute object[] _object;
attribute float[] f;
readonly attribute float[] rf;
};
interface TestAttrNullableArray {
@ -118,6 +126,8 @@ def WebIDLTest(parser, harness):
attribute object[]? obj;
readonly attribute object[]? robj;
attribute object[]? _object;
attribute float[]? f;
readonly attribute float[]? rf;
};
interface TestAttrArrayOfNullableTypes {
@ -142,6 +152,8 @@ def WebIDLTest(parser, harness):
attribute object?[] obj;
readonly attribute object?[] robj;
attribute object?[] _object;
attribute float?[] f;
readonly attribute float?[] rf;
};
interface TestAttrNullableArrayOfNullableTypes {
@ -166,6 +178,8 @@ def WebIDLTest(parser, harness):
attribute object?[]? obj;
readonly attribute object?[]? robj;
attribute object?[]? _object;
attribute float?[]? f;
readonly attribute float?[]? rf;
};
""")

View File

@ -15,6 +15,7 @@ def WebIDLTest(parser, harness):
object getObject();
void setObject(object arg1);
void setAny(any arg1);
float doFloats(float arg1);
};
""")
@ -27,7 +28,7 @@ def WebIDLTest(parser, harness):
"Should be an IDLInterface")
harness.check(iface.identifier.QName(), "::TestMethods", "Interface has the right QName")
harness.check(iface.identifier.name, "TestMethods", "Interface has the right name")
harness.check(len(iface.members), 12, "Expect 12 members")
harness.check(len(iface.members), 13, "Expect 13 members")
methods = iface.members
@ -112,3 +113,7 @@ def WebIDLTest(parser, harness):
"setAny",
[("Void",
[("::TestMethods::setAny::arg1", "arg1", "Any", False, False)])])
checkMethod(methods[12], "::TestMethods::doFloats",
"doFloats",
[("Float",
[("::TestMethods::doFloats::arg1", "arg1", "Float", False, False)])])