Lines Matching defs:format
1 /* Java format strings.
27 #include "format.h"
32 #include "format-invalid.h"
37 /* Java format strings are described in java/text/MessageFormat.html.
130 static bool date_format_parse (const char *format);
131 static bool number_format_parse (const char *format);
132 static bool choice_format_parse (const char *format, struct spec *spec,
139 Assumes local variables format, quoting. */
141 if (*format == '\'' && *++format != '\'') \
148 /* Return true if a format is a valid messageFormatPattern.
151 message_format_parse (const char *format, char *fdi, struct spec *spec,
154 const char *const format_start = format;
160 if (!quoting && *format == '{')
171 FDI_SET (format, FMTDIR_START);
174 element_start = ++format;
176 for (; *format != '\0'; format++)
178 if (*format == '{')
180 else if (*format == '}')
188 if (*format == '\0')
192 FDI_SET (format - 1, FMTDIR_ERROR);
195 element_end = format++;
206 FDI_SET (format - 1, FMTDIR_ERROR);
241 FDI_SET (format - 1, FMTDIR_ERROR);
252 FDI_SET (format - 1, FMTDIR_ERROR);
275 FDI_SET (format - 1, FMTDIR_ERROR);
286 FDI_SET (format - 1, FMTDIR_ERROR);
304 FDI_SET (format - 1, FMTDIR_ERROR);
315 FDI_SET (format - 1, FMTDIR_ERROR);
324 FDI_SET (format - 1, FMTDIR_ERROR);
339 FDI_SET (format - 1, FMTDIR_END);
342 else if (!quoting && *format == '}')
344 FDI_SET (format, FMTDIR_START);
347 FDI_SET (format, FMTDIR_ERROR);
350 else if (*format != '\0')
351 format++;
359 /* Return true if a format is a valid dateFormatPattern. */
361 date_format_parse (const char *format)
371 /* Return true if a format is a valid numberFormatPattern. */
373 number_format_parse (const char *format)
403 while (*format != '\0'
404 && !(!quoting && (*format == '0' || *format == '#')))
406 if (format[0] == '\\')
408 if (format[1] == 'u'
409 && c_isxdigit (format[2])
410 && c_isxdigit (format[3])
411 && c_isxdigit (format[4])
412 && c_isxdigit (format[5]))
413 format += 6;
415 format += 2;
418 format += 1;
423 if (!(!quoting && (*format == '0' || *format == '#')))
425 while (!quoting && *format == '#')
427 format++;
429 if (!quoting && *format == ',')
431 format++;
435 while (!quoting && *format == '0')
437 format++;
439 if (!quoting && *format == ',')
441 format++;
447 if (!quoting && *format == '.')
449 format++;
451 while (!quoting && *format == '0')
453 format++;
456 while (!quoting && *format == '#')
458 format++;
464 if (!quoting && *format == 'E')
466 const char *format_save = format;
467 format++;
469 if (!quoting && *format == '0')
473 format++;
476 while (!quoting && *format == '0');
481 format = format_save;
487 while (*format != '\0'
488 && (seen_semicolon || !(!quoting && *format == ';')))
490 if (format[0] == '\\')
492 if (format[1] == 'u'
493 && c_isxdigit (format[2])
494 && c_isxdigit (format[3])
495 && c_isxdigit (format[4])
496 && c_isxdigit (format[5]))
497 format += 6;
499 format += 2;
502 format += 1;
506 if (seen_semicolon || !(!quoting && *format == ';'))
510 return (*format == '\0');
513 /* Return true if a format is a valid choiceFormatPattern.
516 choice_format_parse (const char *format, struct spec *spec,
530 if (*format == '\0')
543 while (*format != '\0'
544 && !(!quoting && (*format == '<' || *format == '#'
545 || strncmp (format, "\\u2264", 6) == 0
546 || *format == '|')))
548 if (format[0] == '\\')
550 if (format[1] == 'u'
551 && c_isxdigit (format[2])
552 && c_isxdigit (format[3])
553 && c_isxdigit (format[4])
554 && c_isxdigit (format[5]))
555 format += 6;
557 format += 2;
560 format += 1;
566 if (*format == '\0')
576 if (*format == '<' || *format == '#')
577 format += 1;
578 else if (strncmp (format, "\\u2264", 6) == 0)
579 format += 6;
588 msgformat = (char *) xmalloca (strlen (format) + 1);
591 while (*format != '\0' && !(!quoting && *format == '|'))
593 *mp++ = *format++;
606 if (*format == '\0')
609 format++;
626 format_parse (const char *format, bool translated, char *fdi,
637 if (!message_format_parse (format, fdi, &spec, invalid_reason))
745 error_logger (_("a format specification for argument {%u}, as in '%s', doesn't exist in 'msgid'"),
755 error_logger (_("a format specification for argument {%u} doesn't exist in '%s'"),
775 error_logger (_("format specifications in 'msgid' and '%s' for argument {%u} are not the same"),
887 * compile-command: "/bin/sh ../libtool --tag=CC --mode=link gcc -o a.out -static -O -g -Wall -I.. -I../gnulib-lib -I../intl -DHAVE_CONFIG_H -DTEST format-java.c ../gnulib-lib/libgettextlib.la"