Back to index

im-sdk  12.3.91
Classes | Public Member Functions | Package Functions | Static Package Attributes | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes
sun.awt.im.iiimp.LWESyntax Class Reference
Collaboration diagram for sun.awt.im.iiimp.LWESyntax:
Collaboration graph
[legend]

List of all members.

Classes

class  ActionList

Public Member Functions

 LWESyntax (String syntax) throws InvalidSyntaxException
 Constructor.
 LWESyntax (InputStreamReader reader) throws InvalidSyntaxException
IIIMEvent[] getEventList (IIIMEvent e) throws InvalidSyntaxException
 Returns the IIIMEvent are which are generated with incoming event.
 LWESyntax (String syntax) throws InvalidSyntaxException
 Constructor.
 LWESyntax (InputStreamReader reader) throws InvalidSyntaxException
IIIMEvent[] getEventList (IIIMEvent e) throws InvalidSyntaxException
 Returns the IIIMEvent are which are generated with incoming event.

Package Functions

LWESyntax getCopy ()
String getCurrentContext ()
LWESyntax getCopy ()
String getCurrentContext ()

Static Package Attributes

static final String COMMENT = "#"
 ccdef rule's keywords
static final String DEFMODE = "defmode"
static final String INITIALMODE = "initialmode"
static final String MODE = "mode"
static final String STATUS_KEY = "_STATUS_"
static final String FALLTHROUGH = "fallthrough"
static final String FALLTHROUGH_KEY = "_FALLTHROUGH_"
static final String MODE_SWITCH = "goto"
 ccdef actions
static final String CONVERT = "convert"
static final String BACKSPACE = "backspace"
static final String CONVERT_S = "convert-s"
static final String UNCONVERT = "unconvert"
static final String NEXT = "next"
static final String NEXT_S = "next-s"
static final String PREVIOUS = "previous"
static final String PREVIOUS_S = "previous-s"
static final String FORWARD = "forward"
static final String BACKWARD = "backward"
static final String MOVE_TOP = "move-top"
static final String MOVE_BOTTOM = "move-bottom"
static final String CLEAR = "clear"
static final String EXPAND = "expand"
static final String EXPAND_S = "expand-s"
static final String SHRINK = "shrink"
static final String SHRINK_S = "shrink-s"
static final String EXPAND_NOCONV = "expand-noconv"
static final String EXPAND_NOCONV_S = "expand-noconv-s"
static final String SHRINK_NOCONV = "shrink-noconv"
static final String SHRINK_NOCONV_S = "shrink-noconv-s"
static final String FIX = "fix"

Private Member Functions

void readRule (BufferedReader bReader) throws InvalidSyntaxException
void parseRule (String line) throws InvalidSyntaxException
ActionList searchResult (Hashtable table, StringBuffer keyString)
IIIMEvent[] processActions (ActionList result, StringBuffer context) throws InvalidSyntaxException
void debug (String str)
IIIMEvent[] makePreeditEvent (String str)
void readRule (BufferedReader bReader) throws InvalidSyntaxException
void parseRule (String line) throws InvalidSyntaxException
ActionList searchResult (Hashtable table, StringBuffer keyString)
IIIMEvent[] processActions (ActionList result, StringBuffer context) throws InvalidSyntaxException
void debug (String str)
IIIMEvent[] makePreeditEvent (String str)

Static Private Member Functions

static String makeKeyString (String key, int mod)
static boolean printable (int keyCode)
static boolean unprintable (char c)
static String makeKeyString (String key, int mod)
static boolean printable (int keyCode)
static boolean unprintable (char c)

Private Attributes

Hashtable modeTable
Hashtable firstTable
Hashtable currentTable
StringBuffer context = new StringBuffer()

Static Private Attributes

static int[] masks
static String[] maskStrings

Detailed Description

Definition at line 61 of file LWESyntax.java.


Constructor & Destructor Documentation

Constructor.

Definition at line 105 of file LWESyntax.java.

                                                   {
       BufferedReader bReader = new BufferedReader(new StringReader(syntax));
       readRule(bReader);
    }

Here is the call graph for this function:

sun.awt.im.iiimp.LWESyntax.LWESyntax ( InputStreamReader  reader) throws InvalidSyntaxException [inline]

Definition at line 111 of file LWESyntax.java.

                                                   {
       BufferedReader bReader = new BufferedReader(reader);
       readRule(bReader);
    }

Here is the call graph for this function:

Constructor.

Definition at line 105 of file LWESyntax.java.

                                                   {
       BufferedReader bReader = new BufferedReader(new StringReader(syntax));
       readRule(bReader);
    }

Here is the call graph for this function:

sun.awt.im.iiimp.LWESyntax.LWESyntax ( InputStreamReader  reader) throws InvalidSyntaxException [inline]

Definition at line 111 of file LWESyntax.java.

                                                   {
       BufferedReader bReader = new BufferedReader(reader);
       readRule(bReader);
    }

Here is the call graph for this function:


Member Function Documentation

void sun.awt.im.iiimp.LWESyntax.debug ( String  str) [inline, private]

Definition at line 434 of file LWESyntax.java.

                                   {
       if (Manager.DEBUG) {
           System.err.println(str);
       }
    }

Here is the caller graph for this function:

void sun.awt.im.iiimp.LWESyntax.debug ( String  str) [inline, private]

Definition at line 434 of file LWESyntax.java.

                                   {
       if (Manager.DEBUG) {
           System.err.println(str);
       }
    }

Definition at line 136 of file LWESyntax.java.

                        {
       try {
           return (LWESyntax)clone();
       } catch(Exception e) {
           if (Manager.DEBUG) {
              e.printStackTrace();
           }
           return null;
       }
    }

