R
Randy Kramer
Background: In order to do the parsing I've talked about in another thread, in
many circumstances I need to know the number of spaces before and after the
current token. I'm trying to think about efficient ways to do that--one
might be to do a preprocess pass through the text to figure out how many
spaces separate various tokens then store the tokens and spaces between them
in a temporary in memory data structure, or I'll need a way to backtrack from
the found position of some token to find how many spaces separate it from the
previous token.
I'm thinking that maybe a stream ("on" the input file?) might be a way to do
the backtracking (by moving the pos back from the current position, either
one character at a time or several (and then read forward to the first
space)).
I'm wondering how efficient an operation that is--are such stream operations
performed on the disk file itself, or is the stream somehow buffered in
memory and the operations performed there. (Or, am I hopelessly
confused? ;-)
Randy Kramer
Aside: In another thread I'm going to ask about efficient storage for the
other alternative.
many circumstances I need to know the number of spaces before and after the
current token. I'm trying to think about efficient ways to do that--one
might be to do a preprocess pass through the text to figure out how many
spaces separate various tokens then store the tokens and spaces between them
in a temporary in memory data structure, or I'll need a way to backtrack from
the found position of some token to find how many spaces separate it from the
previous token.
I'm thinking that maybe a stream ("on" the input file?) might be a way to do
the backtracking (by moving the pos back from the current position, either
one character at a time or several (and then read forward to the first
space)).
I'm wondering how efficient an operation that is--are such stream operations
performed on the disk file itself, or is the stream somehow buffered in
memory and the operations performed there. (Or, am I hopelessly
confused? ;-)
Randy Kramer
Aside: In another thread I'm going to ask about efficient storage for the
other alternative.