|
18 | 18 | import com.xxvlang.exception.*; |
19 | 19 |
|
20 | 20 | import static com.xxvlang.XXVFlag.*; |
| 21 | +import static com.xxvlang.exception.XXVExceptionType.*; |
21 | 22 |
|
22 | 23 | public class MachineContext { |
23 | 24 |
|
@@ -79,7 +80,7 @@ public static void extractDigit(Statement statement, XXVTrees trees) throws XXVE |
79 | 80 | if (trees.getFlag(DIGIT_ARG_AS_MOD)) { |
80 | 81 | index %= XXVInt.DIGITS_NUM; |
81 | 82 | } else if (index >= XXVInt.DIGITS_NUM) { |
82 | | - throw new XXVException(XXVExceptionType.ILLEGAL_ARGUMENT); |
| 83 | + throw new XXVException(ILLEGAL_ARGUMENT); |
83 | 84 | } |
84 | 85 | resultBytes[index] = beforeBytes[index]; |
85 | 86 | trees.pushStack(new XXVInt(resultBytes), statement.subject()); |
@@ -227,7 +228,7 @@ public static void merrychristmas(Statement statement, XXVTrees trees) throws XX |
227 | 228 | private static void checkXmas() throws XXVException { |
228 | 229 | ZonedDateTime today = ZonedDateTime.now(ZoneOffset.UTC); |
229 | 230 | boolean isReallyXmas = today.getMonth() == Month.DECEMBER && today.getDayOfMonth() == 25; |
230 | | - if (!isReallyXmas) throw new XXVException(XXVExceptionType.IS_NOT_XMAS); |
| 231 | + if (!isReallyXmas) throw new XXVException(IS_NOT_XMAS); |
231 | 232 | } |
232 | 233 |
|
233 | 234 | private static void outputOnce(XXVTrees trees, int index) throws XXVException { |
@@ -260,16 +261,16 @@ private static void outputOnceUTF8(XXVTrees trees, int index) throws XXVExceptio |
260 | 261 | value += nextValue; |
261 | 262 | } |
262 | 263 | value += nextValue; |
263 | | - if (value >= 0xF4BFBFC0) throw new XXVException(XXVExceptionType.ILLEGAL_CHAR_CODE); |
| 264 | + if (value >= 0xF4BFBFC0) throw new XXVException(ILLEGAL_CHAR_CODE); |
264 | 265 | utfChar[size++] = (byte)(value / 0x1000000); |
265 | 266 | utfChar[size++] = (byte)(value / 0x10000 % 0x100); |
266 | 267 | utfChar[size++] = (byte)(value / 0x100 % 0x100); |
267 | 268 | utfChar[size++] = (byte)(value % 0x100); |
268 | 269 | } else { |
269 | | - throw new XXVException(XXVExceptionType.ILLEGAL_CHAR_CODE); |
| 270 | + throw new XXVException(ILLEGAL_CHAR_CODE); |
270 | 271 | } |
271 | 272 | } catch (ArrayIndexOutOfBoundsException ae) { |
272 | | - throw new XXVException(XXVExceptionType.ILLEGAL_CHAR_CODE); |
| 273 | + throw new XXVException(ILLEGAL_CHAR_CODE); |
273 | 274 | } |
274 | 275 | if ( |
275 | 276 | utfChar[0] >= 0xC2 && utfChar[0] < 0xE0 && size == 2 || |
|
0 commit comments