Here is the caller graph for this function:

Definition at line 136 of file LWESyntax.java.

                        {
       try {
           return (LWESyntax)clone();
       } catch(Exception e) {
           if (Manager.DEBUG) {
              e.printStackTrace();
           }
           return null;
       }
    }
String sun.awt.im.iiimp.LWESyntax.getCurrentContext ( ) [inline, package]

Definition at line 440 of file LWESyntax.java.

                               {
       return context.toString();
    }
String sun.awt.im.iiimp.LWESyntax.getCurrentContext ( ) [inline, package]

Definition at line 440 of file LWESyntax.java.

                               {
       return context.toString();
    }
IIIMEvent [] sun.awt.im.iiimp.LWESyntax.getEventList ( IIIMEvent  e) throws InvalidSyntaxException [inline]

Returns the IIIMEvent are which are generated with incoming event.

If no event will be produced returns null.

Definition at line 250 of file LWESyntax.java.

                                                                               {
       // Get event and search mapping tables maintaining
       // Mode and Context, and returns events
       // and/or move to the next mode.
       AWTEvent aev = e.getAWTEvent(); 
       if (aev instanceof KeyEvent) {
           e.consume();
           KeyEvent kev = (KeyEvent)aev;
           int id = kev.getID();
           if (id == KeyEvent.KEY_RELEASED) {
              return null;
           }
           if (id == KeyEvent.KEY_TYPED && unprintable(kev.getKeyChar())) {
              return null;
           }

           if (id == KeyEvent.KEY_PRESSED && printable(kev.getKeyCode())) {
              if (kev.getModifiers() == 0) {
                  return null;
              }
           }

           /*
            * process only
            *    - typed event with printable keyChar
            *        ex: a, A, &, $, etc...
            *    - pressed event with unprintalbe keyCode
            *        ex: VK_TAB, VK_F1, VK_PAGE_DOWN etc...
            */

           String input = null;
           String rawInput = null;

           if (id == KeyEvent.KEY_TYPED) {
              rawInput = String.valueOf(kev.getKeyChar());
              input = "'" + rawInput + "'";
           } else {
              // KEY_PRESSED event which does not produce
              // following KEY_TYPED event
              rawInput = input =
                  makeKeyString(KeyEvent.getKeyText(kev.getKeyCode()),
                              kev.getModifiers());
           }

           Hashtable secondTable = (Hashtable)firstTable.get(input);

           if (secondTable == null) {
              // check fallthrough
              Hashtable ftTable = (Hashtable)firstTable.get(FALLTHROUGH_KEY);
              if (ftTable != null) { 
                  secondTable = (Hashtable)ftTable.get(input);
                  if (secondTable != null) {
                     // check fallthroh table
                     ActionList result =
                         searchResult(secondTable, context);
                     if (result != null) {
                         return processActions(result, context);
                     }
                  }
              }

              if (!Character.isISOControl(kev.getKeyChar())) {
                  if (input.startsWith("'")) { 
                     context.append(rawInput);
                  }
              }
                  
              return makePreeditEvent(context.toString());
           }

           // Context maching
           ActionList result = searchResult(secondTable, context);
           if (result == null) {
              // check fallthrough
              Hashtable ftTable = (Hashtable)firstTable.get(FALLTHROUGH_KEY);
              if (ftTable != null) {
                  secondTable = (Hashtable)ftTable.get(input);
                  if (secondTable != null) {
                     // check fallthrough table
                     result = searchResult(secondTable, context);
                     if (result != null) {
                         return processActions(result, context);
                     }
                  }
              }

              if (!Character.isISOControl(kev.getKeyChar())) {
                  if (input.startsWith("'")) {
                     context.append(rawInput);
                  }
              }

              return makePreeditEvent(context.toString());
           }
           return processActions(result, context);
       }
       return null;
    }

Here is the call graph for this function:

IIIMEvent [] sun.awt.im.iiimp.LWESyntax.getEventList ( IIIMEvent  e) throws InvalidSyntaxException [inline]

Returns the IIIMEvent are which are generated with incoming event.

If no event will be produced returns null.

Definition at line 250 of file LWESyntax.java.

                                                                               {
       // Get event and search mapping tables maintaining
       // Mode and Context, and returns events
       // and/or move to the next mode.
       AWTEvent aev = e.getAWTEvent(); 
       if (aev instanceof KeyEvent) {
           e.consume();
           KeyEvent kev = (KeyEvent)aev;
           int id = kev.getID();
           if (id == KeyEvent.KEY_RELEASED) {
              return null;
           }
           if (id == KeyEvent.KEY_TYPED && unprintable(kev.getKeyChar())) {
              return null;
           }

           if (id == KeyEvent.KEY_PRESSED && printable(kev.getKeyCode())) {
              if (kev.getModifiers() == 0) {
                  return null;
              }
           }

           /*
            * process only
            *    - typed event with printable keyChar
            *        ex: a, A, &, $, etc...
            *    - pressed event with unprintalbe keyCode
            *        ex: VK_TAB, VK_F1, VK_PAGE_DOWN etc...
            */

           String input = null;
           String rawInput = null;

           if (id == KeyEvent.KEY_TYPED) {
              rawInput = String.valueOf(kev.getKeyChar());
              input = "'" + rawInput + "'";
           } else {
              // KEY_PRESSED event which does not produce
              // following KEY_TYPED event
              rawInput = input =
                  makeKeyString(KeyEvent.getKeyText(kev.getKeyCode()),
                              kev.getModifiers());
           }

           Hashtable secondTable = (Hashtable)firstTable.get(input);

           if (secondTable == null) {
              // check fallthrough
              Hashtable ftTable = (Hashtable)firstTable.get(FALLTHROUGH_KEY);
              if (ftTable != null) { 
                  secondTable = (Hashtable)ftTable.get(input);
                  if (secondTable != null) {
                     // check fallthroh table
                     ActionList result =
                         searchResult(secondTable, context);
                     if (result != null) {
                         return processActions(result, context);
                     }
                  }
              }

              if (!Character.isISOControl(kev.getKeyChar())) {
                  if (input.startsWith("'")) { 
                     context.append(rawInput);
                  }
              }
                  
              return makePreeditEvent(context.toString());
           }

           // Context maching
           ActionList result = searchResult(secondTable, context);
           if (result == null) {
              // check fallthrough
              Hashtable ftTable = (Hashtable)firstTable.get(FALLTHROUGH_KEY);
              if (ftTable != null) {
                  secondTable = (Hashtable)ftTable.get(input);
                  if (secondTable != null) {
                     // check fallthrough table
                     result = searchResult(secondTable, context);
                     if (result != null) {
                         return processActions(result, context);
                     }
                  }
              }

              if (!Character.isISOControl(kev.getKeyChar())) {
                  if (input.startsWith("'")) {
                     context.append(rawInput);
                  }
              }

              return makePreeditEvent(context.toString());
           }
           return processActions(result, context);
       }
       return null;
    }

