[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Extending parser to accept '_' in numbers
From: |
LachlanA |
Subject: |
Re: Extending parser to accept '_' in numbers |
Date: |
Tue, 6 Oct 2015 06:06:25 -0700 (PDT) |
Greetings Rik,
If you're extending the numeric formats, a great one would be to expand
octave_read_value<Complex> to accept non-real numbers. I'm currently
working on a C++ implementation of textscan based on John's skeleton of a
couple of years ago. It is mostly done, but it won't be able to replace the
.m version until it can read complex numbers.
More generally, there are a few features that seem to need lookahead:
1. Reading complex numbers (1+2.3e-09i is complex, but 1+2.3e-09 is two
reals)
2. multi-character comments symbols (like //), multi-character delimiters
and multi-character TreatAsEmpty symbols.
The way the second group are handled will depend on how the complex numbers
are handled. I was thinking of writing a streambuf that provides multiple
characters of 'putback', but wasn't sure if that is appropriate. (For
textscan, the alternative is to read an entire line into memory at once, but
that could be huge, since it allows \n to be ignored.) If you can think of
how to read complex numbers, I'll see if that approach applies to the others
too.
Thanks,
Lachlan
--
View this message in context:
http://octave.1599824.n4.nabble.com/Extending-parser-to-accept-in-numbers-tp4672760p4672783.html
Sent from the Octave - Maintainers mailing list archive at Nabble.com.