Home | History | Annotate | Download | only in genrb

Lines Matching full:state

95 ParseResourceFunction(ParseState* state, char *tag, uint32_t startline, const struct UString* comment, UErrorCode *status);
97 static struct SResource *parseResource(ParseState* state, char *tag, const struct UString *comment, UErrorCode *status);
113 initLookahead(ParseState* state, UCHARBUF *buf, UErrorCode *status)
123 state->lookaheadPosition = 0;
124 state->buffer = buf;
130 state->lookahead[i].type = getNextToken(state->buffer, &state->lookahead[i].value, &state->lookahead[i].line, &state->lookahead[i].comment, status);
141 cleanupLookahead(ParseState* state)
146 ustr_deinit(&state->lookahead[i].value);
147 ustr_deinit(&state->lookahead[i].comment);
153 getToken(ParseState* state, struct UString **tokenValue, struct UString* comment, uint32_t *linenumber, UErrorCode *status)
158 result = state->lookahead[state->lookaheadPosition].type;
162 *tokenValue = &state->lookahead[state->lookaheadPosition].value;
167 *linenumber = state->lookahead[state->lookaheadPosition].line;
172 ustr_cpy(comment, &(state->lookahead[state->lookaheadPosition].comment), status);
175 i = (state->lookaheadPosition + MAX_LOOKAHEAD) % (MAX_LOOKAHEAD + 1);
176 state->lookaheadPosition = (state->lookaheadPosition + 1) % (MAX_LOOKAHEAD + 1);
177 ustr_setlen(&state->lookahead[i].comment, 0, status);
178 ustr_setlen(&state->lookahead[i].value, 0, status);
179 state->lookahead[i].type = getNextToken(state->buffer, &state->lookahead[i].value, &state->lookahead[i].line, &state->lookahead[i].comment, status);
187 peekToken(ParseState* state, uint32_t lookaheadCount, struct UString **tokenValue, uint32_t *linenumber, struct UString *comment, UErrorCode *status)
189 uint32_t i = (state->lookaheadPosition + lookaheadCount) % (MAX_LOOKAHEAD + 1);
204 *tokenValue = &state->lookahead[i].value;
209 *linenumber = state->lookahead[i].line;
213 ustr_cpy(comment, &(state->lookahead[state->lookaheadPosition].comment), status);
216 return state->lookahead[i].type;
220 expect(ParseState* state, enum ETokenType expectedToken, struct UString **tokenValue, struct UString *comment, uint32_t *linenumber, UErrorCode *status)
224 enum ETokenType token = getToken(state, tokenValue, comment, &line, status);
247 static char *getInvariantString(ParseState* state, uint32_t *line, struct UString *comment, UErrorCode *status)
253 expect(state, TOK_STRING, &tokenValue, comment, line, status);
280 parseUCARules(ParseState* state, char *tag, uint32_t startline, const struct UString* comment, UErrorCode *status)
298 expect(state, TOK_STRING, &tokenValue, NULL, &line, status);
309 if (state->inputdir != NULL)
311 uprv_strcat(filename, state->inputdir);
313 if (state->inputdir[state->inputdirLength - 1] != U_FILE_SEP_CHAR)
321 expect(state, TOK_CLOSE_BRACE, NULL, NULL, NULL, status);
414 result = string_open(state->bundle, tag, pTarget, (int32_t)(target - pTarget), NULL, status);
425 parseTransliterator(ParseState* state, char *tag, uint32_t startline, const struct UString* comment, UErrorCode *status)
439 expect(state, TOK_STRING, &tokenValue, NULL, &line, status);
450 if (state->inputdir != NULL)
452 uprv_strcat(filename, state->inputdir);
454 if (state->inputdir[state->inputdirLength - 1] != U_FILE_SEP_CHAR)
462 expect(state, TOK_CLOSE_BRACE, NULL, NULL, NULL, status);
492 result = string_open(state->bundle, tag, pTarget, size, NULL, status);
503 parseDependency(ParseState* state, char *tag, uint32_t startline, const struct UString* comment, UErrorCode *status)
512 expect(state, TOK_STRING, &tokenValue, NULL, &line, status);
523 if (state->outputdir != NULL)
525 uprv_strcat(filename, state->outputdir);
527 if (state->outputdir[state->outputdirLength - 1] != U_FILE_SEP_CHAR)
548 dependencyArray = array_open(state->bundle, "%%DEPENDENCY", NULL, status);
551 result = string_open(state->bundle, tag, tokenValue->fChars, tokenValue->fLength, comment, status);
553 elem = string_open(state->bundle, NULL, tokenValue->fChars, tokenValue->fLength, comment, status);
561 expect(state, TOK_CLOSE_BRACE, NULL, NULL, NULL, status);
565 parseString(ParseState* state, char *tag, uint32_t startline, const struct UString* comment, UErrorCode *status)
577 expect(state, TOK_STRING, &tokenValue, NULL, NULL, status);
584 result = string_open(state->bundle, tag, tokenValue->fChars, tokenValue->fLength, comment, status);
586 expect(state, TOK_CLOSE_BRACE, NULL, NULL, NULL, status);
600 parseAlias(ParseState* state, char *tag, uint32_t startline, const struct UString *comment, UErrorCode *status)
605 expect(state, TOK_STRING, &tokenValue, NULL, NULL, status);
616 result = alias_open(state->bundle, tag, tokenValue->fChars, tokenValue->fLength, comment, status);
618 expect(state, TOK_CLOSE_BRACE, NULL, NULL, NULL, status);
805 addCollation(ParseState* state, struct SResource *result, uint32_t startline, UErrorCode *status)
822 token = getToken(state, &tokenValue, &comment, &line, status);
854 member = parseResource(state, subtag, NULL, status);
910 genrbdata.inputDir = state->inputdir;
911 genrbdata.outputDir = state->outputdir;
935 struct SResource *collationBin = bin_open(state->bundle, "%%CollationBin", len, data, NULL, NULL, status);
942 struct SResource *reorderCodeRes = intvector_open(state->bundle, "%%ReorderCodes", NULL, status);
982 bundle_closeString(state->bundle, member);
1006 parseCollationElements(ParseState* state, char *tag, uint32_t startline, UBool newCollation, UErrorCode *status)
1017 result = table_open(state->bundle, tag, NULL, status);
1027 return addCollation(state, result, startline, status);
1032 token = getToken(state, &tokenValue, &comment, &line, status);
1066 member = parseResource(state, subtag, NULL, status);
1078 token = peekToken(state, 0, &tokenValue, &line, &comment, status);
1083 token = getToken(state, &tokenValue, &comment, &line, status);
1084 collationRes = table_open(state->bundle, subtag, NULL, status);
1085 collationRes = addCollation(state, collationRes, startline, status); /* need to parse the collation data regardless */
1091 token = peekToken(state, 1, &tokenValue, &line, &comment, status);
1094 member = parseResource(state, subtag, NULL, status);
1131 realParseTable(ParseState* state, struct SResource *table, char *tag, uint32_t startline, UErrorCode *status)
1148 token = getToken(state, &tokenValue, &comment, &line, status);
1188 member = parseResource(state, subtag, &comment, status);
1214 parseTable(ParseState* state, char *tag, uint32_t startline, const struct UString *comment, UErrorCode *status)
1220 return parseCollationElements(state, tag, startline, FALSE, status);
1224 return parseCollationElements(state, tag, startline, TRUE, status);
1230 result = table_open(state->bundle, tag, comment, status);
1237 return realParseTable(state, result, tag, startline, status);
1241 parseArray(ParseState* state, char *tag, uint32_t startline, const struct UString *comment, UErrorCode *status)
1250 result = array_open(state->bundle, tag, comment, status);
1269 token = peekToken(state, 0, &tokenValue, NULL, &memberComments, status);
1274 getToken(state, NULL, NULL, NULL, status);
1292 getToken(state, &tokenValue, &memberComments, NULL, status);
1293 member = string_open(state->bundle, NULL, tokenValue->fChars, tokenValue->fLength, &memberComments, status);
1297 member = parseResource(state, NULL, &memberComments, status);
1315 token = peekToken(state, 0, NULL, NULL, NULL, status);
1319 getToken(state, NULL, NULL, NULL, status);
1335 parseIntVector(ParseState* state, char *tag, uint32_t startline, const struct UString *comment, UErrorCode *status)
1346 result = intvector_open(state->bundle, tag, comment, status);
1363 token = peekToken(state, 0, NULL, NULL,&memberComments, status);
1368 getToken(state, NULL, NULL, NULL, status);
1376 string = getInvariantString(state, NULL, NULL, status);
1392 token = peekToken(state, 0, NULL, NULL, NULL, status);
1410 getToken(state, NULL, NULL, NULL, status);
1423 parseBinary(ParseState* state, char *tag, uint32_t startline, const struct UString *comment, UErrorCode *status)
1435 string = getInvariantString(state, &line, NULL, status);
1442 expect(state, TOK_CLOSE_BRACE, NULL, NULL, NULL, status);
1482 result = bin_open(state->bundle, tag, (i >> 1), value,NULL, comment, status);
1496 result = bin_open(state->bundle, tag, 0, NULL, "",comment,status);
1505 parseInteger(ParseState* state, char *tag, uint32_t startline, const struct UString *comment, UErrorCode *status)
1513 string = getInvariantString(state, NULL, NULL, status);
1520 expect(state, TOK_CLOSE_BRACE, NULL, NULL, NULL, status);
1543 result = int_open(state->bundle, tag, value, comment, status);
1555 parseImport(ParseState* state, char *tag, uint32_t startline, const struct UString* comment, UErrorCode *status)
1565 filename = getInvariantString(state, &line, NULL, status);
1572 expect(state, TOK_CLOSE_BRACE, NULL, NULL, NULL, status);
1585 if (state->inputdir == NULL)
1605 if (state->inputdir[state->inputdirLength - 1] != U_FILE_SEP_CHAR)
1607 fullname = (char *) uprv_malloc(state->inputdirLength + count + 2);
1616 uprv_strcpy(fullname, state->inputdir);
1618 fullname[state->inputdirLength] = U_FILE_SEP_CHAR;
1619 fullname[state->inputdirLength + 1] = '\0';
1625 fullname = (char *) uprv_malloc(state->inputdirLength + count + 1);
1634 uprv_strcpy(fullname, state->inputdir);
1662 result = bin_open(state->bundle, tag, len, data, fullname, comment, status);
1672 parseInclude(ParseState* state, char *tag, uint32_t startline, const struct UString* comment, UErrorCode *status)
1686 filename = getInvariantString(state, &line, NULL, status);
1694 expect(state, TOK_CLOSE_BRACE, NULL, NULL, NULL, status);
1706 fullname = (char *) uprv_malloc(state->inputdirLength + count + 2);
1715 if(state->inputdir!=NULL){
1716 if (state->inputdir[state->inputdirLength - 1] != U_FILE_SEP_CHAR)
1719 uprv_strcpy(fullname, state->inputdir);
1721 fullname[state->inputdirLength] = U_FILE_SEP_CHAR;
1722 fullname[state->inputdirLength + 1] = '\0';
1728 uprv_strcpy(fullname, state->inputdir);
1743 result = string_open(state->bundle, tag, uBuffer, len, comment, status);
1850 parseResourceType(ParseState* state, UErrorCode *status)
1857 expect(state, TOK_STRING, &tokenValue, &comment, &line, status);
1893 parseResource(ParseState* state, char *tag, const struct UString *comment, UErrorCode *status)
1902 token = getToken(state, &tokenValue, NULL, &startline, status);
1924 resType = parseResourceType(state, status);
1925 expect(state, TOK_OPEN_BRACE, &tokenValue, NULL, &startline, status);
1957 token = peekToken(state, 0, NULL, &line, NULL,status);
1970 token = peekToken(state, 1, NULL, &line, NULL, status);
2007 return parseFunction(state, tag, startline, comment, status);
2026 ParseState state;
2031 ustr_init(&state.lookahead[i].value);
2032 ustr_init(&state.lookahead[i].comment);
2035 initLookahead(&state, buf, status);
2037 state.inputdir = inputDir;
2038 state.inputdirLength = (state.inputdir != NULL) ? (uint32_t)uprv_strlen(state.inputdir) : 0;
2039 state.outputdir = outputDir;
2040 state.outputdirLength = (state.outputdir != NULL) ? (uint32_t)uprv_strlen(state.outputdir) : 0;
2043 expect(&state, TOK_STRING, &tokenValue, &comment, NULL, status);
2045 state.bundle = bundle_open(&comment, FALSE, status);
2047 if (state.bundle == NULL || U_FAILURE(*status))
2053 bundle_setlocale(state.bundle, tokenValue->fChars, status);
2056 token = getToken(&state, NULL, NULL, &line, status);
2059 bundleType=parseResourceType(&state, status);
2063 expect(&state, TOK_OPEN_BRACE, NULL, NULL, &line, status);
2092 bundle_close(state.bundle, status);
2102 state.bundle->noFallback=TRUE;
2105 realParseTable(&state, state.bundle->fRoot, NULL, line, status);
2108 table_add(state.bundle->fRoot, dependencyArray, 0, status);
2113 bundle_close(state.bundle, status);
2118 if (getToken(&state, NULL, NULL, &line, status) != TOK_EOF)
2127 cleanupLookahead(&state);
2129 return state.bundle;