Jason Stover <[email protected]> writes: > I'm thinking about how to write the parser for the DESIGN > subcommand. My question is where to start reading. I have been reading > the code in lexer.c and variable-parser.c. Before I dive in, I just > want to know if I'm looking in the right place. > > An example of the use of the DESIGN subcommand might look like this: > > DESIGN A, B, A*D > > ...which tells me the design matrix should have a column for the > variable A, a column for the variable B, and columns for an > interaction between variables A and D. Another possibility > is > > DESIGN A, B, A(B) > > ...which tells me the variable A is "nested" in the variable B > (which sounds backwards, but that's the notation). > > To write the parser, should I be looking at something like lex_get, > or is there a set of higher-level functions that will do the job?
You will probably need to use lex_get() level functions somewhat. For parsing a single variable name, parse_variable() is the right function. For parsing multiple variable names with support for ranges, etc. (e.g. "VAR001 TO VAR003"), parse_variables() is useful. I do have plans for an easier parsing infrastructure. Someday... -- Ben Pfaff http://benpfaff.org _______________________________________________ pspp-dev mailing list [email protected] http://lists.gnu.org/mailman/listinfo/pspp-dev
