Imported Upstream version 58.1
[platform/upstream/icu.git] / source / tools / genrb / read.h
1 // Copyright (C) 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
3 /*
4 *******************************************************************************
5 *
6 *   Copyright (C) 1998-2011, International Business Machines
7 *   Corporation and others.  All Rights Reserved.
8 *
9 *******************************************************************************
10 *
11 * File read.h
12 *
13 * Modification History:
14 *
15 *   Date        Name        Description
16 *   05/26/99    stephen     Creation.
17 *   5/10/01     Ram         removed ustdio dependency
18 *******************************************************************************
19 */
20
21 #ifndef READ_H
22 #define READ_H 1
23
24 #include "unicode/utypes.h"
25 #include "ustr.h"
26 #include "ucbuf.h"
27
28 /* The types of tokens which may be returned by getNextToken.
29    NOTE: Keep these in sync with tokenNames in parse.c */
30 enum ETokenType
31 {
32     TOK_STRING,          /* A string token, such as "MonthNames" */
33     TOK_OPEN_BRACE,      /* An opening brace character */
34     TOK_CLOSE_BRACE,     /* A closing brace character */
35     TOK_COMMA,           /* A comma */
36     TOK_COLON,           /* A colon */
37
38     TOK_EOF,             /* End of the file has been reached successfully */
39     TOK_ERROR,           /* An error, such an unterminated quoted string */
40     TOK_TOKEN_COUNT      /* Number of "real" token types */
41 };
42
43 U_CFUNC UChar32 unescape(UCHARBUF *buf, UErrorCode *status);
44
45 U_CFUNC void resetLineNumber(void);
46
47 U_CFUNC enum ETokenType
48 getNextToken(UCHARBUF *buf,
49              struct UString *token,
50              uint32_t *linenumber, /* out: linenumber of token */
51              struct UString *comment,
52              UErrorCode *status);
53
54 #endif