X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-psi;a=blobdiff_plain;f=idl%2Fmain.c;fp=idl%2Fmain.c;h=f8029581734cc2fb2efdf707447a17773d4d6ece;hp=fe49647bf49b398229c3f48c3ac0aa19bd2ce2f8;hb=059fffcaee65cf92b95bdbe91e5a156b89b2cf71;hpb=5917ec1de81d919ac670af18166a41238aa1d3f6 diff --git a/idl/main.c b/idl/main.c index fe49647..f802958 100644 --- a/idl/main.c +++ b/idl/main.c @@ -3,6 +3,7 @@ #include #include "lexer.h" #include "parser.h" +#include "validator.h" static int TRACE; @@ -32,6 +33,7 @@ static void loop(PSI_Lexer *L, void *P) int main(int argc, char *argv[]) { PSI_Lexer L; + PSI_Validator V; void *P = PSI_ParserAlloc(malloc); TRACE = !!getenv("TRACE"); @@ -44,7 +46,18 @@ int main(int argc, char *argv[]) loop(&L, P); PSI_ParserFree(P, free); + + if (!PSI_ValidatorInit(&V, &L)) { + perror("Failed to init validator"); + return 2; + } + PSI_LexerDtor(&L); + if (PSI_ValidatorValidate(&V)) { + printf("Whoa! VALID.\n"); + } + PSI_ValidatorDtor(&V); + return 0; }