Here is the call graph for this function:

Here is the caller graph for this function:

static String sun.awt.im.iiimp.LWESyntax.makeKeyString ( String  key,
int  mod 
) [inline, static, private]

Definition at line 478 of file LWESyntax.java.

                                                             {
       String modString = "";
       for (int i = 0; i < masks.length; i++) {
           if ((masks[i] & mod) != 0) { 
              modString += (maskStrings[i] + "-");
           }
       }
       String ret = modString;
       if (key.equals("Backspace")) {
           ret = "'^H'";
       } else {
           if (modString.equals("control-") && key.length() == 1) {
              ret = "'^" + key + "'";
           } else {
              ret += key;
           }
       }
       return ret;
    }

Here is the caller graph for this function:

static String sun.awt.im.iiimp.LWESyntax.makeKeyString ( String  key,
int  mod 
) [inline, static, private]

Definition at line 478 of file LWESyntax.java.

                                                             {
       String modString = "";
       for (int i = 0; i < masks.length; i++) {
           if ((masks[i] & mod) != 0) { 
              modString += (maskStrings[i] + "-");
           }
       }
       String ret = modString;
       if (key.equals("Backspace")) {
           ret = "'^H'";
       } else {
           if (modString.equals("control-") && key.length() == 1) {
              ret = "'^" + key + "'";
           } else {
              ret += key;
           }
       }
       return ret;
    }
IIIMEvent [] sun.awt.im.iiimp.LWESyntax.makePreeditEvent ( String  str) [inline, private]

Definition at line 444 of file LWESyntax.java.

                                                     {
       AttributedString attrstr = new AttributedString(str);
       if (str.length() > 0) {
           attrstr.addAttribute(TextAttribute.INPUT_METHOD_HIGHLIGHT,
                             InputMethodHighlight.SELECTED_CONVERTED_TEXT_HIGHLIGHT,
                             0, str.length());
       }
       AttributedCharacterIterator iterator = attrstr.getIterator();
       IIIMPreeditEvent pe =
           new IIIMPreeditEvent(IIIMPreeditEvent.DRAW, iterator, 0);
       IIIMEvent[] iiimea = new IIIMEvent[1];
       iiimea[0] = pe;
       return iiimea;
    }

Here is the caller graph for this function:

IIIMEvent [] sun.awt.im.iiimp.LWESyntax.makePreeditEvent ( String  str) [inline, private]

Definition at line 444 of file LWESyntax.java.

                                                     {
       AttributedString attrstr = new AttributedString(str);
       if (str.length() > 0) {
           attrstr.addAttribute(TextAttribute.INPUT_METHOD_HIGHLIGHT,
                             InputMethodHighlight.SELECTED_CONVERTED_TEXT_HIGHLIGHT,
                             0, str.length());
       }
       AttributedCharacterIterator iterator = attrstr.getIterator();
       IIIMPreeditEvent pe =
           new IIIMPreeditEvent(IIIMPreeditEvent.DRAW, iterator, 0);
       IIIMEvent[] iiimea = new IIIMEvent[1];
       iiimea[0] = pe;
       return iiimea;
    }
void sun.awt.im.iiimp.LWESyntax.parseRule ( String  line) throws InvalidSyntaxException [inline, private]

