X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Ftext%2FParser.java;h=0daf30c3c08738afaf2db1fc254f9a8b2a79cd5b;hp=ccec36a74e37e6f73c6d1b7698b56cdc226a46a8;hb=179e7da4d8d8a474d0b622d60b5f5d32d6ab4052;hpb=31b4f988a9c7cc2b36006e3249e3ba644beb99f6 diff --git a/src/main/java/net/pterodactylus/sone/text/Parser.java b/src/main/java/net/pterodactylus/sone/text/Parser.java index ccec36a..0daf30c 100644 --- a/src/main/java/net/pterodactylus/sone/text/Parser.java +++ b/src/main/java/net/pterodactylus/sone/text/Parser.java @@ -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 @@ -17,26 +17,29 @@ 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 David ‘Bombe’ Roden + * @param + * The type of the parser context */ -public interface Parser { +public interface Parser { /** - * 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 parse(@Nonnull String source, @Nullable C context); }