[svn:parrot] r35749 - in trunk/languages/pipp: docs src/pct

[email protected]
Newsgroups perl.cvs.parrot
Message-ID <[email protected]>
Author: bernhard
Date: Mon Jan 19 05:13:00 2009
New Revision: 35749

Modified:
   trunk/languages/pipp/docs/pipp.pod
   trunk/languages/pipp/src/pct/grammar.pg

Log:
[Pipp]mark leading backslash in 'name', leading backslash is not allowed
in namespace declaration

Modified: trunk/languages/pipp/docs/pipp.pod
==============================================================================
--- trunk/languages/pipp/docs/pipp.pod	(original)
+++ trunk/languages/pipp/docs/pipp.pod	Mon Jan 19 05:13:00 2009
@@ -31,8 +31,6 @@
 
 =item Only bracketed version of namespaces. No check for unnamespaced code.
 
-=item A leading backslash is allowed in namespace declarations.
-
 =item 'const' outside a declared namespace is allowed.
 
 =back

Modified: trunk/languages/pipp/src/pct/grammar.pg
==============================================================================
--- trunk/languages/pipp/src/pct/grammar.pg	(original)
+++ trunk/languages/pipp/src/pct/grammar.pg	Mon Jan 19 05:13:00 2009
@@ -253,14 +253,17 @@
 
 token method_name              { <ident> }
 
-token namespace_name           { <.name> }
+token namespace_name           { <ns_component>* <ident> }
 
 token name {
-    | <ident> <morename>*    # no leading backslash
-    | <morename>+            # leading backslash
+    <leading_backslash=ns_sep>?           # a leading backslash is optional, but significant
+    <ns_component>*                       # namespace
+    <ident>                               # identifier is required
 }
 
-token morename                 { '\\' <ident> }
+token ns_sep                   { '\\' }   # yes, PHP 5.3 uses backslash as the namespace separator
+
+token ns_component             { <ident> <.ns_sep> }
 
 token var_name                 { '$' <ident> }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.