Syntax highlighting

Hi,

I am developing a custom language pluggin for intellij. I want to highlight the syntax of a custome language for which I have generated java class using Jflex and done upto the implementation of SyntaxHighlighterBase implementation. But How to link that with the editor?


Thanks..!1

7 comments
Comment actions Permalink

Hi Amila,

You should have a look here.

Denis

0
Comment actions Permalink

Hi,

Thank You for replying. Here is my syntaxhighlighting class.  I did not follow the steps mentioned in  'Implementing a Parser and PSI'. Since I am new to this  I created this code snippets to see how the system works.



package newair.org;

import com.intellij.lexer.Lexer;
import com.intellij.openapi.editor.SyntaxHighlighterColors;
import com.intellij.openapi.editor.colors.TextAttributesKey;
import com.intellij.openapi.fileTypes.SyntaxHighlighterBase;
import com.intellij.psi.tree.IElementType;
import gnu.trove.THashMap;
import org.jetbrains.annotations.NotNull;
/**
  * Created with IntelliJ IDEA.
  * User: amila
  * Date: 6/8/12
  * Time: 1:00 PM
  * To change this template use File | Settings | File Templates.
  */

public class SyntaxHighlightHandler extends SyntaxHighlighterBase {

    @NotNull
     @Override
     public Lexer getHighlightingLexer() {
         return new JaggeryHighlightingLexer();  //To change body of implemented methods use File | Settings | File Templates.
     }

    @NotNull
     @Override
     public TextAttributesKey[] getTokenHighlights(IElementType iElementType) {


         return pack(keys1.get(iElementType),keys2.get(iElementType));   //To change body of implemented methods use File | Settings | File  Templates.


     }


     public static final TextAttributesKey JAGGERY_KEY = TextAttributesKey.createTextAttributesKey(
             "JAGGERY.KEY",
             SyntaxHighlighterColors.KEYWORD.getDefaultAttributes()
     );


     public static final TextAttributesKey JAGGERY_VALUE = TextAttributesKey.createTextAttributesKey(
             "JAGGERY.VALUE",
             SyntaxHighlighterColors.STRING.getDefaultAttributes()



    );


     public static final TextAttributesKey JAGGERY_DOCCOMMENT = TextAttributesKey.createTextAttributesKey(
             "JAGGERY.DOCCOMMENT",
             SyntaxHighlighterColors.DOC_COMMENT.getDefaultAttributes()



    );

    private static THashMap<IElementType,TextAttributesKey> keys1;
     private static THashMap<IElementType,TextAttributesKey> keys2;

    static {

        keys1.put(JaggeryTokenTypes.KEY_CHARACTERS, JAGGERY_KEY);
         keys1.put(JaggeryTokenTypes.VALUE_CHARACTERS, JAGGERY_VALUE);


     }



Here is the class which extends flexAdapter.


import com.intellij.lexer.FlexAdapter;
import com.intellij.lexer.FlexLexer;
import com.intellij.psi.tree.IElementType;

/**
* Created with IntelliJ IDEA.
* User: amila
* Date: 6/8/12
* Time: 1:09 PM
* To change this template use File | Settings | File Templates.
*/
public class JflexAdapter extends FlexAdapter {





    public JflexAdapter(FlexLexer flex) {
        super(flex);    //To change body of overridden methods use File | Settings | File Templates.
    }





    @Override
    public IElementType getTokenType() {
        return super.getTokenType();    //To change body of overridden methods use File | Settings | File Templates.
    }


    @Override
    public void start(CharSequence buffer, int startOffset, int endOffset, int initialState) {
        super.start(buffer, startOffset, endOffset, initialState);    //To change body of overridden methods use File | Settings | File Templates.
    }


    @Override
    public void advance() {
        super.advance();    //To change body of overridden methods use File | Settings | File Templates.
    }


    @Override
    public int getBufferEnd() {
        return super.getBufferEnd();    //To change body of overridden methods use File | Settings | File Templates.
    }


    @Override
    public CharSequence getBufferSequence() {
        return super.getBufferSequence();    //To change body of overridden methods use File | Settings | File Templates.
    }


    @Override
    public FlexLexer getFlex() {
        return super.getFlex();    //To change body of overridden methods use File | Settings | File Templates.
    }


    @Override
    public int getState() {
        return super.getState();    //To change body of overridden methods use File | Settings | File Templates.
    }


    @Override
    public int getTokenEnd() {
        return super.getTokenEnd();    //To change body of overridden methods use File | Settings | File Templates.
    }


    @Override
    public int getTokenStart() {
        return super.getTokenStart();    //To change body of overridden methods use File | Settings | File Templates.
    }
}





import com.intellij.lexer.FlexAdapter;

import java.io.Reader;

/**
* Created with IntelliJ IDEA.
* User: amila
* Date: 6/12/12
* Time: 11:30 PM
* To change this template use File | Settings | File Templates.
*/
public class JaggeyLexer extends FlexAdapter {


    public JaggeyLexer(){


        super(new JavaScriptLexer((Reader)null));


    }





}





import com.intellij.psi.TokenType;
import com.intellij.psi.tree.IElementType;
import com.intellij.psi.tree.TokenSet;

/**
* Created with IntelliJ IDEA.
* User: amila
* Date: 6/12/12
* Time: 2:38 PM
* To change this template use File | Settings | File Templates.
*/
public interface JaggeryTokenTypes {



    IElementType KEY_CHARACTERS = new JaggeryElementType("KEY_CHARACTERS");
    IElementType VALUE_CHARACTERS = new JaggeryElementType("VALUE_CHARACTERS");

    IElementType  WHITE_SPACE = TokenType.WHITE_SPACE ;




              TokenSet WHITE_SPACES=  TokenSet.create(WHITE_SPACE);













}






import com.intellij.psi.TokenType;
import com.intellij.psi.tree.IElementType;
import com.intellij.psi.tree.TokenSet;

/**
* Created with IntelliJ IDEA.
* User: amila
* Date: 6/12/12
* Time: 2:38 PM
* To change this template use File | Settings | File Templates.
*/
public interface JaggeryTokenTypes {



    IElementType KEY_CHARACTERS = new JaggeryElementType("KEY_CHARACTERS");
    IElementType VALUE_CHARACTERS = new JaggeryElementType("VALUE_CHARACTERS");

    IElementType  WHITE_SPACE = TokenType.WHITE_SPACE ;




              TokenSet WHITE_SPACES=  TokenSet.create(WHITE_SPACE);













}




File type implementation.



import com.intellij.lang.Language;
import com.intellij.openapi.fileTypes.LanguageFileType;
import org.jetbrains.annotations.NotNull;

import javax.swing.*;

/**
* Created with IntelliJ IDEA.
* User: amila
* Date: 6/7/12
* Time: 12:05 PM
* To change this template use File | Settings | File Templates.
*/
public class JaggeryFileType extends LanguageFileType {


    public  static final String DEFAULT = "jag";




    protected JaggeryFileType(@NotNull Language language) {
        super(language);
    }



    @NotNull
    @Override
    public String getName() {
        return "jag";  //To change body of implemented methods use File | Settings | File Templates.
    }


    @NotNull
    @Override
    public String getDescription() {
        return "jag is the file type extension";  //To change body of implemented methods use File | Settings | File Templates.
    }

    @NotNull
    @Override
    public String getDefaultExtension() {
        return ".jag";  //To change body of implemented methods use File | Settings | File Templates.
    }

    @Override
    public Icon getIcon() {
        return null;  //To change body of implemented methods use File | Settings | File Templates.
    }


    
}






import com.intellij.lexer.LayeredLexer;
import com.intellij.lexer.StringLiteralLexer;
import com.intellij.psi.tree.IElementType;

/**
* Created with IntelliJ IDEA.
* User: amila
* Date: 6/12/12
* Time: 10:24 PM
* To change this template use File | Settings | File Templates.
*/
public class JaggeryHighlightingLexer extends LayeredLexer {

    public JaggeryHighlightingLexer() {
        super(new JaggeyLexer());

        registerSelfStoppingLayer(new StringLiteralLexer(StringLiteralLexer.NO_QUOTE_CHAR, JaggeryTokenTypes.VALUE_CHARACTERS, true, "#!=:"),
                new IElementType[]{JaggeryTokenTypes.VALUE_CHARACTERS},
                IElementType.EMPTY_ARRAY);


        registerSelfStoppingLayer(new StringLiteralLexer(StringLiteralLexer.NO_QUOTE_CHAR, JaggeryTokenTypes.KEY_CHARACTERS, true, "#!=: "),
                new IElementType[]{JaggeryTokenTypes.KEY_CHARACTERS},
                IElementType.EMPTY_ARRAY);registerSelfStoppingLayer(new StringLiteralLexer(StringLiteralLexer.NO_QUOTE_CHAR, JaggeryTokenTypes.KEY_CHARACTERS, true, "#!=: "),
                new IElementType[]{JaggeryTokenTypes.KEY_CHARACTERS},
                IElementType.EMPTY_ARRAY);



    }
}





I just tested with javascript before the real imlementation here is the .java file generated by Jflex.


import com.intellij.lexer.FlexLexer;
import com.intellij.psi.tree.IElementType;
import jsyntaxpane.Token;
import jsyntaxpane.TokenType;
import jsyntaxpane.lexers.DefaultJFlexLexer;

import java.io.IOException;


/**
* This class is a scanner generated by
* <a href="http://www.jflex.de/">JFlex</a> 1.4.3
* on 6/11/12 10:35 AM from the specification file
* <tt>/home/amila/jflex/javascript.flex</tt>
*/
public final class JavaScriptLexer extends DefaultJFlexLexer implements FlexLexer {

