This is an automated email from the ASF dual-hosted git repository.

pauls pushed a commit to branch SLING-7227
in repository 
https://gitbox.apache.org/repos/asf/sling-org-apache-sling-repoinit-parser.git


The following commit(s) were added to refs/heads/SLING-7227 by this push:
     new c6ef765  SLING-7227: Change syntax of abstract privilege creation 
slightly.
c6ef765 is described below

commit c6ef76567dc2fb9107f3cb1912263e0187cd1af6
Author: Karl Pauls <[email protected]>
AuthorDate: Fri Jan 26 14:26:49 2018 +0100

    SLING-7227: Change syntax of abstract privilege creation slightly.
---
 .../sling/repoinit/parser/operations/RegisterPrivilege.java       | 8 +++++---
 src/main/javacc/RepoInitGrammar.jjt                               | 3 +--
 src/test/resources/testcases/test-42-output.txt                   | 6 +++---
 src/test/resources/testcases/test-42.txt                          | 6 +++---
 4 files changed, 12 insertions(+), 11 deletions(-)

diff --git 
a/src/main/java/org/apache/sling/repoinit/parser/operations/RegisterPrivilege.java
 
b/src/main/java/org/apache/sling/repoinit/parser/operations/RegisterPrivilege.java
index 7c6605e..422b8fe 100644
--- 
a/src/main/java/org/apache/sling/repoinit/parser/operations/RegisterPrivilege.java
+++ 
b/src/main/java/org/apache/sling/repoinit/parser/operations/RegisterPrivilege.java
@@ -57,11 +57,13 @@ public class RegisterPrivilege extends Operation {
     }
 
     public String toString() {
-        StringBuilder builder = new StringBuilder("register privilege ");
-        builder.append(this.privilegeName);
+        StringBuilder builder = new StringBuilder("register ");
         if (this.isAbstract) {
-            builder.append(" as abstract");
+            builder.append("abstract ");
         }
+        builder.append("privilege ");
+        builder.append(this.privilegeName);
+
         if (!this.declaredAggregateNames.isEmpty()) {
             builder.append(" with ");
             Iterator<String> iter = this.declaredAggregateNames.iterator();
diff --git a/src/main/javacc/RepoInitGrammar.jjt 
b/src/main/javacc/RepoInitGrammar.jjt
index 9d910af..af1ab56 100644
--- a/src/main/javacc/RepoInitGrammar.jjt
+++ b/src/main/javacc/RepoInitGrammar.jjt
@@ -75,7 +75,6 @@ TOKEN:
 |   < NAMESPACE: "namespace" >
 |   < PRIVILEGE: "privilege" >
 |   < WITH: "with" >
-|   < AS: "as" >
 |   < ABSTRACT: "abstract" >
 |   < PASSWORD: "password" >
 |   < START_TEXTBLOCK: "<<===" > : TEXTBLOCK
@@ -491,7 +490,7 @@ void registerPrivilegeStatement(List<Operation> result) :
     List<String> aggregates = new ArrayList<String>();
 }
 {
-    <REGISTER> <PRIVILEGE> privilege = <STRING> ((<AS> <ABSTRACT>) {isAbstract 
= true;})? (<WITH> aggregates = principalsList())?
+    <REGISTER> ((<ABSTRACT>) {isAbstract = true;})? <PRIVILEGE> privilege = 
<STRING>  (<WITH> aggregates = principalsList())?
     {
         result.add(new RegisterPrivilege(privilege.image, isAbstract, 
aggregates));
     }
diff --git a/src/test/resources/testcases/test-42-output.txt 
b/src/test/resources/testcases/test-42-output.txt
index ef7e7c9..3fc8e0c 100644
--- a/src/test/resources/testcases/test-42-output.txt
+++ b/src/test/resources/testcases/test-42-output.txt
@@ -1,6 +1,6 @@
 register privilege withoutabstract_withoutaggregates
-register privilege withabstract_withoutaggregates as abstract
+register abstract privilege withabstract_withoutaggregates
 register privilege withoutabstract_withaggregate with bla
 register privilege withoutabstract_withaggregates with bla,blub
-register privilege withabstract_withaggregate as abstract with foo
-register privilege withabstract_withaggregates as abstract with foo,bar
\ No newline at end of file
+register abstract privilege withabstract_withaggregate with foo
+register abstract privilege withabstract_withaggregates with foo,bar
\ No newline at end of file
diff --git a/src/test/resources/testcases/test-42.txt 
b/src/test/resources/testcases/test-42.txt
index ef7e7c9..3fc8e0c 100644
--- a/src/test/resources/testcases/test-42.txt
+++ b/src/test/resources/testcases/test-42.txt
@@ -1,6 +1,6 @@
 register privilege withoutabstract_withoutaggregates
-register privilege withabstract_withoutaggregates as abstract
+register abstract privilege withabstract_withoutaggregates
 register privilege withoutabstract_withaggregate with bla
 register privilege withoutabstract_withaggregates with bla,blub
-register privilege withabstract_withaggregate as abstract with foo
-register privilege withabstract_withaggregates as abstract with foo,bar
\ No newline at end of file
+register abstract privilege withabstract_withaggregate with foo
+register abstract privilege withabstract_withaggregates with foo,bar
\ No newline at end of file

-- 
To stop receiving notification emails like this one, please contact
[email protected].

Reply via email to