|
Boost Users : |
Subject: [Boost-users] How to handle blank space in parsing??
From: Ramon F Herrera (ramon_at_[hidden])
Date: 2011-03-07 11:52:05
Hello all,
Boost::regex has been a Godsent to me. Before it, I performed any
parsing with Perl. Now I am becoming comfortable with the regex package.
(a million thanks to the folks responsible for it, and for Boost in
general, btw)
My only problem is spaces. I design typical mini computer language
syntaxes, for example:
Table[1, 4] = Value AND Array[8, 4]
My initial approach was to get rid of all spaces before parsing (I
recall being taught ages ago that the FORTRAN compiler does just that).
Such strategy works in some cases, but the above line would become:
Table[1,4]=ValueANDArray[8,4]
Which is obviously bad news. I solved this particular case with this syntax:
Table[1, 4] = Value && Array[8, 4]
My latest "language" looks like this and has the same problem described
above:
Table rows [1758, 1904, 2053, 2201, 2345, 2497]
Table cols [372, 880, 1336, 1756, 2083, 2439]
I guess I could insert a colon or something between the first two words,
but I am sure there has to be a better way.
TIA,
-RFH
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net