summaryrefslogtreecommitdiff
path: root/pattern2regex.c
blob: c9b17438e2b93a5a9fca68d10a2169699b4fcba3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <stdio.h>

#include "ast.h"
#include "lex-pattern.h"
#include "parse-pattern.h"

int main(int argc, char **argv)
{
	if (argc >= 2) {
		yyin = fmemopen(argv[1], strlen(argv[1]), "r");
	} else {
		yyin = stdin;
	}

	if (!yyparse()) {
		simplify(ast);
		print_regex(ast);
	}

	fclose(yyin);
	return 0;
}