// Path: sonar-flow-plugin-sslr/src/main/java/be/i8c/codequality/sonar/plugins/sag/webmethods/flow/sslr/FlowConfiguration.java
// public class FlowConfiguration extends SquidConfiguration {
// 
//   private boolean ignoreNodeNdf;
// 
//   public FlowConfiguration(Charset encoding) {
//     super(encoding);
//   }
// 
//   public boolean getIgnoreNodeNdf() {
//     return ignoreNodeNdf;
//   }
// 
//   public void setIgnoreNodeNdf(boolean ignoreNodeNdf) {
//     this.ignoreNodeNdf = ignoreNodeNdf;
//   }
// 
// }
// 
// Path: sonar-flow-plugin-sslr/src/main/java/be/i8c/codequality/sonar/plugins/sag/webmethods/flow/sslr/FlowParser.java
// public class FlowParser {
//   private static final Parser<Grammar> P = FlowParser.create();
//   private static FlowConfiguration conf;
// 
//   private FlowParser() {
//   }
// 
//   public static Parser<Grammar> create(FlowConfiguration conf) {
//     FlowParser.conf = conf;
//     return Parser.builder(FlowGrammar.create()).withLexer(FlowLexer.create(conf)).build();
//   }
// 
//   /**
//    * Creates this parser.
//    * @return
//    */
//   public static Parser<Grammar> create() {
//     FlowParser.conf = new FlowConfiguration(Charset.defaultCharset());
//     return Parser.builder(FlowGrammar.create()).withLexer(FlowLexer.create(FlowParser.conf))
//         .build();
//   }
// 
//   /**
//    * Parses a file and returns the AstNode tree.
//    * @param filePath
//    * path to the file.
//    * @return
//    */
//   public static AstNode parseFile(String filePath) {
//     AstNode astNode;
//     File file = FileUtils.getFile(filePath);
//     if (file == null || !file.exists()) {
//       throw new AssertionError("The file \"" + filePath + "\" does not exist.");
//     }
//     astNode = P.parse(file);
//     return astNode;
//   }
// 
//   public static AstNode parseString(String source) {
//     return P.parse(source);
//   }
// 
// }


import com.sonar.sslr.api.Grammar;
import com.sonar.sslr.impl.Parser;
import be.i8c.codequality.sonar.plugins.sag.webmethods.flow.sslr.FlowConfiguration;
import be.i8c.codequality.sonar.plugins.sag.webmethods.flow.sslr.FlowParser;
import java.nio.charset.Charset;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.sonar.api.internal.google.common.annotations.VisibleForTesting;
import org.sonar.api.internal.google.common.collect.ImmutableList;
import org.sonar.colorizer.Tokenizer;
import org.sonar.sslr.toolkit.ConfigurationModel;
import org.sonar.sslr.toolkit.ConfigurationProperty;
import org.sonar.sslr.toolkit.Validators;

/*
 * i8c
 * Copyright (C) 2016 i8c NV
 * mailto:contact AT i8c DOT be
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 3 of the License, or (at your option) any later version.
 *
 * 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
 * Lesser 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, write to the Free Software Foundation,
 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */
package be.i8c.codequality.sonar.plugins.sag.webmethods.flow.sslr.toolkit;





public class FlowConfigurationModel implements ConfigurationModel {

	private static final Logger LOG = LoggerFactory.getLogger(FlowConfigurationModel.class);

	  private static final String CHARSET_PROPERTY_KEY = "sonar.sourceEncoding";

	  @VisibleForTesting
	  ConfigurationProperty charsetProperty = new ConfigurationProperty("Charset", CHARSET_PROPERTY_KEY,
	    getPropertyOrDefaultValue(CHARSET_PROPERTY_KEY, "UTF-8"),
	    Validators.charsetValidator());

	  @Override
	  public Charset getCharset() {
	    return Charset.forName(charsetProperty.getValue());
	  }

	  @Override
	  public List<ConfigurationProperty> getProperties() {
	    return ImmutableList.of(charsetProperty);
	  }