Definition at line 151 of file LWESyntax.java.

                                                                      {
       String rule = line.trim();
       
       if (rule.startsWith(COMMENT)) {
           // comment
           return;
       }
       
       StringTokenizer st = new StringTokenizer(rule);
       if (st.hasMoreTokens() == false) {
           // blank line
           return;
       }
       
       String firstToken = st.nextToken();
       
       if (firstToken.equals(DEFMODE)) {
           // mode kind declaration
           while (st.hasMoreTokens()) {
              String mode = st.nextToken();
              modeTable.put(mode, new Hashtable());
           }
           return;
       }

       if (firstToken.equals(INITIALMODE)) {
           // initial mode declaration
           if (!st.hasMoreTokens()) {
              throw new InvalidSyntaxException();
           }
           String mode = st.nextToken();
           firstTable = (Hashtable)modeTable.get(mode);
           if (firstTable == null) {
              throw new InvalidSyntaxException();
           }
           return;
       }

       if (firstToken.equals(MODE)) {
           // begin rule definition
           try {
              String mode = st.nextToken();
              currentTable = (Hashtable)modeTable.get(mode);
              if (currentTable == null) {
                  throw new InvalidSyntaxException();
              }
              String status = st.nextToken();
              currentTable.put(STATUS_KEY, status);

              // fallthrough handling
              if (st.hasMoreTokens()) {
                  String fallthrough = st.nextToken();
                  if (fallthrough.equals(FALLTHROUGH)) {
                     String target = st.nextToken();
                     Hashtable ftTable = (Hashtable)modeTable.get(target);
                     if (ftTable == null) {
                         throw new InvalidSyntaxException();
                     }
                     currentTable.put(FALLTHROUGH_KEY, ftTable);
                  }
              }
           } catch(Exception e) {
              throw new InvalidSyntaxException();
           }
           return;
       }

       if (firstToken.equals("endmode")) {
           return;
       }

       try {
           String secondToken = st.nextToken();

           Hashtable secondTable;
           if (currentTable.containsKey(secondToken)) {
              secondTable = (Hashtable)currentTable.get(secondToken);
           } else {
              secondTable = new Hashtable();
              currentTable.put(secondToken, secondTable);
           }

           ActionList actions = new ActionList();

           while(st.hasMoreTokens()) {
              actions.addAction(st.nextToken());
           }

           secondTable.put(firstToken, actions);
       } catch(Exception e) {
           throw new InvalidSyntaxException();
       }
    }   

Here is the call graph for this function:

Here is the caller graph for this function:

void sun.awt.im.iiimp.LWESyntax.parseRule ( String  line) throws InvalidSyntaxException [inline, private]

Definition at line 151 of file LWESyntax.java.

                                                                      {
       String rule = line.trim();
       
       if (rule.startsWith(COMMENT)) {
           // comment
           return;
       }
       
       StringTokenizer st = new StringTokenizer(rule);
       if (st.hasMoreTokens() == false) {
           // blank line
           return;
       }
       
       String firstToken = st.nextToken();
       
       if (firstToken.equals(DEFMODE)) {
           // mode kind declaration
           while (st.hasMoreTokens()) {
              String mode = st.nextToken();
              modeTable.put(mode, new Hashtable());
           }
           return;
       }

       if (firstToken.equals(INITIALMODE)) {
           // initial mode declaration
           if (!st.hasMoreTokens()) {
              throw new InvalidSyntaxException();
           }
           String mode = st.nextToken();
           firstTable = (Hashtable)modeTable.get(mode);
           if (firstTable == null) {
              throw new InvalidSyntaxException();
           }
           return;
       }

       if (firstToken.equals(MODE)) {
           // begin rule definition
           try {
              String mode = st.nextToken();
              currentTable = (Hashtable)modeTable.get(mode);
              if (currentTable == null) {
                  throw new InvalidSyntaxException();
              }
              String status = st.nextToken();
              currentTable.put(STATUS_KEY, status);

              // fallthrough handling
              if (st.hasMoreTokens()) {
                  String fallthrough = st.nextToken();
                  if (fallthrough.equals(FALLTHROUGH)) {
                     String target = st.nextToken();
                     Hashtable ftTable = (Hashtable)modeTable.get(target);
                     if (ftTable == null) {
                         throw new InvalidSyntaxException();
                     }
                     currentTable.put(FALLTHROUGH_KEY, ftTable);
                  }
              }
           } catch(Exception e) {
              throw new InvalidSyntaxException();
           }
           return;
       }

       if (firstToken.equals("endmode")) {
           return;
       }

       try {
           String secondToken = st.nextToken();

           Hashtable secondTable;
           if (currentTable.containsKey(secondToken)) {
              secondTable = (Hashtable)currentTable.get(secondToken);
           } else {
              secondTable = new Hashtable();
              currentTable.put(secondToken, secondTable);
           }

           ActionList actions = new ActionList();

           while(st.hasMoreTokens()) {
              actions.addAction(st.nextToken());
           }

           secondTable.put(firstToken, actions);
       } catch(Exception e) {
           throw new InvalidSyntaxException();
       }
    }   

Here is the call graph for this function:

static boolean sun.awt.im.iiimp.LWESyntax.printable ( int  keyCode) [inline, static, private]

