@Override protected void clearLanguageSyntax() { super.clearLanguageSyntax(); literalTokenSyntax.clear(); literalPhraseModifierSyntax.clear(); }
public void addTokenExtensions(PatternBasedSyntax tokenSyntax) { for (PatternBasedElement element : getPhraseModifiers()) { tokenSyntax.add(element); } }
protected final void initializeTokens() { addStandardTokens(tokenSyntax); addTokenExtensions(tokenSyntax); if (configuration != null) { configuration.addTokenExtensions(tokenSyntax); } }
/** * Create new state for tracking a document and its contents during a parse session. Subclasses may override this * method to provide additional state tracking capability. * * @return the new state. */ protected ContentState createState() { ContentState contentState = new ContentState(); contentState.getIdGenerator().setGenerationStrategy(getIdGenerationStrategy()); return contentState; }
protected static String getContent(PatternBasedElementProcessor processor) { return processor.group(CONTENT_GROUP); }
@Override public void setClosed(boolean closed) { if (closed) { style = null; } super.setClosed(closed); } }
/** * Emit a markup line that may contain phrase modifiers and replacement tokens, but no block modifiers. * * @param parser * @param state * @param line * @param offset */ public void emitMarkupLine(MarkupParser parser, ContentState state, String line, int offset) { emitMarkupLine(parser, state, 0, line, offset); }
public void endGroup(String regexFragment, int size) { add(regexFragment, size, false); }
/** * Process the given line of markup starting at the provided offset. * * @param line * the markup line to process * @param offset * the offset at which to start processing * * @return a non-negative integer to indicate that processing of the block completed before the end of the line, or * -1 if the entire line was processed. */ public int processLine(String line, int offset) { getState().setLineCharacterOffset(offset); return processLineContent(line, offset); }
protected final void initializeBlocks() { addStandardBlocks(blocks, paragraphBreakingBlocks); // extensions addBlockExtensions(blocks, paragraphBreakingBlocks); if (configuration != null) { configuration.addBlockExtensions(blocks, paragraphBreakingBlocks); } // ~extensions blocks.add(createParagraphBlock()); // ORDER DEPENDENCY: this must come last }
protected final void initializePhraseModifiers() { addStandardPhraseModifiers(phraseModifierSyntax); addPhraseModifierExtensions(phraseModifierSyntax); if (configuration != null) { configuration.addPhraseModifierExtensions(phraseModifierSyntax); } }
private void initProcessors() { for (Block block : getBlocks()) { if (block.getMarkupLanguage() != null) { return; } block.setMarkupLanguage(this); } }
@Override public void configure(MarkupLanguageConfiguration configuration) throws UnsupportedOperationException { if (configuration.isOptimizeForRepositoryUsage()) { setPreprocessFootnotes(true); } super.configure(configuration); }
/** * configure the markup language with a configuration that may alter the language syntax and capabilities. * * @param configuration * the configuration to use * @throws UnsupportedOperationException * markup languages that do not support configuration must throw this exception. */ public void configure(MarkupLanguageConfiguration configuration) throws UnsupportedOperationException { this.configuration = configuration; initializeSyntax(true); }
/** * Clone the block including its state. Cloning is generally used after the {@link #canStart(String, int)} method is * called in order to implement the Template design pattern. */ @Override public Block clone() { return (Block) super.clone(); }
@Override public TextileLanguage clone() { TextileLanguage copy = (TextileLanguage) super.clone(); copy.preprocessFootnotes = preprocessFootnotes; return copy; }
/** * Indicate if newlines in the markup must cause a line break. If false, then the default markup language behaviour * should be observed. The default is false. */ public void addPhraseModifierExtensions(PatternBasedSyntax phraseModifierSyntax) { for (PatternBasedElement element : getPhraseModifiers()) { phraseModifierSyntax.add(element); } }
protected static String getContent(PatternBasedElementProcessor processor) { return processor.group(CONTENT_GROUP); }
private void initializeSyntax(boolean force) { if (force || !syntaxInitialized) { syntaxInitialized = true; initializeSyntax(); } }
protected static String getContent(PatternBasedElementProcessor processor) { return processor.group(CONTENT_GROUP); }