(LoadContext context, CDOMObject obj, String value)
| 47 | } |
| 48 | |
| 49 | @Override |
| 50 | protected ParseResult parseNonEmptyToken(LoadContext context, CDOMObject obj, String value) |
| 51 | { |
| 52 | if (obj instanceof Ungranted) |
| 53 | { |
| 54 | return new ParseResult.Fail( |
| 55 | "Cannot use " + getTokenName() + " on an Ungranted object type: " + obj.getClass().getSimpleName()); |
| 56 | } |
| 57 | if (obj instanceof NonInteractive) |
| 58 | { |
| 59 | return new ParseResult.Fail("Cannot use " + getTokenName() + " on an Non-Interactive object type: " |
| 60 | + obj.getClass().getSimpleName()); |
| 61 | } |
| 62 | int pipeLoc = value.indexOf(Constants.PIPE); |
| 63 | if (pipeLoc == -1) |
| 64 | { |
| 65 | if (Constants.LST_DOT_CLEAR.equals(value)) |
| 66 | { |
| 67 | if (obj instanceof PCClassLevel) |
| 68 | { |
| 69 | ComplexParseResult cpr = new ComplexParseResult(); |
| 70 | cpr.addErrorMessage("Warning: You performed an invalid " + ".CLEAR in a ADD: Token"); |
| 71 | cpr.addErrorMessage( |
| 72 | " A non-level limited .CLEAR was " + "used in a Class Level line in " + obj.getKeyName()); |
| 73 | return cpr; |
| 74 | } |
| 75 | } |
| 76 | else if (value.startsWith(".CLEAR.LEVEL")) |
| 77 | { |
| 78 | if (!(obj instanceof PCClassLevel)) |
| 79 | { |
| 80 | ComplexParseResult cpr = new ComplexParseResult(); |
| 81 | cpr.addErrorMessage("Warning: You performed an invalid .CLEAR in a ADD: Token"); |
| 82 | cpr.addErrorMessage( |
| 83 | " A level limited .CLEAR ( " + value + " ) was not used in a Class Level line in " |
| 84 | + obj.getClass().getSimpleName() + ' ' + obj.getKeyName()); |
| 85 | return cpr; |
| 86 | } |
| 87 | String levelString = value.substring(12); |
| 88 | try |
| 89 | { |
| 90 | int level = Integer.parseInt(levelString); |
| 91 | if (level != obj.get(IntegerKey.LEVEL)) |
| 92 | { |
| 93 | ComplexParseResult cpr = new ComplexParseResult(); |
| 94 | cpr.addErrorMessage("Warning: You performed an invalid " + ".CLEAR in a ADD: Token"); |
| 95 | cpr.addErrorMessage( |
| 96 | " A level limited .CLEAR ( " + value + " ) was used in a Class Level line"); |
| 97 | cpr.addErrorMessage(" But was asked to clear a " + "different Class Level ( " + level |
| 98 | + " ) than the Class Level Line it appeared on: " + obj.getKeyName()); |
| 99 | return cpr; |
| 100 | } |
| 101 | } |
| 102 | catch (NumberFormatException e) |
| 103 | { |
| 104 | ComplexParseResult cpr = new ComplexParseResult(); |
| 105 | cpr.addErrorMessage("Warning: You performed an invalid .CLEAR in a ADD: Token"); |
| 106 | cpr.addErrorMessage(" A level limited .CLEAR ( " + value + " ) was used in a Class Level line"); |
nothing calls this directly
no test coverage detected