Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Codegen] Introduce a generic & adjustable C header parser in Rust (#…
…3065) * init codegen-v2 * play around with possible implementation * impl derive for GSeparator * add GSeparators with wrapped Vec<GSeparator> * impl ParseTree for GSeparator * add Driver and DriverUsed convenient structs * add read_amt function, use in ParseTree impl * add DerivationResult and Error type, continue impl * update existing code to DerivationResult changes * small cleanup * rename revert to rollback * implement basic tests for GSeparator * fix target slice in Driver impl * track test module * make a GStruct test in GType::derive * handle EOF in ParseTree * check for EOF in tests * init basic types for function parameters * impl ParseTree for GParamItemWithMarker * impl ParseTree for GMarker and GParamName * complete ParseTree impl for GParamItemWithMarker * expand tests, derive Eq and PartialEq for relevant types * implement ParseTree for GParamItemWithoutMarker, write unit tests * add Continuum and ContinuumNext structs * implement ParseTree for Continuum * introduce WithEof struct for checking EOF * add EitherOr struct * deprecate WithEof * make internal changes to Driver * update ParseTree impls to Driver changes * complete new Driver implementation * update unit tests * rename DriverScope to Driver * update scoping mechanism * return DriverFinalized from derive impl * add test for individual separator items * add test_eof * fix position when applying scope * rename various types and methods * move Reader types into reader module * move types into grammar module * rename ReaderToMerge to ReaderBranch * introduce GFuncParams type * add GNonAlphanumeric type * add wipe and ensure convenience functions * expand usage of ensure * use convenience functions in GFuncParams * check explicitly for brackets * complete function definition parsing * convert GMarker to enum, set explicit variants * expand tests for function decleration * reorder impls in grammar * cleanup * add comments * rename GType to GPrimitive * add additional type categories * handle parsing of pointers, add unit tests * handle struct parsing * test Unknown type variant * handle markers in function declaration * add test * cleanup warnings * start ParseTree impl for GHeaderInclude * complete ParseTree impl for GHeaderInclude * deprecate GParamItemWithMarker * rename GParamItemWithoutMarker to GParamItem * write simple parse_file test, add GNewline and GAnyLine to grammar * expand * implement ParseTree for GEndOfLine * introduce GHeaderFileItem * introduce GCommentLine and GCommentBlock types * handle comments in GHeaderFileItem * start with impl of handling of structs * expand tests for struct parsing * split tests into smaller files * implement ParseTree for GType, convert function params to GType * fix mutability indicator * handle struct declarations * implement GEnum * fix some warnings * get rid of remaining warnings * handle marker after return value * introduce GReturnValue * update unit test * handle marker for struct * handle #pragma * handle makers directly * reorder grammar module * return in parse_file * implement serde support * rename variant to g_variant * add ASCII only for now * ignore attribute for test_parse_file * handle 'define' attributes, write unit tests * track attributes tests * implement GMarkers type * introduce GMarkers into other G types * convert inner GMarkers field to tuple * remove unused imports * remove double comment * support typedef, add unit test * track typedef unit test module * test with const void TWData * handle typedef and define in GHeaderFileItem * rename GHeaderDefine to GDefine * check for more separators * be more precise with GDefine parsing * more characters tests for define * handle GDefine better * add must_ok and must_err convenience functions * convert must_ok and must_err to macros * add comment * add unit tests for GKeyword * convert From<String> to From<&str> for test cases * cleanup warnings * use must_ok! in type categories unit tests * migrate functions unit tests to macros too * check for separator handling in functions tests * additional tests in functions module * cleanup * rename var * update unit tests for typedef * deprecate some tests * use GKeyword for GTypeCategory internally * make use of GKeyword in GStruct * use GKeyword in GEnum impl * deprecate GTypeCategory::Unknown * fix warnings * rename GStruct to GStructName * migrate primitives tests to must_ok! * migrate other unit tests to must_ok! * update in mod.rs * poc for reading includes * formatting * complete parse_file and parse_dir impl * print unrecognized items in test * remove unused import * add Unrecognized variant for types, used to handle structs as params * explicitly check for GTypeCategory::Unrecognized * add parser for inline comments * start with ParseTree impl for GEnumDecl * adjust comma check for enums * additional unit tests for enum decls * handle enum decl as part of GHeaderFileItem * track tests * expand tests for enum declaration * handle HEX values in enum variant values * implement ParseTree for GStaticVar * add support for static variables * use macro for single character definitions * move macro to root * wipe comment line in enums * write test for number in static var * handle TW_EXPORT_ENUM marker * cleanup * add test for non-parameter functions * typo * rename GStructDecl to GStructInd * implement ParseTree for GStructDecl * add unit tests for GStructDecl * handle struct declarations in primary parser * handle 'extern' functions * track .devcontainer * update .devcontainer * add extension to devcontainer * add README * add minimal main() method * update README * add workflow for codegen-v2 tests * update workflow * add manifest path to cargo test * deprecate GParamName * deprecate GFuncName * removed example.include_manifest.json * GStructName wraps GKeyword * adjust GStruct and GEnum * deprecate wipe, just use optional * rename Continuum types to plural * move define_char! decl to grammar module * rename EitherOr to Either * update comment * remove unnecessary check on GKeyword derive impl * rename GEnum to GEnumName * add more tests for primitives * fix devcontainer * add copyright notice to each Rust file * track Cargo lock and ignore target
- Loading branch information