JAMES-2134 Extract Parboiled utility methods
Project: http://git-wip-us.apache.org/repos/asf/james-project/repo Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/5fbaeba9 Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/5fbaeba9 Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/5fbaeba9 Branch: refs/heads/master Commit: 5fbaeba92384b5e22ca12bb08f42aca439de446f Parents: 94fbfda Author: Raphael Ouazana <[email protected]> Authored: Wed Apr 4 18:37:43 2018 +0200 Committer: Raphael Ouazana <[email protected]> Committed: Thu Apr 5 14:48:43 2018 +0200 ---------------------------------------------------------------------- .../java/org/apache/james/mdn/BaseParser.java | 37 ++++++++++++++++++++ .../org/apache/james/mdn/MDNReportParser.java | 16 --------- 2 files changed, 37 insertions(+), 16 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/james-project/blob/5fbaeba9/mdn/src/main/java/org/apache/james/mdn/BaseParser.java ---------------------------------------------------------------------- diff --git a/mdn/src/main/java/org/apache/james/mdn/BaseParser.java b/mdn/src/main/java/org/apache/james/mdn/BaseParser.java new file mode 100644 index 0000000..f8da4d9 --- /dev/null +++ b/mdn/src/main/java/org/apache/james/mdn/BaseParser.java @@ -0,0 +1,37 @@ +/**************************************************************** + * Licensed to the Apache Software Foundation (ASF) under one * + * or more contributor license agreements. See the NOTICE file * + * distributed with this work for additional information * + * regarding copyright ownership. The ASF licenses this file * + * to you 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 org.apache.james.mdn; + +public abstract class BaseParser<V> extends org.parboiled.BaseParser<V> { + @SuppressWarnings("unchecked") + <T> T popT() { + return (T) pop(); + } + + @SuppressWarnings("unchecked") + <T> T peekParent() { + return (T) peek(1); + } + + @SuppressWarnings("unchecked") + <T> T peekT() { + return (T) peek(); + } +} http://git-wip-us.apache.org/repos/asf/james-project/blob/5fbaeba9/mdn/src/main/java/org/apache/james/mdn/MDNReportParser.java ---------------------------------------------------------------------- diff --git a/mdn/src/main/java/org/apache/james/mdn/MDNReportParser.java b/mdn/src/main/java/org/apache/james/mdn/MDNReportParser.java index 421ed55..d002c87 100644 --- a/mdn/src/main/java/org/apache/james/mdn/MDNReportParser.java +++ b/mdn/src/main/java/org/apache/james/mdn/MDNReportParser.java @@ -35,7 +35,6 @@ import org.apache.james.mdn.fields.Text; import org.apache.james.mdn.modifier.DispositionModifier; import org.apache.james.mdn.sending.mode.DispositionSendingMode; import org.apache.james.mdn.type.DispositionType; -import org.parboiled.BaseParser; import org.parboiled.Parboiled; import org.parboiled.Rule; import org.parboiled.parserunners.ReportingParseRunner; @@ -403,21 +402,6 @@ public class MDNReportParser { return true; } - @SuppressWarnings("unchecked") - <T> T popT() { - return (T) pop(); - } - - @SuppressWarnings("unchecked") - <T> T peekParent() { - return (T) peek(1); - } - - @SuppressWarnings("unchecked") - <T> T peekT() { - return (T) peek(); - } - // ua-name = *text-no-semi Rule uaName() { return ZeroOrMore(textNoSemi()); --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