Definition at line 500 of file LWESyntax.java.

                                                  {
       switch(keyCode) {
         case KeyEvent.VK_0:
         case KeyEvent.VK_1:
         case KeyEvent.VK_2:
         case KeyEvent.VK_3:
         case KeyEvent.VK_4:
         case KeyEvent.VK_5:
         case KeyEvent.VK_6:
         case KeyEvent.VK_7:
         case KeyEvent.VK_8:
         case KeyEvent.VK_9:
         case KeyEvent.VK_A:
         case KeyEvent.VK_B:
         case KeyEvent.VK_C:
         case KeyEvent.VK_D:
         case KeyEvent.VK_E:
         case KeyEvent.VK_F:
         case KeyEvent.VK_G:
         case KeyEvent.VK_H:
         case KeyEvent.VK_I:
         case KeyEvent.VK_J:
         case KeyEvent.VK_K:
         case KeyEvent.VK_L:
         case KeyEvent.VK_M:
         case KeyEvent.VK_N:
         case KeyEvent.VK_O:
         case KeyEvent.VK_P:
         case KeyEvent.VK_Q:
         case KeyEvent.VK_R:
         case KeyEvent.VK_S:
         case KeyEvent.VK_T:
         case KeyEvent.VK_U:
         case KeyEvent.VK_V:
         case KeyEvent.VK_W:
         case KeyEvent.VK_X:
         case KeyEvent.VK_Y:
         case KeyEvent.VK_Z:
         case KeyEvent.VK_SPACE:
         case KeyEvent.VK_COMMA:
         case KeyEvent.VK_MINUS:
         case KeyEvent.VK_PERIOD:
         case KeyEvent.VK_SLASH:
         case KeyEvent.VK_SEMICOLON:
         case KeyEvent.VK_EQUALS:
         case KeyEvent.VK_OPEN_BRACKET:
         case KeyEvent.VK_BACK_SLASH:
         case KeyEvent.VK_CLOSE_BRACKET:
         case KeyEvent.VK_NUMPAD0:
         case KeyEvent.VK_NUMPAD1:
         case KeyEvent.VK_NUMPAD2:
         case KeyEvent.VK_NUMPAD3:
         case KeyEvent.VK_NUMPAD4:
         case KeyEvent.VK_NUMPAD5:
         case KeyEvent.VK_NUMPAD6:
         case KeyEvent.VK_NUMPAD7:
         case KeyEvent.VK_NUMPAD8:
         case KeyEvent.VK_NUMPAD9:
         case KeyEvent.VK_MULTIPLY:
         case KeyEvent.VK_ADD:
         case KeyEvent.VK_SEPARATER:
         case KeyEvent.VK_SUBTRACT:
         case KeyEvent.VK_DECIMAL:
         case KeyEvent.VK_DIVIDE:
         case KeyEvent.VK_BACK_QUOTE:
         case KeyEvent.VK_QUOTE:
         case KeyEvent.VK_DEAD_GRAVE:
         case KeyEvent.VK_DEAD_ACUTE:
         case KeyEvent.VK_DEAD_CIRCUMFLEX:
         case KeyEvent.VK_DEAD_TILDE:
         case KeyEvent.VK_DEAD_MACRON:
         case KeyEvent.VK_DEAD_BREVE:
         case KeyEvent.VK_DEAD_ABOVEDOT:
         case KeyEvent.VK_DEAD_DIAERESIS:
         case KeyEvent.VK_DEAD_ABOVERING:
         case KeyEvent.VK_DEAD_DOUBLEACUTE:
         case KeyEvent.VK_DEAD_CARON:
         case KeyEvent.VK_DEAD_CEDILLA:
         case KeyEvent.VK_DEAD_OGONEK:
         case KeyEvent.VK_DEAD_IOTA:
         case KeyEvent.VK_DEAD_VOICED_SOUND:
         case KeyEvent.VK_DEAD_SEMIVOICED_SOUND:
         case KeyEvent.VK_AMPERSAND:
         case KeyEvent.VK_ASTERISK:
         case KeyEvent.VK_QUOTEDBL:
         case KeyEvent.VK_LESS:
         case KeyEvent.VK_GREATER:
         case KeyEvent.VK_BRACELEFT:
         case KeyEvent.VK_BRACERIGHT:
         case KeyEvent.VK_AT:
         case KeyEvent.VK_COLON:
         case KeyEvent.VK_CIRCUMFLEX:
         case KeyEvent.VK_DOLLAR:
         case KeyEvent.VK_EURO_SIGN:
         case KeyEvent.VK_EXCLAMATION_MARK:
         case KeyEvent.VK_INVERTED_EXCLAMATION_MARK:
         case KeyEvent.VK_LEFT_PARENTHESIS:
         case KeyEvent.VK_NUMBER_SIGN:
         case KeyEvent.VK_PLUS:
         case KeyEvent.VK_RIGHT_PARENTHESIS:
         case KeyEvent.VK_UNDERSCORE:
           return true;
       }
       return false;
    }
static boolean sun.awt.im.iiimp.LWESyntax.printable ( int  keyCode) [inline, static, private]

