01: /*
02: *******************************************************************************
03: * Copyright (C) 2002-2004, International Business Machines Corporation and *
04: * others. All Rights Reserved. *
05: *******************************************************************************
06: */
07: package com.ibm.icu.dev.tool.localeconverter;
08:
09: public class SpaceTransition extends ComplexTransition {
10: public static final SpaceTransition GLOBAL = new SpaceTransition(
11: SUCCESS);
12: public static final String SPACE_CHARS = " \t";
13:
14: public SpaceTransition(int success) {
15: super (success);
16: //{{INIT_CONTROLS
17: //}}
18: }
19:
20: public boolean accepts(int c) {
21: return SPACE_CHARS.indexOf((char) c) >= 0;
22: }
23:
24: protected Lex.Transition[][] getStates() {
25: return states;
26: }
27:
28: private static final Lex.Transition[][] states = { { //state 0:
29: new Lex.StringTransition(SPACE_CHARS,
30: Lex.IGNORE_CONSUME, -1),
31: new Lex.ParseExceptionTransition(
32: "illegal space character") }, { //state 1:
33: new Lex.EOFTransition(SUCCESS),
34: new Lex.StringTransition(SPACE_CHARS,
35: Lex.IGNORE_CONSUME, -1),
36: new Lex.DefaultTransition(Lex.IGNORE_PUTBACK,
37: SUCCESS) }, };
38: //{{DECLARE_CONTROLS
39: //}}
40: }
|