|SongInfo|Title:"Speed the Plow"|Author:"Trad."|Lyricist:""|Copyright1:""|Copyright2:""
I am assuming I will have two textareas in a form, the data are copied from a clipboard to one of them and split into an array on newline characters. On the last few lines the letters A-G or a-g may or may not be preceded by _, =, or ^ and may or may not be followed by a comma or apostrophe then a (or not) number. The lack of a space after a letter indicates a grouping (beaming).
Does anyone have an example of some parsing code? Just something that looks at the input byte by byte building a token, putting a character back if it belongs to the next token and handling the end of the line and end of data. If someone has a parser for anything, I think I could adapt it.
Sounds confusing. Any parsing process is based on an algorithm. Set that algorithm for your particular case, and you have solved 90% of the problem. And the method is nothing but an equation, after all. What example do you need? Of an algorithm?
I am not sure what example to give... Maybe parsing a RGB value of a color to its Hexadecimal correspondent. Here's a simplified version of a color picker which output RGB to Hexa:
My only reference was to a compiler class I took back in 1994. The final product would look at a line such as
xrad= x * PI / 180.0;
to fetch the variables x and PI, multiply them, then divide by a constant in order to place the result in xrad, creating the commands to do each of these things. If reading a variable it continued until it found a character which could not be in a variable, or a space, or end-of-line. (xrad is different from x, so it has to check the byte(s) after the x to see if there is more to the name).
In this case c may stand alone or ^c'2/3 may be one token. A "|" means one thing by itself and "|:" does something different. If someone had some type of model I could use it and it would be much easier to modify later than if I had to do it from scratch.