Lines Matching defs:input

259 property::parse_string(text_input_buffer &input)
262 assert(*input == '"');
263 ++input;
266 while (char c = *input)
270 input.consume('"');
275 ++input;
282 property::parse_cells(text_input_buffer &input, int cell_size)
284 assert(*input == '<');
285 ++input;
287 input.next_token();
288 while (!input.consume('>'))
290 input.next_token();
293 if (input.consume('&'))
297 input.parse_error("reference only permitted in 32-bit arrays");
301 input.next_token();
303 if (!input.consume('{'))
305 referenced = input.parse_node_name();
309 referenced = input.parse_to('}');
310 input.consume('}');
314 input.parse_error("Expected node name");
318 input.next_token();
336 if (!input.consume_integer_expression(val))
338 input.parse_error("Expected numbers in array of cells");
359 input.next_token();
370 property::parse_bytes(text_input_buffer &input)
372 assert(*input == '[');
373 ++input;
375 input.next_token();
376 while (!input.consume(']'))
383 if (!input.consume_hex_byte(val))
385 input.parse_error("Expected hex bytes in array of bytes");
390 input.next_token();
397 property::parse_reference(text_input_buffer &input)
399 assert(*input == '&');
400 ++input;
401 input.next_token();
403 v.string_data = input.parse_node_name();
406 input.parse_error("Expected node name");
456 void property::parse_define(text_input_buffer &input, define_map *defines)
458 input.consume('$');
461 input.parse_error("No predefined properties to match name\n");
465 string name = input.parse_property_name();
470 input.parse_error("Undefined property name\n");
477 property::property(text_input_buffer &input,
484 input.next_token();
485 switch (*input)
489 parse_define(input, defines);
497 input.parse_error("Invalid property value.");
502 if (input.consume("/incbin/(\""))
504 auto loc = input.location();
505 std::string filename = input.parse_to('"');
506 if (!(valid = input.consume('"')))
512 if (!(valid = input.read_binary_file(filename, v.byte_data)))
514 input.parse_error("Cannot open binary include file");
517 if (!(valid &= input.consume(')')))
519 input.parse_error("Syntax error, expected ')' to terminate /incbin/(");
526 valid = input.consume("/bits/");
527 input.next_token();
528 valid &= input.consume_integer(bits);
533 input.parse_error("Invalid size for elements");
537 input.next_token();
538 if (*input != '<')
540 input.parse_error("/bits/ directive is only valid on arrays");
544 parse_cells(input, bits);
548 parse_string(input);
551 parse_cells(input, 32);
554 parse_bytes(input);
557 parse_reference(input);
564 input.next_token();
565 } while (input.consume(','));
566 if (semicolonTerminated && !input.consume(';'))
568 input.parse_error("Expected ; at end of property");
585 property::parse(text_input_buffer &input, string &&key, string_set &&label,
588 property_ptr p(new property(input,
710 node::parse_name(text_input_buffer &input, bool &is_property, const char *error)
716 input.next_token();
719 return input.parse_property_name();
721 string n = input.parse_node_or_property_name(is_property);
726 input.parse_error(error);
851 node::node(text_input_buffer &input,
859 if (!input.consume('{'))
861 input.parse_error("Expected { to start new device tree node.\n");
863 input.next_token();
864 while (valid && !input.consume('}'))
878 input.parse_error(expected);
882 input.next_token();
883 if (at && input.consume('@'))
886 child_name += parse_name(input, is_property, "Expected unit address");
888 if (!input.consume(';'))
890 input.parse_error("Expected semicolon");
894 input.next_token();
896 if (input.consume("/delete-node/"))
898 input.next_token();
899 child_name = input.parse_node_name();
907 if (input.consume("/delete-property/"))
909 input.next_token();
910 child_name = input.parse_property_name();
918 if (input.consume("/omit-if-no-ref/"))
920 input.next_token();
924 child_name = parse_name(input, is_property,
926 while (input.consume(':'))
932 child_name = parse_name(input, is_property, "Expected property or node name");
934 if (input.consume('@'))
936 child_address = parse_name(input, is_property, "Expected unit address");
942 input.next_token();
944 if (input.consume('='))
946 property_ptr p = property::parse(input, std::move(child_name),
957 else if (!is_property && *input == ('{'))
959 node_ptr child = node::parse(input, tree, std::move(child_name),
971 else if (input.consume(';'))
977 input.parse_error("Error parsing property. Expected property value");
980 input.next_token();
982 input.next_token();
983 input.consume(';');
1014 node::parse(text_input_buffer &input,
1021 node_ptr n(new node(input,
1560 device_tree::parse_file(text_input_buffer &input,
1564 input.next_token();
1566 while (input.consume("/dts-v1/;"))
1569 input.next_token();
1571 if (input.consume("/plugin/;"))
1575 input.next_token();
1578 input.parse_error("Expected /dts-v1/; version string");
1581 while (input.consume("/memreserve/"))
1584 input.next_token();
1586 if (!(input.consume_integer_expression(start) &&
1587 (input.next_token(),
1588 input.consume_integer_expression(len))))
1590 input.parse_error("Expected size on /memreserve/ node.");
1596 input.next_token();
1597 input.consume(';');
1598 input.next_token();
1600 while (valid && !input.finished())
1603 if (input.consume('/'))
1605 input.next_token();
1606 n = node::parse(input, *this, string(), string_set(), string(), &defines);
1608 else if (input.consume('&'))
1610 input.next_token();
1616 if (input.consume('{') && is_plugin)
1618 name = input.parse_to('}');
1619 input.consume('}');
1624 name = input.parse_node_name();
1626 input.next_token();
1627 n = node::parse(input, *this, std::move(name), string_set(), string(), &defines);
1635 input.parse_error("Failed to find root node /.");
1645 input.next_token();
1776 input_buffer &input = *in;
1778 valid = h.read_dtb(input);
1790 input.buffer_from_offset(h.off_mem_rsvmap, 0);
1807 input.buffer_from_offset(h.off_dt_struct, h.size_dt_struct);
1809 input.buffer_from_offset(h.off_dt_strings, h.size_dt_strings);
1943 text_input_buffer input(std::move(in),
1950 parse_file(input, roots, read_header);
1955 input.parse_error("Failed to find root node /.");
1962 input.parse_error("Failed to find root node /.");
1972 input.parse_error("Failed to find root node /.");