Browse files

string constants are no longer valid; http://lists.w3.org/Archives/Pu…

  • Loading branch information...
1 parent ed8b171 commit c078e2696615f5fd8dbcfff2f6a4cae6a75129fc @dontcallmedom committed Dec 14, 2011
View
3 doc/widlproc.html
@@ -655,7 +655,7 @@ <h3 id="html">HTML in comments</h3>
syntax.
The <em>Type</em> specifies the constant's type, the
<em>name</em> attribute specifies the constant's name, and the
-<em>value</em> attribute specifies its value for non-string values, and <em>stringvalue</em> for string values.
+<em>value</em> attribute specifies its value.
The <em>descriptive></em> element
provides the <em>Const</em>'s documentation if any.
The <em>id</em> attribute specifies the absolute scoped name of the const.
@@ -665,7 +665,6 @@ <h3 id="html">HTML in comments</h3>
&lt;!ELEMENT Const (webidl, descriptive?, ExtendedAttributeList?, Type) >
&lt;!ATTLIST Const name CDATA #REQUIRED
value CDATA #IMPLIED
- stringvalue CDATA #IMPLIED
id CDATA #REQUIRED >
</pre>
View
32 src/parse.c
@@ -676,7 +676,7 @@ parseattributeoroperation(struct tok *tok, struct node *eal)
}
/***********************************************************************
- * parseconstexpr : parse ConstExpr
+ * parseconstexpr : parse ConstValue
*
* Enter: tok = next token
* node
@@ -692,7 +692,6 @@ parseconstexpr (struct tok *tok, struct node *node) {
case TOK_false:
case TOK_INTEGER:
case TOK_FLOAT:
- case TOK_STRING:
case TOK_null:
break;
default:
@@ -712,6 +711,32 @@ parseconstexpr (struct tok *tok, struct node *node) {
}
/***********************************************************************
+ * parsedefaultvalue : parse DefaultValue
+ *
+ * Enter: tok = next token
+ * node
+ *
+ * Return: node updated with value
+ * tok updated
+ */
+static struct node *
+parsedefaultvalue (struct tok *tok, struct node *node) {
+ char *s;
+ if (tok->type == TOK_STRING) {
+ s = memalloc(tok->len + 1);
+ memcpy(s, tok->start, tok->len);
+ s[tok->len] = 0;
+ addnode(node, newattr("stringvalue", s));
+ lexnocomment();
+ return node;
+ } else {
+ return parseconstexpr(tok, node);
+ }
+}
+
+
+
+/***********************************************************************
* parsedictionarymember : parse DictionaryMember
*
* Enter: tok = next token
@@ -732,7 +757,7 @@ parsedictionarymember(struct tok *tok, struct node *eal)
// Optional value
if (tok->type == '=') {
tok = lexnocomment();
- node = parseconstexpr(tok, node);
+ node = parsedefaultvalue(tok, node);
}
return node;
}
@@ -759,7 +784,6 @@ parseconst(struct tok *tok, struct node *eal)
case TOK_octet:
case TOK_float:
case TOK_double:
- case TOK_DOMString:
case TOK_unsigned:
case TOK_short:
case TOK_long:
View
1 test/invalid/error/stringconstants.idl
@@ -0,0 +1 @@
+invalid/idl/stringconstants.idl: 2: at 'DOMString': expected acceptable constant type
View
3 test/invalid/idl/stringconstants.idl
@@ -0,0 +1,3 @@
+interface Util {
+ const DOMString hello = "world";
+};
View
3 test/valid/idl/constants.widl
@@ -4,9 +4,6 @@ interface Util {
const octet LF = 10;
const unsigned long BIT_MASK = 0x0000fc00;
const float AVOGADRO = 6.022e23;
- const DOMString hello = "world";
- const DOMString? nullString = "null";
- const DOMString? nullable = null;
};
exception Error {
View
15 test/valid/xml/constants.widlprocxml
@@ -7,9 +7,6 @@
const octet LF = 10;
const unsigned long BIT_MASK = 0x0000fc00;
const float AVOGADRO = 6.022e23;
- const DOMString hello = &quot;world&quot;;
- const DOMString? nullString = &quot;null&quot;;
- const DOMString? nullable = null;
};</webidl>
<Const name="DEBUG" value="false" id="::Util::DEBUG">
<webidl> const boolean DEBUG = false;</webidl>
@@ -27,18 +24,6 @@
<webidl> const float AVOGADRO = 6.022e23;</webidl>
<Type type="float"/>
</Const>
- <Const name="hello" stringvalue="world" id="::Util::hello">
- <webidl> const DOMString hello = &quot;world&quot;;</webidl>
- <Type type="DOMString"/>
- </Const>
- <Const name="nullString" stringvalue="null" id="::Util::nullString">
- <webidl> const DOMString? nullString = &quot;null&quot;;</webidl>
- <Type type="DOMString" nullable="nullable"/>
- </Const>
- <Const name="nullable" value="null" id="::Util::nullable">
- <webidl> const DOMString? nullable = null;</webidl>
- <Type type="DOMString" nullable="nullable"/>
- </Const>
</Interface>
<Exception name="Error" id="::Error">
<webidl>exception Error {

0 comments on commit c078e26

Please sign in to comment.