[Oberon] Re: N-O Scanner structure confusing ?
easlab at absamail.co.za
Sat Feb 3 03:45:35 MET 2007
On 1 Feb 2007, Chris Glur <easlab at absamail.co.za> wrote:
> > Lets examine how we could possibly process text after the very versatile
> > scanner has found a searched-for token.
> > ...
> Texts.Scan is designed for scanning command parameters.
> It's also used as you mention for OberonErrors.Text
> which is formatted to allow with ease Texts.Read following Texts.Scan.
> These texts have no delimiters between tokens but canonical ones like
> space, tab, cr
> and arbitrary single characters are escaped by "\".
> Some other texts need workarounds or their own scanners.
> hoping that could be of some help,
It helps to confirm that I'm increasingly having difficulties to explain.
The Scanner is well designed for any Algol60-family-lang compiler.
Ie. where the tokens are demarcated by white-chars.
Apparently python has syntactic-info in the text-indentations ?
Scanning command parameters is just a bonus.
Here's a simple job which I can't acheive -- directly yet.
1. set the caret
2. scan from the caret until the token "END"
3. reset the caret after the found token.
The problem is that I don't know how to get the char-position
where the token was found, other than by an absurd method of
counting the <CRs> which the scanner saw and then using the
reader to read the whole text-stretch which the scanner has
already proccessed. Besides, the scanner has obviously used
the reader to do the job.
== Chris Glur.
More information about the Oberon