πŸ“œ ⬆️ ⬇️

Google released HTML5 parser on pure C

A good opportunity for web developers to learn the C programming language is the HTML5 parser Gumbo , implemented as a small C99 library without external dependencies. The parser is created as a building block for creating other tools and libraries, such as validators, template languages, refactoring and code analysis tools.

Features:

The developers do not set themselves the goals of optimizing the parser for performance, it was written in C not to increase the speed of code execution tenfold.

In the future we plan to add support for the latest HTML5 features, support for parsing code snippets, full error reports, and so on.
')
To use the Gumbo parser, you need to include the gumbo.h file, and then call gumbo_parse .

 #include "gumbo.h" int main(int argc, char** argv) { GumboOutput* output = gumbo_parse(argv[1]); // Do stuff with output->root gumbo_destroy_output(&kGumboDefaultOptions, output); } 

Useful examples see here .

The program is published under the Apache 2 license.

Source: https://habr.com/ru/post/190044/


All Articles