To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.off-topic.geekOpen lugnet.off-topic.geek in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Off-Topic / Geek / 159
158  |  160
Subject: 
Re: regular expressions for DAT file subpart lines
Newsgroups: 
lugnet.off-topic.geek
Date: 
Wed, 23 Jun 1999 21:37:12 GMT
Viewed: 
156 times
  
Oops, I forgot a few other odd things.  I *think* your expression allows
these, but I'm not sure:

.1
-.1
0.
-0.
001
1E

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.

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.

Steve

On Wed, 23 Jun 1999 17:01:01 GMT, Sproaticus <jsproat@geocities.com> wrote:

Steve Bliss wrote:
On Tue, 22 Jun 1999 22:58:55 GMT, Sproaticus <jsproat@geocities.com> wrote:
Whoops!  I need to account for floating point values within the matrix.
You sure do.  Can your code handle the following:
1 4E0 0 0 0 1E0 0 0 0 1E0 0 0 0 1E0 3001.dat

Arg.  Is this allowed?  I guess it should be; the original parser was
implemented using Pascal...

Yes, ugly getting it is, hmmm?  :-,

if( $linein =~ m/
^
\s*1
   # indicates a subpart
\s+([0-9]+)
   # color
(?:\s+[+-]?[0-9]+(?:\.[0-9]+)?(?:E[+-]?[0-9+])?){3}
   # coordinates
(?:\s+[+-]?[0-9]+(?:\.[0-9]+)?(?:E[+-]?[0-9+])?){9}
   # 3 x 3 matrix
\s+(\S+)
   # part name
\s*$
/xi ) {
# $1 = color
# $2 = part
}

Cheers,
- jsproat

--
Jeremy H. Sproat <jsproat@geocities.com>
http://www.geocities.com/SiliconValley/Horizon/5249/
When constabulary duty's to be done, a Jedi Knight's lot is not a happy one



Message has 1 Reply:
  "Well-Formed" LDraw (Was: regular expressions for DAT file subpart lines)
 
(...) Nope, won't take a fraction w/o the integer part; gotta fix that (...) Nope, same reason as above (...) Nope, won't take a fraction w/o the fraction part, gotta fix that (...) Nope, same reason as above (...) Yep! Woo-Hoo!!! :-, (...) Nope, I (...) (25 years ago, 23-Jun-99, to lugnet.off-topic.geek, lugnet.cad.dev)

Message is in Reply To:
  Re: regular expressions for DAT file subpart lines
 
(...) Arg. Is this allowed? I guess it should be; the original parser was implemented using Pascal... Yes, ugly getting it is, hmmm? :-, if( $linein =~ m/ ^ \s*1 # indicates a subpart \s+([0-9]+) # color (?:\s+[+-]?[0-9]+(?:...-9+])?){3} # (...) (25 years ago, 23-Jun-99, to lugnet.off-topic.geek)

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
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR