MCPcopy Create free account
hub / github.com/MultiMC/Launcher / parse_inline_table

Function parse_inline_table

libraries/tomlc99/src/toml.c:936–973  ·  view source on GitHub ↗

We are at '{ ... }'. * Parse the table. */

Source from the content-addressed store, hash-verified

934 * Parse the table.
935 */
936static int parse_inline_table(context_t* ctx, toml_table_t* tab)
937{
938 if (eat_token(ctx, LBRACE, 1, FLINE))
939 return -1;
940
941 for (;;) {
942 if (ctx->tok.tok == NEWLINE)
943 return e_syntax(ctx, ctx->tok.lineno, "newline not allowed in inline table");
944
945 /* until } */
946 if (ctx->tok.tok == RBRACE)
947 break;
948
949 if (ctx->tok.tok != STRING)
950 return e_syntax(ctx, ctx->tok.lineno, "expect a string");
951
952 if (parse_keyval(ctx, tab))
953 return -1;
954
955 if (ctx->tok.tok == NEWLINE)
956 return e_syntax(ctx, ctx->tok.lineno, "newline not allowed in inline table");
957
958 /* on comma, continue to scan for next keyval */
959 if (ctx->tok.tok == COMMA) {
960 if (eat_token(ctx, COMMA, 1, FLINE))
961 return -1;
962 continue;
963 }
964 break;
965 }
966
967 if (eat_token(ctx, RBRACE, 1, FLINE))
968 return -1;
969
970 tab->readonly = 1;
971
972 return 0;
973}
974
975static int valtype(const char* val)
976{

Callers 2

parse_arrayFunction · 0.85
parse_keyvalFunction · 0.85

Calls 3

eat_tokenFunction · 0.85
e_syntaxFunction · 0.85
parse_keyvalFunction · 0.85

Tested by

no test coverage detected