Definition at line 500 of file LWESyntax.java.

                                                  {
       switch(keyCode) {
         case KeyEvent.VK_0:
         case KeyEvent.VK_1:
         case KeyEvent.VK_2:
         case KeyEvent.VK_3:
         case KeyEvent.VK_4:
         case KeyEvent.VK_5:
         case KeyEvent.VK_6:
         case KeyEvent.VK_7:
         case KeyEvent.VK_8:
         case KeyEvent.VK_9:
         case KeyEvent.VK_A:
         case KeyEvent.VK_B:
         case KeyEvent.VK_C:
         case KeyEvent.VK_D:
         case KeyEvent.VK_E:
         case KeyEvent.VK_F:
         case KeyEvent.VK_G:
         case KeyEvent.VK_H:
         case KeyEvent.VK_I:
         case KeyEvent.VK_J:
         case KeyEvent.VK_K:
         case KeyEvent.VK_L:
         case KeyEvent.VK_M:
         case KeyEvent.VK_N:
         case KeyEvent.VK_O:
         case KeyEvent.VK_P:
         case KeyEvent.VK_Q:
         case KeyEvent.VK_R:
         case KeyEvent.VK_S:
         case KeyEvent.VK_T:
         case KeyEvent.VK_U:
         case KeyEvent.VK_V:
         case KeyEvent.VK_W:
         case KeyEvent.VK_X:
         case KeyEvent.VK_Y:
         case KeyEvent.VK_Z:
         case KeyEvent.VK_SPACE:
         case KeyEvent.VK_COMMA:
         case KeyEvent.VK_MINUS:
         case KeyEvent.VK_PERIOD:
         case KeyEvent.VK_SLASH:
         case KeyEvent.VK_SEMICOLON:
         case KeyEvent.VK_EQUALS:
         case KeyEvent.VK_OPEN_BRACKET:
         case KeyEvent.VK_BACK_SLASH:
         case KeyEvent.VK_CLOSE_BRACKET:
         case KeyEvent.VK_NUMPAD0:
         case KeyEvent.VK_NUMPAD1:
         case KeyEvent.VK_NUMPAD2:
         case KeyEvent.VK_NUMPAD3:
         case KeyEvent.VK_NUMPAD4:
         case KeyEvent.VK_NUMPAD5:
         case KeyEvent.VK_NUMPAD6:
         case KeyEvent.VK_NUMPAD7:
         case KeyEvent.VK_NUMPAD8:
         case KeyEvent.VK_NUMPAD9:
         case KeyEvent.VK_MULTIPLY:
         case KeyEvent.VK_ADD:
         case KeyEvent.VK_SEPARATER:
         case KeyEvent.VK_SUBTRACT:
         case KeyEvent.VK_DECIMAL:
         case KeyEvent.VK_DIVIDE:
         case KeyEvent.VK_BACK_QUOTE:
         case KeyEvent.VK_QUOTE:
         case KeyEvent.VK_DEAD_GRAVE:
         case KeyEvent.VK_DEAD_ACUTE:
         case KeyEvent.VK_DEAD_CIRCUMFLEX:
         case KeyEvent.VK_DEAD_TILDE:
         case KeyEvent.VK_DEAD_MACRON:
         case KeyEvent.VK_DEAD_BREVE:
         case KeyEvent.VK_DEAD_ABOVEDOT:
         case KeyEvent.VK_DEAD_DIAERESIS:
         case KeyEvent.VK_DEAD_ABOVERING:
         case KeyEvent.VK_DEAD_DOUBLEACUTE:
         case KeyEvent.VK_DEAD_CARON:
         case KeyEvent.VK_DEAD_CEDILLA:
         case KeyEvent.VK_DEAD_OGONEK:
         case KeyEvent.VK_DEAD_IOTA:
         case KeyEvent.VK_DEAD_VOICED_SOUND:
         case KeyEvent.VK_DEAD_SEMIVOICED_SOUND:
         case KeyEvent.VK_AMPERSAND:
         case KeyEvent.VK_ASTERISK:
         case KeyEvent.VK_QUOTEDBL:
         case KeyEvent.VK_LESS:
         case KeyEvent.VK_GREATER:
         case KeyEvent.VK_BRACELEFT:
         case KeyEvent.VK_BRACERIGHT:
         case KeyEvent.VK_AT:
         case KeyEvent.VK_COLON:
         case KeyEvent.VK_CIRCUMFLEX:
         case KeyEvent.VK_DOLLAR:
         case KeyEvent.VK_EURO_SIGN:
         case KeyEvent.VK_EXCLAMATION_MARK:
         case KeyEvent.VK_INVERTED_EXCLAMATION_MARK:
         case KeyEvent.VK_LEFT_PARENTHESIS:
         case KeyEvent.VK_NUMBER_SIGN:
         case KeyEvent.VK_PLUS:
         case KeyEvent.VK_RIGHT_PARENTHESIS:
         case KeyEvent.VK_UNDERSCORE:
           return true;
       }
       return false;
    }

Here is the caller graph for this function:

IIIMEvent [] sun.awt.im.iiimp.LWESyntax.processActions ( ActionList  result,
StringBuffer  context 
) throws InvalidSyntaxException [inline, private]

Definition at line 373 of file LWESyntax.java.

                                     {
           
       String[] actionArray = result.getActions();
       Vector retVector = new Vector();
       
       for (int i = 0; i < actionArray.length; i++) {
           String action = actionArray[i];
           if (action.equals("")) {
              continue;
           }
           if (action.startsWith("\"")) {
              String raw = action.substring(1, action.length() - 1);
              context.append(raw);
              IIIMEvent[] imea = makePreeditEvent(context.toString());
              if (imea != null)
                  retVector.add(imea[0]);
           } else {
              // check mode switch
              if (action.equals(MODE_SWITCH)) {
                  if (actionArray.length <= i + 1) {
                     throw new InvalidSyntaxException(0);
                  }
                  String newMode = actionArray[++i];
                  firstTable = (Hashtable)modeTable.get(newMode);
                  if (firstTable == null) {
                     throw new InvalidSyntaxException(0);
                  }
                  retVector.add(new IIIMCommittedEvent
                              (context.toString()));
                  context.setLength(0);
              } else if (action.equals(CONVERT)) {
                  IIIMActionEvent e =
                     new IIIMActionEvent
                     (IIIMActionEvent.FORWARD_STRING,
                      new String[] {action, context.toString()});
System.out.println(" make a event = " + action);
                  retVector.add(e);
                  context.setLength(0);
              } else if (action.equals(BACKSPACE)){
                  if (context.length() > 0) {
                     StringBuffer newSB =  context.delete(context.length() - 1,
                                                      context.length());
                     IIIMEvent[] ie = makePreeditEvent(newSB.toString());
                     retVector.add(ie[0]);
                  }
              } else {
                  debug(" action = " + action +
                                   " is not supported yet.");
              }
           }
       }
       // context.setLength(0);
       Object[] oa = retVector.toArray();
       IIIMEvent[] iiimea = new IIIMEvent[oa.length];
       for (int i = 0; i < oa.length; i++) {
           iiimea[i] = (IIIMEvent)oa[i];
       }
       return iiimea;
    }

Here is the call graph for this function:

IIIMEvent [] sun.awt.im.iiimp.LWESyntax.processActions ( ActionList  result,
StringBuffer  context 
) throws InvalidSyntaxException [inline, private]

