You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by GitBox <gi...@apache.org> on 2020/05/15 14:40:57 UTC

[GitHub] [lucene-solr] markharwood opened a new pull request #1521: Lucene-9371: Allow external access to RegExp's parsed structure

markharwood opened a new pull request #1521:
URL: https://github.com/apache/lucene-solr/pull/1521


   The RegExp parser holds a useful representation of the parsed logic in a regular expression but does not have a public API that would allow the objects to be transformed to new forms e.g. to render to an English explanation of the logic.
   This PR exposes that capability by making the internal fields public and final. I toyed with the idea of just adding getter methods but the internal state of this class should ideally be made immutable anyway so instead I opted for making the parsed fields final.
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


[GitHub] [lucene-solr] markharwood commented on pull request #1521: Lucene-9371: Allow external access to RegExp's parsed structure

Posted by GitBox <gi...@apache.org>.
markharwood commented on pull request #1521:
URL: https://github.com/apache/lucene-solr/pull/1521#issuecomment-630060662


   Thanks for looking at this, Mike!


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


[GitHub] [lucene-solr] mikemccand commented on a change in pull request #1521: Lucene-9371: Allow external access to RegExp's parsed structure

Posted by GitBox <gi...@apache.org>.
mikemccand commented on a change in pull request #1521:
URL: https://github.com/apache/lucene-solr/pull/1521#discussion_r425975833



##########
File path: lucene/core/src/java/org/apache/lucene/util/automaton/RegExp.java
##########
@@ -468,6 +519,37 @@ public RegExp(String s, int syntax_flags) throws IllegalArgumentException {
     from = e.from;
     to = e.to;
   }
+  
+  RegExp(Kind kind, RegExp exp1, RegExp exp2, String s, int c, int min, int max, int digits, int from, int to){    
+    this.originalString = null;
+    this.kind = kind;
+    this.flags = 0;
+    this.exp1=exp1;

Review comment:
       Can we be consistent about the spaces around `=`?

##########
File path: lucene/core/src/java/org/apache/lucene/util/automaton/RegExp.java
##########
@@ -365,8 +365,43 @@
  */
 public class RegExp {
   
-  enum Kind {
-    REGEXP_UNION, REGEXP_CONCATENATION, REGEXP_INTERSECTION, REGEXP_OPTIONAL, REGEXP_REPEAT, REGEXP_REPEAT_MIN, REGEXP_REPEAT_MINMAX, REGEXP_COMPLEMENT, REGEXP_CHAR, REGEXP_CHAR_RANGE, REGEXP_ANYCHAR, REGEXP_EMPTY, REGEXP_STRING, REGEXP_ANYSTRING, REGEXP_AUTOMATON, REGEXP_INTERVAL,
+  /**
+   * The type of expression represented by a RegExp node.

Review comment:
       Can we add `@lucene.experimental` or `@lucene.internal`?
   
   Ahh, nevermind -- the class level javadocs say so already.

##########
File path: lucene/core/src/java/org/apache/lucene/util/automaton/RegExp.java
##########
@@ -468,6 +519,37 @@ public RegExp(String s, int syntax_flags) throws IllegalArgumentException {
     from = e.from;
     to = e.to;
   }
+  
+  RegExp(Kind kind, RegExp exp1, RegExp exp2, String s, int c, int min, int max, int digits, int from, int to){    
+    this.originalString = null;
+    this.kind = kind;
+    this.flags = 0;
+    this.exp1=exp1;
+    this.exp2=exp2;
+    this.s = s;
+    this.c = c;
+    this.min =min;

Review comment:
       Hmm also here.  Still looking for the last permutation ...




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


[GitHub] [lucene-solr] markharwood merged pull request #1521: Lucene-9371: Allow external access to RegExp's parsed structure

Posted by GitBox <gi...@apache.org>.
markharwood merged pull request #1521:
URL: https://github.com/apache/lucene-solr/pull/1521


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org