I have lines of parameters in a text file, which can be spread over several lines. They are terminated (the actual line break) by a sequence of characters, which can also be spread over several lines or contain spaces like these three (non-exhaustive) examples:
< x >
< x
>
< x >
I would like to tidy this text file up so that I can actually parse it. The output should be something like this (P1 … P3 are parameters):
P1 P2 P3 < x >
P1 P2 P3 < x >
P1 P2 P3 < x >
Original:
P1 P2 P3 < x >
P1 P2 P3 < x
>
P1 P2
P3 <
x >
You should do fine with a simple lexical analyzer.
See some previous SO questions:
Recommendations for a good C#/ .NET based lexical analyser
C#/.NET Lexer Generators