<slide>
<title>Collection: Add Token</title>

<blurb>%Zend/zend_language_parser.y%</blurb>
<example inline="2"><![CDATA[
 %token <ident> T_ENUM          "'enum'"
*+%token <ident> T_COLLECTION    "'collection'"*
 %token <ident> T_EXTENDS       "'extends'"
]]></example>

<blurb>%Zend/zend_language_scanner.l%</blurb>

<example><![CDATA[
        RETURN_TOKEN_WITH_IDENT(T_ENUM);
 }

+/*
+ * The collection keyword must be followed by whitespace and another identifier.
+ * This avoids the BC break of using collection in classes, namespaces, functions and constants.
+ */
+<ST_IN_SCRIPTING>"collection"{WHITESPACE_OR_COMMENTS}("extends"|"implements") {
+       yyless(10);
+       RETURN_TOKEN_WITH_STR(T_STRING, 0);
+}
+<ST_IN_SCRIPTING>"collection"{WHITESPACE_OR_COMMENTS}[a-zA-Z_\x80-\xff] {
+       yyless(10);
+       RETURN_TOKEN_WITH_IDENT(T_COLLECTION);
+}
+
]]></example>
</slide>
