]>
git.saurik.com Git - apple/javascriptcore.git/blob - icu/unicode/parseerr.h
2 **********************************************************************
3 * Copyright (C) 1999-2004, International Business Machines
4 * Corporation and others. All Rights Reserved.
5 **********************************************************************
6 * Date Name Description
7 * 03/14/00 aliu Creation.
8 * 06/27/00 aliu Change from C++ class to C struct
9 **********************************************************************
14 #include "unicode/utypes.h"
18 * The capacity of the context strings in UParseError.
21 enum { U_PARSE_CONTEXT_LEN
= 16 };
24 * A UParseError struct is used to returned detailed information about
25 * parsing errors. It is used by ICU parsing engines that parse long
26 * rules, patterns, or programs, where the text being parsed is long
27 * enough that more information than a UErrorCode is needed to
30 * <p>The line, offset, and context fields are optional; parsing
31 * engines may choose not to use to use them.
33 * <p>The preContext and postContext strings include some part of the
34 * context surrounding the error. If the source text is "let for=7"
35 * and "for" is the error (e.g., because it is a reserved word), then
36 * some examples of what a parser might produce are the following:
39 * preContext postContext
40 * "" "" The parser does not support context
41 * "let " "=7" Pre- and post-context only
42 * "let " "for=7" Pre- and post-context and error text
43 * "" "for" Error text only
46 * <p>Examples of engines which use UParseError (or may use it in the
47 * future) are Transliterator, RuleBasedBreakIterator, and
52 typedef struct UParseError
{
55 * The line on which the error occured. If the parser uses this
56 * field, it sets it to the line number of the source text line on
57 * which the error appears, which will be be a value >= 1. If the
58 * parse does not support line numbers, the value will be <= 0.
64 * The character offset to the error. If the line field is >= 1,
65 * then this is the offset from the start of the line. Otherwise,
66 * this is the offset from the start of the text. If the parser
67 * does not support this field, it will have a value < 0.
73 * Textual context before the error. Null-terminated. The empty
74 * string if not supported by parser.
77 UChar preContext
[U_PARSE_CONTEXT_LEN
];
80 * The error itself and/or textual context after the error.
81 * Null-terminated. The empty string if not supported by parser.
84 UChar postContext
[U_PARSE_CONTEXT_LEN
];