Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/native/common/unicode/parseerr.h
38827 views
/*1**********************************************************************2* Copyright (C) 1999-2005, International Business Machines3* Corporation and others. All Rights Reserved.4**********************************************************************5* Date Name Description6* 03/14/00 aliu Creation.7* 06/27/00 aliu Change from C++ class to C struct8**********************************************************************9*/10#ifndef PARSEERR_H11#define PARSEERR_H1213#include "unicode/utypes.h"141516/**17* \file18* \brief C API: Parse Error Information19*/20/**21* The capacity of the context strings in UParseError.22* @stable ICU 2.023*/24enum { U_PARSE_CONTEXT_LEN = 16 };2526/**27* A UParseError struct is used to returned detailed information about28* parsing errors. It is used by ICU parsing engines that parse long29* rules, patterns, or programs, where the text being parsed is long30* enough that more information than a UErrorCode is needed to31* localize the error.32*33* <p>The line, offset, and context fields are optional; parsing34* engines may choose not to use to use them.35*36* <p>The preContext and postContext strings include some part of the37* context surrounding the error. If the source text is "let for=7"38* and "for" is the error (e.g., because it is a reserved word), then39* some examples of what a parser might produce are the following:40*41* <pre>42* preContext postContext43* "" "" The parser does not support context44* "let " "=7" Pre- and post-context only45* "let " "for=7" Pre- and post-context and error text46* "" "for" Error text only47* </pre>48*49* <p>Examples of engines which use UParseError (or may use it in the50* future) are Transliterator, RuleBasedBreakIterator, and51* RegexPattern.52*53* @stable ICU 2.054*/55typedef struct UParseError {5657/**58* The line on which the error occured. If the parser uses this59* field, it sets it to the line number of the source text line on60* which the error appears, which will be be a value >= 1. If the61* parse does not support line numbers, the value will be <= 0.62* @stable ICU 2.063*/64int32_t line;6566/**67* The character offset to the error. If the line field is >= 1,68* then this is the offset from the start of the line. Otherwise,69* this is the offset from the start of the text. If the parser70* does not support this field, it will have a value < 0.71* @stable ICU 2.072*/73int32_t offset;7475/**76* Textual context before the error. Null-terminated. The empty77* string if not supported by parser.78* @stable ICU 2.079*/80UChar preContext[U_PARSE_CONTEXT_LEN];8182/**83* The error itself and/or textual context after the error.84* Null-terminated. The empty string if not supported by parser.85* @stable ICU 2.086*/87UChar postContext[U_PARSE_CONTEXT_LEN];8889} UParseError;9091#endif929394