intl/icu/source/common/unicode/parseerr.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /*
michael@0 2 **********************************************************************
michael@0 3 * Copyright (C) 1999-2005, International Business Machines
michael@0 4 * Corporation and others. All Rights Reserved.
michael@0 5 **********************************************************************
michael@0 6 * Date Name Description
michael@0 7 * 03/14/00 aliu Creation.
michael@0 8 * 06/27/00 aliu Change from C++ class to C struct
michael@0 9 **********************************************************************
michael@0 10 */
michael@0 11 #ifndef PARSEERR_H
michael@0 12 #define PARSEERR_H
michael@0 13
michael@0 14 #include "unicode/utypes.h"
michael@0 15
michael@0 16
michael@0 17 /**
michael@0 18 * \file
michael@0 19 * \brief C API: Parse Error Information
michael@0 20 */
michael@0 21 /**
michael@0 22 * The capacity of the context strings in UParseError.
michael@0 23 * @stable ICU 2.0
michael@0 24 */
michael@0 25 enum { U_PARSE_CONTEXT_LEN = 16 };
michael@0 26
michael@0 27 /**
michael@0 28 * A UParseError struct is used to returned detailed information about
michael@0 29 * parsing errors. It is used by ICU parsing engines that parse long
michael@0 30 * rules, patterns, or programs, where the text being parsed is long
michael@0 31 * enough that more information than a UErrorCode is needed to
michael@0 32 * localize the error.
michael@0 33 *
michael@0 34 * <p>The line, offset, and context fields are optional; parsing
michael@0 35 * engines may choose not to use to use them.
michael@0 36 *
michael@0 37 * <p>The preContext and postContext strings include some part of the
michael@0 38 * context surrounding the error. If the source text is "let for=7"
michael@0 39 * and "for" is the error (e.g., because it is a reserved word), then
michael@0 40 * some examples of what a parser might produce are the following:
michael@0 41 *
michael@0 42 * <pre>
michael@0 43 * preContext postContext
michael@0 44 * "" "" The parser does not support context
michael@0 45 * "let " "=7" Pre- and post-context only
michael@0 46 * "let " "for=7" Pre- and post-context and error text
michael@0 47 * "" "for" Error text only
michael@0 48 * </pre>
michael@0 49 *
michael@0 50 * <p>Examples of engines which use UParseError (or may use it in the
michael@0 51 * future) are Transliterator, RuleBasedBreakIterator, and
michael@0 52 * RegexPattern.
michael@0 53 *
michael@0 54 * @stable ICU 2.0
michael@0 55 */
michael@0 56 typedef struct UParseError {
michael@0 57
michael@0 58 /**
michael@0 59 * The line on which the error occured. If the parser uses this
michael@0 60 * field, it sets it to the line number of the source text line on
michael@0 61 * which the error appears, which will be be a value >= 1. If the
michael@0 62 * parse does not support line numbers, the value will be <= 0.
michael@0 63 * @stable ICU 2.0
michael@0 64 */
michael@0 65 int32_t line;
michael@0 66
michael@0 67 /**
michael@0 68 * The character offset to the error. If the line field is >= 1,
michael@0 69 * then this is the offset from the start of the line. Otherwise,
michael@0 70 * this is the offset from the start of the text. If the parser
michael@0 71 * does not support this field, it will have a value < 0.
michael@0 72 * @stable ICU 2.0
michael@0 73 */
michael@0 74 int32_t offset;
michael@0 75
michael@0 76 /**
michael@0 77 * Textual context before the error. Null-terminated. The empty
michael@0 78 * string if not supported by parser.
michael@0 79 * @stable ICU 2.0
michael@0 80 */
michael@0 81 UChar preContext[U_PARSE_CONTEXT_LEN];
michael@0 82
michael@0 83 /**
michael@0 84 * The error itself and/or textual context after the error.
michael@0 85 * Null-terminated. The empty string if not supported by parser.
michael@0 86 * @stable ICU 2.0
michael@0 87 */
michael@0 88 UChar postContext[U_PARSE_CONTEXT_LEN];
michael@0 89
michael@0 90 } UParseError;
michael@0 91
michael@0 92 #endif

mercurial