Re: Is it possible to have special characters in list



Larry W. Virden <lvirden@xxxxxxxxx> wrote:
On Sep 1, 1:03 pm, Andreas Leitgeb <a...@xxxxxxxx> wrote:
It seems like you were parsing a hexdump.
You just can't treat that as a list, not even simply
convert it, since the last "column" could just as well
contain characters that look like hexdata and/or spaces,
which would foul up your result.
You *have* to parse that line by line!

While I agree that one can't treat arbitrary strings as a list, that
doesn't mean that one has to hand parse the line if there is a need to
use list commands - just use Tcl's split on the line first.

You're right in the general case. There are situations where
a string can be easily "prepared" for proper list-parsing.

I'm talking about the special case of parsing a hexdump with that
plaintext-column. If you coerced that into a list, there'd be no
way to sensibly handle that list, just because the plaintext-column
might contain anything, including stuff that looks like data-columns
or even extra spaces, that will randomize the number of perceived
list-elements per line.

So, my comment about *having* to parse it line by line was more
targetted to the problem at hand (parsing that particular format),
than about Tcl's string-list-issue.

.



Relevant Pages

  • Re: Overloading of operator names - opinions sought
    ... connections between syntax and semantic make parsing a program ... keyword or similar, then a is the type and b is the name. ... to parse the code to see the declarations to parse the code. ... But then this is not necessary to know during parsing. ...
    (comp.lang.misc)
  • misc: my effort, and a new ambiguity...
    ... today I actually got around to writing most of the new parser. ... the final x in 'tx;' would need to change the relative precedence ... ordering after parsing 't' in order to parse as expected. ...
    (comp.lang.misc)
  • Re: Is C++ fundamentally broken?:was:Re: C++ unit testing
    ... These both stem largely from the fact that you can't parse ... statement you're parsing. ... Unfortunately, all of this cascades as well, so you can't produce a ... semi-usable tool by just skipping over a few tough cases -- a fairly ...
    (comp.lang.cpp)
  • Re: Need help to speed up custom parser
    ... I am not an expert in parsing, and I first have a few questions - ... later some hopefully useful advice. ... Do you want any parse or all parses? ... effectively must go through all the facts for promote/2. ...
    (comp.lang.prolog)
  • Re: Text Files or binaries with objects?
    ... I have some large text files that I need to repeatedly analyse. ... parse the strings and load the data into my custom object ready to be ... file many times over many sessions, to parse the text files once, then save ...
    (alt.comp.lang.borland-delphi)