Definition at line 373 of file LWESyntax.java.

                                     {
           
       String[] actionArray = result.getActions();
       Vector retVector = new Vector();
       
       for (int i = 0; i < actionArray.length; i++) {
           String action = actionArray[i];
           if (action.equals("")) {
              continue;
           }
           if (action.startsWith("\"")) {
              String raw = action.substring(1, action.length() - 1);
              context.append(raw);
              IIIMEvent[] imea = makePreeditEvent(context.toString());
              if (imea != null)
                  retVector.add(imea[0]);
           } else {
              // check mode switch
              if (action.equals(MODE_SWITCH)) {
                  if (actionArray.length <= i + 1) {
                     throw new InvalidSyntaxException(0);
                  }
                  String newMode = actionArray[++i];
                  firstTable = (Hashtable)modeTable.get(newMode);
                  if (firstTable == null) {
                     throw new InvalidSyntaxException(0);
                  }
                  retVector.add(new IIIMCommittedEvent
                              (context.toString()));
                  context.setLength(0);
              } else if (action.equals(CONVERT)) {
                  IIIMActionEvent e =
                     new IIIMActionEvent
                     (IIIMActionEvent.FORWARD_STRING,
                      new String[] {action, context.toString()});
System.out.println(" make a event = " + action);
                  retVector.add(e);
                  context.setLength(0);
              } else if (action.equals(BACKSPACE)){
                  if (context.length() > 0) {
                     StringBuffer newSB =  context.delete(context.length() - 1,
                                                      context.length());
                     IIIMEvent[] ie = makePreeditEvent(newSB.toString());
                     retVector.add(ie[0]);
                  }
              } else {
                  debug(" action = " + action +
                                   " is not supported yet.");
              }
           }
       }
       // context.setLength(0);
       Object[] oa = retVector.toArray();
       IIIMEvent[] iiimea = new IIIMEvent[oa.length];
       for (int i = 0; i < oa.length; i++) {
           iiimea[i] = (IIIMEvent)oa[i];
       }
       return iiimea;
    }

Here is the call graph for this function:

Here is the caller graph for this function:

void sun.awt.im.iiimp.LWESyntax.readRule ( BufferedReader  bReader) throws InvalidSyntaxException [inline, private]

Definition at line 117 of file LWESyntax.java.

                                                                                {
       // Syntax is represented by kinput2's ccdef rule,
       // so it will come as character stream.
       // This constructer need to interpret ccdef syntax
       // and construct the Hashtable chain.
       modeTable = new Hashtable();

       String line;
       int lineNo = 0;
       try {
           while ((line = bReader.readLine()) != null) {
              parseRule(line);
              lineNo++;
           }
       } catch(Exception e) {
           throw new InvalidSyntaxException(lineNo);
       }
    }

Here is the call graph for this function:

Here is the caller graph for this function:

void sun.awt.im.iiimp.LWESyntax.readRule ( BufferedReader  bReader) throws InvalidSyntaxException [inline, private]

Definition at line 117 of file LWESyntax.java.

                                                                                {
       // Syntax is represented by kinput2's ccdef rule,
       // so it will come as character stream.
       // This constructer need to interpret ccdef syntax
       // and construct the Hashtable chain.
       modeTable = new Hashtable();

       String line;
       int lineNo = 0;
       try {
           while ((line = bReader.readLine()) != null) {
              parseRule(line);
              lineNo++;
           }
       } catch(Exception e) {
           throw new InvalidSyntaxException(lineNo);
       }
    }

Here is the call graph for this function:

ActionList sun.awt.im.iiimp.LWESyntax.searchResult ( Hashtable  table,
StringBuffer  keyString 
) [inline, private]

Definition at line 349 of file LWESyntax.java.

                                                                             {
       String key = keyString.toString();
       /*
        * if keyString is "XYZ", and result is null,
        * then try "YZ", "Z", "" respectively.
        */
       while(true) {
           String skey = "\"" + key + "\"";
           Object value = table.get(skey);
           if (value != null) {
              int len = keyString.length();
              int keyLen = key.length();
              if (len > 0) {
                  keyString.delete(len - keyLen, len);
              }
              return (ActionList)value;
           }
           if (key.length() < 1) {
              return null;
           }
           key = key.substring(1, key.length());
       }
    }

Here is the caller graph for this function:

ActionList sun.awt.im.iiimp.LWESyntax.searchResult ( Hashtable  table,
StringBuffer  keyString 
) [inline, private]

Definition at line 349 of file LWESyntax.java.

                                                                             {
       String key = keyString.toString();
       /*
        * if keyString is "XYZ", and result is null,
        * then try "YZ", "Z", "" respectively.
        */
       while(true) {
           String skey = "\"" + key + "\"";
           Object value = table.get(skey);
           if (value != null) {
              int len = keyString.length();
              int keyLen = key.length();
              if (len > 0) {
                  keyString.delete(len - keyLen, len);
              }
              return (ActionList)value;
           }
           if (key.length() < 1) {
              return null;
           }
           key = key.substring(1, key.length());
       }
    }
static boolean sun.awt.im.iiimp.LWESyntax.unprintable ( char  c) [inline, static, private]

Definition at line 606 of file LWESyntax.java.

                                               {
       if (c >= '\u0000' && c <= '\u0019' || c == '\u007f') {
           return true;
       }
       return false;
    }

Here is the caller graph for this function:

static boolean sun.awt.im.iiimp.LWESyntax.unprintable ( char  c) [inline, static, private]

Definition at line 606 of file LWESyntax.java.

                                               {
       if (c >= '\u0000' && c <= '\u0019' || c == '\u007f') {
           return true;
       }
       return false;
    }

Member Data Documentation

