View Javadoc

    1   /*
    2    * JavaScriptTokenMarker.java - JavaScript token marker
    3    * Copyright (C) 1999 Slava Pestov
    4    *
    5    * You may use and modify this package for any purpose. Redistribution is
    6    * permitted, in both source and binary form, provided that this notice
    7    * remains intact in all source distributions of this package.
    8    */
    9
    10  package org.syntax.jedit.tokenmarker;
    11
    12  import org.syntax.jedit.KeywordMap;
    13
    14  /***
    15   * JavaScript token marker.
    16   *
    17   * @author Slava Pestov
    18   * @version $Id: JavaScriptTokenMarker.java,v 1.3 1999/12/13 03:40:29 sp Exp $
    19   */
    20  public class JavaScriptTokenMarker extends CTokenMarker
    21  {
    22  	public JavaScriptTokenMarker()
    23  	{
    24  		super(false,getKeywords());
    25  	}
    26
    27  	public static KeywordMap getKeywords()
    28  	{
    29  		if(javaScriptKeywords == null)
    30  		{
    31  			javaScriptKeywords = new KeywordMap(false);
    32  			javaScriptKeywords.add("function",Token.KEYWORD3);
    33  			javaScriptKeywords.add("var",Token.KEYWORD3);
    34  			javaScriptKeywords.add("else",Token.KEYWORD1);
    35  			javaScriptKeywords.add("for",Token.KEYWORD1);
    36  			javaScriptKeywords.add("if",Token.KEYWORD1);
    37  			javaScriptKeywords.add("in",Token.KEYWORD1);
    38  			javaScriptKeywords.add("new",Token.KEYWORD1);
    39  			javaScriptKeywords.add("return",Token.KEYWORD1);
    40  			javaScriptKeywords.add("while",Token.KEYWORD1);
    41  			javaScriptKeywords.add("with",Token.KEYWORD1);
    42  			javaScriptKeywords.add("break",Token.KEYWORD1);
    43  			javaScriptKeywords.add("case",Token.KEYWORD1);
    44  			javaScriptKeywords.add("continue",Token.KEYWORD1);
    45  			javaScriptKeywords.add("default",Token.KEYWORD1);
    46  			javaScriptKeywords.add("false",Token.LABEL);
    47  			javaScriptKeywords.add("this",Token.LABEL);
    48  			javaScriptKeywords.add("true",Token.LABEL);
    49  		}
    50  		return javaScriptKeywords;
    51  	}
    52
    53  	// private members
    54  	private static KeywordMap javaScriptKeywords;
    55  }