  /** This character denotes the end of file */
  public static final int YYEOF = -1;

  /** initial size of the lookahead buffer */
  private static final int ZZ_BUFFERSIZE = 16384;

  /** lexical states */
  public static final int STRING = 2;
  public static final int YYINITIAL = 0;
  public static final int SSTRING = 4;

  /**
   * ZZ_LEXSTATE[l] is the state in the DFA for the lexical state l
   * ZZ_LEXSTATE[l+1] is the state in the DFA for the lexical state l
   *                  at the beginning of a line
   * l is of the form l = 2*k, k a non negative integer
   */
  private static final int ZZ_LEXSTATE[] = {
     0,  0,  1,  1,  2, 2
  };

  /**
   * Translates characters to character classes
   */
  private static final String ZZ_CMAP_PACKED =
    "\11\7\1\3\1\2\1\0\1\3\1\1\16\7\4\0\1\3\1\104"+
    "\1\24\1\0\1\6\1\104\1\105\1\25\1\72\1\73\1\5\1\107"+
    "\1\100\1\23\1\21\1\4\1\10\1\16\2\15\4\17\2\11\1\71"+
    "\1\100\1\103\1\101\1\102\1\100\1\0\1\62\1\63\1\57\1\14"+
    "\1\22\1\20\2\6\1\53\2\6\1\12\1\64\1\54\1\65\2\6"+
    "\1\56\1\70\1\6\1\55\2\6\1\13\2\6\1\76\1\26\1\77"+
    "\1\104\1\6\1\0\1\32\1\27\1\34\1\44\1\31\1\46\1\51"+
    "\1\37\1\42\1\66\1\33\1\45\1\60\1\41\1\40\1\61\1\6"+
    "\1\30\1\35\1\36\1\43\1\52\1\50\1\67\1\47\1\6\1\74"+
    "\1\106\1\75\1\100\41\7\2\0\4\6\4\0\1\6\2\0\1\7"+
    "\7\0\1\6\4\0\1\6\5\0\27\6\1\0\37\6\1\0\u013f\6"+
    "\31\0\162\6\4\0\14\6\16\0\5\6\11\0\1\6\21\0\130\7"+
    "\5\0\23\7\12\0\1\6\13\0\1\6\1\0\3\6\1\0\1\6"+
    "\1\0\24\6\1\0\54\6\1\0\46\6\1\0\5\6\4\0\202\6"+
    "\1\0\4\7\3\0\105\6\1\0\46\6\2\0\2\6\6\0\20\6"+
    "\41\0\46\6\2\0\1\6\7\0\47\6\11\0\21\7\1\0\27\7"+
    "\1\0\3\7\1\0\1\7\1\0\2\7\1\0\1\7\13\0\33\6"+
    "\5\0\3\6\15\0\4\7\14\0\6\7\13\0\32\6\5\0\13\6"+
    "\16\7\7\0\12\7\4\0\2\6\1\7\143\6\1\0\1\6\10\7"+
    "\1\0\6\7\2\6\2\7\1\0\4\7\2\6\12\7\3\6\2\0"+
    "\1\6\17\0\1\7\1\6\1\7\36\6\33\7\2\0\3\6\60\0"+
    "\46\6\13\7\1\6\u014f\0\3\7\66\6\2\0\1\7\1\6\20\7"+
    "\2\0\1\6\4\7\3\0\12\6\2\7\2\0\12\7\21\0\3\7"+
    "\1\0\10\6\2\0\2\6\2\0\26\6\1\0\7\6\1\0\1\6"+
    "\3\0\4\6\2\0\1\7\1\6\7\7\2\0\2\7\2\0\3\7"+
    "\11\0\1\7\4\0\2\6\1\0\3\6\2\7\2\0\12\7\4\6"+
    "\15\0\3\7\1\0\6\6\4\0\2\6\2\0\26\6\1\0\7\6"+
    "\1\0\2\6\1\0\2\6\1\0\2\6\2\0\1\7\1\0\5\7"+
    "\4\0\2\7\2\0\3\7\13\0\4\6\1\0\1\6\7\0\14\7"+
    "\3\6\14\0\3\7\1\0\11\6\1\0\3\6\1\0\26\6\1\0"+
    "\7\6\1\0\2\6\1\0\5\6\2\0\1\7\1\6\10\7\1\0"+
    "\3\7\1\0\3\7\2\0\1\6\17\0\2\6\2\7\2\0\12\7"+
    "\1\0\1\6\17\0\3\7\1\0\10\6\2\0\2\6\2\0\26\6"+
    "\1\0\7\6\1\0\2\6\1\0\5\6\2\0\1\7\1\6\6\7"+
    "\3\0\2\7\2\0\3\7\10\0\2\7\4\0\2\6\1\0\3\6"+
    "\4\0\12\7\1\0\1\6\20\0\1\7\1\6\1\0\6\6\3\0"+
    "\3\6\1\0\4\6\3\0\2\6\1\0\1\6\1\0\2\6\3\0"+
    "\2\6\3\0\3\6\3\0\10\6\1\0\3\6\4\0\5\7\3\0"+
    "\3\7\1\0\4\7\11\0\1\7\17\0\11\7\11\0\1\6\7\0"+
    "\3\7\1\0\10\6\1\0\3\6\1\0\27\6\1\0\12\6\1\0"+
    "\5\6\4\0\7\7\1\0\3\7\1\0\4\7\7\0\2\7\11\0"+
    "\2\6\4\0\12\7\22\0\2\7\1\0\10\6\1\0\3\6\1\0"+
    "\27\6\1\0\12\6\1\0\5\6\2\0\1\7\1\6\7\7\1\0"+
    "\3\7\1\0\4\7\7\0\2\7\7\0\1\6\1\0\2\6\4\0"+
    "\12\7\22\0\2\7\1\0\10\6\1\0\3\6\1\0\27\6\1\0"+
    "\20\6\4\0\6\7\2\0\3\7\1\0\4\7\11\0\1\7\10\0"+
    "\2\6\4\0\12\7\22\0\2\7\1\0\22\6\3\0\30\6\1\0"+
    "\11\6\1\0\1\6\2\0\7\6\3\0\1\7\4\0\6\7\1\0"+
    "\1\7\1\0\10\7\22\0\2\7\15\0\60\6\1\7\2\6\7\7"+
    "\4\0\10\6\10\7\1\0\12\7\47\0\2\6\1\0\1\6\2\0"+
    "\2\6\1\0\1\6\2\0\1\6\6\0\4\6\1\0\7\6\1\0"+
    "\3\6\1\0\1\6\1\0\1\6\2\0\2\6\1\0\4\6\1\7"+
    "\2\6\6\7\1\0\2\7\1\6\2\0\5\6\1\0\1\6\1\0"+
    "\6\7\2\0\12\7\2\0\2\6\42\0\1\6\27\0\2\7\6\0"+
    "\12\7\13\0\1\7\1\0\1\7\1\0\1\7\4\0\2\7\10\6"+
    "\1\0\42\6\6\0\24\7\1\0\2\7\4\6\4\0\10\7\1\0"+
    "\44\7\11\0\1\7\71\0\42\6\1\0\5\6\1\0\2\6\1\0"+
    "\7\7\3\0\4\7\6\0\12\7\6\0\6\6\4\7\106\0\46\6"+
    "\12\0\51\6\7\0\132\6\5\0\104\6\5\0\122\6\6\0\7\6"+
    "\1\0\77\6\1\0\1\6\1\0\4\6\2\0\7\6\1\0\1\6"+
    "\1\0\4\6\2\0\47\6\1\0\1\6\1\0\4\6\2\0\37\6"+
    "\1\0\1\6\1\0\4\6\2\0\7\6\1\0\1\6\1\0\4\6"+
    "\2\0\7\6\1\0\7\6\1\0\27\6\1\0\37\6\1\0\1\6"+
    "\1\0\4\6\2\0\7\6\1\0\47\6\1\0\23\6\16\0\11\7"+
    "\56\0\125\6\14\0\u026c\6\2\0\10\6\12\0\32\6\5\0\113\6"+
    "\3\0\3\6\17\0\15\6\1\0\4\6\3\7\13\0\22\6\3\7"+
    "\13\0\22\6\2\7\14\0\15\6\1\0\3\6\1\0\2\7\14\0"+
    "\64\6\40\7\3\0\1\6\3\0\2\6\1\7\2\0\12\7\41\0"+
    "\3\7\2\0\12\7\6\0\130\6\10\0\51\6\1\7\126\0\35\6"+
    "\3\0\14\7\4\0\14\7\12\0\12\7\36\6\2\0\5\6\u038b\0"+
    "\154\6\224\0\234\6\4\0\132\6\6\0\26\6\2\0\6\6\2\0"+
    "\46\6\2\0\6\6\2\0\10\6\1\0\1\6\1\0\1\6\1\0"+
    "\1\6\1\0\37\6\2\0\65\6\1\0\7\6\1\0\1\6\3\0"+
    "\3\6\1\0\7\6\3\0\4\6\2\0\6\6\4\0\15\6\5\0"+
    "\3\6\1\0\7\6\17\0\4\7\32\0\5\7\20\0\2\6\23\0"+
    "\1\6\13\0\4\7\6\0\6\7\1\0\1\6\15\0\1\6\40\0"+
    "\22\6\36\0\15\7\4\0\1\7\3\0\6\7\27\0\1\6\4\0"+
    "\1\6\2\0\12\6\1\0\1\6\3\0\5\6\6\0\1\6\1\0"+
    "\1\6\1\0\1\6\1\0\4\6\1\0\3\6\1\0\7\6\3\0"+
    "\3\6\5\0\5\6\26\0\44\6\u0e81\0\3\6\31\0\11\6\6\7"+
    "\1\0\5\6\2\0\5\6\4\0\126\6\2\0\2\7\2\0\3\6"+
    "\1\0\137\6\5\0\50\6\4\0\136\6\21\0\30\6\70\0\20\6"+
    "\u0200\0\u19b6\6\112\0\u51a6\6\132\0\u048d\6\u0773\0\u2ba4\6\u215c\0\u012e\6"+
    "\2\0\73\6\225\0\7\6\14\0\5\6\5\0\1\6\1\7\12\6"+
    "\1\0\15\6\1\0\5\6\1\0\1\6\1\0\2\6\1\0\2\6"+
    "\1\0\154\6\41\0\u016b\6\22\0\100\6\2\0\66\6\50\0\15\6"+
    "\3\0\20\7\20\0\4\7\17\0\2\6\30\0\3\6\31\0\1\6"+
    "\6\0\5\6\1\0\207\6\2\0\1\7\4\0\1\6\13\0\12\7"+
    "\7\0\32\6\4\0\1\6\1\0\32\6\12\0\132\6\3\0\6\6"+
    "\2\0\6\6\2\0\6\6\2\0\3\6\3\0\2\6\3\0\2\6"+
    "\22\0\3\7\4\0";

