diff --git a/assets/parser.h.erb b/assets/parser.h.erb index 7796e4c..a9927b6 100644 --- a/assets/parser.h.erb +++ b/assets/parser.h.erb @@ -4,8 +4,7 @@ * This file is generated by Propane. */ -#ifndef PROPANE_PARSER_H -#define PROPANE_PARSER_H +#pragma once #include #include @@ -121,5 +120,3 @@ size_t <%= @grammar.prefix %>parse(<%= @grammar.prefix %>context_t * context); <%= start_rule_type[1] %> <%= @grammar.prefix %>result(<%= @grammar.prefix %>context_t * context); <%= @grammar.prefix %>position_t <%= @grammar.prefix %>position(<%= @grammar.prefix %>context_t * context); - -#endif diff --git a/spec/test_multiple_parsers.c b/spec/test_multiple_parsers.c new file mode 100644 index 0000000..cad14a7 --- /dev/null +++ b/spec/test_multiple_parsers.c @@ -0,0 +1,19 @@ +#include "testparsermyp1.h" +#include "testparsermyp2.h" +#include +#include + +int main() +{ + char const * input1 = "a\n1"; + myp1_context_t context1; + myp1_context_init(&context1, (uint8_t const *)input1, strlen(input1)); + assert(myp1_parse(&context1) == MYP1_SUCCESS); + + char const * input2 = "bcb"; + myp2_context_t context2; + myp2_context_init(&context2, (uint8_t const *)input2, strlen(input2)); + assert(myp2_parse(&context2) == MYP2_SUCCESS); + + return 0; +}