/* * [BaliTokenizer.java] * * Summary: Decides which extensions will be processed by the Bali finite state automaton parser. * * Copyright: (c) 2014-2017 Roedy Green, Canadian Mind Products, http://mindprod.com * * Licence: This software may be copied and used freely for any purpose but military. * http://mindprod.com/contact/nonmil.html * * Requires: JDK 1.8+ * * Created with: JetBrains IntelliJ IDEA IDE http://www.jetbrains.com/idea/ * * Version History: * 1.0 2014-04-12 initial version, cloned from JavaTokenizer */ /** * Decides which extensions will be processed by the Java finite state automaton parser. * * @author Roedy Green, Canadian Mind Products * @version 1.0 2014-04-12 initial version, cloned from JavaTokenizer * @since 2004-05-15 */ package com.mindprod.jprep; import com.mindprod.jtokens.Token; /** * Decides which extensions will be processed by the Bali finite state automaton parser. * * @author Roedy Green, Canadian Mind Products * @version 1.0 2014-04-12 initial version, cloned from JavaTokenizer * @since 2014-04-12 */ public final class BaliTokenizer implements JPrepTokenizer { // BaliTokenizer must be registered in Jprep.prepareAllSnippetsForOneDirectory. // Does not have its on character categoriser. Uses JavaCharCategory /** * Constructor */ public BaliTokenizer() { // we don't load the big BaliState class until we actually first need to // parse. // Because BaliState is all static, it will be created only once no // matter // how many // BaliTokenizers you create. } /** * @inheritDoc */ public String[] getExtensions() { return new String[] { "bali", "balifrag", "js", // might eventually get a read js parser "jsfrag" }; } /** * Parse program and return array of tokens * * @param big the entire program or fragment to parse. * * @return array of tokens encoding colour and font. */ public Token[] tokenize( String big ) { return BaliState.parse( big ); } }