We are at '{ ... }'. * Parse the table. */
| 934 | * Parse the table. |
| 935 | */ |
| 936 | static 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 | |
| 975 | static int valtype(const char* val) |
| 976 | { |
no test coverage detected