headers: sc_trunc - truncate via type casts
[supercollider.git] / external_libraries / icu / unicode / parseerr.h
blob67fdd46f70e73afd5ce3f71db88f1d3d3ceb56f4
1 /*
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 **********************************************************************
11 #ifndef PARSEERR_H
12 #define PARSEERR_H
14 #include "utypes.h"
17 /**
18 * The capacity of the context strings in UParseError.
19 * @stable ICU 2.0
21 enum { U_PARSE_CONTEXT_LEN = 16 };
23 /**
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
28 * localize the error.
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:
38 * <pre>
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
44 * </pre>
46 * <p>Examples of engines which use UParseError (or may use it in the
47 * future) are Transliterator, RuleBasedBreakIterator, and
48 * RegexPattern.
50 * @stable ICU 2.0
52 typedef struct UParseError {
54 /**
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.
59 * @stable ICU 2.0
61 int32_t line;
63 /**
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.
68 * @stable ICU 2.0
70 int32_t offset;
72 /**
73 * Textual context before the error. Null-terminated. The empty
74 * string if not supported by parser.
75 * @stable ICU 2.0
77 UChar preContext[U_PARSE_CONTEXT_LEN];
79 /**
80 * The error itself and/or textual context after the error.
81 * Null-terminated. The empty string if not supported by parser.
82 * @stable ICU 2.0
84 UChar postContext[U_PARSE_CONTEXT_LEN];
86 } UParseError;
88 #endif