raylib/parser
lazaray df6caea25d
Parser improvements (#2461)
* Fix parser function description detection

Some functions in easings.h are defined on a single line and include a
division which was mistaken for the start of the description.

* Fix parser detection of macros including spaces

* Add support for self-referencing structs to parser

* Fix parser code style

* Fix parser handling of multiple fields on one line

* Increase parser MAX_STRUCT_FIELDS

For internal rlglData State struct (internal structs are still not
supported but this makes it less wrong).

* Add description helper to parser

* Regenerate parser output

* Add cakkbacks to parser

* Regenerate parser output

* Refactor funcLines to be an array of line numbers

It used to be an array of pointers into the text buffer but was changed
to be an array of pointers to the lines. Now it is an array of line
numbers like the others.

* Fix code style

* Move array size from name to type

* Regenerate parser output
2022-05-04 11:06:01 +02:00
..
LICENSE Update year to 2022 2021-12-31 20:06:22 +01:00
Makefile Added defines to parser (#2269) 2022-02-03 14:56:00 +01:00
raylib_api.json Parser improvements (#2461) 2022-05-04 11:06:01 +02:00
raylib_api.lua Parser improvements (#2461) 2022-05-04 11:06:01 +02:00
raylib_api.txt Parser improvements (#2461) 2022-05-04 11:06:01 +02:00
raylib_api.xml Parser improvements (#2461) 2022-05-04 11:06:01 +02:00
raylib_parser.c Parser improvements (#2461) 2022-05-04 11:06:01 +02:00
README.md Add proper license to raylib-parser 2021-11-02 12:03:42 +01:00

raylib parser

This parser scans raylib.h to get information about structs, enums and functions. All data is separated into parts, usually as strings. The following types are used for data:

  • struct FunctionInfo
  • struct StructInfo
  • struct EnumInfo

Check raylib_parser.c for details about those structs.

Command Line Arguments

The parser can take a few options...

  • --help Displays help information about the parser
  • --json Outputs the header information in JSON format

Constraints

This parser is specifically designed to work with raylib.h, so, it has some constraints:

  • Functions are expected as a single line with the following structure:
   <retType> <name>(<paramType[0]> <paramName[0]>, <paramType[1]> <paramName[1]>);  <desc>

Be careful with functions broken into several lines, it breaks the process!

  • Structures are expected as several lines with the following form:
   <desc>
   typedef struct <name> {
       <fieldType[0]> <fieldName[0]>;  <fieldDesc[0]>
       <fieldType[1]> <fieldName[1]>;  <fieldDesc[1]>
       <fieldType[2]> <fieldName[2]>;  <fieldDesc[2]>
   } <name>;
  • Enums are expected as several lines with the following form:
   <desc>
   typedef enum {
       <valueName[0]> = <valueInteger[0]>, <valueDesc[0]>
       <valueName[1]>,
       <valueName[2]>, <valueDesc[2]>
       <valueName[3]>  <valueDesc[3]>
   } <name>;

NOTE: For enums, multiple options are supported:

  • If value is not provided, (<valueInteger[i -1]> + 1) is assigned
  • Value description can be provided or not

Additional notes

This parser could work with other C header files if mentioned constraints are followed.

This parser does not require <string.h> library, all data is parsed directly from char buffers.

LICENSE: zlib/libpng

raylib-parser is licensed under an unmodified zlib/libpng license, which is an OSI-certified, BSD-like license that allows static linking with closed source software. Check LICENSE for further details.