start validator
[m6w6/ext-psi] / idl / main.c
index fe49647bf49b398229c3f48c3ac0aa19bd2ce2f8..f8029581734cc2fb2efdf707447a17773d4d6ece 100644 (file)
@@ -3,6 +3,7 @@
 #include <string.h>
 #include "lexer.h"
 #include "parser.h"
 #include <string.h>
 #include "lexer.h"
 #include "parser.h"
+#include "validator.h"
 
 static int TRACE;
 
 
 static int TRACE;
 
@@ -32,6 +33,7 @@ static void loop(PSI_Lexer *L, void *P)
 int main(int argc, char *argv[])
 {
        PSI_Lexer L;
 int main(int argc, char *argv[])
 {
        PSI_Lexer L;
+       PSI_Validator V;
        void *P = PSI_ParserAlloc(malloc);
 
        TRACE = !!getenv("TRACE");
        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);
        loop(&L, P);
 
        PSI_ParserFree(P, free);
+
+       if (!PSI_ValidatorInit(&V, &L)) {
+               perror("Failed to init validator");
+               return 2;
+       }
+
        PSI_LexerDtor(&L);
 
        PSI_LexerDtor(&L);
 
+       if (PSI_ValidatorValidate(&V)) {
+               printf("Whoa! VALID.\n");
+       }
+       PSI_ValidatorDtor(&V);
+
        return 0;
 }
        return 0;
 }