Parse section 1 of a lex specification
| 1464 | |
| 1465 | /// Parse section 1 of a lex specification |
| 1466 | void Reflex::parse_section_1() |
| 1467 | { |
| 1468 | if (!get_line()) |
| 1469 | return; |
| 1470 | while (!is("%%")) |
| 1471 | { |
| 1472 | if (linelen == 0) |
| 1473 | { |
| 1474 | if (!get_line()) |
| 1475 | return; |
| 1476 | } |
| 1477 | else |
| 1478 | { |
| 1479 | if (is_code()) |
| 1480 | { |
| 1481 | size_t pos = 0; |
| 1482 | size_t this_lineno = lineno; |
| 1483 | std::string code = get_code(pos); |
| 1484 | section_1.push_back(Code(code, infile, this_lineno)); |
| 1485 | } |
| 1486 | else if (is_top_code()) |
| 1487 | { |
| 1488 | size_t pos = 0; |
| 1489 | size_t this_lineno = lineno; |
| 1490 | std::string code = get_code(pos); |
| 1491 | section_top.push_back(Code(code, infile, this_lineno)); |
| 1492 | } |
| 1493 | else if (is_class_code()) |
| 1494 | { |
| 1495 | size_t pos = 0; |
| 1496 | size_t this_lineno = lineno; |
| 1497 | std::string code = get_code(pos); |
| 1498 | section_class.push_back(Code(code, infile, this_lineno)); |
| 1499 | } |
| 1500 | else if (is_init_code()) |
| 1501 | { |
| 1502 | size_t pos = 0; |
| 1503 | size_t this_lineno = lineno; |
| 1504 | std::string code = get_code(pos); |
| 1505 | section_init.push_back(Code(code, infile, this_lineno)); |
| 1506 | } |
| 1507 | else if (is_begin_code()) |
| 1508 | { |
| 1509 | size_t pos = 0; |
| 1510 | size_t this_lineno = lineno; |
| 1511 | std::string code = get_code(pos); |
| 1512 | section_begin.push_back(Code(code, infile, this_lineno)); |
| 1513 | } |
| 1514 | else |
| 1515 | { |
| 1516 | if (linelen > 1 && line.at(0) == '%') |
| 1517 | { |
| 1518 | size_t pos = 1; |
| 1519 | if (as(pos, "include")) |
| 1520 | { |
| 1521 | do |
| 1522 | { |
| 1523 | std::string filename; |