static final String sun.awt.im.iiimp.LWESyntax.BACKSPACE = "backspace" [static, package]

Definition at line 79 of file LWESyntax.java.

static final String sun.awt.im.iiimp.LWESyntax.BACKWARD = "backward" [static, package]

Definition at line 87 of file LWESyntax.java.

static final String sun.awt.im.iiimp.LWESyntax.CLEAR = "clear" [static, package]

Definition at line 90 of file LWESyntax.java.

static final String sun.awt.im.iiimp.LWESyntax.COMMENT = "#" [static, package]

ccdef rule's keywords

Definition at line 66 of file LWESyntax.java.

StringBuffer sun.awt.im.iiimp.LWESyntax.context = new StringBuffer() [private]

Definition at line 498 of file LWESyntax.java.

static final String sun.awt.im.iiimp.LWESyntax.CONVERT = "convert" [static, package]

Definition at line 78 of file LWESyntax.java.

static final String sun.awt.im.iiimp.LWESyntax.CONVERT_S = "convert-s" [static, package]

Definition at line 80 of file LWESyntax.java.

Definition at line 149 of file LWESyntax.java.

static final String sun.awt.im.iiimp.LWESyntax.DEFMODE = "defmode" [static, package]

Definition at line 67 of file LWESyntax.java.

static final String sun.awt.im.iiimp.LWESyntax.EXPAND = "expand" [static, package]

Definition at line 91 of file LWESyntax.java.

static final String sun.awt.im.iiimp.LWESyntax.EXPAND_NOCONV = "expand-noconv" [static, package]

Definition at line 95 of file LWESyntax.java.

static final String sun.awt.im.iiimp.LWESyntax.EXPAND_NOCONV_S = "expand-noconv-s" [static, package]

Definition at line 96 of file LWESyntax.java.

static final String sun.awt.im.iiimp.LWESyntax.EXPAND_S = "expand-s" [static, package]

Definition at line 92 of file LWESyntax.java.

static final String sun.awt.im.iiimp.LWESyntax.FALLTHROUGH = "fallthrough" [static, package]

Definition at line 71 of file LWESyntax.java.

static final String sun.awt.im.iiimp.LWESyntax.FALLTHROUGH_KEY = "_FALLTHROUGH_" [static, package]

Definition at line 72 of file LWESyntax.java.

Definition at line 148 of file LWESyntax.java.

static final String sun.awt.im.iiimp.LWESyntax.FIX = "fix" [static, package]

Definition at line 99 of file LWESyntax.java.

static final String sun.awt.im.iiimp.LWESyntax.FORWARD = "forward" [static, package]

Definition at line 86 of file LWESyntax.java.

static final String sun.awt.im.iiimp.LWESyntax.INITIALMODE = "initialmode" [static, package]

Definition at line 68 of file LWESyntax.java.

int [] sun.awt.im.iiimp.LWESyntax.masks [static, private]
Initial value:
 {
       InputEvent.SHIFT_MASK,
       InputEvent.CTRL_MASK,
       InputEvent.META_MASK,
       
       
       
       
       
       
       
    }

Definition at line 459 of file LWESyntax.java.

String [] sun.awt.im.iiimp.LWESyntax.maskStrings [static, private]
Initial value:
 {
       "shift",
       "control",
       "mod1",
    }

Definition at line 472 of file LWESyntax.java.

static final String sun.awt.im.iiimp.LWESyntax.MODE = "mode" [static, package]

Definition at line 69 of file LWESyntax.java.

static final String sun.awt.im.iiimp.LWESyntax.MODE_SWITCH = "goto" [static, package]

ccdef actions

Definition at line 77 of file LWESyntax.java.

Definition at line 147 of file LWESyntax.java.

static final String sun.awt.im.iiimp.LWESyntax.MOVE_BOTTOM = "move-bottom" [static, package]

Definition at line 89 of file LWESyntax.java.

static final String sun.awt.im.iiimp.LWESyntax.MOVE_TOP = "move-top" [static, package]

Definition at line 88 of file LWESyntax.java.

static final String sun.awt.im.iiimp.LWESyntax.NEXT = "next" [static, package]

Definition at line 82 of file LWESyntax.java.

static final String sun.awt.im.iiimp.LWESyntax.NEXT_S = "next-s" [static, package]

Definition at line 83 of file LWESyntax.java.

static final String sun.awt.im.iiimp.LWESyntax.PREVIOUS = "previous" [static, package]

Definition at line 84 of file LWESyntax.java.

static final String sun.awt.im.iiimp.LWESyntax.PREVIOUS_S = "previous-s" [static, package]

Definition at line 85 of file LWESyntax.java.

static final String sun.awt.im.iiimp.LWESyntax.SHRINK = "shrink" [static, package]

Definition at line 93 of file LWESyntax.java.

static final String sun.awt.im.iiimp.LWESyntax.SHRINK_NOCONV = "shrink-noconv" [static, package]

Definition at line 97 of file LWESyntax.java.

static final String sun.awt.im.iiimp.LWESyntax.SHRINK_NOCONV_S = "shrink-noconv-s" [static, package]

Definition at line 98 of file LWESyntax.java.

static final String sun.awt.im.iiimp.LWESyntax.SHRINK_S = "shrink-s" [static, package]

Definition at line 94 of file LWESyntax.java.

static final String sun.awt.im.iiimp.LWESyntax.STATUS_KEY = "_STATUS_" [static, package]

Definition at line 70 of file LWESyntax.java.

static final String sun.awt.im.iiimp.LWESyntax.UNCONVERT = "unconvert" [static, package]

Definition at line 81 of file LWESyntax.java.


The documentation for this class was generated from the following files: