/**
* Copyright 2011 Oliver Buchtala
*
* This file is part of ndogen.
*
* ndogen is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ndogen is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ndogen. If not, see <http://www.gnu.org/licenses/>.
*/
package org.ndogen.markdown;
import org.antlr.runtime.CharStream;
import org.antlr.runtime.CommonToken;
import org.antlr.runtime.CommonTokenStream;
import org.antlr.runtime.Lexer;
import org.antlr.runtime.RecognitionException;
import org.ndogen.ScannerDelegate;
import org.ndogen.xml.XMLLexer;
import org.ndogen.xml.XMLParser;
import org.ndogen.xml.XMLParser.element_return;
public class VerbatimHTML implements ScannerDelegate {
int token_type;
public VerbatimHTML(int tokenType) {
super();
token_type = tokenType;
}
public void call(Lexer parent) throws RecognitionException {
CharStream charStream = parent.getCharStream();
Lexer lexer = new XMLLexer(charStream);
CommonTokenStream tokens = new CommonTokenStream(lexer);
XMLParser parser = new XMLParser(tokens);
element_return element = parser.element();
CommonToken start = (CommonToken) element.getStart();
CommonToken stop = (CommonToken) element.getStop();
CommonToken inline_html_token = new CommonToken(token_type);
inline_html_token.setInputStream(charStream);
inline_html_token.setLine(start.getLine());
inline_html_token.setCharPositionInLine(start.getCharPositionInLine());
inline_html_token.setStartIndex(start.getStartIndex());
if(stop != null)
inline_html_token.setStopIndex(stop.getStopIndex());
parent.emit(inline_html_token);
};
}