diff options
Diffstat (limited to 'Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/parser')
12 files changed, 0 insertions, 773 deletions
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/parser/AbstractParser.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/parser/AbstractParser.java deleted file mode 100644 index 6f0b79c072..0000000000 --- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/parser/AbstractParser.java +++ /dev/null @@ -1,67 +0,0 @@ -/*
- *
- * Copyright 2001-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.parser;
-import java.io.IOException;
-import java.io.Reader;
-/**
- * An abstract base class for simple parsers
- *
- * @author Curt Arnold
- */
-public abstract class AbstractParser {
- /**
- *
- *
- */
- protected AbstractParser() {
- }
- protected abstract void addFilename(String filename);
- public abstract AbstractParserState getNewLineState();
- protected void parse(Reader reader) throws IOException {
- char[] buf = new char[4096];
- AbstractParserState newLineState = getNewLineState();
- AbstractParserState state = newLineState;
- int charsRead = -1;
- do {
- charsRead = reader.read(buf, 0, buf.length);
- if (state == null) {
- for (int i = 0; i < charsRead; i++) {
- if (buf[i] == '\n') {
- state = newLineState;
- break;
- }
- }
- }
- if (state != null) {
- for (int i = 0; i < charsRead; i++) {
- state = state.consume(buf[i]);
- //
- // didn't match a production, skip to a new line
- //
- if (state == null) {
- for (; i < charsRead; i++) {
- if (buf[i] == '\n') {
- state = newLineState;
- break;
- }
- }
- }
- }
- }
- } while (charsRead >= 0);
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/parser/AbstractParserState.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/parser/AbstractParserState.java deleted file mode 100644 index fe66dbbef0..0000000000 --- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/parser/AbstractParserState.java +++ /dev/null @@ -1,41 +0,0 @@ -/*
- *
- * Copyright 2002-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.parser;
-/**
- * An base class for objects that represent the state of an AbstractParser.
- *
- * @author CurtArnold
- * @see AbstractParser
- */
-public abstract class AbstractParserState {
- private AbstractParser parser;
- protected AbstractParserState(AbstractParser parser) {
- if (parser == null) {
- throw new NullPointerException("parser");
- }
- this.parser = parser;
- }
- /**
- * Consume a character
- *
- * @return new state, may be null to ignore the rest of the line
- */
- public abstract AbstractParserState consume(char ch);
- protected AbstractParser getParser() {
- return parser;
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/parser/BranchState.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/parser/BranchState.java deleted file mode 100644 index 370c7d5836..0000000000 --- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/parser/BranchState.java +++ /dev/null @@ -1,46 +0,0 @@ -/*
- *
- * Copyright 2002-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.parser;
-public class BranchState extends AbstractParserState {
- private char[] branchChars;
- private AbstractParserState[] branchStates;
- private AbstractParserState noMatchState;
- public BranchState(AbstractParser parser, char[] branchChars,
- AbstractParserState[] branchStates, AbstractParserState noMatchState) {
- super(parser);
- this.branchChars = (char[]) branchChars.clone();
- this.branchStates = (AbstractParserState[]) branchStates.clone();
- this.noMatchState = noMatchState;
- }
- public AbstractParserState consume(char ch) {
- AbstractParserState state;
- for (int i = 0; i < branchChars.length; i++) {
- if (ch == branchChars[i]) {
- state = branchStates[i];
- return state.consume(ch);
- }
- }
- state = getNoMatchState();
- if (state != null) {
- return state.consume(ch);
- }
- return state;
- }
- protected AbstractParserState getNoMatchState() {
- return noMatchState;
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/parser/CParser.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/parser/CParser.java deleted file mode 100644 index 07f8eba4e2..0000000000 --- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/parser/CParser.java +++ /dev/null @@ -1,78 +0,0 @@ -/*
- *
- * Copyright 2002-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.parser;
-import java.io.IOException;
-import java.io.Reader;
-import java.util.Vector;
-/**
- * A parser that extracts #include statements from a Reader.
- *
- * @author Adam Murdoch
- * @author Curt Arnold
- */
-public final class CParser extends AbstractParser implements Parser {
- private final Vector includes = new Vector();
- private AbstractParserState newLineState;
- /**
- *
- *
- */
- public CParser() {
- AbstractParserState quote = new FilenameState(this, new char[]{'"'});
- AbstractParserState bracket = new FilenameState(this, new char[]{'>'});
- AbstractParserState postE = new PostE(this, bracket, quote);
- //
- // nclude
- //
- AbstractParserState e = new LetterState(this, 'e', postE, null);
- AbstractParserState d = new LetterState(this, 'd', e, null);
- AbstractParserState u = new LetterState(this, 'u', d, null);
- AbstractParserState l = new LetterState(this, 'l', u, null);
- AbstractParserState c = new LetterState(this, 'c', l, null);
- AbstractParserState n = new LetterState(this, 'n', c, null);
- //
- // mport is equivalent to nclude
- //
- AbstractParserState t = new LetterState(this, 't', postE, null);
- AbstractParserState r = new LetterState(this, 'r', t, null);
- AbstractParserState o = new LetterState(this, 'o', r, null);
- AbstractParserState p = new LetterState(this, 'p', o, null);
- AbstractParserState m = new LetterState(this, 'm', p, null);
- //
- // switch between
- //
- AbstractParserState n_m = new BranchState(this, new char[]{'n', 'm'},
- new AbstractParserState[]{n, m}, null);
- AbstractParserState i = new WhitespaceOrLetterState(this, 'i', n_m);
- newLineState = new LetterState(this, '#', i, null);
- }
- public void addFilename(String include) {
- includes.addElement(include);
- }
- public String[] getIncludes() {
- String[] retval = new String[includes.size()];
- includes.copyInto(retval);
- return retval;
- }
- public AbstractParserState getNewLineState() {
- return newLineState;
- }
- public void parse(Reader reader) throws IOException {
- includes.setSize(0);
- super.parse(reader);
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/parser/CaseInsensitiveLetterState.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/parser/CaseInsensitiveLetterState.java deleted file mode 100644 index a86700f166..0000000000 --- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/parser/CaseInsensitiveLetterState.java +++ /dev/null @@ -1,87 +0,0 @@ -/*
- *
- * Copyright 2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.parser;
-
-/**
- * This parser state checks consumed characters against a specific character
- * (case insensitive).
- *
- * @author Curt Arnold
- */
-public final class CaseInsensitiveLetterState
- extends AbstractParserState {
- /**
- * Next state if a match is found.
- */
- private final AbstractParserState nextState;
-
- /**
- * Next state if not match is found.
- */
- private final AbstractParserState noMatchState;
-
- /**
- * Lower case version of character to match.
- */
- private final char lowerLetter;
-
- /**
- * Lower case version of character to match.
- */
- private final char upperLetter;
-
- /**
- * Constructor.
- *
- * @param parser
- * parser
- * @param matchLetter
- * letter to match
- * @param nextStateArg
- * next state if a match on the letter
- * @param noMatchStateArg
- * state if no match on letter
- */
- public CaseInsensitiveLetterState(final AbstractParser parser,
- final char matchLetter,
- final AbstractParserState nextStateArg,
- final AbstractParserState noMatchStateArg) {
- super(parser);
- this.lowerLetter = Character.toLowerCase(matchLetter);
- this.upperLetter = Character.toUpperCase(matchLetter);
- this.nextState = nextStateArg;
- this.noMatchState = noMatchStateArg;
- }
-
- /**
- * Consumes a character and returns the next state for the parser.
- *
- * @param ch
- * next character
- * @return the configured nextState if ch is the expected character or the
- * configure noMatchState otherwise.
- */
- public AbstractParserState consume(final char ch) {
- if (ch == lowerLetter || ch == upperLetter) {
- return nextState;
- }
- if (ch == '\n') {
- getParser().getNewLineState();
- }
- return noMatchState;
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/parser/FilenameState.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/parser/FilenameState.java deleted file mode 100644 index f33940b0a7..0000000000 --- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/parser/FilenameState.java +++ /dev/null @@ -1,41 +0,0 @@ -/*
- *
- * Copyright 2002-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.parser;
-public class FilenameState extends AbstractParserState {
- private final StringBuffer buf = new StringBuffer();
- private final char[] terminators;
- public FilenameState(AbstractParser parser, char[] terminators) {
- super(parser);
- this.terminators = (char[]) terminators.clone();
- }
- public AbstractParserState consume(char ch) {
- for (int i = 0; i < terminators.length; i++) {
- if (ch == terminators[i]) {
- getParser().addFilename(buf.toString());
- buf.setLength(0);
- return null;
- }
- }
- if (ch == '\n') {
- buf.setLength(0);
- return getParser().getNewLineState();
- } else {
- buf.append(ch);
- }
- return this;
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/parser/FortranParser.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/parser/FortranParser.java deleted file mode 100644 index 261e95ad81..0000000000 --- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/parser/FortranParser.java +++ /dev/null @@ -1,106 +0,0 @@ -/*
- *
- * Copyright 2002-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.parser;
-
-import java.io.IOException;
-import java.io.Reader;
-import java.util.Vector;
-
-/**
- * A parser that extracts INCLUDE statements from a Reader.
- *
- * @author Curt Arnold
- */
-public final class FortranParser
- extends AbstractParser
- implements Parser {
- /**
- * List of included filenames.
- */
- private final Vector includes = new Vector();
-
- /**
- * State that starts consuming content at the beginning of a line.
- */
- private final AbstractParserState newLineState;
-
- /**
- * Default constructor.
- *
- */
- public FortranParser() {
- AbstractParserState filename = new FilenameState(this, new char[] {'\'',
- '/'});
- AbstractParserState apos = new WhitespaceOrLetterState(this, '\'',
- filename);
- AbstractParserState blank = new LetterState(this, ' ', apos, null);
- AbstractParserState e = new CaseInsensitiveLetterState(this, 'E',
- blank, null);
- AbstractParserState d = new CaseInsensitiveLetterState(this, 'D', e,
- null);
- AbstractParserState u = new CaseInsensitiveLetterState(this, 'U', d,
- null);
- AbstractParserState l = new CaseInsensitiveLetterState(this, 'L', u,
- null);
- AbstractParserState c = new CaseInsensitiveLetterState(this, 'C', l,
- null);
- AbstractParserState n = new CaseInsensitiveLetterState(this, 'N', c,
- null);
- newLineState = new WhitespaceOrCaseInsensitiveLetterState(this, 'I', n);
- }
-
- /**
- * Called by FilenameState at completion of file name production.
- *
- * @param include
- * include file name
- */
- public void addFilename(final String include) {
- includes.addElement(include);
- }
-
- /**
- * Gets collection of include file names encountered in parse.
- * @return include file names
- */
- public String[] getIncludes() {
- String[] retval = new String[includes.size()];
- includes.copyInto(retval);
- return retval;
- }
-
- /**
- * Get the state for the beginning of a new line.
- * @return start of line state
- */
- public AbstractParserState getNewLineState() {
- return newLineState;
- }
-
- /**
- * Collects all included files from the content of the reader.
- *
- * @param reader
- * character reader containing a FORTRAN source module
- * @throws IOException
- * throw if I/O error during parse
- */
- public void parse(final Reader reader) throws IOException {
- includes.setSize(0);
- super.parse(reader);
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/parser/LetterState.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/parser/LetterState.java deleted file mode 100644 index 945ae91233..0000000000 --- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/parser/LetterState.java +++ /dev/null @@ -1,80 +0,0 @@ -/*
- *
- * Copyright 2002-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.parser;
-
-/**
- * This parser state checks consumed characters against a specific character.
- *
- * @author Curt Arnold
- */
-public final class LetterState
- extends AbstractParserState {
- /**
- * Next state if a match is found.
- */
- private final AbstractParserState nextState;
-
- /**
- * Next state if not match is found.
- */
- private final AbstractParserState noMatchState;
-
- /**
- * Character to match.
- */
- private final char thisLetter;
-
- /**
- * Constructor.
- *
- * @param parser
- * parser
- * @param matchLetter
- * letter to match
- * @param nextStateArg
- * next state if a match on the letter
- * @param noMatchStateArg
- * state if no match on letter
- */
- public LetterState(final AbstractParser parser,
- final char matchLetter,
- final AbstractParserState nextStateArg,
- final AbstractParserState noMatchStateArg) {
- super(parser);
- this.thisLetter = matchLetter;
- this.nextState = nextStateArg;
- this.noMatchState = noMatchStateArg;
- }
-
- /**
- * Consumes a character and returns the next state for the parser.
- *
- * @param ch
- * next character
- * @return the configured nextState if ch is the expected character or the
- * configure noMatchState otherwise.
- */
- public AbstractParserState consume(final char ch) {
- if (ch == thisLetter) {
- return nextState;
- }
- if (ch == '\n') {
- getParser().getNewLineState();
- }
- return noMatchState;
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/parser/Parser.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/parser/Parser.java deleted file mode 100644 index cf759fc7d5..0000000000 --- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/parser/Parser.java +++ /dev/null @@ -1,28 +0,0 @@ -/*
- *
- * Copyright 2002-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.parser;
-import java.io.IOException;
-import java.io.Reader;
-/**
- * A parser that extracts #include statements from a Reader.
- *
- * @author Curt Arnold
- */
-public interface Parser {
- String[] getIncludes();
- void parse(Reader reader) throws IOException;
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/parser/PostE.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/parser/PostE.java deleted file mode 100644 index fe225fb35a..0000000000 --- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/parser/PostE.java +++ /dev/null @@ -1,41 +0,0 @@ -/*
- *
- * Copyright 2002-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.parser;
-public class PostE extends AbstractParserState {
- private AbstractParserState bracket;
- private AbstractParserState quote;
- public PostE(CParser parser, AbstractParserState bracket,
- AbstractParserState quote) {
- super(parser);
- this.bracket = bracket;
- this.quote = quote;
- }
- public AbstractParserState consume(char ch) {
- switch (ch) {
- case ' ' :
- case '\t' :
- return this;
- case '<' :
- return bracket;
- case '"' :
- return quote;
- case '\n' :
- return getParser().getNewLineState();
- }
- return null;
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/parser/WhitespaceOrCaseInsensitiveLetterState.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/parser/WhitespaceOrCaseInsensitiveLetterState.java deleted file mode 100644 index 9d42feeaad..0000000000 --- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/parser/WhitespaceOrCaseInsensitiveLetterState.java +++ /dev/null @@ -1,83 +0,0 @@ -/*
- *
- * Copyright 2002-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.parser;
-
-/**
- * This parser state checks consumed characters against a specific character
- * (case insensitive) or whitespace.
- *
- * @author Curt Arnold
- */
-public final class WhitespaceOrCaseInsensitiveLetterState
- extends
- AbstractParserState {
- /**
- * Next state if the character is found.
- */
- private final AbstractParserState nextState;
-
- /**
- * Character to match (lower case).
- */
- private final char lowerLetter;
-
- /**
- * Character to match (upper case).
- */
- private final char upperLetter;
-
- /**
- * Constructor.
- *
- * @param parser
- * parser
- * @param matchLetter
- * letter to match
- * @param nextStateArg
- * next state if a match on the letter
- */
- public WhitespaceOrCaseInsensitiveLetterState(final AbstractParser parser,
- final char matchLetter,
- final AbstractParserState
- nextStateArg) {
- super(parser);
- this.lowerLetter = Character.toLowerCase(matchLetter);
- this.upperLetter = Character.toUpperCase(matchLetter);
- this.nextState = nextStateArg;
- }
-
- /**
- * Consumes a character and returns the next state for the parser.
- *
- * @param ch
- * next character
- * @return the configured nextState if ch is the expected character or the
- * configure noMatchState otherwise.
- */
- public AbstractParserState consume(final char ch) {
- if (ch == lowerLetter || ch == upperLetter) {
- return nextState;
- }
- if (ch == ' ' || ch == '\t') {
- return this;
- }
- if (ch == '\n') {
- getParser().getNewLineState();
- }
- return null;
- }
-}
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/parser/WhitespaceOrLetterState.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/parser/WhitespaceOrLetterState.java deleted file mode 100644 index 824abe6b68..0000000000 --- a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/parser/WhitespaceOrLetterState.java +++ /dev/null @@ -1,75 +0,0 @@ -/*
- *
- * Copyright 2002-2004 The Ant-Contrib project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.antcontrib.cpptasks.parser;
-
-/**
- * This parser state checks consumed characters against a specific character or
- * whitespace.
- *
- * @author Curt Arnold
- */
-public final class WhitespaceOrLetterState
- extends AbstractParserState {
- /**
- * Next state if the character is found.
- */
- private final AbstractParserState nextState;
-
- /**
- * Character to match.
- */
- private final char thisLetter;
-
- /**
- * Constructor.
- *
- * @param parser
- * parser
- * @param matchLetter
- * letter to match
- * @param nextStateArg
- * next state if a match on the letter
- */
- public WhitespaceOrLetterState(final AbstractParser parser,
- final char matchLetter,
- final AbstractParserState nextStateArg) {
- super(parser);
- this.thisLetter = matchLetter;
- this.nextState = nextStateArg;
- }
-
- /**
- * Consumes a character and returns the next state for the parser.
- *
- * @param ch
- * next character @returns the configured nextState if ch is the
- * expected character or the configure noMatchState otherwise.
- * @return next state
- */
- public AbstractParserState consume(final char ch) {
- if (ch == thisLetter) {
- return nextState;
- }
- if (ch == ' ' || ch == '\t') {
- return this;
- }
- if (ch == '\n') {
- getParser().getNewLineState();
- }
- return null;
- }
-}
|