Support Forums

Full Version: Parsing text files for keywords/class names and arguments
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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.
(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....