📄 token.java
字号:
package wmlcparser;
import java.util.Hashtable;
class Token
{
static final int IANA_GBK = 113;
static final int IANA_UTF_8 = 106;
static final int IANA_UTF_16 = 1015;
static final int IANA_UTF_32 = 1017;
static final String GBK = "GBK";
static final String UTF_8 = "UTF-8";
static final String UTF_16 = "UTF-16";
static final String UTF_32 = "UTF-32";
// the global token
static final int GLOBAL_SWITCH_PAGE = 0x0;
static final int GLOBAL_END = 0x1;
static final int GLOBAL_ENTITY = 0x2; // Followed by a mb_u_int32 encoding the character entity number.
static final int GLOBAL_STRI_I = 0x3; // Followed by a termstr.
static final int GLOBAL_LITERAL = 0x4; // Followed by a mb_u_int32 that encodes an offset into the string table.
static final int GLOBAL_EXT_I_0 = 0x40; // Token is followed by a termstr.
static final int GLOBAL_EXT_I_1 = 0x41; // Token is followed by a termstr.
static final int GLOBAL_EXT_I_2 = 0x42; // Token is followed by a termstr.
static final int GLOBAL_PI = 0x43;
static final int GLOBAL_LITERAL_C = 0x44;
static final int GLOBAL_EXT_T_0 = 0x80; // Token is followed by a mb_u_int32
static final int GLOBAL_EXT_T_1 = 0x81; // Token is followed by a mb_u_int32.
static final int GLOBAL_EXT_T_2 = 0x82; // Token is followed by a mb_u_int32. $()
static final int GLOBAL_STR_T = 0x83; // Followed by a mb_u_int32 encoding a byte offset from the beginning of the string table.
static final int GLOBAL_LITERAL_A = 0x84;
static final int GLOBAL_EXT_0 = 0xC0;
static final int GLOBAL_EXT_1 = 0xC1;
static final int GLOBAL_EXT_2 = 0xC2;
static final int GLOBAL_OPAQUE = 0xC3;
static final int GLOBAL_LITERAL_AC = 0xC4;
// static Hashtable GLOBAL_TOKEN = new Hashtable();
static final int[] GLOBAL_TOKEN =
{
GLOBAL_END
, GLOBAL_ENTITY
, GLOBAL_STRI_I
, GLOBAL_LITERAL
, GLOBAL_EXT_I_0
, GLOBAL_EXT_I_1
, GLOBAL_EXT_I_2
, GLOBAL_PI
, GLOBAL_LITERAL_C
, GLOBAL_EXT_T_0
, GLOBAL_EXT_T_1
, GLOBAL_EXT_T_2
, GLOBAL_STR_T
, GLOBAL_LITERAL_A
, GLOBAL_EXT_0
, GLOBAL_EXT_1
, GLOBAL_EXT_2
, GLOBAL_OPAQUE
, GLOBAL_LITERAL_AC
};
/** key-Integer, value-String **/
static Hashtable TAG_TOKEN = new Hashtable();
/**
* key-Integer,
* value-String[2], 0-key, 1-value
**/
static Hashtable ATTRIBUTE_START_TOKEN = new Hashtable();
/** key-Integer, value-String **/
static Hashtable ATTRIBUTE_VALUE_TOKEN = new Hashtable();
static{
initTagToken();
initAttributeStartToken();
initAttributeValueToken();
}
/*
a 1C
anchor 22
access 23
b 24
big 25
br 26
card 27
do 28
em 29
fieldset 2A
go 2B
head 2C
i 2D
img 2E
input 2F
meta 30
noop 31
p 20
postfield 21
pre 1B
prev 32
onevent 33
optgroup 34
option 35
refresh 36
select 37
setvar 3E
small 38
strong 39
table 1F
td 1D
template 3B
timer 3C
tr 1E
u 3D
wml 3F
*/
static void initTagToken()
{
TAG_TOKEN.put(new Integer(0x1c), "a");
TAG_TOKEN.put(new Integer(0x22), "anchor");
TAG_TOKEN.put(new Integer(0x23), "access");
TAG_TOKEN.put(new Integer(0x24), "b");
TAG_TOKEN.put(new Integer(0x25), "big");
TAG_TOKEN.put(new Integer(0x26), "br");
TAG_TOKEN.put(new Integer(0x27), "card");
TAG_TOKEN.put(new Integer(0x28), "do");
TAG_TOKEN.put(new Integer(0x29), "em");
TAG_TOKEN.put(new Integer(0x2a), "fieldset");
TAG_TOKEN.put(new Integer(0x2b), "go");
TAG_TOKEN.put(new Integer(0x2c), "head");
TAG_TOKEN.put(new Integer(0x2d), "i");
TAG_TOKEN.put(new Integer(0x2e), "img");
TAG_TOKEN.put(new Integer(0x2f), "input");
TAG_TOKEN.put(new Integer(0x30), "meta");
TAG_TOKEN.put(new Integer(0x31), "noop");
TAG_TOKEN.put(new Integer(0x20), "p");
TAG_TOKEN.put(new Integer(0x21), "postfield");
TAG_TOKEN.put(new Integer(0x1b), "pre");
TAG_TOKEN.put(new Integer(0x32), "prev");
TAG_TOKEN.put(new Integer(0x33), "onevent");
TAG_TOKEN.put(new Integer(0x34), "optgroup");
TAG_TOKEN.put(new Integer(0x35), "option");
TAG_TOKEN.put(new Integer(0x36), "refresh");
TAG_TOKEN.put(new Integer(0x37), "select");
TAG_TOKEN.put(new Integer(0x3e), "setvar");
TAG_TOKEN.put(new Integer(0x38), "small");
TAG_TOKEN.put(new Integer(0x39), "strong");
TAG_TOKEN.put(new Integer(0x1f), "table");
TAG_TOKEN.put(new Integer(0x1d), "td");
TAG_TOKEN.put(new Integer(0x3b), "template");
TAG_TOKEN.put(new Integer(0x3c), "timer");
TAG_TOKEN.put(new Integer(0x1e), "tr");
TAG_TOKEN.put(new Integer(0x3d), "u");
TAG_TOKEN.put(new Integer(0x3f), "wml");
}
/**
accept-charset 5
accesskey 5E
align 52
align bottom 6
align center 7
align left 8
align middle 9
align right A
align top B
alt C
cache-control no-cache 64
class 54
columns 53
content D
content application/vn
d.wap.wmlc;c
harset=
5C
domain F
emptyok false 10
emptyok true 11
enctype 5F
enctype application/xwww-
formurlencoded
60
enctype multipart/for 61
Attribute Name Attribute Value
Prefix
Token
m-data
format 12
forua false 56
forua true 57
height 13
href 4A
href http:// 4B
href https:// 4C
hspace 14
http-equiv 5A
http-equiv Content-Type 5B
http-equiv Expires 5D
id 55
ivalue 15
iname 16
label 18
localsrc 19
maxlength 1A
method get 1B
method post 1C
mode nowrap 1D
mode wrap 1E
multiple false 1F
*/
static void initAttributeStartToken()
{
ATTRIBUTE_START_TOKEN.put(new Integer(0x5), new String[]{ "accept-charset", ""});
ATTRIBUTE_START_TOKEN.put(new Integer(0x5e), new String[]{ "accesskey", ""});
ATTRIBUTE_START_TOKEN.put(new Integer(0x52), new String[]{ "align", ""} );
ATTRIBUTE_START_TOKEN.put(new Integer(0x6), new String[]{ "align", "bottom"});
ATTRIBUTE_START_TOKEN.put(new Integer(0x7), new String[]{ "align", "center"});
ATTRIBUTE_START_TOKEN.put(new Integer(0x8), new String[]{ "align", "left"});
ATTRIBUTE_START_TOKEN.put(new Integer(0x9), new String[]{ "align", "middle"});
ATTRIBUTE_START_TOKEN.put(new Integer(0xA), new String[]{ "align", "right"});
ATTRIBUTE_START_TOKEN.put(new Integer(0xB), new String[]{ "align", "top"});
ATTRIBUTE_START_TOKEN.put(new Integer(0xC), new String[]{ "alt", "" });
ATTRIBUTE_START_TOKEN.put(new Integer(0x64), new String[]{ "cache-control", "no-cache"});
ATTRIBUTE_START_TOKEN.put(new Integer(0x54), new String[]{ "class", ""});
ATTRIBUTE_START_TOKEN.put(new Integer(0x53), new String[]{ "columns", ""});
ATTRIBUTE_START_TOKEN.put(new Integer(0xd), new String[]{ "content", ""});
ATTRIBUTE_START_TOKEN.put(new Integer(0x5c), new String[]{ "content", "application/vnd.wap.wmlc;charset="});
ATTRIBUTE_START_TOKEN.put(new Integer(0xf), new String[]{ "domain", ""});
ATTRIBUTE_START_TOKEN.put(new Integer(0x10), new String[]{ "emptyok", "false"});
ATTRIBUTE_START_TOKEN.put(new Integer(0x11), new String[]{ "emptyok", "true"});
ATTRIBUTE_START_TOKEN.put(new Integer(0x5f), new String[]{ "enctype", ""});
ATTRIBUTE_START_TOKEN.put(new Integer(0x60), new String[]{ "enctype", "application/xwww-formurlencoded"});
ATTRIBUTE_START_TOKEN.put(new Integer(0x61), new String[]{ "enctype", "multipart/form-data"});
ATTRIBUTE_START_TOKEN.put(new Integer(0xf), new String[]{ "domain", ""});
ATTRIBUTE_START_TOKEN.put(new Integer(0x12), new String[]{ "format", ""});
ATTRIBUTE_START_TOKEN.put(new Integer(0x56), new String[]{ "forua", "false"});
ATTRIBUTE_START_TOKEN.put(new Integer(0x57), new String[]{ "forua", "true"});
ATTRIBUTE_START_TOKEN.put(new Integer(0x13), new String[]{ "height", "true"});
ATTRIBUTE_START_TOKEN.put(new Integer(0x4A), new String[]{ "href", ""});
ATTRIBUTE_START_TOKEN.put(new Integer(0x4B), new String[]{ "href", "http://"});
ATTRIBUTE_START_TOKEN.put(new Integer(0x4C), new String[]{ "href", "https://"});
ATTRIBUTE_START_TOKEN.put(new Integer(0x14), new String[]{ "hspace", ""});
ATTRIBUTE_START_TOKEN.put(new Integer(0x5A), new String[]{ "http-equiv", ""});
ATTRIBUTE_START_TOKEN.put(new Integer(0x5B), new String[]{ "http-equiv", "Content-Type"});
ATTRIBUTE_START_TOKEN.put(new Integer(0x5D), new String[]{ "http-equiv", "Expires"});
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -