public SymbolMatch make(ParseSpecification specification, int offset, String text) { if (specification.matchesFor(WikiWord.symbolType)) { int length = findWikiWordLength(text); if (length > 0) { Symbol wikiWord = new Symbol(new WikiWord(sourcePage), text.substring(0, length), offset); wikiWord.evaluateVariables(new String[]{WikiWord.REGRACE_LINK}, variableSource); return new SymbolMatch(wikiWord, offset, length); } } if (specification.matchesFor(SymbolType.EMail) && isEmailAddress(text)) { return new SymbolMatch(SymbolType.EMail, text, offset); } return new SymbolMatch(SymbolType.Text, text, offset); }
public SymbolMatch make(ParseSpecification specification, int offset, String text) { if (specification.matchesFor(WikiWord.symbolType)) { int length = findWikiWordLength(text); if (length > 0) { Symbol wikiWord = new Symbol(new WikiWord(sourcePage), text.substring(0, length), offset); wikiWord.evaluateVariables(new String[]{WikiWord.REGRACE_LINK}, variableSource); return new SymbolMatch(wikiWord, offset, length); } } if (specification.matchesFor(SymbolType.EMail) && isEmailAddress(text)) { return new SymbolMatch(SymbolType.EMail, text, offset); } return new SymbolMatch(SymbolType.Text, text, offset); }
@Override public SymbolMatch makeMatch(ScanString input, SymbolStream symbols) { for (Matcher matcher: getWikiMatchers()) { Maybe<Integer> matchLength = matcher.makeMatch(input, symbols); if (!matchLength.isNothing()) return new SymbolMatch(this, input, matchLength.getValue()); } return SymbolMatch.noMatch; }
@Override public SymbolMatch makeMatch(ScanString input, SymbolStream symbols) { for (Matcher matcher: getWikiMatchers()) { Maybe<Integer> matchLength = matcher.makeMatch(input, symbols); if (!matchLength.isNothing()) return new SymbolMatch(this, input, matchLength.getValue()); } return SymbolMatch.noMatch; }