	  @Override

// Path: sonar-flow-plugin-sslr/src/main/java/be/i8c/codequality/sonar/plugins/sag/webmethods/flow/sslr/FlowConfiguration.java
// public class FlowConfiguration extends SquidConfiguration {
// 
//   private boolean ignoreNodeNdf;
// 
//   public FlowConfiguration(Charset encoding) {
//     super(encoding);
//   }
// 
//   public boolean getIgnoreNodeNdf() {
//     return ignoreNodeNdf;
//   }
// 
//   public void setIgnoreNodeNdf(boolean ignoreNodeNdf) {
//     this.ignoreNodeNdf = ignoreNodeNdf;
//   }
// 
// }
// 
// Path: sonar-flow-plugin-sslr/src/main/java/be/i8c/codequality/sonar/plugins/sag/webmethods/flow/sslr/FlowParser.java
// public class FlowParser {
//   private static final Parser<Grammar> P = FlowParser.create();
//   private static FlowConfiguration conf;
// 
//   private FlowParser() {
//   }
// 
//   public static Parser<Grammar> create(FlowConfiguration conf) {
//     FlowParser.conf = conf;
//     return Parser.builder(FlowGrammar.create()).withLexer(FlowLexer.create(conf)).build();
//   }
// 
//   /**
//    * Creates this parser.
//    * @return
//    */
//   public static Parser<Grammar> create() {
//     FlowParser.conf = new FlowConfiguration(Charset.defaultCharset());
//     return Parser.builder(FlowGrammar.create()).withLexer(FlowLexer.create(FlowParser.conf))
//         .build();
//   }
// 
//   /**
//    * Parses a file and returns the AstNode tree.
//    * @param filePath
//    * path to the file.
//    * @return
//    */
//   public static AstNode parseFile(String filePath) {
//     AstNode astNode;
//     File file = FileUtils.getFile(filePath);
//     if (file == null || !file.exists()) {
//       throw new AssertionError("The file \"" + filePath + "\" does not exist.");
//     }
//     astNode = P.parse(file);
//     return astNode;
//   }
// 
//   public static AstNode parseString(String source) {
//     return P.parse(source);
//   }
// 
// }


// Path: sonar-flow-plugin-sslr-toolkit/src/main/java/be/i8c/codequality/sonar/plugins/sag/webmethods/flow/sslr/toolkit/FlowConfigurationModel.java
import com.sonar.sslr.api.Grammar;
import com.sonar.sslr.impl.Parser;
import be.i8c.codequality.sonar.plugins.sag.webmethods.flow.sslr.FlowConfiguration;
import be.i8c.codequality.sonar.plugins.sag.webmethods.flow.sslr.FlowParser;
import java.nio.charset.Charset;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.sonar.api.internal.google.common.annotations.VisibleForTesting;
import org.sonar.api.internal.google.common.collect.ImmutableList;
import org.sonar.colorizer.Tokenizer;
import org.sonar.sslr.toolkit.ConfigurationModel;
import org.sonar.sslr.toolkit.ConfigurationProperty;
import org.sonar.sslr.toolkit.Validators;

/*
 * i8c
 * Copyright (C) 2016 i8c NV
 * mailto:contact AT i8c DOT be
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 3 of the License, or (at your option) any later version.
 *
 * 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
 * Lesser 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, write to the Free Software Foundation,
 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */
package be.i8c.codequality.sonar.plugins.sag.webmethods.flow.sslr.toolkit;





public class FlowConfigurationModel implements ConfigurationModel {

	private static final Logger LOG = LoggerFactory.getLogger(FlowConfigurationModel.class);

	  private static final String CHARSET_PROPERTY_KEY = "sonar.sourceEncoding";

	  @VisibleForTesting
	  ConfigurationProperty charsetProperty = new ConfigurationProperty("Charset", CHARSET_PROPERTY_KEY,
	    getPropertyOrDefaultValue(CHARSET_PROPERTY_KEY, "UTF-8"),
	    Validators.charsetValidator());

	  @Override
	  public Charset getCharset() {
	    return Charset.forName(charsetProperty.getValue());
	  }

	  @Override
	  public List<ConfigurationProperty> getProperties() {
	    return ImmutableList.of(charsetProperty);
	  }

	  @Override

	  public Parser<Grammar> getParser() {
