diff --git a/src/org/joni/Analyser.java b/src/org/joni/Analyser.java index 62734f60..6de2ea7d 100644 --- a/src/org/joni/Analyser.java +++ b/src/org/joni/Analyser.java @@ -1607,7 +1607,7 @@ private Node expandCaseFoldString(Node node) { int altNum = 1; ListNode topRoot = null, root = null; - ObjPtr prevNode = new ObjPtr(); + ObjPtr prevNode = new ObjPtr<>(); StringNode stringNode = null; while (p < end) { diff --git a/src/org/joni/Config.java b/src/org/joni/Config.java index b5f4a921..90eec0ba 100644 --- a/src/org/joni/Config.java +++ b/src/org/joni/Config.java @@ -22,69 +22,68 @@ import java.io.PrintStream; public interface Config extends org.jcodings.Config { - final int REGEX_MAX_LENGTH = ConfigSupport.getInt("joni.regex_max_length", -1); - final int CHAR_TABLE_SIZE = ConfigSupport.getInt("joni.char_table_size", 256); - final boolean USE_NO_INVALID_QUANTIFIER = ConfigSupport.getBoolean("joni.use_no_invalid_quantifier", true); - final int SCANENV_MEMNODES_SIZE = ConfigSupport.getInt("joni.scanenv_memnodes_size", 8); - - final boolean USE_NAMED_GROUP = ConfigSupport.getBoolean("joni.use_named_group", true); - final boolean USE_SUBEXP_CALL = ConfigSupport.getBoolean("joni.use_subexp_call", true); - final boolean USE_PERL_SUBEXP_CALL = ConfigSupport.getBoolean("joni.use_perl_subexp_call", true); - final boolean USE_BACKREF_WITH_LEVEL = ConfigSupport.getBoolean("joni.use_backref_with_level", true); /* \k, \k */ - - final boolean USE_MONOMANIAC_CHECK_CAPTURES_IN_ENDLESS_REPEAT = ConfigSupport.getBoolean("joni.use_monomaniac_check_captures_in_endless_repeat", true); /* /(?:()|())*\2/ */ - final boolean USE_NEWLINE_AT_END_OF_STRING_HAS_EMPTY_LINE = ConfigSupport.getBoolean("joni.use_newline_at_end_of_string_has_empty_line", true); /* /\n$/ =~ "\n" */ - final boolean USE_WARNING_REDUNDANT_NESTED_REPEAT_OPERATOR = ConfigSupport.getBoolean("joni.use_warning_redundant_nested_repeat_operator", true); - - final boolean CASE_FOLD_IS_APPLIED_INSIDE_NEGATIVE_CCLASS = ConfigSupport.getBoolean("joni.case_fold_is_applied_inside_negative_cclass", true); - - final boolean USE_MATCH_RANGE_MUST_BE_INSIDE_OF_SPECIFIED_RANGE = ConfigSupport.getBoolean("joni.use_match_range_must_be_inside_of_specified_range", false); - final boolean USE_CAPTURE_HISTORY = ConfigSupport.getBoolean("joni.use_capture_history", false); - final boolean USE_VARIABLE_META_CHARS = ConfigSupport.getBoolean("joni.use_variable_meta_chars", true); - final boolean USE_WORD_BEGIN_END = ConfigSupport.getBoolean("joni.use_word_begin_end", true); /* "\<": word-begin, "\>": word-end */ - final boolean USE_FIND_LONGEST_SEARCH_ALL_OF_RANGE = ConfigSupport.getBoolean("joni.use_find_longest_search_all_of_range", true); - final boolean USE_SUNDAY_QUICK_SEARCH = ConfigSupport.getBoolean("joni.use_sunday_quick_search", true); - final boolean USE_CEC = ConfigSupport.getBoolean("joni.use_cec", false); - final boolean USE_DYNAMIC_OPTION = ConfigSupport.getBoolean("joni.use_dynamic_option", false); - final boolean USE_BYTE_MAP = ConfigSupport.getBoolean("joni.use_byte_map", OptExactInfo.OPT_EXACT_MAXLEN <= CHAR_TABLE_SIZE); - final boolean USE_INT_MAP_BACKWARD = ConfigSupport.getBoolean("joni.use_int_map_backward", false); - - final int NREGION = ConfigSupport.getInt("joni.nregion", 10); - final int MAX_BACKREF_NUM = ConfigSupport.getInt("joni.max_backref_num", 1000); - final int MAX_CAPTURE_GROUP_NUM = ConfigSupport.getInt("joni.max_capture_group_num", 32767); - final int MAX_REPEAT_NUM = ConfigSupport.getInt("joni.max_multi_byte_ranges_num", 100000); - final int MAX_MULTI_BYTE_RANGES_NUM = ConfigSupport.getInt("joni.max_multi_byte_ranges_num", 10000); + int REGEX_MAX_LENGTH = ConfigSupport.getInt("joni.regex_max_length", -1); + int CHAR_TABLE_SIZE = ConfigSupport.getInt("joni.char_table_size", 256); + boolean USE_NO_INVALID_QUANTIFIER = ConfigSupport.getBoolean("joni.use_no_invalid_quantifier", true); + int SCANENV_MEMNODES_SIZE = ConfigSupport.getInt("joni.scanenv_memnodes_size", 8); + + boolean USE_NAMED_GROUP = ConfigSupport.getBoolean("joni.use_named_group", true); + boolean USE_SUBEXP_CALL = ConfigSupport.getBoolean("joni.use_subexp_call", true); + boolean USE_PERL_SUBEXP_CALL = ConfigSupport.getBoolean("joni.use_perl_subexp_call", true); + boolean USE_BACKREF_WITH_LEVEL = ConfigSupport.getBoolean("joni.use_backref_with_level", true); /* \k, \k */ + + boolean USE_MONOMANIAC_CHECK_CAPTURES_IN_ENDLESS_REPEAT = ConfigSupport.getBoolean("joni.use_monomaniac_check_captures_in_endless_repeat", true); /* /(?:()|())*\2/ */ + boolean USE_NEWLINE_AT_END_OF_STRING_HAS_EMPTY_LINE = ConfigSupport.getBoolean("joni.use_newline_at_end_of_string_has_empty_line", true); /* /\n$/ =~ "\n" */ + boolean USE_WARNING_REDUNDANT_NESTED_REPEAT_OPERATOR = ConfigSupport.getBoolean("joni.use_warning_redundant_nested_repeat_operator", true); + + boolean CASE_FOLD_IS_APPLIED_INSIDE_NEGATIVE_CCLASS = ConfigSupport.getBoolean("joni.case_fold_is_applied_inside_negative_cclass", true); + + boolean USE_MATCH_RANGE_MUST_BE_INSIDE_OF_SPECIFIED_RANGE = ConfigSupport.getBoolean("joni.use_match_range_must_be_inside_of_specified_range", false); + boolean USE_CAPTURE_HISTORY = ConfigSupport.getBoolean("joni.use_capture_history", false); + boolean USE_VARIABLE_META_CHARS = ConfigSupport.getBoolean("joni.use_variable_meta_chars", true); + boolean USE_WORD_BEGIN_END = ConfigSupport.getBoolean("joni.use_word_begin_end", true); /* "\<": word-begin, "\>": word-end */ + boolean USE_FIND_LONGEST_SEARCH_ALL_OF_RANGE = ConfigSupport.getBoolean("joni.use_find_longest_search_all_of_range", true); + boolean USE_SUNDAY_QUICK_SEARCH = ConfigSupport.getBoolean("joni.use_sunday_quick_search", true); + boolean USE_CEC = ConfigSupport.getBoolean("joni.use_cec", false); + boolean USE_DYNAMIC_OPTION = ConfigSupport.getBoolean("joni.use_dynamic_option", false); + boolean USE_BYTE_MAP = ConfigSupport.getBoolean("joni.use_byte_map", OptExactInfo.OPT_EXACT_MAXLEN <= CHAR_TABLE_SIZE); + boolean USE_INT_MAP_BACKWARD = ConfigSupport.getBoolean("joni.use_int_map_backward", false); + + int NREGION = ConfigSupport.getInt("joni.nregion", 10); + int MAX_BACKREF_NUM = ConfigSupport.getInt("joni.max_backref_num", 1000); + int MAX_CAPTURE_GROUP_NUM = ConfigSupport.getInt("joni.max_capture_group_num", 32767); + int MAX_REPEAT_NUM = ConfigSupport.getInt("joni.max_multi_byte_ranges_num", 100000); + int MAX_MULTI_BYTE_RANGES_NUM = ConfigSupport.getInt("joni.max_multi_byte_ranges_num", 10000); // internal config - final boolean USE_OP_PUSH_OR_JUMP_EXACT = ConfigSupport.getBoolean("joni.use_op_push_or_jump_exact", true); - final boolean USE_QTFR_PEEK_NEXT = ConfigSupport.getBoolean("joni.use_qtfr_peek_next", true); + boolean USE_OP_PUSH_OR_JUMP_EXACT = ConfigSupport.getBoolean("joni.use_op_push_or_jump_exact", true); + boolean USE_QTFR_PEEK_NEXT = ConfigSupport.getBoolean("joni.use_qtfr_peek_next", true); - final int INIT_MATCH_STACK_SIZE = ConfigSupport.getInt("joni.init_match_stack_size", 64); + int INIT_MATCH_STACK_SIZE = ConfigSupport.getInt("joni.init_match_stack_size", 64); - final boolean OPTIMIZE = ConfigSupport.getBoolean("joni.optimize", true); - @Deprecated - final boolean DONT_OPTIMIZE = !OPTIMIZE; + boolean OPTIMIZE = ConfigSupport.getBoolean("joni.optimize", true); + @Deprecated boolean DONT_OPTIMIZE = !OPTIMIZE; // use embedded string templates in Regex object as byte arrays instead of compiling them into int bytecode array - final boolean USE_STRING_TEMPLATES = ConfigSupport.getBoolean("joni.use_string_templates", true); + boolean USE_STRING_TEMPLATES = ConfigSupport.getBoolean("joni.use_string_templates", true); - final int MAX_CAPTURE_HISTORY_GROUP = ConfigSupport.getInt("joni.max_capture_history_group", 31); + int MAX_CAPTURE_HISTORY_GROUP = ConfigSupport.getInt("joni.max_capture_history_group", 31); - final int CHECK_STRING_THRESHOLD_LEN = ConfigSupport.getInt("joni.check_string_threshold_len", 7); - final int CHECK_BUFF_MAX_SIZE = ConfigSupport.getInt("joni.check_buff_max_size", 0x4000); + int CHECK_STRING_THRESHOLD_LEN = ConfigSupport.getInt("joni.check_string_threshold_len", 7); + int CHECK_BUFF_MAX_SIZE = ConfigSupport.getInt("joni.check_buff_max_size", 0x4000); - final PrintStream log = System.out; - final PrintStream err = System.err; + PrintStream log = System.out; + PrintStream err = System.err; - final boolean DEBUG_ALL = ConfigSupport.getBoolean("joni.debug.all", false); + boolean DEBUG_ALL = ConfigSupport.getBoolean("joni.debug.all", false); - final boolean DEBUG = ConfigSupport.getBoolean("joni.debug", false) || DEBUG_ALL; - final boolean DEBUG_PARSE_TREE = ConfigSupport.getBoolean("joni.debug.parse.tree", false) || DEBUG_ALL; - final boolean DEBUG_PARSE_TREE_RAW = ConfigSupport.getBoolean("joni.debug.parse.tree.raw", true) || DEBUG_ALL; - final boolean DEBUG_COMPILE = ConfigSupport.getBoolean("joni.debug.compile", false) || DEBUG_ALL; - final boolean DEBUG_COMPILE_BYTE_CODE_INFO = ConfigSupport.getBoolean("joni.debug.compile.bytecode.info", false) || DEBUG_ALL; - final boolean DEBUG_SEARCH = ConfigSupport.getBoolean("joni.debug.search", false) || DEBUG_ALL; - final boolean DEBUG_MATCH = ConfigSupport.getBoolean("joni.debug.match", false) || DEBUG_ALL; + boolean DEBUG = ConfigSupport.getBoolean("joni.debug", false) || DEBUG_ALL; + boolean DEBUG_PARSE_TREE = ConfigSupport.getBoolean("joni.debug.parse.tree", false) || DEBUG_ALL; + boolean DEBUG_PARSE_TREE_RAW = ConfigSupport.getBoolean("joni.debug.parse.tree.raw", true) || DEBUG_ALL; + boolean DEBUG_COMPILE = ConfigSupport.getBoolean("joni.debug.compile", false) || DEBUG_ALL; + boolean DEBUG_COMPILE_BYTE_CODE_INFO = ConfigSupport.getBoolean("joni.debug.compile.bytecode.info", false) || DEBUG_ALL; + boolean DEBUG_SEARCH = ConfigSupport.getBoolean("joni.debug.search", false) || DEBUG_ALL; + boolean DEBUG_MATCH = ConfigSupport.getBoolean("joni.debug.match", false) || DEBUG_ALL; } diff --git a/src/org/joni/Lexer.java b/src/org/joni/Lexer.java index daa3c8e8..d9ed2b1c 100644 --- a/src/org/joni/Lexer.java +++ b/src/org/joni/Lexer.java @@ -522,7 +522,7 @@ private boolean strExistCheckWithEsc(int[]s, int n, int bad) { return false; } - private static final int send[] = new int[]{':', ']'}; + private static final int[] send = new int[]{':', ']'}; private void fetchTokenInCCFor_charType(boolean flag, int type) { token.type = TokenType.CHAR_TYPE; diff --git a/src/org/joni/MinMaxLen.java b/src/org/joni/MinMaxLen.java index 1f522448..0c6d18f4 100644 --- a/src/org/joni/MinMaxLen.java +++ b/src/org/joni/MinMaxLen.java @@ -24,7 +24,7 @@ final class MinMaxLen { int max; /* max byte length */ /* 1000 / (min-max-dist + 1) */ - private static final short distValues[] = { + private static final short[] distValues = { 1000, 500, 333, 250, 200, 167, 143, 125, 111, 100, 91, 83, 77, 71, 67, 63, 59, 56, 53, 50, 48, 45, 43, 42, 40, 38, 37, 36, 34, 33, diff --git a/src/org/joni/NameEntry.java b/src/org/joni/NameEntry.java index 40caaea0..2b625130 100644 --- a/src/org/joni/NameEntry.java +++ b/src/org/joni/NameEntry.java @@ -28,7 +28,7 @@ public final class NameEntry { int backNum; int backRef1; - int backRefs[]; + int[] backRefs; public NameEntry(byte[]bytes, int p, int end) { name = bytes; diff --git a/src/org/joni/OptExactInfo.java b/src/org/joni/OptExactInfo.java index a8a0615b..ab975bbb 100644 --- a/src/org/joni/OptExactInfo.java +++ b/src/org/joni/OptExactInfo.java @@ -28,7 +28,7 @@ final class OptExactInfo { final OptAnchorInfo anchor = new OptAnchorInfo(); boolean reachEnd; int ignoreCase; /* -1: unset, 0: case sensitive, 1: ignore case */ - final byte bytes[] = new byte[OPT_EXACT_MAXLEN]; + final byte[] bytes = new byte[OPT_EXACT_MAXLEN]; int length; boolean isFull() { diff --git a/src/org/joni/OptMapInfo.java b/src/org/joni/OptMapInfo.java index d6615956..0aeaec9e 100644 --- a/src/org/joni/OptMapInfo.java +++ b/src/org/joni/OptMapInfo.java @@ -26,7 +26,7 @@ final class OptMapInfo { final MinMaxLen mmd = new MinMaxLen(); /* info position */ final OptAnchorInfo anchor = new OptAnchorInfo(); int value; /* weighted value */ - final byte map[] = new byte[Config.CHAR_TABLE_SIZE]; + final byte[] map = new byte[Config.CHAR_TABLE_SIZE]; void clear() { mmd.clear(); @@ -99,7 +99,7 @@ void altMerge(OptMapInfo other, Encoding enc) { anchor.altMerge(other.anchor); } - static final short ByteValTable[] = { + static final short[] ByteValTable = { 5, 1, 1, 1, 1, 1, 1, 1, 1, 10, 10, 1, 1, 10, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 12, 4, 7, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, diff --git a/src/org/joni/Parser.java b/src/org/joni/Parser.java index 6389339b..2bdfb288 100644 --- a/src/org/joni/Parser.java +++ b/src/org/joni/Parser.java @@ -62,7 +62,7 @@ protected Parser(Regex regex, Syntax syntax, byte[]bytes, int p, int end, WarnCa private static final int POSIX_BRACKET_NAME_MIN_LEN = 4; private static final int POSIX_BRACKET_CHECK_LIMIT_LENGTH = 20; - private static final byte BRACKET_END[] = ":]".getBytes(); + private static final byte[] BRACKET_END = ":]".getBytes(); private boolean parsePosixBracket(CClassNode cc, CClassNode ascCc) { mark(); @@ -309,7 +309,7 @@ private CClassNode parseCharClass(ObjPtr ascNode) { break; case CC_CC_OPEN: /* [ */ - ObjPtr ascPtr = new ObjPtr(); + ObjPtr ascPtr = new ObjPtr<>(); CClassNode acc = parseCharClass(ascPtr); cc.or(acc, env); if (ascPtr.p != null) { @@ -817,7 +817,7 @@ private Node parseExp(TokenType term) { break; case CC_OPEN: { - ObjPtr ascPtr = new ObjPtr(); + ObjPtr ascPtr = new ObjPtr<>(); CClassNode cc = parseCharClass(ascPtr); int code = cc.isOneChar(); if (code != -1) return parseStringLoop(StringNode.fromCodePoint(code, enc), group); diff --git a/src/org/joni/Regex.java b/src/org/joni/Regex.java index 031fc49f..46db17e5 100644 --- a/src/org/joni/Regex.java +++ b/src/org/joni/Regex.java @@ -38,7 +38,6 @@ import org.joni.exception.ErrorMessages; import org.joni.exception.InternalException; import org.joni.exception.ValueException; -import org.joni.Config; public final class Regex { int[] code; /* compiled pattern */ @@ -237,7 +236,7 @@ void nameAdd(byte[]name, int nameP, int nameEnd, int backRef, Syntax syntax) { NameEntry e = null; if (nameTable == null) { - nameTable = new BytesHash(); // 13, oni defaults to 5 + nameTable = new BytesHash<>(); // 13, oni defaults to 5 } else { e = nameFind(name, nameP, nameEnd); } diff --git a/src/org/joni/ScanEnvironment.java b/src/org/joni/ScanEnvironment.java index 5f67c7c7..d3370339 100644 --- a/src/org/joni/ScanEnvironment.java +++ b/src/org/joni/ScanEnvironment.java @@ -44,7 +44,7 @@ public final class ScanEnvironment { int numNamed; // USE_NAMED_GROUP - public EncloseNode memNodes[]; + public EncloseNode[] memNodes; // USE_COMBINATION_EXPLOSION_CHECK int numCombExpCheck; @@ -54,7 +54,7 @@ public final class ScanEnvironment { private int warningsFlag; int numPrecReadNotNodes; - Node precReadNotNodes[]; + Node[] precReadNotNodes; ScanEnvironment(Regex regex, Syntax syntax, WarnCallback warnings) { this.syntax = syntax; diff --git a/src/org/joni/StackMachine.java b/src/org/joni/StackMachine.java index 71adff26..5af31d3b 100644 --- a/src/org/joni/StackMachine.java +++ b/src/org/joni/StackMachine.java @@ -78,18 +78,18 @@ private void doubleStack() { } static final ThreadLocal> stacks - = new ThreadLocal>(); + = new ThreadLocal<>(); private static StackEntry[] fetchStack() { WeakReference ref = stacks.get(); StackEntry[] stack; if (ref == null) { - stacks.set( new WeakReference(stack = allocateStack()) ); + stacks.set( new WeakReference<>(stack = allocateStack()) ); } else { stack = ref.get(); if (stack == null) { - stacks.set( new WeakReference(stack = allocateStack()) ); + stacks.set( new WeakReference<>(stack = allocateStack()) ); } } return stack; diff --git a/src/org/joni/ast/BackRefNode.java b/src/org/joni/ast/BackRefNode.java index 6e3baa7a..fd50d021 100644 --- a/src/org/joni/ast/BackRefNode.java +++ b/src/org/joni/ast/BackRefNode.java @@ -25,7 +25,7 @@ import org.joni.exception.ValueException; public final class BackRefNode extends StateNode { - public final int back[]; + public final int[] back; public int backNum; public int nestLevel; diff --git a/src/org/joni/ast/CClassNode.java b/src/org/joni/ast/CClassNode.java index 681a7224..ecc72464 100644 --- a/src/org/joni/ast/CClassNode.java +++ b/src/org/joni/ast/CClassNode.java @@ -228,7 +228,7 @@ public void or(CClassNode other, ScanEnvironment env) { } // add_ctype_to_cc_by_range // Encoding out! - public void addCTypeByRange(int ctype, boolean not, ScanEnvironment env, int sbOut, int mbr[]) { + public void addCTypeByRange(int ctype, boolean not, ScanEnvironment env, int sbOut, int[] mbr) { int n = mbr[0]; int i; @@ -382,13 +382,13 @@ public void addCType(int ctype, boolean not, boolean asciiRange, ScanEnvironment } // switch } - public static enum CCVALTYPE { + public enum CCVALTYPE { SB, CODE_POINT, CLASS } - public static enum CCSTATE { + public enum CCSTATE { VALUE, RANGE, COMPLETE, diff --git a/src/org/joni/ast/QuantifierNode.java b/src/org/joni/ast/QuantifierNode.java index bca3e2d4..ed9e80ed 100644 --- a/src/org/joni/ast/QuantifierNode.java +++ b/src/org/joni/ast/QuantifierNode.java @@ -129,7 +129,7 @@ protected void copy(QuantifierNode other) { combExpCheckNum = other.combExpCheckNum; } - static enum ReduceType { + enum ReduceType { ASIS, /* as is */ DEL, /* delete parent */ A, /* to '*' */ @@ -199,8 +199,8 @@ public void reduceNestedQuantifier(QuantifierNode other) { other.target = null; // remove target from reduced quantifier } - static final String PopularQStr[] = new String[] {"?", "*", "+", "??", "*?", "+?"}; - static final String ReduceQStr[] = new String[] {"", "", "*", "*?", "??", "+ and ??", "+? and ?"}; + static final String[] PopularQStr = new String[] {"?", "*", "+", "??", "*?", "+?"}; + static final String[] ReduceQStr = new String[] {"", "", "*", "*?", "??", "+ and ??", "+? and ?"}; public int setQuantifier(Node tgt, boolean group, ScanEnvironment env, byte[]bytes, int p, int end) { if (lower == 1 && upper == 1) { diff --git a/src/org/joni/constants/MetaChar.java b/src/org/joni/constants/MetaChar.java index 37f94a7b..ee393cc4 100644 --- a/src/org/joni/constants/MetaChar.java +++ b/src/org/joni/constants/MetaChar.java @@ -20,12 +20,12 @@ package org.joni.constants; public interface MetaChar { - final int ESCAPE = 0; - final int ANYCHAR = 1; - final int ANYTIME = 2; - final int ZERO_OR_ONE_TIME = 3; - final int ONE_OR_MORE_TIME = 4; - final int ANYCHAR_ANYTIME = 5; + int ESCAPE = 0; + int ANYCHAR = 1; + int ANYTIME = 2; + int ZERO_OR_ONE_TIME = 3; + int ONE_OR_MORE_TIME = 4; + int ANYCHAR_ANYTIME = 5; - final int INEFFECTIVE_META_CHAR = 0; + int INEFFECTIVE_META_CHAR = 0; } diff --git a/src/org/joni/constants/SyntaxProperties.java b/src/org/joni/constants/SyntaxProperties.java index 7f75700e..62709e19 100644 --- a/src/org/joni/constants/SyntaxProperties.java +++ b/src/org/joni/constants/SyntaxProperties.java @@ -21,107 +21,107 @@ public interface SyntaxProperties { /* syntax (operators); */ - final int OP_VARIABLE_META_CHARACTERS = (1<<0); - final int OP_DOT_ANYCHAR = (1<<1); /* . */ - final int OP_ASTERISK_ZERO_INF = (1<<2); /* * */ - final int OP_ESC_ASTERISK_ZERO_INF = (1<<3); - final int OP_PLUS_ONE_INF = (1<<4); /* + */ - final int OP_ESC_PLUS_ONE_INF = (1<<5); - final int OP_QMARK_ZERO_ONE = (1<<6); /* ? */ - final int OP_ESC_QMARK_ZERO_ONE = (1<<7); - final int OP_BRACE_INTERVAL = (1<<8); /* {lower,upper} */ - final int OP_ESC_BRACE_INTERVAL = (1<<9); /* \{lower,upper\} */ - final int OP_VBAR_ALT = (1<<10); /* | */ - final int OP_ESC_VBAR_ALT = (1<<11); /* \| */ - final int OP_LPAREN_SUBEXP = (1<<12); /* (...); */ - final int OP_ESC_LPAREN_SUBEXP = (1<<13); /* \(...\); */ - final int OP_ESC_AZ_BUF_ANCHOR = (1<<14); /* \A, \Z, \z */ - final int OP_ESC_CAPITAL_G_BEGIN_ANCHOR = (1<<15); /* \G */ - final int OP_DECIMAL_BACKREF = (1<<16); /* \num */ - final int OP_BRACKET_CC = (1<<17); /* [...] */ - final int OP_ESC_W_WORD = (1<<18); /* \w, \W */ - final int OP_ESC_LTGT_WORD_BEGIN_END = (1<<19); /* \<. \> */ - final int OP_ESC_B_WORD_BOUND = (1<<20); /* \b, \B */ - final int OP_ESC_S_WHITE_SPACE = (1<<21); /* \s, \S */ - final int OP_ESC_D_DIGIT = (1<<22); /* \d, \D */ - final int OP_LINE_ANCHOR = (1<<23); /* ^, $ */ - final int OP_POSIX_BRACKET = (1<<24); /* [:xxxx:] */ - final int OP_QMARK_NON_GREEDY = (1<<25); /* ??,*?,+?,{n,m}? */ - final int OP_ESC_CONTROL_CHARS = (1<<26); /* \n,\r,\t,\a ... */ - final int OP_ESC_C_CONTROL = (1<<27); /* \cx */ - final int OP_ESC_OCTAL3 = (1<<28); /* \OOO */ - final int OP_ESC_X_HEX2 = (1<<29); /* \xHH */ - final int OP_ESC_X_BRACE_HEX8 = (1<<30); /* \x{7HHHHHHH} */ - final int OP_ESC_O_BRACE_OCTAL = (1<<31); /* \o{OOO} */ + int OP_VARIABLE_META_CHARACTERS = (1<<0); + int OP_DOT_ANYCHAR = (1<<1); /* . */ + int OP_ASTERISK_ZERO_INF = (1<<2); /* * */ + int OP_ESC_ASTERISK_ZERO_INF = (1<<3); + int OP_PLUS_ONE_INF = (1<<4); /* + */ + int OP_ESC_PLUS_ONE_INF = (1<<5); + int OP_QMARK_ZERO_ONE = (1<<6); /* ? */ + int OP_ESC_QMARK_ZERO_ONE = (1<<7); + int OP_BRACE_INTERVAL = (1<<8); /* {lower,upper} */ + int OP_ESC_BRACE_INTERVAL = (1<<9); /* \{lower,upper\} */ + int OP_VBAR_ALT = (1<<10); /* | */ + int OP_ESC_VBAR_ALT = (1<<11); /* \| */ + int OP_LPAREN_SUBEXP = (1<<12); /* (...); */ + int OP_ESC_LPAREN_SUBEXP = (1<<13); /* \(...\); */ + int OP_ESC_AZ_BUF_ANCHOR = (1<<14); /* \A, \Z, \z */ + int OP_ESC_CAPITAL_G_BEGIN_ANCHOR = (1<<15); /* \G */ + int OP_DECIMAL_BACKREF = (1<<16); /* \num */ + int OP_BRACKET_CC = (1<<17); /* [...] */ + int OP_ESC_W_WORD = (1<<18); /* \w, \W */ + int OP_ESC_LTGT_WORD_BEGIN_END = (1<<19); /* \<. \> */ + int OP_ESC_B_WORD_BOUND = (1<<20); /* \b, \B */ + int OP_ESC_S_WHITE_SPACE = (1<<21); /* \s, \S */ + int OP_ESC_D_DIGIT = (1<<22); /* \d, \D */ + int OP_LINE_ANCHOR = (1<<23); /* ^, $ */ + int OP_POSIX_BRACKET = (1<<24); /* [:xxxx:] */ + int OP_QMARK_NON_GREEDY = (1<<25); /* ??,*?,+?,{n,m}? */ + int OP_ESC_CONTROL_CHARS = (1<<26); /* \n,\r,\t,\a ... */ + int OP_ESC_C_CONTROL = (1<<27); /* \cx */ + int OP_ESC_OCTAL3 = (1<<28); /* \OOO */ + int OP_ESC_X_HEX2 = (1<<29); /* \xHH */ + int OP_ESC_X_BRACE_HEX8 = (1<<30); /* \x{7HHHHHHH} */ + int OP_ESC_O_BRACE_OCTAL = (1<<31); /* \o{OOO} */ - final int OP2_ESC_CAPITAL_Q_QUOTE = (1<<0); /* \Q...\E */ - final int OP2_QMARK_GROUP_EFFECT = (1<<1); /* (?...); */ - final int OP2_OPTION_PERL = (1<<2); /* (?imsxadlu), (?-imsx), (?^imsxalu) */ - final int OP2_OPTION_RUBY = (1<<3); /* (?imxadu);, (?-imx); */ - final int OP2_PLUS_POSSESSIVE_REPEAT = (1<<4); /* ?+,*+,++ */ - final int OP2_PLUS_POSSESSIVE_INTERVAL = (1<<5); /* {n,m}+ */ - final int OP2_CCLASS_SET_OP = (1<<6); /* [...&&..[..]..] */ - final int OP2_QMARK_LT_NAMED_GROUP = (1<<7); /* (?...); */ - final int OP2_ESC_K_NAMED_BACKREF = (1<<8); /* \k */ - final int OP2_ESC_G_SUBEXP_CALL = (1<<9); /* \g, \g */ - final int OP2_ATMARK_CAPTURE_HISTORY = (1<<10); /* (?@..);,(?@..); */ - final int OP2_ESC_CAPITAL_C_BAR_CONTROL = (1<<11); /* \C-x */ - final int OP2_ESC_CAPITAL_M_BAR_META = (1<<12); /* \M-x */ - final int OP2_ESC_V_VTAB = (1<<13); /* \v as VTAB */ - final int OP2_ESC_U_HEX4 = (1<<14); /* \\uHHHH */ - final int OP2_ESC_GNU_BUF_ANCHOR = (1<<15); /* \`, \' */ - final int OP2_ESC_P_BRACE_CHAR_PROPERTY = (1<<16); /* \p{...}, \P{...} */ - final int OP2_ESC_P_BRACE_CIRCUMFLEX_NOT = (1<<17); /* \p{^..}, \P{^..} */ + int OP2_ESC_CAPITAL_Q_QUOTE = (1<<0); /* \Q...\E */ + int OP2_QMARK_GROUP_EFFECT = (1<<1); /* (?...); */ + int OP2_OPTION_PERL = (1<<2); /* (?imsxadlu), (?-imsx), (?^imsxalu) */ + int OP2_OPTION_RUBY = (1<<3); /* (?imxadu);, (?-imx); */ + int OP2_PLUS_POSSESSIVE_REPEAT = (1<<4); /* ?+,*+,++ */ + int OP2_PLUS_POSSESSIVE_INTERVAL = (1<<5); /* {n,m}+ */ + int OP2_CCLASS_SET_OP = (1<<6); /* [...&&..[..]..] */ + int OP2_QMARK_LT_NAMED_GROUP = (1<<7); /* (?...); */ + int OP2_ESC_K_NAMED_BACKREF = (1<<8); /* \k */ + int OP2_ESC_G_SUBEXP_CALL = (1<<9); /* \g, \g */ + int OP2_ATMARK_CAPTURE_HISTORY = (1<<10); /* (?@..);,(?@..); */ + int OP2_ESC_CAPITAL_C_BAR_CONTROL = (1<<11); /* \C-x */ + int OP2_ESC_CAPITAL_M_BAR_META = (1<<12); /* \M-x */ + int OP2_ESC_V_VTAB = (1<<13); /* \v as VTAB */ + int OP2_ESC_U_HEX4 = (1<<14); /* \\uHHHH */ + int OP2_ESC_GNU_BUF_ANCHOR = (1<<15); /* \`, \' */ + int OP2_ESC_P_BRACE_CHAR_PROPERTY = (1<<16); /* \p{...}, \P{...} */ + int OP2_ESC_P_BRACE_CIRCUMFLEX_NOT = (1<<17); /* \p{^..}, \P{^..} */ /* final int OP2_CHAR_PROPERTY_PREFIX_IS = (1<<18); */ - final int OP2_ESC_H_XDIGIT = (1<<19); /* \h, \H */ - final int OP2_INEFFECTIVE_ESCAPE = (1<<20); /* \ */ - final int OP2_ESC_CAPITAL_R_LINEBREAK = (1<<21); /* \R as (?>\x0D\x0A|[\x0A-\x0D\x{85}\x{2028}\x{2029}]) */ - final int OP2_ESC_CAPITAL_X_EXTENDED_GRAPHEME_CLUSTER = (1<<22); /* \X as (?:\P{M}\p{M}*) */ - final int OP2_ESC_V_VERTICAL_WHITESPACE = (1<<23); /* \v, \V -- Perl */ - final int OP2_ESC_H_HORIZONTAL_WHITESPACE= (1<<24); /* \h, \H -- Perl */ - final int OP2_ESC_CAPITAL_K_KEEP = (1<<25); /* \K */ - final int OP2_ESC_G_BRACE_BACKREF = (1<<26); /* \g{name}, \g{n} */ - final int OP2_QMARK_SUBEXP_CALL = (1<<27); /* (?&name), (?n), (?R), (?0) */ - final int OP2_QMARK_BAR_BRANCH_RESET = (1<<28); /* (?|...) */ - final int OP2_QMARK_LPAREN_CONDITION = (1<<29); /* (?(cond)yes...|no...) */ - final int OP2_QMARK_CAPITAL_P_NAMED_GROUP= (1<<30); /* (?P...), (?P=name), (?P>name) -- Python/PCRE */ - final int OP2_QMARK_TILDE_ABSENT = (1<<31); /* (?~...) */ + int OP2_ESC_H_XDIGIT = (1<<19); /* \h, \H */ + int OP2_INEFFECTIVE_ESCAPE = (1<<20); /* \ */ + int OP2_ESC_CAPITAL_R_LINEBREAK = (1<<21); /* \R as (?>\x0D\x0A|[\x0A-\x0D\x{85}\x{2028}\x{2029}]) */ + int OP2_ESC_CAPITAL_X_EXTENDED_GRAPHEME_CLUSTER = (1<<22); /* \X as (?:\P{M}\p{M}*) */ + int OP2_ESC_V_VERTICAL_WHITESPACE = (1<<23); /* \v, \V -- Perl */ + int OP2_ESC_H_HORIZONTAL_WHITESPACE= (1<<24); /* \h, \H -- Perl */ + int OP2_ESC_CAPITAL_K_KEEP = (1<<25); /* \K */ + int OP2_ESC_G_BRACE_BACKREF = (1<<26); /* \g{name}, \g{n} */ + int OP2_QMARK_SUBEXP_CALL = (1<<27); /* (?&name), (?n), (?R), (?0) */ + int OP2_QMARK_BAR_BRANCH_RESET = (1<<28); /* (?|...) */ + int OP2_QMARK_LPAREN_CONDITION = (1<<29); /* (?(cond)yes...|no...) */ + int OP2_QMARK_CAPITAL_P_NAMED_GROUP= (1<<30); /* (?P...), (?P=name), (?P>name) -- Python/PCRE */ + int OP2_QMARK_TILDE_ABSENT = (1<<31); /* (?~...) */ - final int OP3_OPTION_JAVA = (1<<0); /* (?idmsux), (?-idmsux) */ - final int OP3_OPTION_ECMASCRIPT = (1<<1); /* EcmaScript quirks */ + int OP3_OPTION_JAVA = (1<<0); /* (?idmsux), (?-idmsux) */ + int OP3_OPTION_ECMASCRIPT = (1<<1); /* EcmaScript quirks */ /* syntax (behavior); */ - final int CONTEXT_INDEP_ANCHORS = (1<<31); /* not implemented */ - final int CONTEXT_INDEP_REPEAT_OPS = (1<<0); /* ?, *, +, {n,m} */ - final int CONTEXT_INVALID_REPEAT_OPS = (1<<1); /* error or ignore */ - final int ALLOW_UNMATCHED_CLOSE_SUBEXP = (1<<2); /* ...);... */ - final int ALLOW_INVALID_INTERVAL = (1<<3); /* {??? */ - final int ALLOW_INTERVAL_LOW_ABBREV = (1<<4); /* {,n} => {0,n} */ - final int STRICT_CHECK_BACKREF = (1<<5); /* /(\1);/,/\1();/ ..*/ - final int DIFFERENT_LEN_ALT_LOOK_BEHIND = (1<<6); /* (?<=a|bc); */ - final int CAPTURE_ONLY_NAMED_GROUP = (1<<7); /* see doc/RE */ - final int ALLOW_MULTIPLEX_DEFINITION_NAME = (1<<8); /* (?);(?); */ - final int FIXED_INTERVAL_IS_GREEDY_ONLY = (1<<9); /* a{n}?=(?:a{n});? */ - final int ALLOW_MULTIPLEX_DEFINITION_NAME_CALL = (1<<10); /* (?)(?)(?&x) */ + int CONTEXT_INDEP_ANCHORS = (1<<31); /* not implemented */ + int CONTEXT_INDEP_REPEAT_OPS = (1<<0); /* ?, *, +, {n,m} */ + int CONTEXT_INVALID_REPEAT_OPS = (1<<1); /* error or ignore */ + int ALLOW_UNMATCHED_CLOSE_SUBEXP = (1<<2); /* ...);... */ + int ALLOW_INVALID_INTERVAL = (1<<3); /* {??? */ + int ALLOW_INTERVAL_LOW_ABBREV = (1<<4); /* {,n} => {0,n} */ + int STRICT_CHECK_BACKREF = (1<<5); /* /(\1);/,/\1();/ ..*/ + int DIFFERENT_LEN_ALT_LOOK_BEHIND = (1<<6); /* (?<=a|bc); */ + int CAPTURE_ONLY_NAMED_GROUP = (1<<7); /* see doc/RE */ + int ALLOW_MULTIPLEX_DEFINITION_NAME = (1<<8); /* (?);(?); */ + int FIXED_INTERVAL_IS_GREEDY_ONLY = (1<<9); /* a{n}?=(?:a{n});? */ + int ALLOW_MULTIPLEX_DEFINITION_NAME_CALL = (1<<10); /* (?)(?)(?&x) */ /* syntax (behavior); in char class [...] */ - final int NOT_NEWLINE_IN_NEGATIVE_CC = (1<<20); /* [^...] */ - final int BACKSLASH_ESCAPE_IN_CC = (1<<21); /* [..\w..] etc.. */ - final int ALLOW_EMPTY_RANGE_IN_CC = (1<<22); - final int ALLOW_DOUBLE_RANGE_OP_IN_CC = (1<<23); /* [0-9-a]=[0-9\-a] */ + int NOT_NEWLINE_IN_NEGATIVE_CC = (1<<20); /* [^...] */ + int BACKSLASH_ESCAPE_IN_CC = (1<<21); /* [..\w..] etc.. */ + int ALLOW_EMPTY_RANGE_IN_CC = (1<<22); + int ALLOW_DOUBLE_RANGE_OP_IN_CC = (1<<23); /* [0-9-a]=[0-9\-a] */ /* syntax (behavior); warning */ - final int WARN_CC_OP_NOT_ESCAPED = (1<<24); /* [,-,] */ - final int WARN_REDUNDANT_NESTED_REPEAT = (1<<25); /* (?:a*);+ */ - final int WARN_CC_DUP = (1<<26); /* [aa] */ + int WARN_CC_OP_NOT_ESCAPED = (1<<24); /* [,-,] */ + int WARN_REDUNDANT_NESTED_REPEAT = (1<<25); /* (?:a*);+ */ + int WARN_CC_DUP = (1<<26); /* [aa] */ - final int POSIX_COMMON_OP = + int POSIX_COMMON_OP = OP_DOT_ANYCHAR | OP_POSIX_BRACKET | OP_DECIMAL_BACKREF | OP_BRACKET_CC | OP_ASTERISK_ZERO_INF | OP_LINE_ANCHOR | OP_ESC_CONTROL_CHARS; - final int GNU_REGEX_OP = + int GNU_REGEX_OP = OP_DOT_ANYCHAR | OP_BRACKET_CC | OP_POSIX_BRACKET | OP_DECIMAL_BACKREF | OP_BRACE_INTERVAL | OP_LPAREN_SUBEXP | @@ -134,7 +134,7 @@ public interface SyntaxProperties { OP_ESC_S_WHITE_SPACE | OP_ESC_D_DIGIT | OP_LINE_ANCHOR; - final int GNU_REGEX_BV = + int GNU_REGEX_BV = CONTEXT_INDEP_ANCHORS | CONTEXT_INDEP_REPEAT_OPS | CONTEXT_INVALID_REPEAT_OPS | ALLOW_INVALID_INTERVAL | BACKSLASH_ESCAPE_IN_CC | ALLOW_DOUBLE_RANGE_OP_IN_CC; diff --git a/src/org/joni/constants/internal/AnchorType.java b/src/org/joni/constants/internal/AnchorType.java index 5773634e..6851c995 100644 --- a/src/org/joni/constants/internal/AnchorType.java +++ b/src/org/joni/constants/internal/AnchorType.java @@ -20,31 +20,31 @@ package org.joni.constants.internal; public interface AnchorType { - final int BEGIN_BUF = (1<<0); - final int BEGIN_LINE = (1<<1); - final int BEGIN_POSITION = (1<<2); - final int END_BUF = (1<<3); - final int SEMI_END_BUF = (1<<4); - final int END_LINE = (1<<5); + int BEGIN_BUF = (1<<0); + int BEGIN_LINE = (1<<1); + int BEGIN_POSITION = (1<<2); + int END_BUF = (1<<3); + int SEMI_END_BUF = (1<<4); + int END_LINE = (1<<5); - final int WORD_BOUND = (1<<6); - final int NOT_WORD_BOUND = (1<<7); - final int WORD_BEGIN = (1<<8); - final int WORD_END = (1<<9); - final int PREC_READ = (1<<10); - final int PREC_READ_NOT = (1<<11); - final int LOOK_BEHIND = (1<<12); - final int LOOK_BEHIND_NOT = (1<<13); + int WORD_BOUND = (1<<6); + int NOT_WORD_BOUND = (1<<7); + int WORD_BEGIN = (1<<8); + int WORD_END = (1<<9); + int PREC_READ = (1<<10); + int PREC_READ_NOT = (1<<11); + int LOOK_BEHIND = (1<<12); + int LOOK_BEHIND_NOT = (1<<13); - final int ANYCHAR_STAR = (1<<14); /* ".*" optimize info */ - final int ANYCHAR_STAR_ML = (1<<15); /* ".*" optimize info (multi-line) */ + int ANYCHAR_STAR = (1<<14); /* ".*" optimize info */ + int ANYCHAR_STAR_ML = (1<<15); /* ".*" optimize info (multi-line) */ - final int ANYCHAR_STAR_MASK = (ANYCHAR_STAR | ANYCHAR_STAR_ML); - final int END_BUF_MASK = (END_BUF | SEMI_END_BUF); + int ANYCHAR_STAR_MASK = (ANYCHAR_STAR | ANYCHAR_STAR_ML); + int END_BUF_MASK = (END_BUF | SEMI_END_BUF); - final int KEEP = (1<<16); + int KEEP = (1<<16); - final int ALLOWED_IN_LB = ( LOOK_BEHIND | + int ALLOWED_IN_LB = ( LOOK_BEHIND | LOOK_BEHIND_NOT | BEGIN_LINE | END_LINE | @@ -57,7 +57,7 @@ public interface AnchorType { WORD_END ); - final int ALLOWED_IN_LB_NOT = ( LOOK_BEHIND | + int ALLOWED_IN_LB_NOT = ( LOOK_BEHIND | LOOK_BEHIND_NOT | BEGIN_LINE | END_LINE | diff --git a/src/org/joni/constants/internal/Arguments.java b/src/org/joni/constants/internal/Arguments.java index b23f3bfa..02a1896d 100644 --- a/src/org/joni/constants/internal/Arguments.java +++ b/src/org/joni/constants/internal/Arguments.java @@ -20,12 +20,12 @@ package org.joni.constants.internal; public interface Arguments { - final int SPECIAL = -1; - final int NON = 0; - final int RELADDR = 1; - final int ABSADDR = 2; - final int LENGTH = 3; - final int MEMNUM = 4; - final int OPTION = 5; - final int STATE_CHECK = 6; + int SPECIAL = -1; + int NON = 0; + int RELADDR = 1; + int ABSADDR = 2; + int LENGTH = 3; + int MEMNUM = 4; + int OPTION = 5; + int STATE_CHECK = 6; } diff --git a/src/org/joni/constants/internal/EncloseType.java b/src/org/joni/constants/internal/EncloseType.java index 779f5545..67e0b82d 100644 --- a/src/org/joni/constants/internal/EncloseType.java +++ b/src/org/joni/constants/internal/EncloseType.java @@ -20,12 +20,12 @@ package org.joni.constants.internal; public interface EncloseType { - final int MEMORY = 1<<0; - final int OPTION = 1<<1; - final int STOP_BACKTRACK = 1<<2; - final int CONDITION = 1<<3; - final int ABSENT = 1<<4; + int MEMORY = 1<<0; + int OPTION = 1<<1; + int STOP_BACKTRACK = 1<<2; + int CONDITION = 1<<3; + int ABSENT = 1<<4; - final int ALLOWED_IN_LB = MEMORY | OPTION; - final int ALLOWED_IN_LB_NOT = OPTION; + int ALLOWED_IN_LB = MEMORY | OPTION; + int ALLOWED_IN_LB_NOT = OPTION; } diff --git a/src/org/joni/constants/internal/NodeStatus.java b/src/org/joni/constants/internal/NodeStatus.java index 50f5d9b6..335acd72 100644 --- a/src/org/joni/constants/internal/NodeStatus.java +++ b/src/org/joni/constants/internal/NodeStatus.java @@ -21,19 +21,19 @@ public interface NodeStatus { /* status bits */ - final int NST_MIN_FIXED = (1<<0); - final int NST_MAX_FIXED = (1<<1); - final int NST_CLEN_FIXED = (1<<2); - final int NST_MARK1 = (1<<3); - final int NST_MARK2 = (1<<4); - final int NST_MEM_BACKREFED = (1<<5); - final int NST_STOP_BT_SIMPLE_REPEAT= (1<<6); - final int NST_RECURSION = (1<<7); - final int NST_CALLED = (1<<8); - final int NST_ADDR_FIXED = (1<<9); - final int NST_NAMED_GROUP = (1<<10); - final int NST_NAME_REF = (1<<11); - final int NST_IN_REPEAT = (1<<12); /* STK_REPEAT is nested in stack. */ - final int NST_NEST_LEVEL = (1<<13); - final int NST_BY_NUMBER = (1<<14); /* {n,m} */ + int NST_MIN_FIXED = (1<<0); + int NST_MAX_FIXED = (1<<1); + int NST_CLEN_FIXED = (1<<2); + int NST_MARK1 = (1<<3); + int NST_MARK2 = (1<<4); + int NST_MEM_BACKREFED = (1<<5); + int NST_STOP_BT_SIMPLE_REPEAT= (1<<6); + int NST_RECURSION = (1<<7); + int NST_CALLED = (1<<8); + int NST_ADDR_FIXED = (1<<9); + int NST_NAMED_GROUP = (1<<10); + int NST_NAME_REF = (1<<11); + int NST_IN_REPEAT = (1<<12); /* STK_REPEAT is nested in stack. */ + int NST_NEST_LEVEL = (1<<13); + int NST_BY_NUMBER = (1<<14); /* {n,m} */ } diff --git a/src/org/joni/constants/internal/NodeType.java b/src/org/joni/constants/internal/NodeType.java index da8aeab3..dd1acda7 100644 --- a/src/org/joni/constants/internal/NodeType.java +++ b/src/org/joni/constants/internal/NodeType.java @@ -21,32 +21,32 @@ public interface NodeType { /* node type */ - final int STR = 0; - final int CCLASS = 1; - final int CTYPE = 2; - final int CANY = 3; - final int BREF = 4; - final int QTFR = 5; - final int ENCLOSE = 6; - final int ANCHOR = 7; - final int LIST = 8; - final int ALT = 9; - final int CALL = 10; + int STR = 0; + int CCLASS = 1; + int CTYPE = 2; + int CANY = 3; + int BREF = 4; + int QTFR = 5; + int ENCLOSE = 6; + int ANCHOR = 7; + int LIST = 8; + int ALT = 9; + int CALL = 10; - final int BIT_STR = 1 << STR; - final int BIT_CCLASS = 1 << CCLASS; - final int BIT_CTYPE = 1 << CTYPE; - final int BIT_CANY = 1 << CANY; - final int BIT_BREF = 1 << BREF; - final int BIT_QTFR = 1 << QTFR; - final int BIT_ENCLOSE = 1 << ENCLOSE; - final int BIT_ANCHOR = 1 << ANCHOR; - final int BIT_LIST = 1 << LIST; - final int BIT_ALT = 1 << ALT; - final int BIT_CALL = 1 << CALL; + int BIT_STR = 1 << STR; + int BIT_CCLASS = 1 << CCLASS; + int BIT_CTYPE = 1 << CTYPE; + int BIT_CANY = 1 << CANY; + int BIT_BREF = 1 << BREF; + int BIT_QTFR = 1 << QTFR; + int BIT_ENCLOSE = 1 << ENCLOSE; + int BIT_ANCHOR = 1 << ANCHOR; + int BIT_LIST = 1 << LIST; + int BIT_ALT = 1 << ALT; + int BIT_CALL = 1 << CALL; /* allowed node types in look-behind */ - final int ALLOWED_IN_LB = ( BIT_LIST | + int ALLOWED_IN_LB = ( BIT_LIST | BIT_ALT | BIT_STR | BIT_CCLASS | @@ -57,7 +57,7 @@ public interface NodeType { BIT_QTFR | BIT_CALL ); - final int SIMPLE = ( BIT_STR | + int SIMPLE = ( BIT_STR | BIT_CCLASS | BIT_CTYPE | BIT_CANY | diff --git a/src/org/joni/constants/internal/OPCode.java b/src/org/joni/constants/internal/OPCode.java index 5862af67..b8c3b1a3 100644 --- a/src/org/joni/constants/internal/OPCode.java +++ b/src/org/joni/constants/internal/OPCode.java @@ -22,127 +22,127 @@ import org.joni.Config; public interface OPCode { - final int FINISH = 0; /* matching process terminator (no more alternative) */ - final int END = 1; /* pattern code terminator (success end) */ + int FINISH = 0; /* matching process terminator (no more alternative) */ + int END = 1; /* pattern code terminator (success end) */ - final int EXACT1 = 2; /* single byte, N = 1 */ - final int EXACT2 = 3; /* single byte, N = 2 */ - final int EXACT3 = 4; /* single byte, N = 3 */ - final int EXACT4 = 5; /* single byte, N = 4 */ - final int EXACT5 = 6; /* single byte, N = 5 */ - final int EXACTN = 7; /* single byte */ - final int EXACTMB2N1 = 8; /* mb-length = 2 N = 1 */ - final int EXACTMB2N2 = 9; /* mb-length = 2 N = 2 */ - final int EXACTMB2N3 = 10; /* mb-length = 2 N = 3 */ - final int EXACTMB2N = 11; /* mb-length = 2 */ - final int EXACTMB3N = 12; /* mb-length = 3 */ - final int EXACTMBN = 13; /* other length */ + int EXACT1 = 2; /* single byte, N = 1 */ + int EXACT2 = 3; /* single byte, N = 2 */ + int EXACT3 = 4; /* single byte, N = 3 */ + int EXACT4 = 5; /* single byte, N = 4 */ + int EXACT5 = 6; /* single byte, N = 5 */ + int EXACTN = 7; /* single byte */ + int EXACTMB2N1 = 8; /* mb-length = 2 N = 1 */ + int EXACTMB2N2 = 9; /* mb-length = 2 N = 2 */ + int EXACTMB2N3 = 10; /* mb-length = 2 N = 3 */ + int EXACTMB2N = 11; /* mb-length = 2 */ + int EXACTMB3N = 12; /* mb-length = 3 */ + int EXACTMBN = 13; /* other length */ - final int EXACT1_IC = 14; /* single byte, N = 1, ignore case */ - final int EXACTN_IC = 15; /* single byte, ignore case */ + int EXACT1_IC = 14; /* single byte, N = 1, ignore case */ + int EXACTN_IC = 15; /* single byte, ignore case */ - final int CCLASS = 16; - final int CCLASS_MB = 17; - final int CCLASS_MIX = 18; - final int CCLASS_NOT = 19; - final int CCLASS_MB_NOT = 20; - final int CCLASS_MIX_NOT = 21; + int CCLASS = 16; + int CCLASS_MB = 17; + int CCLASS_MIX = 18; + int CCLASS_NOT = 19; + int CCLASS_MB_NOT = 20; + int CCLASS_MIX_NOT = 21; - final int ANYCHAR = 22; /* "." */ - final int ANYCHAR_ML = 23; /* "." multi-line */ - final int ANYCHAR_STAR = 24; /* ".*" */ - final int ANYCHAR_ML_STAR = 25; /* ".*" multi-line */ - final int ANYCHAR_STAR_PEEK_NEXT = 26; - final int ANYCHAR_ML_STAR_PEEK_NEXT = 27; + int ANYCHAR = 22; /* "." */ + int ANYCHAR_ML = 23; /* "." multi-line */ + int ANYCHAR_STAR = 24; /* ".*" */ + int ANYCHAR_ML_STAR = 25; /* ".*" multi-line */ + int ANYCHAR_STAR_PEEK_NEXT = 26; + int ANYCHAR_ML_STAR_PEEK_NEXT = 27; - final int WORD = 28; - final int NOT_WORD = 29; - final int WORD_BOUND = 30; - final int NOT_WORD_BOUND = 31; - final int WORD_BEGIN = 32; - final int WORD_END = 33; + int WORD = 28; + int NOT_WORD = 29; + int WORD_BOUND = 30; + int NOT_WORD_BOUND = 31; + int WORD_BEGIN = 32; + int WORD_END = 33; - final int ASCII_WORD = 34; - final int ASCII_NOT_WORD = 35; - final int ASCII_WORD_BOUND = 36; - final int ASCII_NOT_WORD_BOUND = 37; - final int ASCII_WORD_BEGIN = 38; - final int ASCII_WORD_END = 39; + int ASCII_WORD = 34; + int ASCII_NOT_WORD = 35; + int ASCII_WORD_BOUND = 36; + int ASCII_NOT_WORD_BOUND = 37; + int ASCII_WORD_BEGIN = 38; + int ASCII_WORD_END = 39; - final int BEGIN_BUF = 40; - final int END_BUF = 41; - final int BEGIN_LINE = 42; - final int END_LINE = 43; - final int SEMI_END_BUF = 44; - final int BEGIN_POSITION = 45; + int BEGIN_BUF = 40; + int END_BUF = 41; + int BEGIN_LINE = 42; + int END_LINE = 43; + int SEMI_END_BUF = 44; + int BEGIN_POSITION = 45; - final int BACKREF1 = 46; - final int BACKREF2 = 47; - final int BACKREFN = 48; - final int BACKREFN_IC = 49; - final int BACKREF_MULTI = 50; - final int BACKREF_MULTI_IC = 51; - final int BACKREF_WITH_LEVEL = 52; /* \k, \k */ + int BACKREF1 = 46; + int BACKREF2 = 47; + int BACKREFN = 48; + int BACKREFN_IC = 49; + int BACKREF_MULTI = 50; + int BACKREF_MULTI_IC = 51; + int BACKREF_WITH_LEVEL = 52; /* \k, \k */ - final int MEMORY_START = 53; - final int MEMORY_START_PUSH = 54; /* push back-tracker to stack */ - final int MEMORY_END_PUSH = 55; /* push back-tracker to stack */ - final int MEMORY_END_PUSH_REC = 56; /* push back-tracker to stack */ - final int MEMORY_END = 57; - final int MEMORY_END_REC = 58; /* push marker to stack */ + int MEMORY_START = 53; + int MEMORY_START_PUSH = 54; /* push back-tracker to stack */ + int MEMORY_END_PUSH = 55; /* push back-tracker to stack */ + int MEMORY_END_PUSH_REC = 56; /* push back-tracker to stack */ + int MEMORY_END = 57; + int MEMORY_END_REC = 58; /* push marker to stack */ - final int KEEP = 59; - final int FAIL = 60; /* pop stack and move */ - final int JUMP = 61; - final int PUSH = 62; - final int POP = 63; - final int PUSH_OR_JUMP_EXACT1 = 64; /* if match exact then push, else jump. */ - final int PUSH_IF_PEEK_NEXT = 65; /* if match exact then push, else none. */ + int KEEP = 59; + int FAIL = 60; /* pop stack and move */ + int JUMP = 61; + int PUSH = 62; + int POP = 63; + int PUSH_OR_JUMP_EXACT1 = 64; /* if match exact then push, else jump. */ + int PUSH_IF_PEEK_NEXT = 65; /* if match exact then push, else none. */ - final int REPEAT = 66; /* {n,m} */ - final int REPEAT_NG = 67; /* {n,m}? (non greedy) */ - final int REPEAT_INC = 68; - final int REPEAT_INC_NG = 69; /* non greedy */ - final int REPEAT_INC_SG = 70; /* search and get in stack */ - final int REPEAT_INC_NG_SG = 71; /* search and get in stack (non greedy) */ + int REPEAT = 66; /* {n,m} */ + int REPEAT_NG = 67; /* {n,m}? (non greedy) */ + int REPEAT_INC = 68; + int REPEAT_INC_NG = 69; /* non greedy */ + int REPEAT_INC_SG = 70; /* search and get in stack */ + int REPEAT_INC_NG_SG = 71; /* search and get in stack (non greedy) */ - final int NULL_CHECK_START = 72; /* null loop checker start */ - final int NULL_CHECK_END = 73; /* null loop checker end */ - final int NULL_CHECK_END_MEMST = 74; /* null loop checker end (with capture status) */ - final int NULL_CHECK_END_MEMST_PUSH = 75; /* with capture status and push check-end */ + int NULL_CHECK_START = 72; /* null loop checker start */ + int NULL_CHECK_END = 73; /* null loop checker end */ + int NULL_CHECK_END_MEMST = 74; /* null loop checker end (with capture status) */ + int NULL_CHECK_END_MEMST_PUSH = 75; /* with capture status and push check-end */ - final int PUSH_POS = 76; /* (?=...) start */ - final int POP_POS = 77; /* (?=...) end */ - final int PUSH_POS_NOT = 78; /* (?!...) start */ - final int FAIL_POS = 79; /* (?!...) end */ - final int PUSH_STOP_BT = 80; /* (?>...) start */ - final int POP_STOP_BT = 81; /* (?>...) end */ - final int LOOK_BEHIND = 82; /* (?<=...) start (no needs end opcode) */ - final int PUSH_LOOK_BEHIND_NOT = 83; /* (?...) start */ + int POP_STOP_BT = 81; /* (?>...) end */ + int LOOK_BEHIND = 82; /* (?<=...) start (no needs end opcode) */ + int PUSH_LOOK_BEHIND_NOT = 83; /* (? */ - final int RETURN = 89; - final int CONDITION = 90; + int CALL = 88; /* \g */ + int RETURN = 89; + int CONDITION = 90; - final int STATE_CHECK_PUSH = 91; /* combination explosion check and push */ - final int STATE_CHECK_PUSH_OR_JUMP = 92; /* check ok -> push, else jump */ - final int STATE_CHECK = 93; /* check only */ - final int STATE_CHECK_ANYCHAR_STAR = 94; - final int STATE_CHECK_ANYCHAR_ML_STAR = 95; + int STATE_CHECK_PUSH = 91; /* combination explosion check and push */ + int STATE_CHECK_PUSH_OR_JUMP = 92; /* check ok -> push, else jump */ + int STATE_CHECK = 93; /* check only */ + int STATE_CHECK_ANYCHAR_STAR = 94; + int STATE_CHECK_ANYCHAR_ML_STAR = 95; /* no need: IS_DYNAMIC_OPTION() == 0 */ - final int SET_OPTION_PUSH = 96; /* set option and push recover option */ - final int SET_OPTION = 97; /* set option */ + int SET_OPTION_PUSH = 96; /* set option and push recover option */ + int SET_OPTION = 97; /* set option */ - final int EXACT1_IC_SB = 98; /* single byte, N = 1, ignore case */ - final int EXACTN_IC_SB = 99; /* single byte, ignore case */ + int EXACT1_IC_SB = 98; /* single byte, N = 1, ignore case */ + int EXACTN_IC_SB = 99; /* single byte, ignore case */ - public final String OpCodeNames[] = Config.DEBUG_COMPILE ? new String[] { + String[] OpCodeNames = Config.DEBUG_COMPILE ? new String[] { "finish", /*OP_FINISH*/ "end", /*OP_END*/ "exact1", /*OP_EXACT1*/ @@ -246,7 +246,7 @@ public interface OPCode { "exactn-ic-sb", /*OP_EXACTN_IC*/ } : null; - public final int OpCodeArgTypes[] = Config.DEBUG_COMPILE ? new int[] { + int[] OpCodeArgTypes = Config.DEBUG_COMPILE ? new int[] { Arguments.NON, /*OP_FINISH*/ Arguments.NON, /*OP_END*/ Arguments.SPECIAL, /*OP_EXACT1*/ diff --git a/src/org/joni/constants/internal/OPSize.java b/src/org/joni/constants/internal/OPSize.java index b3cdc0fd..60941b5e 100644 --- a/src/org/joni/constants/internal/OPSize.java +++ b/src/org/joni/constants/internal/OPSize.java @@ -22,59 +22,59 @@ public interface OPSize { // this might be helpful for potential byte[] migration - final int OPCODE = 1; - final int RELADDR = 1; - final int ABSADDR = 1; - final int LENGTH = 1; - final int MEMNUM = 1; - final int STATE_CHECK_NUM = 1; - final int REPEATNUM = 1; - final int OPTION = 1; - final int CODE_POINT = 1; - final int POINTER = 1; - final int INDEX = 1; + int OPCODE = 1; + int RELADDR = 1; + int ABSADDR = 1; + int LENGTH = 1; + int MEMNUM = 1; + int STATE_CHECK_NUM = 1; + int REPEATNUM = 1; + int OPTION = 1; + int CODE_POINT = 1; + int POINTER = 1; + int INDEX = 1; /* op-code + arg size */ - final int ANYCHAR_STAR = OPCODE; - final int ANYCHAR_STAR_PEEK_NEXT = (OPCODE + 1); - final int JUMP = (OPCODE + RELADDR); - final int PUSH = (OPCODE + RELADDR); - final int POP = OPCODE; - final int PUSH_OR_JUMP_EXACT1 = (OPCODE + RELADDR + 1); - final int PUSH_IF_PEEK_NEXT = (OPCODE + RELADDR + 1); - final int REPEAT_INC = (OPCODE + MEMNUM); - final int REPEAT_INC_NG = (OPCODE + MEMNUM); - final int PUSH_POS = OPCODE; - final int PUSH_POS_NOT = (OPCODE + RELADDR); - final int POP_POS = OPCODE; - final int FAIL_POS = OPCODE; - final int SET_OPTION = (OPCODE + OPTION); - final int SET_OPTION_PUSH = (OPCODE + OPTION); - final int FAIL = OPCODE; - final int MEMORY_START = (OPCODE + MEMNUM); - final int MEMORY_START_PUSH = (OPCODE + MEMNUM); - final int MEMORY_END_PUSH = (OPCODE + MEMNUM); - final int MEMORY_END_PUSH_REC = (OPCODE + MEMNUM); - final int MEMORY_END = (OPCODE + MEMNUM); - final int MEMORY_END_REC = (OPCODE + MEMNUM); - final int PUSH_STOP_BT = OPCODE; - final int POP_STOP_BT = OPCODE; - final int NULL_CHECK_START = (OPCODE + MEMNUM); - final int NULL_CHECK_END = (OPCODE + MEMNUM); - final int LOOK_BEHIND = (OPCODE + LENGTH); - final int PUSH_LOOK_BEHIND_NOT = (OPCODE + RELADDR + LENGTH); - final int FAIL_LOOK_BEHIND_NOT = OPCODE; - final int CALL = (OPCODE + ABSADDR); - final int RETURN = OPCODE; - final int CONDITION = (OPCODE + MEMNUM + RELADDR); - final int PUSH_ABSENT_POS = OPCODE; - final int ABSENT = (OPCODE + RELADDR); - final int ABSENT_END = OPCODE; + int ANYCHAR_STAR = OPCODE; + int ANYCHAR_STAR_PEEK_NEXT = (OPCODE + 1); + int JUMP = (OPCODE + RELADDR); + int PUSH = (OPCODE + RELADDR); + int POP = OPCODE; + int PUSH_OR_JUMP_EXACT1 = (OPCODE + RELADDR + 1); + int PUSH_IF_PEEK_NEXT = (OPCODE + RELADDR + 1); + int REPEAT_INC = (OPCODE + MEMNUM); + int REPEAT_INC_NG = (OPCODE + MEMNUM); + int PUSH_POS = OPCODE; + int PUSH_POS_NOT = (OPCODE + RELADDR); + int POP_POS = OPCODE; + int FAIL_POS = OPCODE; + int SET_OPTION = (OPCODE + OPTION); + int SET_OPTION_PUSH = (OPCODE + OPTION); + int FAIL = OPCODE; + int MEMORY_START = (OPCODE + MEMNUM); + int MEMORY_START_PUSH = (OPCODE + MEMNUM); + int MEMORY_END_PUSH = (OPCODE + MEMNUM); + int MEMORY_END_PUSH_REC = (OPCODE + MEMNUM); + int MEMORY_END = (OPCODE + MEMNUM); + int MEMORY_END_REC = (OPCODE + MEMNUM); + int PUSH_STOP_BT = OPCODE; + int POP_STOP_BT = OPCODE; + int NULL_CHECK_START = (OPCODE + MEMNUM); + int NULL_CHECK_END = (OPCODE + MEMNUM); + int LOOK_BEHIND = (OPCODE + LENGTH); + int PUSH_LOOK_BEHIND_NOT = (OPCODE + RELADDR + LENGTH); + int FAIL_LOOK_BEHIND_NOT = OPCODE; + int CALL = (OPCODE + ABSADDR); + int RETURN = OPCODE; + int CONDITION = (OPCODE + MEMNUM + RELADDR); + int PUSH_ABSENT_POS = OPCODE; + int ABSENT = (OPCODE + RELADDR); + int ABSENT_END = OPCODE; // #ifdef USE_COMBINATION_EXPLOSION_CHECK - final int STATE_CHECK = (OPCODE + STATE_CHECK_NUM); - final int STATE_CHECK_PUSH = (OPCODE + STATE_CHECK_NUM + RELADDR); - final int STATE_CHECK_PUSH_OR_JUMP = (OPCODE + STATE_CHECK_NUM + RELADDR); - final int STATE_CHECK_ANYCHAR_STAR = (OPCODE + STATE_CHECK_NUM); + int STATE_CHECK = (OPCODE + STATE_CHECK_NUM); + int STATE_CHECK_PUSH = (OPCODE + STATE_CHECK_NUM + RELADDR); + int STATE_CHECK_PUSH_OR_JUMP = (OPCODE + STATE_CHECK_NUM + RELADDR); + int STATE_CHECK_ANYCHAR_STAR = (OPCODE + STATE_CHECK_NUM); } diff --git a/src/org/joni/constants/internal/StackPopLevel.java b/src/org/joni/constants/internal/StackPopLevel.java index aec5e65c..c27ad559 100644 --- a/src/org/joni/constants/internal/StackPopLevel.java +++ b/src/org/joni/constants/internal/StackPopLevel.java @@ -20,8 +20,8 @@ package org.joni.constants.internal; public interface StackPopLevel { - final int FREE = 0; - final int MEM_START = 1; - final int ALL = 2; + int FREE = 0; + int MEM_START = 1; + int ALL = 2; } diff --git a/src/org/joni/constants/internal/StackType.java b/src/org/joni/constants/internal/StackType.java index 44212672..9aa9aa45 100644 --- a/src/org/joni/constants/internal/StackType.java +++ b/src/org/joni/constants/internal/StackType.java @@ -21,33 +21,33 @@ public interface StackType { /** stack **/ - final int INVALID_STACK_INDEX = -1; + int INVALID_STACK_INDEX = -1; /* stack type */ /* used by normal-POP */ - final int ALT = 0x0001; - final int LOOK_BEHIND_NOT = 0x0002; - final int POS_NOT = 0x0003; + int ALT = 0x0001; + int LOOK_BEHIND_NOT = 0x0002; + int POS_NOT = 0x0003; /* handled by normal-POP */ - final int MEM_START = 0x0100; - final int MEM_END = 0x8200; - final int REPEAT_INC = 0x0300; - final int STATE_CHECK_MARK = 0x1000; + int MEM_START = 0x0100; + int MEM_END = 0x8200; + int REPEAT_INC = 0x0300; + int STATE_CHECK_MARK = 0x1000; /* avoided by normal-POP */ - final int NULL_CHECK_START = 0x3000; - final int NULL_CHECK_END = 0x5000; /* for recursive call */ - final int MEM_END_MARK = 0x8400; - final int POS = 0x0500; /* used when POP-POS */ - final int STOP_BT = 0x0600; /* mark for "(?>...)" */ - final int REPEAT = 0x0700; - final int CALL_FRAME = 0x0800; - final int RETURN = 0x0900; - final int VOID = 0x0a00; /* for fill a blank */ - final int ABSENT_POS = 0x0b00; /* for absent */ - final int ABSENT = 0x0c00; /* absent inner loop marker */ + int NULL_CHECK_START = 0x3000; + int NULL_CHECK_END = 0x5000; /* for recursive call */ + int MEM_END_MARK = 0x8400; + int POS = 0x0500; /* used when POP-POS */ + int STOP_BT = 0x0600; /* mark for "(?>...)" */ + int REPEAT = 0x0700; + int CALL_FRAME = 0x0800; + int RETURN = 0x0900; + int VOID = 0x0a00; /* for fill a blank */ + int ABSENT_POS = 0x0b00; /* for absent */ + int ABSENT = 0x0c00; /* absent inner loop marker */ /* stack type check mask */ - final int MASK_POP_USED = 0x00ff; - final int MASK_TO_VOID_TARGET = 0x10ff; - final int MASK_MEM_END_OR_MARK = 0x8000; /* MEM_END or MEM_END_MARK */ + int MASK_POP_USED = 0x00ff; + int MASK_TO_VOID_TARGET = 0x10ff; + int MASK_MEM_END_OR_MARK = 0x8000; /* MEM_END or MEM_END_MARK */ } diff --git a/src/org/joni/constants/internal/StringType.java b/src/org/joni/constants/internal/StringType.java index 11a12e14..032e452a 100644 --- a/src/org/joni/constants/internal/StringType.java +++ b/src/org/joni/constants/internal/StringType.java @@ -20,8 +20,8 @@ package org.joni.constants.internal; public interface StringType { - final int NSTR_RAW = 1<<0; - final int NSTR_AMBIG = 1<<1; - final int NSTR_DONT_GET_OPT_INFO = 1<<2; - final int NSTR_SHARED = 1<<3; + int NSTR_RAW = 1<<0; + int NSTR_AMBIG = 1<<1; + int NSTR_DONT_GET_OPT_INFO = 1<<2; + int NSTR_SHARED = 1<<3; } diff --git a/src/org/joni/constants/internal/TargetInfo.java b/src/org/joni/constants/internal/TargetInfo.java index df164912..cad12f2d 100644 --- a/src/org/joni/constants/internal/TargetInfo.java +++ b/src/org/joni/constants/internal/TargetInfo.java @@ -20,8 +20,8 @@ package org.joni.constants.internal; public interface TargetInfo { - final int ISNOT_EMPTY = 0; - final int IS_EMPTY = 1; - final int IS_EMPTY_MEM = 2; - final int IS_EMPTY_REC = 3; + int ISNOT_EMPTY = 0; + int IS_EMPTY = 1; + int IS_EMPTY_MEM = 2; + int IS_EMPTY_REC = 3; } diff --git a/src/org/joni/constants/internal/Traverse.java b/src/org/joni/constants/internal/Traverse.java index f0804422..5fab1ec1 100644 --- a/src/org/joni/constants/internal/Traverse.java +++ b/src/org/joni/constants/internal/Traverse.java @@ -20,7 +20,7 @@ package org.joni.constants.internal; public interface Traverse { - final int TRAVERSE_CALLBACK_AT_FIRST = 1; - final int TRAVERSE_CALLBACK_AT_LAST = 2; - final int TRAVERSE_CALLBACK_AT_BOTH = TRAVERSE_CALLBACK_AT_FIRST | TRAVERSE_CALLBACK_AT_LAST; + int TRAVERSE_CALLBACK_AT_FIRST = 1; + int TRAVERSE_CALLBACK_AT_LAST = 2; + int TRAVERSE_CALLBACK_AT_BOTH = TRAVERSE_CALLBACK_AT_FIRST | TRAVERSE_CALLBACK_AT_LAST; } diff --git a/src/org/joni/exception/ErrorMessages.java b/src/org/joni/exception/ErrorMessages.java index 432c1587..b80340b7 100644 --- a/src/org/joni/exception/ErrorMessages.java +++ b/src/org/joni/exception/ErrorMessages.java @@ -23,67 +23,67 @@ public interface ErrorMessages extends org.jcodings.exception.ErrorMessages { /* internal error */ - final String PARSER_BUG = "internal parser error (bug)"; - final String UNDEFINED_BYTECODE = "undefined bytecode (bug)"; - final String UNEXPECTED_BYTECODE = "unexpected bytecode (bug)"; - final String TOO_MANY_CAPTURE_GROUPS = "too many capture groups are specified"; + String PARSER_BUG = "internal parser error (bug)"; + String UNDEFINED_BYTECODE = "undefined bytecode (bug)"; + String UNEXPECTED_BYTECODE = "unexpected bytecode (bug)"; + String TOO_MANY_CAPTURE_GROUPS = "too many capture groups are specified"; /* general error */ - final String INVALID_ARGUMENT = "invalid argument"; + String INVALID_ARGUMENT = "invalid argument"; /* syntax error */ - final String REGEX_TOO_LONG = "regex length too long"; - final String END_PATTERN_AT_LEFT_BRACE = "end pattern at left brace"; - final String END_PATTERN_AT_LEFT_BRACKET = "end pattern at left bracket"; - final String EMPTY_CHAR_CLASS = "empty char-class"; - final String PREMATURE_END_OF_CHAR_CLASS = "premature end of char-class"; - final String END_PATTERN_AT_ESCAPE = "end pattern at escape"; - final String END_PATTERN_AT_META = "end pattern at meta"; - final String END_PATTERN_AT_CONTROL = "end pattern at control"; - final String META_CODE_SYNTAX = "invalid meta-code syntax"; - final String CONTROL_CODE_SYNTAX = "invalid control-code syntax"; - final String CHAR_CLASS_VALUE_AT_END_OF_RANGE = "char-class value at end of range"; - final String CHAR_CLASS_VALUE_AT_START_OF_RANGE = "char-class value at start of range"; - final String UNMATCHED_RANGE_SPECIFIER_IN_CHAR_CLASS = "unmatched range specifier in char-class"; - final String TARGET_OF_REPEAT_OPERATOR_NOT_SPECIFIED = "target of repeat operator is not specified"; - final String TARGET_OF_REPEAT_OPERATOR_INVALID = "target of repeat operator is invalid"; - final String NESTED_REPEAT_NOT_ALLOWED = "nested repeat is not allowed"; - final String NESTED_REPEAT_OPERATOR = "nested repeat operator"; - final String UNMATCHED_CLOSE_PARENTHESIS = "unmatched close parenthesis"; - final String END_PATTERN_WITH_UNMATCHED_PARENTHESIS = "end pattern with unmatched parenthesis"; - final String END_PATTERN_IN_GROUP = "end pattern in group"; - final String UNDEFINED_GROUP_OPTION = "undefined group option"; - final String INVALID_POSIX_BRACKET_TYPE = "invalid POSIX bracket type"; - final String INVALID_LOOK_BEHIND_PATTERN = "invalid pattern in look-behind"; - final String INVALID_REPEAT_RANGE_PATTERN = "invalid repeat range {lower,upper}"; - final String INVALID_CONDITION_PATTERN = "invalid conditional pattern"; + String REGEX_TOO_LONG = "regex length too long"; + String END_PATTERN_AT_LEFT_BRACE = "end pattern at left brace"; + String END_PATTERN_AT_LEFT_BRACKET = "end pattern at left bracket"; + String EMPTY_CHAR_CLASS = "empty char-class"; + String PREMATURE_END_OF_CHAR_CLASS = "premature end of char-class"; + String END_PATTERN_AT_ESCAPE = "end pattern at escape"; + String END_PATTERN_AT_META = "end pattern at meta"; + String END_PATTERN_AT_CONTROL = "end pattern at control"; + String META_CODE_SYNTAX = "invalid meta-code syntax"; + String CONTROL_CODE_SYNTAX = "invalid control-code syntax"; + String CHAR_CLASS_VALUE_AT_END_OF_RANGE = "char-class value at end of range"; + String CHAR_CLASS_VALUE_AT_START_OF_RANGE = "char-class value at start of range"; + String UNMATCHED_RANGE_SPECIFIER_IN_CHAR_CLASS = "unmatched range specifier in char-class"; + String TARGET_OF_REPEAT_OPERATOR_NOT_SPECIFIED = "target of repeat operator is not specified"; + String TARGET_OF_REPEAT_OPERATOR_INVALID = "target of repeat operator is invalid"; + String NESTED_REPEAT_NOT_ALLOWED = "nested repeat is not allowed"; + String NESTED_REPEAT_OPERATOR = "nested repeat operator"; + String UNMATCHED_CLOSE_PARENTHESIS = "unmatched close parenthesis"; + String END_PATTERN_WITH_UNMATCHED_PARENTHESIS = "end pattern with unmatched parenthesis"; + String END_PATTERN_IN_GROUP = "end pattern in group"; + String UNDEFINED_GROUP_OPTION = "undefined group option"; + String INVALID_POSIX_BRACKET_TYPE = "invalid POSIX bracket type"; + String INVALID_LOOK_BEHIND_PATTERN = "invalid pattern in look-behind"; + String INVALID_REPEAT_RANGE_PATTERN = "invalid repeat range {lower,upper}"; + String INVALID_CONDITION_PATTERN = "invalid conditional pattern"; /* values error (syntax error) */ - final String TOO_BIG_NUMBER = "too big number"; - final String TOO_BIG_NUMBER_FOR_REPEAT_RANGE = "too big number for repeat range"; - final String UPPER_SMALLER_THAN_LOWER_IN_REPEAT_RANGE = "upper is smaller than lower in repeat range"; - final String EMPTY_RANGE_IN_CHAR_CLASS = "empty range in char class"; - final String MISMATCH_CODE_LENGTH_IN_CLASS_RANGE = "mismatch multibyte code length in char-class range"; - final String TOO_MANY_MULTI_BYTE_RANGES = "too many multibyte code ranges are specified"; - final String TOO_SHORT_MULTI_BYTE_STRING = "too short multibyte code string"; - final String TOO_BIG_BACKREF_NUMBER = "too big backref number"; - final String INVALID_BACKREF = Config.USE_NAMED_GROUP ? "invalid backref number/name" : "invalid backref number"; - final String NUMBERED_BACKREF_OR_CALL_NOT_ALLOWED = "numbered backref/call is not allowed. (use name)"; - final String TOO_SHORT_DIGITS = "too short digits"; - final String INVALID_WIDE_CHAR_VALUE = "invalid wide-char value"; - final String EMPTY_GROUP_NAME = "group name is empty"; - final String INVALID_GROUP_NAME = "invalid group name <%n>"; - final String INVALID_CHAR_IN_GROUP_NAME = Config.USE_NAMED_GROUP ? "invalid char in group name <%n>" : "invalid char in group number <%n>"; - final String UNDEFINED_NAME_REFERENCE = "undefined name <%n> reference"; - final String UNDEFINED_GROUP_REFERENCE = "undefined group <%n> reference"; - final String MULTIPLEX_DEFINED_NAME = "multiplex defined name <%n>"; - final String MULTIPLEX_DEFINITION_NAME_CALL = "multiplex definition name <%n> call"; - final String PROPERTY_NAME_NEVER_TERMINATED = "property name never terminated \\p{%n"; - final String NEVER_ENDING_RECURSION = "never ending recursion"; - final String GROUP_NUMBER_OVER_FOR_CAPTURE_HISTORY = "group number is too big for capture history"; - final String NOT_SUPPORTED_ENCODING_COMBINATION = "not supported encoding combination"; - final String INVALID_COMBINATION_OF_OPTIONS = "invalid combination of options"; - final String OVER_THREAD_PASS_LIMIT_COUNT = "over thread pass limit count"; - final String TOO_BIG_SB_CHAR_VALUE = "too big singlebyte char value"; + String TOO_BIG_NUMBER = "too big number"; + String TOO_BIG_NUMBER_FOR_REPEAT_RANGE = "too big number for repeat range"; + String UPPER_SMALLER_THAN_LOWER_IN_REPEAT_RANGE = "upper is smaller than lower in repeat range"; + String EMPTY_RANGE_IN_CHAR_CLASS = "empty range in char class"; + String MISMATCH_CODE_LENGTH_IN_CLASS_RANGE = "mismatch multibyte code length in char-class range"; + String TOO_MANY_MULTI_BYTE_RANGES = "too many multibyte code ranges are specified"; + String TOO_SHORT_MULTI_BYTE_STRING = "too short multibyte code string"; + String TOO_BIG_BACKREF_NUMBER = "too big backref number"; + String INVALID_BACKREF = Config.USE_NAMED_GROUP ? "invalid backref number/name" : "invalid backref number"; + String NUMBERED_BACKREF_OR_CALL_NOT_ALLOWED = "numbered backref/call is not allowed. (use name)"; + String TOO_SHORT_DIGITS = "too short digits"; + String INVALID_WIDE_CHAR_VALUE = "invalid wide-char value"; + String EMPTY_GROUP_NAME = "group name is empty"; + String INVALID_GROUP_NAME = "invalid group name <%n>"; + String INVALID_CHAR_IN_GROUP_NAME = Config.USE_NAMED_GROUP ? "invalid char in group name <%n>" : "invalid char in group number <%n>"; + String UNDEFINED_NAME_REFERENCE = "undefined name <%n> reference"; + String UNDEFINED_GROUP_REFERENCE = "undefined group <%n> reference"; + String MULTIPLEX_DEFINED_NAME = "multiplex defined name <%n>"; + String MULTIPLEX_DEFINITION_NAME_CALL = "multiplex definition name <%n> call"; + String PROPERTY_NAME_NEVER_TERMINATED = "property name never terminated \\p{%n"; + String NEVER_ENDING_RECURSION = "never ending recursion"; + String GROUP_NUMBER_OVER_FOR_CAPTURE_HISTORY = "group number is too big for capture history"; + String NOT_SUPPORTED_ENCODING_COMBINATION = "not supported encoding combination"; + String INVALID_COMBINATION_OF_OPTIONS = "invalid combination of options"; + String OVER_THREAD_PASS_LIMIT_COUNT = "over thread pass limit count"; + String TOO_BIG_SB_CHAR_VALUE = "too big singlebyte char value"; } diff --git a/src/org/joni/exception/TimeoutException.java b/src/org/joni/exception/TimeoutException.java index 18866809..91489254 100644 --- a/src/org/joni/exception/TimeoutException.java +++ b/src/org/joni/exception/TimeoutException.java @@ -1,7 +1,9 @@ package org.joni.exception; public class TimeoutException extends InterruptedException { - public TimeoutException() { + private static final long serialVersionUID = 1L; + + public TimeoutException() { super(); } } diff --git a/test/org/joni/test/Test.java b/test/org/joni/test/Test.java index 157ad4e7..91c00be6 100644 --- a/test/org/joni/test/Test.java +++ b/test/org/joni/test/Test.java @@ -99,10 +99,7 @@ public void xerr(byte[] pattern, int p, int end, String msg, int option, WarnCal try { new Regex(pattern, p, end, option, encoding(), syntax(), warnCallback); nfail++; - } catch (JOniException je) { - nsucc++; - assertEquals(je.getMessage(), msg); - } catch (CharacterPropertyException cpe) { + } catch (JOniException | CharacterPropertyException cpe) { nsucc++; assertEquals(cpe.getMessage(), msg); } diff --git a/test/org/joni/test/TestInterrupt.java b/test/org/joni/test/TestInterrupt.java index 48034ece..092d13a9 100755 --- a/test/org/joni/test/TestInterrupt.java +++ b/test/org/joni/test/TestInterrupt.java @@ -37,7 +37,7 @@ */ public class TestInterrupt extends Test { interface InterruptibleRunnable { - public void run() throws InterruptedException; + void run() throws InterruptedException; } @Override