Home | History | Annotate | Download | only in number

Lines Matching refs:state

28         ParserState state = new ParserState(patternString);
30 consumePattern(state, result);
238 private static void consumePattern(ParserState state, ParsedPatternInfo result) {
241 consumeSubpattern(state, result.positive);
242 if (state.peek() == ';') {
243 state.next(); // consume the ';'
245 if (state.peek() != -1) {
247 consumeSubpattern(state, result.negative);
250 if (state.peek() != -1) {
251 throw state.toParseException("Found unquoted special character");
255 private static void consumeSubpattern(ParserState state, ParsedSubpatternInfo result) {
257 consumePadding(state, result, PadPosition.BEFORE_PREFIX);
258 result.prefixEndpoints = consumeAffix(state, result);
259 consumePadding(state, result, PadPosition.AFTER_PREFIX);
260 consumeFormat(state, result);
261 consumeExponent(state, result);
262 consumePadding(state, result, PadPosition.BEFORE_SUFFIX);
263 result.suffixEndpoints = consumeAffix(state, result);
264 consumePadding(state, result, PadPosition.AFTER_SUFFIX);
267 private static void consumePadding(ParserState state, ParsedSubpatternInfo result, PadPosition paddingLocation) {
268 if (state.peek() != '*') {
272 throw state.toParseException("Cannot have multiple pad specifiers");
275 state.next(); // consume the '*'
276 result.paddingEndpoints |= state.offset;
277 consumeLiteral(state);
278 result.paddingEndpoints |= ((long) state.offset) << 32;
281 private static long consumeAffix(ParserState state, ParsedSubpatternInfo result) {
283 long endpoints = state.offset;
285 switch (state.peek()) {
326 consumeLiteral(state);
328 endpoints |= ((long) state.offset) << 32;
332 private static void consumeLiteral(ParserState state) {
333 if (state.peek() == -1) {
334 throw state.toParseException("Expected unquoted literal but found EOL");
335 } else if (state.peek() == '\'') {
336 state.next(); // consume the starting quote
337 while (state.peek() != '\'') {
338 if (state.peek() == -1) {
339 throw state.toParseException("Expected quoted literal but found EOL");
341 state.next(); // consume a quoted character
344 state.next(); // consume the ending quote
347 state.next();
351 private static void consumeFormat(ParserState state, ParsedSubpatternInfo result) {
352 consumeIntegerFormat(state, result);
353 if (state.peek() == '.') {
354 state.next(); // consume the decimal point
357 consumeFractionFormat(state, result);
361 private static void consumeIntegerFormat(ParserState state, ParsedSubpatternInfo result) {
363 switch (state.peek()) {
371 throw state.toParseException("# cannot follow 0 before decimal point");
385 throw state.toParseException("Cannot mix 0 and @");
388 throw state.toParseException("Cannot nest # inside of a run of @");
407 throw state.toParseException("Cannot mix @ and 0");
413 if (state.peek() != '0' && result.rounding == null) {
417 result.rounding.appendDigit((byte) (state.peek() - '0'), 0, true);
424 state.next(); // consume the symbol
432 throw state.toParseException("Trailing grouping separator is invalid");
435 throw state.toParseException("Grouping width of zero is invalid");
439 private static void consumeFractionFormat(ParserState state
442 switch (state.peek()) {
461 throw state.toParseException("0 cannot follow # after decimal point");
466 if (state.peek() == '0') {
472 result.rounding.appendDigit((byte) (state.peek() - '0'), zeroCounter, false);
480 state.next(); // consume the symbol
484 private static void consumeExponent(ParserState state, ParsedSubpatternInfo result) {
485 if (state.peek() != 'E') {
489 throw state.toParseException("Cannot have grouping separator in scientific notation");
491 state.next(); // consume the E
493 if (state.peek() == '+') {
494 state.next(); // consume the +
498 while (state.peek() == '0') {
499 state.next(); // consume the 0