Terminals extends Lexicon { @Deprecated public static Terminals caseSensitive(String[] ops, String[] keywords) { return operators(ops).words(Scanners.IDENTIFIER).keywords(asList(keywords)).build(); } private  Terminals(Lexicon lexicon); @Deprecated static Terminals caseInsensitive(String[] ops, String[] keywords); @Deprecated static Terminals caseSensitive(String[] ops, String[] keywords); @Deprecated static Terminals caseInsensitive(
      Parser<String> wordScanner, String[] ops, String[] keywords); @Deprecated static Terminals caseSensitive(
      Parser<String> wordScanner, String[] ops, String[] keywords); @Deprecated static Terminals caseInsensitive(
      Parser<String> wordScanner, String[] ops, String[] keywords, Function<String, ?> wordMap); @Deprecated static Terminals caseSensitive(
      Parser<String> wordScanner, String[] ops, String[] keywords, Function<String, ?> wordMap); static Terminals operators(String... ops); static Terminals operators(Collection<String> ops); Builder words(Parser<String> wordScanner); static Parser<String> identifier(); static Parser<String> fragment(final Object... tags); static final Parser<String> RESERVED; }
@Test public void testCaseSensitive() { String[] keywords = { "foo", "bar", "baz" }; Terminals terminals = Terminals.operators("+", "-").words(Scanners.IDENTIFIER).keywords(asList(keywords)).build(); Parser<Token> parser = terminals.token("+", "-", "foo", "bar").from(terminals.tokenizer(), WHITESPACES); assertEquals(new Token(0, 1, Tokens.reserved("+")), parser.parse("+")); assertEquals(new Token(0, 1, Tokens.reserved("-")), parser.parse("-")); assertEquals(new Token(0, 3, Tokens.reserved("foo")), parser.parse("foo")); assertEquals(new Token(0, 3, Tokens.reserved("bar")), parser.parse("bar")); assertFailure(mode, parser, "baz", 1, 1, "+, -, foo or bar expected, baz encountered."); assertFailure(mode, parser, "Foo", 1, 1, "+, -, foo or bar expected, Foo encountered."); assertFailure(mode, parser, "123", 1, 1, "+, -, foo or bar expected, 1 encountered."); assertEquals("FOO", Terminals.Identifier.PARSER.from(terminals.tokenizer(), WHITESPACES).parse("FOO")); }