Stefan Schuermans
remaining parts of config parser implemented
Stefan Schuermans commited 3a6f6fd at 2011-09-11 10:46:13
/* JFlexiPix - Java implementation of FlexiPix output library
*
* Copyright 2010-2011 Stefan Schuermans <stefan blinkenarea org>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3 of the License.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.blinkenarea.JFlexiPix;
import java.io.*;
import java.net.*;
import java.util.*;
import java.util.regex.*;
/// configuration parser
class Config
{
/**
* @brief constructor
* @param[in] display display to configure
* @param[in] messageIf message interface to report messages to or null
*/
Config(Display display, MessageIf messageIf)
{
// save constructor parameters
m_display = display;
m_messageIf = messageIf;
// compile regular expression patterns
// empty lines: " # comment"
m_patternEmpty = Pattern.compile("^" + "\\s*" + "(?:#.*)?" + "$");
// extract setting and value from " setting = value # comment"
m_patternLine = Pattern.compile("^" +
"\\s*" +
"([^\\s=#](?:[^=#]*[^\\s=#])?)" +
"\\s*=\\s*" +
"([^\\s=#](?:[^=#]*[^\\s=#])?)" +
"\\s*" +
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX