You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by oh...@apache.org on 2012/03/16 20:55:05 UTC

svn commit: r1301722 - in /commons/proper/configuration/trunk/src: changes/changes.xml main/javacc/PropertyListParser.jj test/resources/test.plist

Author: oheger
Date: Fri Mar 16 19:55:04 2012
New Revision: 1301722

URL: http://svn.apache.org/viewvc?rev=1301722&view=rev
Log:
[CONFIGURATION-477] PropertyListConfiguration now supports C-style comments.

Modified:
    commons/proper/configuration/trunk/src/changes/changes.xml
    commons/proper/configuration/trunk/src/main/javacc/PropertyListParser.jj
    commons/proper/configuration/trunk/src/test/resources/test.plist

Modified: commons/proper/configuration/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/changes/changes.xml?rev=1301722&r1=1301721&r2=1301722&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/changes/changes.xml (original)
+++ commons/proper/configuration/trunk/src/changes/changes.xml Fri Mar 16 19:55:04 2012
@@ -31,6 +31,10 @@
         Variable substitution in configuration sources declared in a definition
         file for DefaultConfigurationBuilder now works across multiple sources.
       </action>
+      <action dev="oheger" type="fix" issue="CONFIGURATION-477">
+        PropertyListConfiguration now can deal with C-style comments in plist
+        configuration files. Both block and single-line comments are supported.
+      </action>
     </release>
 
     <release version="1.8" date="2012-02-04"

Modified: commons/proper/configuration/trunk/src/main/javacc/PropertyListParser.jj
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/javacc/PropertyListParser.jj?rev=1301722&r1=1301721&r2=1301722&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/main/javacc/PropertyListParser.jj (original)
+++ commons/proper/configuration/trunk/src/main/javacc/PropertyListParser.jj Fri Mar 16 19:55:04 2012
@@ -115,6 +115,16 @@ PARSER_END(PropertyListParser)
 
 SKIP : { " " | "\t" | "\n" | "\r" }
 
+// Handle comments
+MORE : { "/*": IN_COMMENT }
+< IN_COMMENT > MORE : { <  ~[] > }
+< IN_COMMENT > SKIP : { "*/": DEFAULT } 
+
+MORE : { "//": IN_SINGLE_LINE_COMMENT }
+< IN_SINGLE_LINE_COMMENT > SPECIAL_TOKEN : {
+    < SINGLE_LINE_COMMENT: "\n"|"\r"|"\r\n" > : DEFAULT }
+< IN_SINGLE_LINE_COMMENT > MORE : { <  ~[] > } 
+
 TOKEN : { <ARRAY_BEGIN     : "(" > }
 TOKEN : { <ARRAY_END       : ")" > }
 TOKEN : { <ARRAY_SEPARATOR : "," > }

Modified: commons/proper/configuration/trunk/src/test/resources/test.plist
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/resources/test.plist?rev=1301722&r1=1301721&r2=1301722&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/resources/test.plist (original)
+++ commons/proper/configuration/trunk/src/test/resources/test.plist Fri Mar 16 19:55:04 2012
@@ -1,9 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 {
     simple-string = string1;
     quoted-string = "string2";
     quoted-string2 = "this is a string";
     "complex-string" = "this is a \"complex\" string {(=,;)}";
 
+    // This is a test single-line comment
     array = ( "value1", "value2", "value3" );
 
     empty-array = ();