Update year in copyright lines
[Sone.git] / src / main / java / net / pterodactylus / sone / text / Parser.java
index ccec36a..0daf30c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Sone - Parser.java - Copyright © 2010 David Roden
+ * Sone - Parser.java - Copyright © 2010–2019 David Roden
  *
  * 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
 
 package net.pterodactylus.sone.text;
 
-import java.io.IOException;
 import java.io.Reader;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
 
 /**
  * Interface for parsers that can create {@link Part}s from a text source
  * (usually a {@link Reader}).
  *
- * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
+ * @param <C>
+ *            The type of the parser context
  */
-public interface Parser {
+public interface Parser<C extends ParserContext> {
 
        /**
-        * Create a {@link Part} from the given text source.
+        * Create one or more {@link Part}s from the given text source.
         *
         * @param source
         *            The text source
-        * @return The parsed part
-        * @throws IOException
-        *             if an I/O error occurs
+        * @param context
+        *            The parser context (may be {@code null})
+        * @return The parsed parts
         */
-       public Part parse(Reader source) throws IOException;
+       @Nonnull
+       Iterable<Part> parse(@Nonnull String source, @Nullable C context);
 
 }