A tiny parser to read content of a own config file using pure c and flex library.
$ flex myscanner.l
$ cc myscanner.c lex.yy.c
$ ls
a.out config.in lex.yy.c myscanner.c myscanner.h myscanner.l
Run parser and get contents from config.in
file via linux/unix command:
$ ./a.out < config.in
1
db_type is set to mysql
2
db_name is set to testdata
3
db_table_prefix is set to test_
4
db_port is set to 1099
You can use %option nounput yylineno
in lex file.
- Adding
fopen()
to read yyinput from file - Using keyName as value (e.g:
db_name : db_name
)
Feel free to participate and develop.
I saw an lecture from Prof. Jonathan Engelsma and It's encouraged me to do this project myself.
© Copyright Max Base