|
1 | 1 | /*
|
2 |
| - * Copyright 2002-2017 the original author or authors. |
| 2 | + * Copyright 2002-2019 the original author or authors. |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
@@ -36,8 +36,8 @@ public abstract class Literal extends SpelNodeImpl {
|
36 | 36 | private final String originalValue;
|
37 | 37 |
|
38 | 38 |
|
39 |
| - public Literal(@Nullable String originalValue, int pos) { |
40 |
| - super(pos); |
| 39 | + public Literal(@Nullable String originalValue, int startPos, int endPos) { |
| 40 | + super(startPos, endPos); |
41 | 41 | this.originalValue = originalValue;
|
42 | 42 | }
|
43 | 43 |
|
@@ -74,39 +74,39 @@ public String toStringAST() {
|
74 | 74 | * @param radix the base of number
|
75 | 75 | * @return a subtype of Literal that can represent it
|
76 | 76 | */
|
77 |
| - public static Literal getIntLiteral(String numberToken, int pos, int radix) { |
| 77 | + public static Literal getIntLiteral(String numberToken, int startPos, int endPos, int radix) { |
78 | 78 | try {
|
79 | 79 | int value = Integer.parseInt(numberToken, radix);
|
80 |
| - return new IntLiteral(numberToken, pos, value); |
| 80 | + return new IntLiteral(numberToken, startPos, endPos, value); |
81 | 81 | }
|
82 | 82 | catch (NumberFormatException ex) {
|
83 |
| - throw new InternalParseException(new SpelParseException(pos>>16, ex, SpelMessage.NOT_AN_INTEGER, numberToken)); |
| 83 | + throw new InternalParseException(new SpelParseException(startPos, ex, SpelMessage.NOT_AN_INTEGER, numberToken)); |
84 | 84 | }
|
85 | 85 | }
|
86 | 86 |
|
87 |
| - public static Literal getLongLiteral(String numberToken, int pos, int radix) { |
| 87 | + public static Literal getLongLiteral(String numberToken, int startPos, int endPos, int radix) { |
88 | 88 | try {
|
89 | 89 | long value = Long.parseLong(numberToken, radix);
|
90 |
| - return new LongLiteral(numberToken, pos, value); |
| 90 | + return new LongLiteral(numberToken, startPos, endPos, value); |
91 | 91 | }
|
92 | 92 | catch (NumberFormatException ex) {
|
93 |
| - throw new InternalParseException(new SpelParseException(pos>>16, ex, SpelMessage.NOT_A_LONG, numberToken)); |
| 93 | + throw new InternalParseException(new SpelParseException(startPos, ex, SpelMessage.NOT_A_LONG, numberToken)); |
94 | 94 | }
|
95 | 95 | }
|
96 | 96 |
|
97 |
| - public static Literal getRealLiteral(String numberToken, int pos, boolean isFloat) { |
| 97 | + public static Literal getRealLiteral(String numberToken, int startPos, int endPos, boolean isFloat) { |
98 | 98 | try {
|
99 | 99 | if (isFloat) {
|
100 | 100 | float value = Float.parseFloat(numberToken);
|
101 |
| - return new FloatLiteral(numberToken, pos, value); |
| 101 | + return new FloatLiteral(numberToken, startPos, endPos, value); |
102 | 102 | }
|
103 | 103 | else {
|
104 | 104 | double value = Double.parseDouble(numberToken);
|
105 |
| - return new RealLiteral(numberToken, pos, value); |
| 105 | + return new RealLiteral(numberToken, startPos, endPos, value); |
106 | 106 | }
|
107 | 107 | }
|
108 | 108 | catch (NumberFormatException ex) {
|
109 |
| - throw new InternalParseException(new SpelParseException(pos>>16, ex, SpelMessage.NOT_A_REAL, numberToken)); |
| 109 | + throw new InternalParseException(new SpelParseException(startPos, ex, SpelMessage.NOT_A_REAL, numberToken)); |
110 | 110 | }
|
111 | 111 | }
|
112 | 112 |
|
|
0 commit comments