  /**
   * Translates characters to character classes
   */
  private static final char [] ZZ_CMAP = zzUnpackCMap(ZZ_CMAP_PACKED);

  /**
   * Translates DFA states to action switch labels.
   */
  private static final int [] ZZ_ACTION = zzUnpackAction();

  private static final String ZZ_ACTION_PACKED_0 =
    "\3\0\3\1\2\2\1\3\2\4\1\3\2\2\1\5"+
    "\1\6\27\3\1\2\1\7\1\10\1\11\1\12\1\13"+
    "\1\14\5\2\1\15\2\16\1\17\1\1\1\15\1\20"+
    "\1\21\1\0\1\22\3\4\1\0\3\4\1\0\17\3"+
    "\1\23\23\3\1\2\1\24\2\15\2\21\2\0\4\4"+
    "\1\0\31\3\1\25\10\3\1\15\1\0\2\4\1\22"+
    "\24\3\2\4\21\3\2\4\14\3\2\4\6\3\2\4"+
    "\4\3\2\4\1\3\2\4\1\3\1\0\1\4\1\3"+
    "\1\0\1\4\1\3\1\0\1\4\1\3\1\0\1\4"+
    "\1\3\1\0\1\4\1\3\1\0\1\4\1\0\1\4"+
    "\1\0\5\4";

  private static int [] zzUnpackAction() {
    int [] result = new int[254];
    int offset = 0;
    offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result);
    return result;
  }

  private static int zzUnpackAction(String packed, int offset, int [] result) {
    int i = 0;       /* index in packed string  */
    int j = offset;  /* index in unpacked array */
    int l = packed.length();
    while (i < l) {
      int count = packed.charAt(i++);
      int value = packed.charAt(i++);
      do result[j++] = value; while (--count > 0);
    }
    return j;
  }


  /**
   * Translates a state to a row index in the transition table
   */
  private static final int [] ZZ_ROWMAP = zzUnpackRowMap();

  private static final String ZZ_ROWMAP_PACKED_0 =
    "\0\0\0\110\0\220\0\330\0\u0120\0\u0168\0\u01b0\0\u01f8"+
    "\0\u0240\0\u0288\0\u02d0\0\u0318\0\u0360\0\u03a8\0\330\0\330"+
    "\0\u03f0\0\u0438\0\u0480\0\u04c8\0\u0510\0\u0558\0\u05a0\0\u05e8"+
    "\0\u0630\0\u0678\0\u06c0\0\u0708\0\u0750\0\u0798\0\u07e0\0\u0828"+
    "\0\u0870\0\u08b8\0\u0900\0\u0948\0\u0990\0\u09d8\0\u0a20\0\330"+
    "\0\330\0\330\0\330\0\330\0\330\0\330\0\u0a68\0\u0ab0"+
    "\0\u0af8\0\u0b40\0\u0b88\0\u0bd0\0\u0c18\0\330\0\330\0\u0c60"+
    "\0\u0ca8\0\330\0\u0cf0\0\u0d38\0\330\0\u0d80\0\u0dc8\0\330"+
    "\0\u0e10\0\u0e58\0\u0ea0\0\u0ee8\0\u0f30\0\u0f78\0\u0fc0\0\u1008"+
    "\0\u1050\0\u1098\0\u10e0\0\u1128\0\u1170\0\u11b8\0\u1200\0\u1248"+
    "\0\u1290\0\u12d8\0\u1320\0\u1368\0\u0240\0\u13b0\0\u13f8\0\u1440"+
    "\0\u1488\0\u14d0\0\u1518\0\u1560\0\u15a8\0\u15f0\0\u1638\0\u1680"+
    "\0\u16c8\0\u1710\0\u1758\0\u17a0\0\u17e8\0\u1830\0\u1878\0\u18c0"+
    "\0\u1908\0\330\0\u1950\0\u1998\0\u19e0\0\330\0\u1a28\0\u1a70"+
    "\0\u1ab8\0\u1b00\0\u1b48\0\u1b90\0\u1bd8\0\u1c20\0\u1c68\0\u1cb0"+
    "\0\u1cf8\0\u1d40\0\u1d88\0\u1dd0\0\u1e18\0\u1e60\0\u1ea8\0\u1ef0"+
    "\0\u1f38\0\u1f80\0\u1fc8\0\u2010\0\u2058\0\u20a0\0\u20e8\0\u2130"+
    "\0\u2178\0\u21c0\0\u2208\0\u2250\0\u2298\0\u22e0\0\u0240\0\u2328"+
    "\0\u2370\0\u23b8\0\u2400\0\u2448\0\u2490\0\u24d8\0\u2520\0\330"+
    "\0\u2568\0\u25b0\0\u25f8\0\u0240\0\u2640\0\u2688\0\u26d0\0\u2718"+
    "\0\u2760\0\u27a8\0\u27f0\0\u2838\0\u2880\0\u28c8\0\u2910\0\u2958"+
    "\0\u29a0\0\u29e8\0\u2a30\0\u2a78\0\u2ac0\0\u2b08\0\u2b50\0\u2b98"+
    "\0\u2be0\0\u2c28\0\u2c70\0\u2cb8\0\u2d00\0\u2d48\0\u2d90\0\u2dd8"+
    "\0\u2e20\0\u2e68\0\u2eb0\0\u2ef8\0\u2f40\0\u2f88\0\u2fd0\0\u3018"+
    "\0\u3060\0\u30a8\0\u30f0\0\u3138\0\u3180\0\u31c8\0\u3210\0\u3258"+
    "\0\u32a0\0\u32e8\0\u3330\0\u3378\0\u33c0\0\u3408\0\u3450\0\u3498"+
    "\0\u34e0\0\u3528\0\u3570\0\u35b8\0\u3600\0\u3648\0\u3690\0\u36d8"+
    "\0\u3720\0\u3768\0\u37b0\0\u37f8\0\u3840\0\u3888\0\u38d0\0\u3918"+
    "\0\u3960\0\u39a8\0\u39f0\0\u3a38\0\u3a80\0\u3ac8\0\u3b10\0\u3b58"+
    "\0\u3ba0\0\u3be8\0\u3c30\0\u3c78\0\u3cc0\0\u3d08\0\u3d50\0\u3d98"+
    "\0\u3de0\0\u3e28\0\u3e70\0\u3eb8\0\u3f00\0\u3f48\0\u3f90\0\u3fd8"+
    "\0\u4020\0\u4068\0\u40b0\0\u40f8\0\u4140\0\u4188";

