This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.github.parboiled1.grappa.samples; | |
| import com.github.parboiled1.grappa.helpers.ValueBuilder; | |
| import com.google.common.eventbus.Subscribe; | |
| import javax.annotation.Nonnull; | |
| import javax.annotation.ParametersAreNonnullByDefault; | |
| @ParametersAreNonnullByDefault | |
| public final class StudentBuilder |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.github.parboiled1.grappa.samples; | |
| import org.parboiled.Parboiled; | |
| import org.parboiled.parserunners.BasicParseRunner; | |
| import org.parboiled.parserunners.ParseRunner; | |
| import org.parboiled.support.ParsingResult; | |
| public final class SampleRun | |
| { | |
| public static void main(final String... args) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private int binarySearch(final int index) | |
| { | |
| return doBinarySearch(0, nrLines - 1, index); | |
| } | |
| private int doBinarySearch(final int low, final int high, final int index) | |
| { | |
| // Guaranteed to always succeed at this point | |
| if (low == high) | |
| return low; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.github.parboiled1.grappa.samples; | |
| import com.github.parboiled1.grappa.parsers.EventBusParser; | |
| import org.parboiled.Rule; | |
| import org.parboiled.support.Var; | |
| import java.util.HashMap; | |
| import java.util.Map; | |
| public class TestGrammar2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.github.parboiled1.grappa.samples; | |
| import org.parboiled.BaseParser; | |
| import org.parboiled.Rule; | |
| import java.util.ArrayList; | |
| import java.util.List; | |
| @SuppressWarnings("AutoBoxing") | |
| public class TestGrammar |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.github.fge.grappa; | |
| import org.parboiled.BaseParser; | |
| import org.parboiled.Rule; | |
| import org.parboiled.annotations.Label; | |
| public class JsonParser | |
| extends BaseParser<Void> | |
| { | |
| @Label("e") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * A joining matcher | |
| * | |
| * <p>Such a matcher has two submatchers: a "joined" matcher and a "joining" | |
| * matcher.</p> | |
| * | |
| * <p>This matcher will run cycles through both of these; the first will be a | |
| * run of the "joined" matcher, subsequent cycles will be ("joining", "joined"). | |
| * </p> | |
| * |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * The final step to building a {@link JoinMatcher} | |
| * | |
| * <p>At this step of the build, we have both rules (the "joined" rule and the | |
| * "joining" rule). The final information to feed to the matcher is the number | |
| * of cycles.</p> | |
| * | |
| * <p>The number of cycles can be bounded on the lower end and on the upper end. | |
| * The "true" building method is {@link #range(Range)}; all other methods | |
| * ultimately call this one to generate the result.</p> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static void main(final String... args) | |
| throws IOException | |
| { | |
| final ObjectMapper mapper = new ObjectMapper(); | |
| final TypeReference<List<Integer>> typeRef | |
| = new TypeReference<List<Integer>>() {}; | |
| final List<Integer> list; | |
| final InputStream in | |
| = EndOfInputMatcher.class.getResourceAsStream("/foo/bar/baz.json"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.github.fge.grappa; | |
| import org.parboiled.BaseParser; | |
| import org.parboiled.Rule; | |
| import org.parboiled.annotations.Label; | |
| public class JsonParser | |
| extends BaseParser<Void> | |
| { | |
| @Label("e") |