-package org.simantics.scl.compiler.markdown.internal;\r
-\r
-public class CharacterSet {\r
- private int minChar;\r
- private int maxChar;\r
- boolean[] table;\r
- \r
- public CharacterSet(String chars) {\r
- if(chars.isEmpty())\r
- throw new IllegalArgumentException();\r
- minChar = Integer.MAX_VALUE;\r
- maxChar = Integer.MIN_VALUE;\r
- for(int i=0;i<chars.length();++i) {\r
- int c = (int)chars.charAt(i);\r
- if(c == '-' && i > 0 && i < chars.length()-1)\r
- continue;\r
- minChar = Math.min(minChar, c);\r
- maxChar = Math.max(maxChar, c);\r
- }\r
- \r
- table = new boolean[maxChar-minChar+1];\r
- for(int i=0;i<chars.length();++i) {\r
- int c = (int)chars.charAt(i);\r
- if(i < chars.length()-2 && chars.charAt(i+1)=='-') {\r
- int c2 = (int)chars.charAt(i+2);\r
- if(c > c2) {\r
- int temp = c;\r
- c = c2;\r
- c2 = temp;\r
- }\r
- for(int j=c;j<=c2;++j)\r
- table[j - minChar] = true;\r
- i+=2;\r
- }\r
- else \r
- table[c - minChar] = true;\r
- }\r
- }\r
- \r
- public boolean contains(char c_) {\r
- int c = (int)c_;\r
- return c >= minChar && c <= maxChar && table[c - minChar];\r
- }\r
-}\r
+package org.simantics.scl.compiler.markdown.internal;
+
+public class CharacterSet {
+ private int minChar;
+ private int maxChar;
+ boolean[] table;
+
+ public CharacterSet(String chars) {
+ if(chars.isEmpty())
+ throw new IllegalArgumentException();
+ minChar = Integer.MAX_VALUE;
+ maxChar = Integer.MIN_VALUE;
+ for(int i=0;i<chars.length();++i) {
+ int c = (int)chars.charAt(i);
+ if(c == '-' && i > 0 && i < chars.length()-1)
+ continue;
+ minChar = Math.min(minChar, c);
+ maxChar = Math.max(maxChar, c);
+ }
+
+ table = new boolean[maxChar-minChar+1];
+ for(int i=0;i<chars.length();++i) {
+ int c = (int)chars.charAt(i);
+ if(i < chars.length()-2 && chars.charAt(i+1)=='-') {
+ int c2 = (int)chars.charAt(i+2);
+ if(c > c2) {
+ int temp = c;
+ c = c2;
+ c2 = temp;
+ }
+ for(int j=c;j<=c2;++j)
+ table[j - minChar] = true;
+ i+=2;
+ }
+ else
+ table[c - minChar] = true;
+ }
+ }
+
+ public boolean contains(char c_) {
+ int c = (int)c_;
+ return c >= minChar && c <= maxChar && table[c - minChar];
+ }
+}