1 21 22 package org.armedbear.j; 23 24 import java.awt.event.KeyEvent ; 25 26 public final class ShellScriptMode extends AbstractMode implements Constants, 27 Mode 28 { 29 private static final ShellScriptMode mode = new ShellScriptMode(); 30 31 private ShellScriptMode() 32 { 33 super(SHELL_SCRIPT_MODE, SHELL_SCRIPT_MODE_NAME); 34 keywords = new Keywords(this); 35 } 36 37 public static final ShellScriptMode getMode() 38 { 39 return mode; 40 } 41 42 public final String getCommentStart() 43 { 44 return "# "; 45 } 46 47 public final Formatter getFormatter(Buffer buffer) 48 { 49 return new ShellScriptFormatter(buffer); 50 } 51 52 protected void setKeyMapDefaults(KeyMap km) 53 { 54 km.mapKey(KeyEvent.VK_ENTER, 0, "newlineAndIndent"); 55 } 56 57 private static final String validChars = 58 "-./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz"; 59 60 public boolean isIdentifierStart(char c) 61 { 62 return validChars.indexOf(c) >= 0; 63 } 64 65 public boolean isIdentifierPart(char c) 66 { 67 return validChars.indexOf(c) >= 0; 68 } 69 } 70 | Popular Tags |