  private static int [] zzUnpackRowMap() {
    int [] result = new int[254];
    int offset = 0;
    offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result);
    return result;
  }

  private static int zzUnpackRowMap(String packed, int offset, int [] result) {
    int i = 0;  /* index in packed string  */
    int j = offset;  /* index in unpacked array */
    int l = packed.length();
    while (i < l) {
      int high = packed.charAt(i++) << 16;
      result[j++] = high | packed.charAt(i++);
    }
    return j;
  }

  /**
   * The transition table of the DFA
   */
  private static final int [] ZZ_TRANS = zzUnpackTrans();

  private static final String ZZ_TRANS_PACKED_0 =
    "\1\4\1\5\1\4\1\6\1\7\1\10\1\11\1\4"+
    "\1\12\1\13\2\11\1\14\3\13\1\11\1\15\1\11"+
    "\1\16\1\17\1\20\1\4\1\21\1\22\1\23\2\11"+
    "\1\24\1\25\1\26\2\11\1\27\1\30\1\31\1\32"+
    "\1\11\1\33\1\11\1\34\1\35\1\36\1\37\1\40"+
    "\1\11\1\41\2\11\1\42\1\43\1\44\1\45\1\46"+
    "\2\11\1\47\1\50\1\51\1\52\1\53\1\54\1\55"+
    "\1\56\1\50\1\10\1\57\1\60\1\10\1\61\1\62"+
    "\1\63\1\64\1\65\1\66\21\64\1\67\1\64\1\70"+
    "\61\64\1\71\1\65\1\66\22\71\1\72\1\70\61\71"+
    "\112\0\1\4\110\0\1\6\110\0\1\73\1\74\73\0"+
    "\1\50\107\0\1\50\14\0\13\11\1\0\1\11\4\0"+
    "\42\11\1\75\26\0\1\76\1\77\1\100\1\101\1\100"+
    "\1\102\1\103\1\102\1\100\1\104\1\105\6\0\1\105"+
    "\12\0\3\100\20\0\1\101\30\0\2\13\1\100\1\0"+
    "\1\100\3\13\1\100\1\104\1\105\6\0\1\105\12\0"+
    "\3\100\47\0\13\11\1\0\1\11\4\0\3\11\1\106"+
    "\36\11\1\75\26\0\2\104\3\0\3\104\113\0\1\50"+
    "\55\0\1\50\14\0\13\11\1\0\1\11\4\0\1\11"+
    "\1\107\40\11\1\75\24\0\13\11\1\0\1\11\4\0"+
    "\2\11\1\110\37\11\1\75\24\0\13\11\1\0\1\11"+
    "\4\0\6\11\1\111\3\11\1\112\3\11\1\113\4\11"+
    "\1\114\16\11\1\75\24\0\13\11\1\0\1\11\4\0"+
    "\3\11\1\115\5\11\1\116\30\11\1\75\24\0\13\11"+
    "\1\0\1\11\4\0\21\11\1\117\20\11\1\75\24\0"+
    "\13\11\1\0\1\11\4\0\1\11\1\120\6\11\1\121"+
    "\31\11\1\75\24\0\13\11\1\0\1\11\4\0\2\11"+
    "\1\122\11\11\1\123\25\11\1\75\24\0\13\11\1\0"+
    "\1\11\4\0\6\11\1\124\3\11\1\125\4\11\1\125"+
    "\22\11\1\75\24\0\13\11\1\0\1\11\4\0\12\11"+
    "\1\126\27\11\1\75\24\0\13\11\1\0\1\11\4\0"+
    "\2\11\1\127\6\11\1\125\30\11\1\75\24\0\13\11"+
    "\1\0\1\11\4\0\3\11\1\130\5\11\1\131\1\11"+
    "\1\132\1\133\25\11\1\75\24\0\13\11\1\0\1\11"+
    "\4\0\10\11\1\134\2\11\1\135\26\11\1\75\24\0"+
    "\13\11\1\0\1\11\4\0\11\11\1\136\30\11\1\75"+
    "\24\0\13\11\1\0\1\11\4\0\3\11\1\131\36\11"+
    "\1\75\24\0\13\11\1\0\1\11\4\0\12\11\1\137"+
    "\27\11\1\75\24\0\13\11\1\0\1\11\4\0\3\11"+
    "\1\140\10\11\1\141\25\11\1\75\24\0\13\11\1\0"+
    "\1\11\4\0\2\11\1\142\37\11\1\75\24\0\13\11"+
    "\1\0\1\11\4\0\3\11\1\143\36\11\1\75\24\0"+
    "\13\11\1\0\1\11\4\0\1\11\1\144\40\11\1\75"+
    "\24\0\13\11\1\0\1\11\4\0\11\11\1\145\30\11"+
    "\1\75\24\0\13\11\1\0\1\11\4\0\3\11\1\146"+
    "\36\11\1\75\24\0\13\11\1\0\1\11\4\0\1\147"+
    "\41\11\1\75\24\0\13\11\1\0\1\11\4\0\7\11"+
    "\1\150\32\11\1\75\117\0\1\50\1\151\106\0\1\50"+
    "\1\0\1\10\105\0\1\50\3\0\1\50\103\0\1\50"+
    "\4\0\1\50\102\0\1\50\5\0\1\50\1\64\2\0"+
    "\21\64\1\0\1\64\1\0\61\64\2\0\1\66\105\0"+
    "\2\152\1\0\5\152\1\153\4\152\2\153\1\154\70\152"+
    "\1\71\2\0\22\71\2\0\61\71\1\73\1\155\1\156"+
    "\105\73\5\157\1\160\102\157\10\0\1\76\1\77\1\100"+
    "\1\0\1\100\1\102\1\103\1\102\1\100\1\104\1\105"+
    "\6\0\1\105\12\0\3\100\51\0\2\77\2\0\1\100"+
    "\3\77\1\100\1\104\1\105\6\0\1\105\12\0\1\100"+
    "\1\0\1\100\51\0\1\161\1\162\2\0\5\162\1\0"+
    "\1\162\4\0\1\162\1\0\2\162\1\0\1\162\7\0"+
    "\1\162\1\0\1\162\10\0\1\162\2\0\2\162\34\0"+
    "\1\163\1\77\1\100\1\0\1\100\3\163\1\100\1\104"+
    "\1\105\6\0\1\105\12\0\3\100\51\0\1\102\1\77"+
    "\1\100\1\0\1\100\3\102\1\100\1\104\1\105\6\0"+
    "\1\105\12\0\3\100\51\0\2\104\2\0\1\100\3\104"+
    "\1\100\1\0\1\105\6\0\1\105\12\0\1\100\1\0"+
    "\1\100\51\0\2\164\3\0\3\164\3\0\1\165\63\0"+
    "\1\165\6\0\13\11\1\0\1\11\4\0\7\11\1\166"+
    "\32\11\1\75\24\0\13\11\1\0\1\11\4\0\2\11"+
    "\1\167\37\11\1\75\24\0\13\11\1\0\1\11\4\0"+
    "\7\11\1\170\32\11\1\75\24\0\13\11\1\0\1\11"+
    "\4\0\5\11\1\171\34\11\1\75\24\0\13\11\1\0"+
    "\1\11\4\0\5\11\1\172\34\11\1\75\24\0\13\11"+
    "\1\0\1\11\4\0\6\11\1\173\33\11\1\75\24\0"+
    "\13\11\1\0\1\11\4\0\3\11\1\174\36\11\1\75"+
    "\24\0\13\11\1\0\1\11\4\0\6\11\1\173\1\175"+
    "\32\11\1\75\24\0\13\11\1\0\1\11\4\0\12\11"+
    "\1\176\27\11\1\75\24\0\13\11\1\0\1\11\4\0"+
    "\13\11\1\177\26\11\1\75\24\0\13\11\1\0\1\11"+
    "\4\0\14\11\1\173\3\11\1\125\21\11\1\75\24\0"+
    "\13\11\1\0\1\11\4\0\13\11\1\200\26\11\1\75"+
    "\24\0\13\11\1\0\1\11\4\0\21\11\1\125\20\11"+
    "\1\75\24\0\13\11\1\0\1\11\4\0\16\11\1\201"+
    "\23\11\1\75\24\0\12\11\1\202\1\0\1\11\4\0"+
    "\25\11\1\203\14\11\1\75\24\0\13\11\1\0\1\11"+
    "\4\0\2\11\1\204\12\11\1\205\24\11\1\75\24\0"+
    "\13\11\1\0\1\11\4\0\5\11\1\206\10\11\1\207"+
    "\1\210\22\11\1\75\24\0\13\11\1\0\1\11\4\0"+
    "\16\11\1\113\23\11\1\75\24\0\13\11\1\0\1\11"+
    "\4\0\1\11\1\125\40\11\1\75\24\0\13\11\1\0"+
    "\1\11\4\0\12\11\1\211\27\11\1\75\24\0\13\11"+
    "\1\0\1\11\4\0\12\11\1\212\27\11\1\75\24\0"+
    "\13\11\1\0\1\11\4\0\13\11\1\213\26\11\1\75"+
    "\24\0\13\11\1\0\1\11\4\0\7\11\1\214\32\11"+
    "\1\75\24\0\13\11\1\0\1\11\4\0\7\11\1\215"+
    "\32\11\1\75\24\0\13\11\1\0\1\11\4\0\17\11"+
    "\1\216\22\11\1\75\24\0\13\11\1\0\1\11\4\0"+
    "\25\11\1\217\14\11\1\75\24\0\13\11\1\0\1\11"+
    "\4\0\31\11\1\220\10\11\1\75\24\0\13\11\1\0"+
    "\1\11\4\0\22\11\1\221\17\11\1\75\24\0\13\11"+
    "\1\0\1\11\4\0\1\11\1\222\40\11\1\75\24\0"+
    "\13\11\1\0\1\11\4\0\1\11\1\223\40\11\1\75"+
    "\24\0\13\11\1\0\1\11\4\0\11\11\1\224\30\11"+
    "\1\75\24\0\13\11\1\0\1\11\4\0\7\11\1\225"+
    "\32\11\1\75\24\0\13\11\1\0\1\11\4\0\37\11"+
    "\1\226\2\11\1\75\24\0\13\11\1\0\1\11\4\0"+
    "\1\11\1\227\40\11\1\75\117\0\1\50\1\10\15\0"+
    "\1\154\4\0\3\154\100\0\1\230\4\0\3\230\72\0"+
    "\1\156\105\0\5\157\1\231\102\157\4\0\1\156\1\160"+
    "\112\0\1\161\1\162\1\100\1\0\5\162\1\0\1\162"+
    "\4\0\1\162\1\0\2\162\1\0\1\162\7\0\1\162"+
    "\1\100\1\162\10\0\1\162\2\0\2\162\34\0\2\232"+
    "\1\100\1\0\5\232\1\0\1\232\4\0\1\232\1\0"+
    "\2\232\1\0\1\232\7\0\1\232\1\100\1\232\10\0"+
    "\1\232\2\0\2\232\34\0\1\233\1\77\1\100\1\0"+
    "\1\100\3\233\1\100\1\104\1\105\6\0\1\105\12\0"+
    "\3\100\51\0\2\164\2\0\1\100\3\164\1\100\23\0"+
    "\1\100\1\0\1\100\51\0\2\164\3\0\3\164\76\0"+
    "\13\11\1\0\1\11\4\0\2\11\1\234\37\11\1\75"+
    "\24\0\13\11\1\0\1\11\4\0\3\11\1\235\36\11"+
    "\1\75\24\0\13\11\1\0\1\11\4\0\14\11\1\236"+
    "\25\11\1\75\24\0\13\11\1\0\1\11\4\0\3\11"+
    "\1\237\36\11\1\75\24\0\13\11\1\0\1\11\4\0"+
    "\11\11\1\240\30\11\1\75\24\0\13\11\1\0\1\11"+
    "\4\0\2\11\1\125\37\11\1\75\24\0\13\11\1\0"+
    "\1\11\4\0\16\11\1\217\23\11\1\75\24\0\13\11"+
    "\1\0\1\11\4\0\5\11\1\214\34\11\1\75\24\0"+
    "\13\11\1\0\1\11\4\0\7\11\1\241\32\11\1\75"+
    "\24\0\13\11\1\0\1\11\4\0\7\11\1\175\32\11"+
    "\1\75\24\0\13\11\1\0\1\11\4\0\6\11\1\125"+
    "\33\11\1\75\24\0\13\11\1\0\1\11\4\0\16\11"+
    "\1\125\23\11\1\75\24\0\13\11\1\0\1\11\4\0"+
    "\13\11\1\242\26\11\1\75\24\0\13\11\1\0\1\11"+
    "\4\0\3\11\1\140\36\11\1\75\24\0\13\11\1\0"+
    "\1\11\4\0\6\11\1\111\33\11\1\75\24\0\13\11"+
    "\1\0\1\11\4\0\2\11\1\243\37\11\1\75\24\0"+
    "\13\11\1\0\1\11\4\0\11\11\1\244\30\11\1\75"+
    "\24\0\13\11\1\0\1\11\4\0\2\11\1\245\37\11"+
    "\1\75\24\0\13\11\1\0\1\11\4\0\3\11\1\246"+
    "\36\11\1\75\24\0\13\11\1\0\1\11\4\0\3\11"+
    "\1\247\36\11\1\75\24\0\13\11\1\0\1\11\4\0"+
    "\5\11\1\250\34\11\1\75\24\0\13\11\1\0\1\11"+
    "\4\0\16\11\1\173\23\11\1\75\24\0\13\11\1\0"+
    "\1\11\4\0\10\11\1\125\31\11\1\75\24\0\13\11"+
    "\1\0\1\11\4\0\11\11\1\125\30\11\1\75\24\0"+
    "\13\11\1\0\1\11\4\0\13\11\1\251\26\11\1\75"+
    "\24\0\13\11\1\0\1\11\4\0\1\252\41\11\1\75"+
    "\24\0\13\11\1\0\1\253\4\0\42\11\1\75\24\0"+
    "\13\11\1\0\1\11\4\0\6\11\1\254\33\11\1\75"+
    "\24\0\13\11\1\0\1\11\4\0\3\11\1\255\36\11"+
    "\1\75\24\0\13\11\1\0\1\11\4\0\16\11\1\256"+
    "\23\11\1\75\24\0\13\11\1\0\1\11\4\0\10\11"+
    "\1\234\31\11\1\75\24\0\13\11\1\0\1\11\4\0"+
    "\2\11\1\257\37\11\1\75\24\0\13\11\1\0\1\11"+
    "\4\0\13\11\1\260\26\11\1\75\16\0\4\157\1\156"+
    "\1\231\102\157\10\0\2\261\1\100\1\0\5\261\1\0"+
    "\1\261\4\0\1\261\1\0\2\261\1\0\1\261\7\0"+
    "\1\261\1\100\1\261\10\0\1\261\2\0\2\261\34\0"+
    "\1\262\1\77\1\100\1\0\1\100\3\262\1\100\1\104"+
    "\1\105\6\0\1\105\12\0\3\100\47\0\13\11\1\0"+
    "\1\11\4\0\4\11\1\125\35\11\1\75\24\0\13\11"+
    "\1\0\1\11\4\0\1\11\1\263\40\11\1\75\24\0"+
    "\13\11\1\0\1\11\4\0\32\11\1\264\7\11\1\75"+
    "\24\0\13\11\1\0\1\11\4\0\15\11\1\265\24\11"+
    "\1\75\24\0\13\11\1\0\1\11\4\0\13\11\1\266"+
    "\26\11\1\75\24\0\13\11\1\0\1\11\4\0\12\11"+
    "\1\267\27\11\1\75\24\0\13\11\1\0\1\11\4\0"+
    "\17\11\1\270\22\11\1\75\24\0\13\11\1\0\1\11"+
    "\4\0\15\11\1\271\24\11\1\75\24\0\13\11\1\0"+
    "\1\11\4\0\7\11\1\173\32\11\1\75\24\0\13\11"+
    "\1\0\1\11\4\0\14\11\1\272\25\11\1\75\24\0"+
    "\13\11\1\0\1\11\4\0\16\11\1\273\23\11\1\75"+
    "\24\0\13\11\1\0\1\11\4\0\7\11\1\274\32\11"+
    "\1\75\24\0\13\11\1\0\1\11\4\0\12\11\1\275"+
    "\27\11\1\75\24\0\13\11\1\0\1\11\4\0\2\11"+
    "\1\276\37\11\1\75\24\0\13\11\1\0\1\11\4\0"+
    "\40\11\1\277\1\11\1\75\24\0\13\11\1\0\1\11"+
    "\4\0\2\11\1\300\37\11\1\75\24\0\13\11\1\0"+
    "\1\11\4\0\20\11\1\234\21\11\1\75\24\0\13\11"+
    "\1\0\1\11\4\0\2\11\1\301\37\11\1\75\24\0"+
    "\13\11\1\0\1\11\4\0\5\11\1\302\34\11\1\75"+
    "\24\0\13\11\1\0\1\11\4\0\12\11\1\303\27\11"+
    "\1\75\26\0\2\304\1\100\1\0\5\304\1\0\1\304"+
    "\4\0\1\304\1\0\2\304\1\0\1\304\7\0\1\304"+
    "\1\100\1\304\10\0\1\304\2\0\2\304\34\0\1\305"+
    "\1\77\1\100\1\0\1\100\3\305\1\100\1\104\1\105"+
    "\6\0\1\105\12\0\3\100\47\0\13\11\1\0\1\11"+
    "\4\0\12\11\1\125\27\11\1\75\24\0\13\11\1\0"+
    "\1\11\4\0\2\11\1\217\37\11\1\75\24\0\13\11"+
    "\1\0\1\11\4\0\2\11\1\306\37\11\1\75\24\0"+
    "\13\11\1\0\1\11\4\0\12\11\1\307\27\11\1\75"+
    "\24\0\13\11\1\0\1\11\4\0\13\11\1\310\26\11"+
    "\1\75\24\0\13\11\1\0\1\11\4\0\13\11\1\311"+
    "\26\11\1\75\24\0\13\11\1\0\1\11\4\0\2\11"+
    "\1\312\37\11\1\75\24\0\13\11\1\0\1\11\4\0"+
    "\16\11\1\313\23\11\1\75\24\0\13\11\1\0\1\11"+
    "\4\0\16\11\1\314\23\11\1\75\24\0\13\11\1\0"+
    "\1\11\4\0\13\11\1\315\26\11\1\75\24\0\13\11"+
    "\1\0\1\11\4\0\13\11\1\316\26\11\1\75\24\0"+
    "\13\11\1\0\1\11\4\0\1\11\1\234\40\11\1\75"+
    "\24\0\13\11\1\0\1\11\4\0\32\11\1\234\7\11"+
    "\1\75\24\0\12\11\1\317\1\0\1\11\4\0\24\11"+
    "\1\320\15\11\1\75\24\0\13\11\1\0\1\11\4\0"+
    "\3\11\1\321\36\11\1\75\24\0\13\11\1\0\1\11"+
    "\4\0\7\11\1\234\32\11\1\75\24\0\13\11\1\0"+
    "\1\11\4\0\22\11\1\234\17\11\1\75\26\0\2\322"+
    "\1\100\1\0\5\322\1\0\1\322\4\0\1\322\1\0"+
    "\2\322\1\0\1\322\7\0\1\322\1\100\1\322\10\0"+
    "\1\322\2\0\2\322\34\0\1\323\1\77\1\100\1\0"+
    "\1\100\3\323\1\100\1\104\1\105\6\0\1\105\12\0"+
    "\3\100\47\0\13\11\1\0\1\11\4\0\26\11\1\324"+
    "\13\11\1\75\24\0\13\11\1\0\1\11\4\0\14\11"+
    "\1\173\25\11\1\75\24\0\13\11\1\0\1\11\4\0"+
    "\7\11\1\264\32\11\1\75\24\0\13\11\1\0\1\11"+
    "\4\0\12\11\1\325\27\11\1\75\24\0\13\11\1\0"+
    "\1\11\4\0\26\11\1\326\13\11\1\75\24\0\13\11"+
    "\1\0\1\11\4\0\7\11\1\125\32\11\1\75\24\0"+
    "\13\11\1\0\1\11\4\0\20\11\1\125\21\11\1\75"+
    "\24\0\13\11\1\0\1\11\4\0\11\11\1\263\30\11"+
    "\1\75\24\0\13\11\1\0\1\11\4\0\7\11\1\327"+
    "\32\11\1\75\24\0\13\11\1\0\1\11\4\0\16\11"+
    "\1\330\23\11\1\75\24\0\13\11\1\0\1\11\4\0"+
    "\12\11\1\331\27\11\1\75\24\0\13\11\1\0\1\11"+
    "\4\0\12\11\1\234\27\11\1\75\26\0\2\332\1\100"+
    "\1\0\5\332\1\0\1\332\4\0\1\332\1\0\2\332"+
    "\1\0\1\332\7\0\1\332\1\100\1\332\10\0\1\332"+
    "\2\0\2\332\34\0\1\333\1\77\1\100\1\0\1\100"+
    "\3\333\1\100\1\104\1\105\6\0\1\105\12\0\3\100"+
    "\47\0\13\11\1\0\1\11\4\0\27\11\1\334\12\11"+
    "\1\75\24\0\13\11\1\0\1\11\4\0\2\11\1\335"+
    "\37\11\1\75\24\0\13\11\1\0\1\11\4\0\27\11"+
    "\1\336\12\11\1\75\24\0\13\11\1\0\1\11\4\0"+
    "\20\11\1\217\21\11\1\75\24\0\13\11\1\0\1\11"+
    "\4\0\11\11\1\337\30\11\1\75\24\0\13\11\1\0"+
    "\1\11\4\0\7\11\1\217\32\11\1\75\26\0\2\340"+
    "\1\100\1\0\5\340\1\0\1\340\4\0\1\340\1\0"+
    "\2\340\1\0\1\340\7\0\1\340\1\100\1\340\10\0"+
    "\1\340\2\0\2\340\34\0\1\341\1\77\1\100\1\0"+
    "\1\100\3\341\1\100\1\104\1\105\6\0\1\105\12\0"+
    "\3\100\47\0\13\11\1\0\1\11\4\0\24\11\1\342"+
    "\15\11\1\75\24\0\13\11\1\0\1\11\4\0\15\11"+
    "\1\217\24\11\1\75\24\0\13\11\1\0\1\11\4\0"+
    "\24\11\1\217\15\11\1\75\24\0\13\11\1\0\1\11"+
    "\4\0\3\11\1\331\36\11\1\75\26\0\2\343\1\100"+
    "\1\0\5\343\1\0\1\343\4\0\1\343\1\0\2\343"+
    "\1\0\1\343\7\0\1\343\1\100\1\343\10\0\1\343"+
    "\2\0\2\343\34\0\1\344\1\77\1\100\1\0\1\100"+
    "\3\344\1\100\1\104\1\105\6\0\1\105\12\0\3\100"+
    "\47\0\13\11\1\0\1\11\4\0\30\11\1\345\11\11"+
    "\1\75\26\0\2\346\1\100\1\0\5\346\1\0\1\346"+
    "\4\0\1\346\1\0\2\346\1\0\1\346\7\0\1\346"+
    "\1\100\1\346\10\0\1\346\2\0\2\346\34\0\1\347"+
    "\1\77\1\100\1\0\1\100\3\347\1\100\1\104\1\105"+
    "\6\0\1\105\12\0\3\100\47\0\13\11\1\0\1\11"+
    "\4\0\11\11\1\350\30\11\1\75\26\0\2\351\1\100"+
    "\1\0\5\351\1\0\1\351\4\0\1\351\1\0\2\351"+
    "\1\0\1\351\7\0\1\351\1\100\1\351\10\0\1\351"+
    "\2\0\2\351\34\0\1\352\1\77\1\100\1\0\1\100"+
    "\3\352\1\100\1\104\1\105\6\0\1\105\12\0\3\100"+
    "\47\0\13\11\1\0\1\11\4\0\31\11\1\353\10\11"+
    "\1\75\26\0\2\354\1\100\1\0\5\354\1\0\1\354"+
    "\4\0\1\354\1\0\2\354\1\0\1\354\7\0\1\354"+
    "\1\100\1\354\10\0\1\354\2\0\2\354\34\0\1\355"+
    "\1\77\1\100\1\0\1\100\3\355\1\100\1\104\1\105"+
    "\6\0\1\105\12\0\3\100\47\0\13\11\1\0\1\11"+
    "\4\0\32\11\1\356\7\11\1\75\26\0\2\357\1\100"+
    "\1\0\5\357\1\0\1\357\4\0\1\357\1\0\2\357"+
    "\1\0\1\357\7\0\1\357\1\100\1\357\10\0\1\357"+
    "\2\0\2\357\34\0\1\360\1\77\1\100\1\0\1\100"+
    "\3\360\1\100\1\104\1\105\6\0\1\105\12\0\3\100"+
    "\47\0\13\11\1\0\1\11\4\0\11\11\1\361\30\11"+
    "\1\75\26\0\2\362\1\100\1\0\5\362\1\0\1\362"+
    "\4\0\1\362\1\0\2\362\1\0\1\362\7\0\1\362"+
    "\1\100\1\362\10\0\1\362\2\0\2\362\34\0\1\363"+
    "\1\77\1\100\1\0\1\100\3\363\1\100\1\104\1\105"+
    "\6\0\1\105\12\0\3\100\47\0\13\11\1\0\1\11"+
    "\4\0\12\11\1\364\27\11\1\75\26\0\2\365\1\100"+
    "\1\0\5\365\1\0\1\365\4\0\1\365\1\0\2\365"+
    "\1\0\1\365\7\0\1\365\1\100\1\365\10\0\1\365"+
    "\2\0\2\365\34\0\1\366\1\77\1\100\1\0\1\100"+
    "\3\366\1\100\1\104\1\105\6\0\1\105\12\0\3\100"+
    "\47\0\13\11\1\0\1\11\4\0\2\11\1\320\37\11"+
    "\1\75\26\0\2\367\1\100\1\0\5\367\1\0\1\367"+
    "\4\0\1\367\1\0\2\367\1\0\1\367\7\0\1\367"+
    "\1\100\1\367\10\0\1\367\2\0\2\367\34\0\1\370"+
    "\1\77\1\100\1\0\1\100\3\370\1\100\1\104\1\105"+
    "\6\0\1\105\12\0\3\100\51\0\2\371\1\100\1\0"+
    "\5\371\1\0\1\371\4\0\1\371\1\0\2\371\1\0"+
    "\1\371\7\0\1\371\1\100\1\371\10\0\1\371\2\0"+
    "\2\371\34\0\1\372\1\77\1\100\1\0\1\100\3\372"+
    "\1\100\1\104\1\105\6\0\1\105\12\0\3\100\53\0"+
    "\1\100\32\0\1\100\52\0\1\373\1\77\1\100\1\0"+
    "\1\100\3\373\1\100\1\104\1\105\6\0\1\105\12\0"+
    "\3\100\51\0\1\374\1\77\1\100\1\0\1\100\3\374"+
    "\1\100\1\104\1\105\6\0\1\105\12\0\3\100\51\0"+
    "\1\375\1\77\1\100\1\0\1\100\3\375\1\100\1\104"+
    "\1\105\6\0\1\105\12\0\3\100\51\0\1\376\1\77"+
    "\1\100\1\0\1\100\3\376\1\100\1\104\1\105\6\0"+
    "\1\105\12\0\3\100\51\0\2\77\1\100\1\0\1\100"+
    "\3\77\1\100\1\104\1\105\6\0\1\105\12\0\3\100"+
    "\41\0";

  private static int [] zzUnpackTrans() {
    int [] result = new int[16848];
    int offset = 0;
    offset = zzUnpackTrans(ZZ_TRANS_PACKED_0, offset, result);
    return result;
  }

  private static int zzUnpackTrans(String packed, int offset, int [] result) {
    int i = 0;       /* index in packed string  */
    int j = offset;  /* index in unpacked array */
    int l = packed.length();
    while (i < l) {
      int count = packed.charAt(i++);
      int value = packed.charAt(i++);
      value--;
      do result[j++] = value; while (--count > 0);
    }
    return j;
  }


  /* error codes */
  private static final int ZZ_UNKNOWN_ERROR = 0;
  private static final int ZZ_NO_MATCH = 1;
  private static final int ZZ_PUSHBACK_2BIG = 2;

  /* error messages for the codes above */
  private static final String ZZ_ERROR_MSG[] = {
    "Unkown internal scanner error",
    "Error: could not match input",
    "Error: pushback value was too large"
  };

  /**
   * ZZ_ATTRIBUTE[aState] contains the attributes of state <code>aState</code>
   */
  private static final int [] ZZ_ATTRIBUTE = zzUnpackAttribute();

  private static final String ZZ_ATTRIBUTE_PACKED_0 =
    "\3\0\1\11\12\1\2\11\27\1\7\11\7\1\2\11"+
    "\2\1\1\11\1\1\1\0\1\11\2\1\1\11\1\0"+
    "\3\1\1\0\44\1\1\11\3\1\1\11\2\0\4\1"+
    "\1\0\42\1\1\11\1\0\114\1\1\0\2\1\1\0"+
    "\2\1\1\0\2\1\1\0\2\1\1\0\2\1\1\0"+
    "\1\1\1\0\1\1\1\0\5\1";

  private static int [] zzUnpackAttribute() {
    int [] result = new int[254];
    int offset = 0;
    offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result);
    return result;
  }

  private static int zzUnpackAttribute(String packed, int offset, int [] result) {
    int i = 0;       /* index in packed string  */
    int j = offset;  /* index in unpacked array */
    int l = packed.length();
    while (i < l) {
      int count = packed.charAt(i++);
      int value = packed.charAt(i++);
      do result[j++] = value; while (--count > 0);
    }
    return j;
  }

  /** the input device */
  private java.io.Reader zzReader;

  /** the current state of the DFA */
  private int zzState;

  /** the current lexical state */
  private int zzLexicalState = YYINITIAL;

  /** this buffer contains the current text to be matched and is
      the source of the yytext() string */
  private char zzBuffer[] = new char[ZZ_BUFFERSIZE];

  /** the textposition at the last accepting state */
  private int zzMarkedPos;

  /** the current text position in the buffer */
  private int zzCurrentPos;

  /** startRead marks the beginning of the yytext() string in the buffer */
  private int zzStartRead;

  /** endRead marks the last character in the buffer, that has been read
      from input */
  private int zzEndRead;

  /** number of newlines encountered up to the start of the matched text */
  private int yyline;

  /** the number of characters up to the start of the matched text */
  private int yychar;

  /**
   * the number of characters from the last newline up to the start of the
   * matched text
   */
  private int yycolumn;

  /**
   * zzAtBOL == true <=> the scanner is currently at the beginning of a line
   */
  private boolean zzAtBOL = true;

  /** zzAtEOF == true <=> the scanner is at the EOF */
  private boolean zzAtEOF;

  /** denotes if the user-EOF-code has already been executed */
  private boolean zzEOFDone;

  /* user code: */
    /**
     * Create an empty lexer, yyrset will be called later to reset and assign
     * the reader
     */
    public JavaScriptLexer() {
        super();
    }

    @Override
    public int yychar() {
        return yychar;
    }

    private static final byte PARAN     = 1;
    private static final byte BRACKET   = 2;
    private static final byte CURLY     = 3;
    


  /**
   * Creates a new scanner
   * There is also a java.io.InputStream version of this constructor.
   *
   * @param   in  the java.io.Reader to read input from.
   */
  public JavaScriptLexer(java.io.Reader in) {
    this.zzReader = in;
  }

  /**
   * Creates a new scanner.
   * There is also java.io.Reader version of this constructor.
   *
   * @param   in  the java.io.Inputstream to read input from.
   */
  public JavaScriptLexer(java.io.InputStream in) {
    this(new java.io.InputStreamReader(in));
  }

  /**
   * Unpacks the compressed character translation table.
   *
   * @param packed   the packed character translation table
   * @return         the unpacked character translation table
   */
  private static char [] zzUnpackCMap(String packed) {
    char [] map = new char[0x10000];
    int i = 0;  /* index in packed string  */
    int j = 0;  /* index in unpacked array */
    while (i < 1806) {
      int  count = packed.charAt(i++);
      char value = packed.charAt(i++);
      do map[j++] = value; while (--count > 0);
    }
    return map;
  }


  /**
   * Refills the input buffer.
   *
   * @return      <code>false</code>, iff there was new input.
   *
   * @exception   java.io.IOException  if any I/O-Error occurs
   */
  private boolean zzRefill() throws java.io.IOException {

    /* first: make room (if you can) */
    if (zzStartRead > 0) {
      System.arraycopy(zzBuffer, zzStartRead,
                       zzBuffer, 0,
                       zzEndRead-zzStartRead);

      /* translate stored positions */
      zzEndRead-= zzStartRead;
      zzCurrentPos-= zzStartRead;
      zzMarkedPos-= zzStartRead;
      zzStartRead = 0;
    }

    /* is the buffer big enough? */
    if (zzCurrentPos >= zzBuffer.length) {
      /* if not: blow it up */
      char newBuffer[] = new char[zzCurrentPos*2];
      System.arraycopy(zzBuffer, 0, newBuffer, 0, zzBuffer.length);
      zzBuffer = newBuffer;
    }

    /* finally: fill the buffer with new input */
    int numRead = zzReader.read(zzBuffer, zzEndRead,
                                            zzBuffer.length-zzEndRead);

    if (numRead > 0) {
      zzEndRead+= numRead;
      return false;
    }
    // unlikely but not impossible: read 0 characters, but not at end of stream    
    if (numRead == 0) {
      int c = zzReader.read();
      if (c == -1) {
        return true;
      } else {
        zzBuffer[zzEndRead++] = (char) c;
        return false;
      }     
    }

    // numRead < 0
    return true;
  }

    
  /**
   * Closes the input stream.
   */
  public final void yyclose() throws java.io.IOException {
    zzAtEOF = true;            /* indicate end of file */
    zzEndRead = zzStartRead;  /* invalidate buffer    */

    if (zzReader != null)
      zzReader.close();
  }


  /**
   * Resets the scanner to read from a new input stream.
   * Does not close the old reader.
   *
   * All internal variables are reset, the old input stream
   * <b>cannot</b> be reused (internal buffer is discarded and lost).
   * Lexical state is set to <tt>ZZ_INITIAL</tt>.
   *
   * @param reader   the new input stream
   */
  public final void yyreset(java.io.Reader reader) {
    zzReader = reader;
    zzAtBOL  = true;
    zzAtEOF  = false;
    zzEOFDone = false;
    zzEndRead = zzStartRead = 0;
    zzCurrentPos = zzMarkedPos = 0;
    yyline = yychar = yycolumn = 0;
    zzLexicalState = YYINITIAL;
  }


  /**
   * Returns the current lexical state.
   */
  public final int yystate() {
    return zzLexicalState;
  }

    @Override
    public int getTokenStart() {
        return zzStartRead;  //To change body of implemented methods use File | Settings | File Templates.
    }

    @Override
    public int getTokenEnd() {
        return zzEndRead;  //To change body of implemented methods use File | Settings | File Templates.
    }

    @Override
    public IElementType advance() throws IOException {

     Token t =  yylex(); //get the next  token. This should be mapped to an IELEMENTTYPE


       if(t.type.equals(TokenType.KEYWORD)){

           return JaggeryTokenTypes.KEY_CHARACTERS;

       }


       else if(t.type.equals(TokenType.STRING)){

         return JaggeryTokenTypes.VALUE_CHARACTERS;


       }



          else return null;
    }

    @Override
    public void reset(CharSequence charSequence, int start, int end, int initialState) {
        //To change body of implemented methods use File | Settings | File Templates.

                                     //yyreset can also be used.check..!!

        zzBuffer = com.intellij.util.text.CharArrayUtil.fromSequenceWithoutCopying(charSequence);
        zzCurrentPos = zzMarkedPos = zzStartRead = start;
      //  zzPushbackPos = 0;
        zzAtEOF = false;
        zzAtBOL = true;
        zzEndRead = end;
        yybegin(initialState);







    }


    /**
   * Enters a new lexical state
   *
   * @param newState the new lexical state
   */
  public final void yybegin(int newState) {
    zzLexicalState = newState;
  }


  /**
   * Returns the text matched by the current regular expression.
   */
  public final String yytext() {
    return new String( zzBuffer, zzStartRead, zzMarkedPos-zzStartRead );
  }


  /**
   * Returns the character at position <tt>pos</tt> from the
   * matched text.
   *
   * It is equivalent to yytext().charAt(pos), but faster
   *
   * @param pos the position of the character to fetch.
   *            A value from 0 to yylength()-1.
   *
   * @return the character at position pos
   */
  public final char yycharat(int pos) {
    return zzBuffer[zzStartRead+pos];
  }


  /**
   * Returns the length of the matched text region.
   */
  public final int yylength() {
    return zzMarkedPos-zzStartRead;
  }


  /**
   * Reports an error that occured while scanning.
   *
   * In a wellformed scanner (no or only correct usage of
   * yypushback(int) and a match-all fallback rule) this method
   * will only be called with things that "Can't Possibly Happen".
   * If this method is called, something is seriously wrong
   * (e.g. a JFlex bug producing a faulty scanner etc.).
   *
   * Usual syntax/scanner level error handling should be done
   * in error fallback rules.
   *
   * @param   errorCode  the code of the errormessage to display
   */
  private void zzScanError(int errorCode) {
    String message;
    try {
      message = ZZ_ERROR_MSG[errorCode];
    }
    catch (ArrayIndexOutOfBoundsException e) {
      message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR];
    }

    throw new Error(message);
  }


  /**
   * Pushes the specified amount of characters back into the input stream.
   *
   * They will be read again by then next call of the scanning method
   *
   * @param number  the number of characters to be read again.
   *                This number must not be greater than yylength()!
   */
  public void yypushback(int number)  {
    if ( number > yylength() )
      zzScanError(ZZ_PUSHBACK_2BIG);

    zzMarkedPos -= number;
  }



  /**
   * Resumes scanning until the next regular expression is matched,
   * the end of input is encountered or an I/O-Error occurs.
   *
   * @return      the next token
   * @exception   java.io.IOException  if any I/O-Error occurs
   */
  public Token yylex() throws java.io.IOException {
    int zzInput;
    int zzAction;

    // cached fields:
    int zzCurrentPosL;
    int zzMarkedPosL;
    int zzEndReadL = zzEndRead;
    char [] zzBufferL = zzBuffer;
    char [] zzCMapL = ZZ_CMAP;

    int [] zzTransL = ZZ_TRANS;
    int [] zzRowMapL = ZZ_ROWMAP;
    int [] zzAttrL = ZZ_ATTRIBUTE;

    while (true) {
      zzMarkedPosL = zzMarkedPos;

      yychar+= zzMarkedPosL-zzStartRead;

      zzAction = -1;

      zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL;
  
      zzState = ZZ_LEXSTATE[zzLexicalState];


      zzForAction: {
        while (true) {
    
          if (zzCurrentPosL < zzEndReadL)
            zzInput = zzBufferL[zzCurrentPosL++];
          else if (zzAtEOF) {
            zzInput = YYEOF;
            break zzForAction;
          }
          else {
            // store back cached positions
            zzCurrentPos  = zzCurrentPosL;
            zzMarkedPos   = zzMarkedPosL;
            boolean eof = zzRefill();
            // get translated positions and possibly new buffer
            zzCurrentPosL  = zzCurrentPos;
            zzMarkedPosL   = zzMarkedPos;
            zzBufferL      = zzBuffer;
            zzEndReadL     = zzEndRead;
            if (eof) {
              zzInput = YYEOF;
              break zzForAction;
            }
            else {
              zzInput = zzBufferL[zzCurrentPosL++];
            }
          }
          int zzNext = zzTransL[ zzRowMapL[zzState] + zzCMapL[zzInput] ];
          if (zzNext == -1) break zzForAction;
          zzState = zzNext;

          int zzAttributes = zzAttrL[zzState];
          if ( (zzAttributes & 1) == 1 ) {
            zzAction = zzState;
            zzMarkedPosL = zzCurrentPosL;
            if ( (zzAttributes & 8) == 8 ) break zzForAction;
          }

        }
      }

      // store back cached position
      zzMarkedPos = zzMarkedPosL;

      switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) {
        case 8:
          { return token(TokenType.OPERATOR, -PARAN);
          }
        case 22: break;
        case 19:
          { return token(TokenType.KEYWORD);
          }
        case 23: break;
        case 4:
          { return token(TokenType.NUMBER);
          }
        case 24: break;
        case 2:
          { return token(TokenType.OPERATOR);
          }
        case 25: break;
        case 9:
          { return token(TokenType.OPERATOR,  CURLY);
          }
        case 26: break;
        case 10:
          { return token(TokenType.OPERATOR, -CURLY);
          }
        case 27: break;
        case 6:
          { yybegin(SSTRING);
                                    tokenStart = yychar;
                                    tokenLength = 1;
          }
        case 28: break;
        case 15:
          { yybegin(YYINITIAL);
                                     // length also includes the trailing quote
                                     return token(TokenType.STRING, tokenStart, tokenLength + 1);
          }
        case 29: break;
        case 13:
          { tokenLength += yylength();
          }
        case 30: break;
        case 14:
          { yybegin(YYINITIAL);
          }
        case 31: break;
        case 16:
          { yybegin(YYINITIAL);
                                     // length also includes the trailing quote
                                     return token(TokenType.STRING, tokenStart, tokenLength + 1);
          }
        case 32: break;
        case 18:
          { return token(TokenType.TYPE);
          }
        case 33: break;
        case 12:
          { return token(TokenType.OPERATOR, -BRACKET);
          }
        case 34: break;
        case 7:
          { return token(TokenType.OPERATOR,  PARAN);
          }
        case 35: break;
        case 21:
          { return token(TokenType.KEYWORD2);
          }
        case 36: break;
        case 3:
          { return token(TokenType.IDENTIFIER);
          }
        case 37: break;
        case 20:
          { tokenLength += 2;
          }
        case 38: break;
        case 11:
          { return token(TokenType.OPERATOR,  BRACKET);
          }
        case 39: break;
        case 17:
          { return token(TokenType.COMMENT);
          }
        case 40: break;
        case 5:
          { yybegin(STRING);
                                    tokenStart = yychar;
                                    tokenLength = 1;
          }
        case 41: break;
        case 1:
          {
          }
        case 42: break;
        default:
          if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {
            zzAtEOF = true;
              {
                return null;
              }
          }
          else {
            zzScanError(ZZ_NO_MATCH);
          }
      }
    }
  }


}

