Home | History | Annotate | Download | only in genrb

Lines Matching refs:state

93 ParseResourceFunction(ParseState* state, char *tag, uint32_t startline, const struct UString* comment, UErrorCode *status);
95 static struct SResource *parseResource(ParseState* state, char *tag, const struct UString *comment, UErrorCode *status);
111 initLookahead(ParseState* state, UCHARBUF *buf, UErrorCode *status)
121 state->lookaheadPosition = 0;
122 state->buffer = buf;
128 state->lookahead[i].type = getNextToken(state->buffer, &state->lookahead[i].value, &state->lookahead[i].line, &state->lookahead[i].comment, status);
139 cleanupLookahead(ParseState* state)
144 ustr_deinit(&state->lookahead[i].value);
145 ustr_deinit(&state->lookahead[i].comment);
151 getToken(ParseState* state, struct UString **tokenValue, struct UString* comment, uint32_t *linenumber, UErrorCode *status)
156 result = state->lookahead[state->lookaheadPosition].type;
160 *tokenValue = &state->lookahead[state->lookaheadPosition].value;
165 *linenumber = state->lookahead[state->lookaheadPosition].line;
170 ustr_cpy(comment, &(state->lookahead[state->lookaheadPosition].comment), status);
173 i = (state->lookaheadPosition + MAX_LOOKAHEAD) % (MAX_LOOKAHEAD + 1);
174 state->lookaheadPosition = (state->lookaheadPosition + 1) % (MAX_LOOKAHEAD + 1);
175 ustr_setlen(&state->lookahead[i].comment, 0, status);
176 ustr_setlen(&state->lookahead[i].value, 0, status);
177 state->lookahead[i].type = getNextToken(state->buffer, &state->lookahead[i].value, &state->lookahead[i].line, &state->lookahead[i].comment, status);
185 peekToken(ParseState* state, uint32_t lookaheadCount, struct UString **tokenValue, uint32_t *linenumber, struct UString *comment, UErrorCode *status)
187 uint32_t i = (state->lookaheadPosition + lookaheadCount) % (MAX_LOOKAHEAD + 1);
202 *tokenValue = &state->lookahead[i].value;
207 *linenumber = state->lookahead[i].line;
211 ustr_cpy(comment, &(state->lookahead[state->lookaheadPosition].comment), status);
214 return state->lookahead[i].type;
218 expect(ParseState* state, enum ETokenType expectedToken, struct UString **tokenValue, struct UString *comment, uint32_t *linenumber, UErrorCode *status)
222 enum ETokenType token = getToken(state, tokenValue, comment, &line, status);
245 static char *getInvariantString(ParseState* state, uint32_t *line, struct UString *comment, UErrorCode *status)
251 expect(state, TOK_STRING, &tokenValue, comment, line, status);
278 parseUCARules(ParseState* state, char *tag, uint32_t startline, const struct UString* /*comment*/, UErrorCode *status)
295 expect(state, TOK_STRING, &tokenValue, NULL, &line, status);
306 if (state->inputdir != NULL)
308 uprv_strcat(filename, state->inputdir);
310 if (state->inputdir[state->inputdirLength - 1] != U_FILE_SEP_CHAR)
318 expect(state, TOK_CLOSE_BRACE, NULL, NULL, NULL, status);
411 result = string_open(state->bundle, tag, pTarget, (int32_t)(target - pTarget), NULL, status);
422 parseTransliterator(ParseState* state, char *tag, uint32_t startline, const struct UString* /*comment*/, UErrorCode *status)
436 expect(state, TOK_STRING, &tokenValue, NULL, &line, status);
447 if (state->inputdir != NULL)
449 uprv_strcat(filename, state->inputdir);
451 if (state->inputdir[state->inputdirLength - 1] != U_FILE_SEP_CHAR)
459 expect(state, TOK_CLOSE_BRACE, NULL, NULL, NULL, status);
489 result = string_open(state->bundle, tag, pTarget, size, NULL, status);
500 parseDependency(ParseState* state, char *tag, uint32_t startline, const struct UString* comment, UErrorCode *status)
509 expect(state, TOK_STRING, &tokenValue, NULL, &line, status);
520 if (state->outputdir != NULL)
522 uprv_strcat(filename, state->outputdir);
524 if (state->outputdir[state->outputdirLength - 1] != U_FILE_SEP_CHAR)
545 dependencyArray = array_open(state->bundle, "%%DEPENDENCY", NULL, status);
548 result = string_open(state->bundle, tag, tokenValue->fChars, tokenValue->fLength, comment, status);
550 elem = string_open(state->bundle, NULL, tokenValue->fChars, tokenValue->fLength, comment, status);
558 expect(state, TOK_CLOSE_BRACE, NULL, NULL, NULL, status);
562 parseString(ParseState* state, char *tag, uint32_t startline, const struct UString* comment, UErrorCode *status)
574 expect(state, TOK_STRING, &tokenValue, NULL, NULL, status);
581 result = string_open(state->bundle, tag, tokenValue->fChars, tokenValue->fLength, comment, status);
583 expect(state, TOK_CLOSE_BRACE, NULL, NULL, NULL, status);
597 parseAlias(ParseState* state, char *tag, uint32_t startline, const struct UString *comment, UErrorCode *status)
602 expect(state, TOK_STRING, &tokenValue, NULL, NULL, status);
613 result = alias_open(state->bundle, tag, tokenValue->fChars, tokenValue->fLength, comment, status);
615 expect(state, TOK_CLOSE_BRACE, NULL, NULL, NULL, status);
828 addCollation(ParseState* state, struct SResource *result, uint32_t startline, UErrorCode *status)
844 token = getToken(state, &tokenValue, &comment, &line, status);
876 member = parseResource(state, subtag, NULL, status);
915 if(state->makeBinaryCollation) {
926 genrbdata.inputDir = state->inputdir;
927 genrbdata.outputDir = state->outputdir;
953 struct SResource *collationBin = bin_open(state->bundle, "%%CollationBin", len, data, NULL, NULL, status);
960 struct SResource *reorderCodeRes = intvector_open(state->bundle, "%%ReorderCodes", NULL, status);
1012 bundle_closeString(state->bundle, member);
1030 parseCollationElements(ParseState* state, char *tag, uint32_t startline, UBool newCollation, UErrorCode *status)
1041 result = table_open(state->bundle, tag, NULL, status);
1051 return addCollation(state, result, startline, status);
1056 token = getToken(state, &tokenValue, &comment, &line, status);
1090 member = parseResource(state, subtag, NULL, status);
1102 token = peekToken(state, 0, &tokenValue, &line, &comment, status);
1107 token = getToken(state, &tokenValue, &comment, &line, status);
1108 collationRes = table_open(state->bundle, subtag, NULL, status);
1109 collationRes = addCollation(state, collationRes, startline, status); /* need to parse the collation data regardless */
1115 token = peekToken(state, 1, &tokenValue, &line, &comment, status);
1118 member = parseResource(state, subtag, NULL, status);
1154 realParseTable(ParseState* state, struct SResource *table, char *tag, uint32_t startline, UErrorCode *status)
1172 token = getToken(state, &tokenValue, &comment, &line, status);
1212 member = parseResource(state, subtag, &comment, status);
1238 parseTable(ParseState* state, char *tag, uint32_t startline, const struct UString *comment, UErrorCode *status)
1244 return parseCollationElements(state, tag, startline, FALSE, status);
1248 return parseCollationElements(state, tag, startline, TRUE, status);
1254 result = table_open(state->bundle, tag, comment, status);
1260 return realParseTable(state, result, tag, startline, status);
1264 parseArray(ParseState* state, char *tag, uint32_t startline, const struct UString *comment, UErrorCode *status)
1273 result = array_open(state->bundle, tag, comment, status);
1292 token = peekToken(state, 0, &tokenValue, NULL, &memberComments, status);
1297 getToken(state, NULL, NULL, NULL, status);
1315 getToken(state, &tokenValue, &memberComments, NULL, status);
1316 member = string_open(state->bundle, NULL, tokenValue->fChars, tokenValue->fLength, &memberComments, status);
1320 member = parseResource(state, NULL, &memberComments, status);
1338 token = peekToken(state, 0, NULL, NULL, NULL, status);
1342 getToken(state, NULL, NULL, NULL, status);
1358 parseIntVector(ParseState* state, char *tag, uint32_t startline, const struct UString *comment, UErrorCode *status)
1369 result = intvector_open(state->bundle, tag, comment, status);
1386 token = peekToken(state, 0, NULL, NULL,&memberComments, status);
1391 getToken(state, NULL, NULL, NULL, status);
1399 string = getInvariantString(state, NULL, NULL, status);
1415 token = peekToken(state, 0, NULL, NULL, NULL, status);
1433 getToken(state, NULL, NULL, NULL, status);
1446 parseBinary(ParseState* state, char *tag, uint32_t startline, const struct UString *comment, UErrorCode *status)
1458 string = getInvariantString(state, &line, NULL, status);
1465 expect(state, TOK_CLOSE_BRACE, NULL, NULL, NULL, status);
1505 result = bin_open(state->bundle, tag, (i >> 1), value,NULL, comment, status);
1519 result = bin_open(state->bundle, tag, 0, NULL, "",comment,status);
1528 parseInteger(ParseState* state, char *tag, uint32_t startline, const struct UString *comment, UErrorCode *status)
1536 string = getInvariantString(state, NULL, NULL, status);
1543 expect(state, TOK_CLOSE_BRACE, NULL, NULL, NULL, status);
1566 result = int_open(state->bundle, tag, value, comment, status);
1578 parseImport(ParseState* state, char *tag, uint32_t startline, const struct UString* comment, UErrorCode *status)
1587 filename = getInvariantString(state, &line, NULL, status);
1594 expect(state, TOK_CLOSE_BRACE, NULL, NULL, NULL, status);
1607 if (state->inputdir == NULL)
1627 if (state->inputdir[state->inputdirLength - 1] != U_FILE_SEP_CHAR)
1629 fullname = (char *) uprv_malloc(state->inputdirLength + count + 2);
1638 uprv_strcpy(fullname, state->inputdir);
1640 fullname[state->inputdirLength] = U_FILE_SEP_CHAR;
1641 fullname[state->inputdirLength + 1] = '\0';
1647 fullname = (char *) uprv_malloc(state->inputdirLength + count + 1);
1656 uprv_strcpy(fullname, state->inputdir);
1684 result = bin_open(state->bundle, tag, len, data, fullname, comment, status);
1694 parseInclude(ParseState* state, char *tag, uint32_t startline, const struct UString* comment, UErrorCode *status)
1708 filename = getInvariantString(state, &line, NULL, status);
1716 expect(state, TOK_CLOSE_BRACE, NULL, NULL, NULL, status);
1728 fullname = (char *) uprv_malloc(state->inputdirLength + count + 2);
1737 if(state->inputdir!=NULL){
1738 if (state->inputdir[state->inputdirLength - 1] != U_FILE_SEP_CHAR)
1741 uprv_strcpy(fullname, state->inputdir);
1743 fullname[state->inputdirLength] = U_FILE_SEP_CHAR;
1744 fullname[state->inputdirLength + 1] = '\0';
1750 uprv_strcpy(fullname, state->inputdir);
1765 result = string_open(state->bundle, tag, uBuffer, len, comment, status);
1871 parseResourceType(ParseState* state, UErrorCode *status)
1878 expect(state, TOK_STRING, &tokenValue, &comment, &line, status);
1914 parseResource(ParseState* state, char *tag, const struct UString *comment, UErrorCode *status)
1924 token = getToken(state, &tokenValue, NULL, &startline, status);
1946 resType = parseResourceType(state, status);
1947 expect(state, TOK_OPEN_BRACE, &tokenValue, NULL, &startline, status);
1980 token = peekToken(state, 0, NULL, &line, NULL,status);
1993 token = peekToken(state, 1, NULL, &line, NULL, status);
2031 return parseFunction(state, tag, startline, comment, status);
2051 ParseState state;
2057 ustr_init(&state.lookahead[i].value);
2058 ustr_init(&state.lookahead[i].comment);
2061 initLookahead(&state, buf, status);
2063 state.inputdir = inputDir;
2064 state.inputdirLength = (state.inputdir != NULL) ? (uint32_t)uprv_strlen(state.inputdir) : 0;
2065 state.outputdir = outputDir;
2066 state.outputdirLength = (state.outputdir != NULL) ? (uint32_t)uprv_strlen(state.outputdir) : 0;
2067 state.makeBinaryCollation = makeBinaryCollation;
2070 expect(&state, TOK_STRING, &tokenValue, &comment, NULL, status);
2072 state.bundle = bundle_open(&comment, FALSE, status);
2074 if (state.bundle == NULL || U_FAILURE(*status))
2080 bundle_setlocale(state.bundle, tokenValue->fChars, status);
2083 token = getToken(&state, NULL, NULL, &line, status);
2086 bundleType=parseResourceType(&state, status);
2090 expect(&state, TOK_OPEN_BRACE, NULL, NULL, &line, status);
2117 bundle_close(state.bundle, status);
2127 state.bundle->noFallback=TRUE;
2130 realParseTable(&state, state.bundle->fRoot, NULL, line, status);
2132 table_add(state.bundle->fRoot, dependencyArray, 0, status);
2137 bundle_close(state.bundle, status);
2142 if (getToken(&state, NULL, NULL, &line, status) != TOK_EOF)
2151 cleanupLookahead(&state);
2153 return state.bundle;