Skip to content

v3.1

Choose a tag to compare

@thewizardplusplus thewizardplusplus released this 03 Feb 22:24
· 210 commits to master since this release

Add offsets to nodes, remove lifting, combining and ignoring nodes, remove throwing exceptions, use the ericniebler/range-v3 library.

Change Log

  • Fix logic of the parser::repetition_parser::parse_and_count() method.
  • Support -- as a separator of options and positional arguments in the example.
  • Add an offset to a node:
    • move the parser::integral_infinity constant to the utilities module;
    • add:
      • lexer::get_offset() function;
      • parser::ast_node::offset field;
    • set a node offset in some parsers:
      • empty_parser class;
      • match_parser class;
      • repetition_parser class;
      • lookahead_parser class;
    • fix the example:
      • replace nodes offsets equal to the utilities::integral_infinity constant to a code size;
      • output offsets:
        • in tokens;
        • in nodes.
  • Remove:
    • ignoring nothing and eoi nodes;
    • combining sequence nodes:
      • refactoring:
        • of the parser::concatenation_parser::parse() method;
        • of the parser::repetition_parser::parse() method;
    • lifting:
      • remove:
        • parser::important_assignable_parser class;
        • parser::lift_parser class;
    • exceptions:
      • simplify the lexer::tokenize() function;
      • remove:
        • parser::parse() function;
        • parser::eoi_parser class;
        • exceptions module.
  • Refactoring:
    • of the parser::type_assignable_parser class:
      • rename it to typing_parser;
      • refactoring of the parse() method;
      • combine:
        • assignable_parser and typing_parser classes in a single class;
        • typing_parser class and RULE macro in a single file;
    • use the ericniebler/range-v3 library:
      • in the lexer module;
      • in the example.

Возможности

  • лексинг ASCII-текста:
    • задание лексем посредством регулярных выражений;
  • парсинг ASCII-текста:
    • описание грамматики на EBNF непосредственно в коде программы (посредством DSL);
  • представление результата в виде дерева парсинга:
    • задание имени ноды в дереве парсинга;
  • парсеры:
    • терминальные:
      • пустота;
      • определённые:
        • текст;
        • лексема;
    • комбинаторы:
      • альтернатива (упорядоченная);
      • объединяющие:
        • следование;
        • повторение:
          • 0 или 1 раз (опциональность);
          • 0 или больше раз;
          • 1 или больше раз;
          • любое число раз в указанном диапазоне;
      • проверяющие:
        • исключение;
        • просмотр вперёд:
          • позитивный;
          • негативный.

Скриншоты

Лексический анализ

Лексический анализ

Синтаксический анализ

Синтаксический анализ