Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Parsing text files for keywords/class names and arguments
#1
I want to be able to describe artifacts in a text file using keywords and parameters. The keywords found in the file actually represent classes that are then called with the provided arguments or parameters. This process is similar to the screen description language (SDL) files when using POV-Ray or scripts when using OpenSCAD. The following is an example of my file.

// Process another file as if it is part of this one
include kobldes.inc

// Set default variables
snapObject = sphere
snapSize = 10

// call an object in a particular calss with the provided parameters
siteLevel(name, 0, 0) // name, siteLevel, basementLevel
buildingLevel(level1Name, 3000) // name, height
buildingLevel(level2Name, 3000) // name, height

setLevel(level1Name)

space(spaceName, 4, 0, 2464) // name, number of sides,
// base elevation in level, height

So considering some of the functions I have provided as comments, I am looking for the best way to create an engine that will read this file and call the appropriate classes via the keywords.
Reply
#2
(11-29-2012, 08:47 AM)kemen Wrote: I want to be able to describe artifacts in a text file using keywords and parameters. The keywords found in the file actually represent classes that are then called with the provided arguments or parameters. This process is similar to the screen description language (SDL) files when using POV-Ray or scripts when using OpenSCAD. The following is an example of my file.

// Process another file as if it is part of this one
include kobldes.inc

// Set default variables
snapObject = sphere
snapSize = 10

// call an object in a particular calss with the provided parameters
siteLevel(name, 0, 0) // name, siteLevel, basementLevel
buildingLevel(level1Name, 3000) // name, height
buildingLevel(level2Name, 3000) // name, height

setLevel(level1Name)

space(spaceName, 4, 0, 2464) // name, number of sides,
// base elevation in level, height

So considering some of the functions I have provided as comments, I am looking for the best way to create an engine that will read this file and call the appropriate classes via the keywords.
This doesn't look like Python to me....
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Parsing Webpages in Python Nyx- 10 5,349 01-24-2010, 07:11 PM
Last Post: Nyx-

Forum Jump:


Users browsing this thread: 1 Guest(s)