--- parser3/src/classes/table.C 2001/09/18 16:05:42 1.112 +++ parser3/src/classes/table.C 2001/10/02 15:40:32 1.118 @@ -2,10 +2,10 @@ Parser: @b table parser class. Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com) - Author: Alexander Petrosyan (http://design.ru/paf) + + $Id: table.C,v 1.118 2001/10/02 15:40:32 parser Exp $ */ -static const char *RCSId="$Id: table.C,v 1.112 2001/09/18 16:05:42 parser Exp $"; #include "classes.h" #include "pa_config_includes.h" @@ -65,7 +65,7 @@ static void _set(Request& r, const Strin while(i.has_next()) { Array& row=*new(pool) Array(pool); const String& string=*i.next_string(); - // remove empty lines + // remove comment lines if(!string.size()) continue; @@ -80,11 +80,11 @@ static void _set(Request& r, const Strin static void _load(Request& r, const String& method_name, MethodParams *params) { Pool& pool=r.pool(); // filename is last parameter - const String& filename=params->as_string(params->size()-1, + Value& vfilename=params->as_no_junction(params->size()-1, "file name must not be code"); // loading text - char *data=file_read_text(pool, r.absolute(filename)); + char *data=file_read_text(pool, r.absolute(vfilename.as_string())); // parse columns Array *columns; @@ -110,7 +110,8 @@ static void _load(Request& r, const Stri Table& table=*new(pool) Table(pool, &method_name, columns); char *row_chars; while(row_chars=getrow(&data)) { - if(!*row_chars) // remove empty lines + // remove empty&comment lines + if(!*row_chars || *row_chars == '#') continue; Array *row=new(pool) Array(pool); while(char *cell_chars=lsplit(&row_chars, '\t')) { @@ -470,7 +471,8 @@ static void _sort(Request& r, const Stri for(i=0; i(r.self)->set_table(new_table); } static void _locate(Request& r, const String& method_name, MethodParams *params) {