Subject:
|
"Well-Formed" LDraw (Was: regular expressions for DAT file subpart lines)
|
Newsgroups:
|
lugnet.off-topic.geek, lugnet.cad.dev
|
Date:
|
Wed, 23 Jun 1999 22:09:53 GMT
|
Reply-To:
|
JSPROAT@GEOCITIESspamcake.COM
|
Viewed:
|
867 times
|
| |
| |
Steve Bliss wrote:
> Oops, I forgot a few other odd things. I *think* your expression allows
> these, but I'm not sure:
> .1
Nope, won't take a fraction w/o the integer part; gotta fix that
> -.1
Nope, same reason as above
> 0.
Nope, won't take a fraction w/o the fraction part, gotta fix that
> -0.
Nope, same reason as above
> 001
Yep! Woo-Hoo!!! :-,
> 1E
Nope, I can't even figure out what this is supposed to be without the
mantissa! Is it just 1?
The hard part about using a single regular expression to detect scientific
notation is that it might allow things like "+.E." to represent a number,
which any respectable atoi() would choke on. I gotta think about this some
more, see if it's even worth my time at the moment...
> BTW, the color-code can be in scientific notation. The line-type can't, at
> least, it can't in LDLite. I'm betting LDraw would recognize 1E0 as a
> valid line-type.
Hmmm... But LEdit doesn't output scientific notation in these areas. I'm
inclined to be more liberal than restrictive, but some of these cases don't
make any sense; i.e. fractional colors.
> What about line-breaks? LDraw allows those in the middle of the line. And
> anything extra after the filename is ignored, I think. At least, on
> line-types 2 through 5, anything after the last parameter and before a line
> break is ignored.
Arg. Broken lines would obviate a line-based parser. Pascal parsers tend
to be character-based, while Perl makes it much easier to write line-based
parsers.
I wonder if we should start to differentiate between "valid" and
"well-formed" LDraw files, a la XML...?
Cheers,
- jsproat
--
Jeremy H. Sproat <jsproat@geocities.com>
http://www.geocities.com/SiliconValley/Horizon/5249/
Darth Sideous the wicked ruled his world -- Sidious spoke in class today
|
|
Message has 1 Reply:
Message is in Reply To:
9 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
This Message and its Replies on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|