1 /* 2 * #%L 3 * Native ARchive plugin for Maven 4 * %% 5 * Copyright (C) 2002 - 2014 NAR Maven Plugin developers. 6 * %% 7 * Licensed under the Apache License, Version 2.0 (the "License"); 8 * you may not use this file except in compliance with the License. 9 * You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, software 14 * distributed under the License is distributed on an "AS IS" BASIS, 15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 * See the License for the specific language governing permissions and 17 * limitations under the License. 18 * #L% 19 */ 20 package com.github.maven_nar.cpptasks.borland; 21 22 import com.github.maven_nar.cpptasks.parser.AbstractParser; 23 import com.github.maven_nar.cpptasks.parser.AbstractParserState; 24 import com.github.maven_nar.cpptasks.parser.FilenameState; 25 26 public class CfgFilenameState extends FilenameState { 27 private final char terminator; 28 29 public CfgFilenameState(final AbstractParser parser, final char[] terminators) { 30 super(parser, terminators); 31 this.terminator = terminators[0]; 32 } 33 34 @Override 35 public AbstractParserState consume(final char ch) { 36 // 37 // if a ';' is encountered then 38 // close the previous filename by sending a 39 // recognized terminator to our super class 40 // and stay in this state for more filenamese 41 if (ch == ';') { 42 super.consume(this.terminator); 43 return this; 44 } 45 AbstractParserState newState = super.consume(ch); 46 // 47 // change null (consume to end of line) 48 // to look for next switch character 49 if (newState == null) { 50 newState = getParser().getNewLineState(); 51 } 52 return newState; 53 } 54 }