JAL-1807 Bob's JalviewJS prototype first commit
[jalviewjs.git] / src / com / stevesoft / pat / Rthings.java
1 //
2 // This software is now distributed according to
3 // the Lesser Gnu Public License.  Please see
4 // http://www.gnu.org/copyleft/lesser.txt for
5 // the details.
6 //    -- Happy Computing!
7 //
8 package com.stevesoft.pat;
9
10 /**
11  Shareware: package pat
12  <a href="copyright.html">Copyright 2001, Steven R. Brandt</a>
13  */
14 /**
15  * This class only exists to store data needed during the compilation of a
16  * regular expression.
17  */
18 public class Rthings
19 {
20   /**
21    * The numeric identity of the next () to be encountered while compiling the
22    * pattern.
23    */
24   public int val = Regex.BackRefOffset;
25
26   /**
27    * Needed in case (?i) is encountered, to pass back the message that
28    * ignoreCase should be set.
29    */
30   public boolean ignoreCase;
31
32   /**
33    * Needed in case (?Q) is encountered, to pass back the message that
34    * dontMatchInQuotes should be set.
35    */
36   public boolean dontMatchInQuotes;
37
38   public boolean optimizeMe = false;
39
40   public boolean noBackRefs = false;
41
42   public int parenLevel = 0;
43
44   boolean gFlag = false, mFlag = false, sFlag = false;
45
46   Pattern p;
47
48   Or o;
49
50   Rthings(Regex r)
51   {
52     ignoreCase = r.ignoreCase;
53     dontMatchInQuotes = r.dontMatchInQuotes;
54   }
55
56   void set(Regex r)
57   {
58     r.gFlag = gFlag;
59     r.mFlag = mFlag;
60     r.sFlag = sFlag;
61     r.ignoreCase = ignoreCase;
62     r.dontMatchInQuotes = dontMatchInQuotes;
63     if (optimizeMe)
64     {
65       r.optimize();
66     }
67   }
68 };