If You want store some settings, easiest way is to use QSettings.
If You want store some settings, easiest way is to use QSettings.
Storing isn't that problem. An Alghorithm for parsing these files is the problem ...
After cutting all whitespaces, I've to go through it via QRegExp I think ... The best way I think ...
A lexer can be implemented in any number of ways. Using regular expressions is one of the hardest/slowest.
I say to look in the opposite direction, towards finite automata , especially if you are interested in only one language.
Regards
bad idea, you are not aware of the context in which the string is found. some bad examples (FullMetalCoder will be able to explain about NFA and DFA, I suggest you to read about Turing machines as well)
Qt Code:
// class a { int foo; }; #if 0 class a { int foo; }; #endif /* class a { int foo; }; */To copy to clipboard, switch view to plain text mode
Note to JayJay: That's (Non)Deterministic Finite Automata. And while Turing Machines are very interesting, I don't think they're relevant for this at all.
Anyway, I think everyone here is pointing you in the right direction. You need to create a token-stream/list and go through them with a finite automaton. But how formal and elaborate you want to make your parser really depends on what kind of stuff you expect to find in these header files. Are they more predictable than elcuco's example?
"The strength of a civilization is not measured by its ability to wage wars, but rather by its ability to prevent them." - Gene Roddenberry
Bookmarks