0
Comment actions Permalink

please make the whole project available for checkout/download

0
Comment actions Permalink

Here is the link. Sorry for confusion of so many classes. Up to now I have implemented the file type recognition part. It shows in the File type with the icon. But in the tutorial there is no clear step to be implemented as how to invoke the editor. Is it by the FileEditorProvider or anything else?

Your help is kindly appreciated...!!


Thanx.!!

0
Comment actions Permalink

I meant, though it is shown in the File type I cannot open in an editor.

ex:-

new--> file---->file name given-----> File type is chosen (ok) --------> but no empty editor is opened.


what is the procedure to get the editor?

Thanks..!!

0
Comment actions Permalink

There is no special procedure or need for FileEditorProvider for your usecase.

Since I cannot compile your project fully, I can only give you some hints:

- please remove/comment out everything from plugin.xml you don't need, you don't need to assign "id" to every extension either
- in newair.org.SyntaxHighlightHandler "keys1" and "keys2" are not initialized and class initialization is thus bound to fail in its static initializer

Please follow instructions step-by-step and have a look at other simple highlight-only language plugins (there's plenty in plugin repository, also http://git.jetbrains.org/?p=idea/contrib.git;a=tree;f=typoScript;h=fd072e0a387dba678ceeac0cd01fe2694f954eeb;hb=HEAD TypoScript is a good example).

0

Please sign in to leave a comment.