01: /*
02: * ShellScriptMode.java
03: *
04: * Copyright (C) 1998-2002 Peter Graves
05: * $Id: ShellScriptMode.java,v 1.1.1.1 2002/09/24 16:09:28 piso Exp $
06: *
07: * This program is free software; you can redistribute it and/or
08: * modify it under the terms of the GNU General Public License
09: * as published by the Free Software Foundation; either version 2
10: * of the License, or (at your option) any later version.
11: *
12: * This program is distributed in the hope that it will be useful,
13: * but WITHOUT ANY WARRANTY; without even the implied warranty of
14: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15: * GNU General Public License for more details.
16: *
17: * You should have received a copy of the GNU General Public License
18: * along with this program; if not, write to the Free Software
19: * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20: */
21:
22: package org.armedbear.j;
23:
24: import java.awt.event.KeyEvent;
25:
26: public final class ShellScriptMode extends AbstractMode implements
27: Constants, Mode {
28: private static final ShellScriptMode mode = new ShellScriptMode();
29:
30: private ShellScriptMode() {
31: super (SHELL_SCRIPT_MODE, SHELL_SCRIPT_MODE_NAME);
32: keywords = new Keywords(this );
33: }
34:
35: public static final ShellScriptMode getMode() {
36: return mode;
37: }
38:
39: public final String getCommentStart() {
40: return "# ";
41: }
42:
43: public final Formatter getFormatter(Buffer buffer) {
44: return new ShellScriptFormatter(buffer);
45: }
46:
47: protected void setKeyMapDefaults(KeyMap km) {
48: km.mapKey(KeyEvent.VK_ENTER, 0, "newlineAndIndent");
49: }
50:
51: private static final String validChars = "-./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz";
52:
53: public boolean isIdentifierStart(char c) {
54: return validChars.indexOf(c) >= 0;
55: }
56:
57: public boolean isIdentifierPart(char c) {
58: return validChars.indexOf(c) >= 0;
59: }
60: }
|