use crate::sourcefile::Span;
#[derive(Debug)]
pub struct Token {
pub kind: TokenKind,
pub span: Span,
}
impl PartialEq for Token {
fn eq(&self, other: &Self) -> bool {
self.kind == other.kind
}
}
#[derive(Debug, Clone, PartialEq)]
pub enum TokenKind {
TAaload,
TAastore,
TAbstract,
TAconstnull,
TAload,
TAload0,
TAload1,
TAload2,
TAload3,
TAnewarray,
TAnnotation,
TAreturn,
TArraylength,
TAssign,
TAstore,
TAstore0,
TAstore1,
TAstore2,
TAstore3,
TAthrow,
TBaload,
TBastore,
TBipush,
TBridge,
TCaload,
TCastore,
TCatch,
TCheckcast,
TClass,
TColon,
TD2f,
TD2i,
TD2l,
TDadd,
TDaload,
TDastore,
TDcmpg,
TDcmpl,
TDconst0,
TDconst1,
TDdiv,
TDefault,
TDload,
TDload0,
TDload1,
TDload2,
TDload3,
TDmul,
TDneg,
TDot,
TDrem,
TDreturn,
TDstore,
TDstore0,
TDstore1,
TDstore2,
TDstore3,
TDsub,
TDup,
TDup2,
TDup2x1,
TDup2x2,
TDupx1,
TDupx2,
TEnd,
TEndMethod,
TEnum,
TEof,
TF2d,
TF2i,
TF2l,
TFadd,
TFaload,
TFastore,
TFcmpg,
TFcmpl,
TFconst0,
TFconst1,
TFconst2,
TFdiv,
TField,
TFinal,
TFload,
TFload0,
TFload1,
TFload2,
TFload3,
TFloat(f64),
TFmul,
TFneg,
TFrem,
TFreturn,
TFrom,
TFstore,
TFstore0,
TFstore1,
TFstore2,
TFstore3,
TFsub,
TGetfield,
TGetstatic,
TGoto,
TGotow,
TI2b,
TI2c,
TI2d,
TI2f,
TI2l,
TI2s,
TIadd,
TIaload,
TIand,
TIastore,
TIconst0,
TIconst1,
TIconst2,
TIconst3,
TIconst4,
TIconst5,
TIconstm1,
TIdent(String),
TIdiv,
TIfacmpeq,
TIfacmpne,
TIfeq,
TIfge,
TIfgt,
TIficmpeq,
TIficmpge,
TIficmpgt,
TIficmple,
TIficmplt,
TIficmpne,
TIfle,
TIflt,
TIfne,
TIfnonnull,
TIfnull,
TIinc,
TIload,
TIload0,
TIload1,
TIload2,
TIload3,
TImplements,
TImul,
TIneg,
TInstanceof,
TInt(i64),
TInterface,
TInvokeinterface,
TInvokespecial,
TInvokestatic,
TInvokevirtual,
TIor,
TIrem,
TIreturn,
TIs,
TIshl,
TIshr,
TIstore,
TIstore0,
TIstore1,
TIstore2,
TIstore3,
TIsub,
TIushr,
TIxor,
TJsr,
TJsrw,
TL2d,
TL2f,
TL2i,
TLaload,
TLadd,
TLand,
TLastore,
TLcmp,
TLconst0,
TLconst1,
TLdc,
TLdc2w,
TLdcw,
TLdiv,
TLeftParen,
TLimit,
TLine,
TLload,
TLload0,
TLload1,
TLload2,
TLload3,
TLmul,
TLneg,
TLoaload,
TLocals,
TLookupswitch,
TLor,
TLrem,
TLreturn,
TLshl,
TLshr,
TLstore,
TLstore0,
TLstore1,
TLstore2,
TLstore3,
TLsub,
TLushr,
TLxor,
TMethod,
TModule,
TMonitorenter,
TMonitorexit,
TMultianewarray,
TNative,
TNew,
TNewarray,
TNop,
TPop,
TPop2,
TPrivate,
TProtected,
TPublic,
TPutfield,
TPutstatic,
TRet,
TReturn,
TRightParen,
TSaload,
TSastore,
TSipush,
TSource,
TStack,
TStatic,
TStrict,
TString(String),
TSuper,
TSwap,
TSynchronized,
TSynthetic,
TTableswitch,
TThrows,
TTo,
TTransient,
TUsing,
TVar,
TVarargs,
TVolatile,
Twide,
}
use std::fmt;
impl fmt::Display for TokenKind {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
use TokenKind::*;
write!(
f,
"{}",
match *self {
TAaload => "aaload",
TAastore => "aastore",
TAbstract => "abstract",
TAconstnull => "aconst_null",
TAload => "aload",
TAload0 => "aload_0",
TAload1 => "aload_1",
TAload2 => "aload_2",
TAload3 => "aload_3",
TAnewarray => "anewarray",
TAnnotation => "annotation",
TAreturn => "areturn",
TArraylength => "arraylength",
TAssign => "assign",
TAstore => "astore",
TAstore0 => "astore_0",
TAstore1 => "astore_1",
TAstore2 => "astore_2",
TAstore3 => "astore_3",
TAthrow => "athrow",
TBaload => "baload",
TBastore => "bastore",
TBipush => "bipush",
TBridge => "bridge",
TCaload => "caload",
TCastore => "castore",
TCatch => "catch",
TCheckcast => "checkcast",
TClass => "class",
TColon => "colon",
TD2f => "d2f",
TD2i => "d2i",
TD2l => "d2l",
TDadd => "dadd",
TDaload => "daload",
TDastore => "dastore",
TDcmpg => "dcmpg",
TDcmpl => "dcmpl",
TDconst0 => "dconst_0",
TDconst1 => "dconst_1",
TDdiv => "ddiv",
TDefault => "default",
TDload => "dload",
TDload0 => "dload_0",
TDload1 => "dload_1",
TDload2 => "dload_2",
TDload3 => "dload_3",
TDmul => "dmul",
TDneg => "dneg",
TDot => "dot",
TDrem => "drem",
TDreturn => "dreturn",
TDstore => "dstore",
TDstore0 => "dstore_0",
TDstore1 => "dstore_1",
TDstore2 => "dstore_2",
TDstore3 => "dstore_3",
TDsub => "dsub",
TDup => "dup",
TDup2 => "dup2",
TDup2x1 => "dup2_x1",
TDup2x2 => "dup2_x2",
TDupx1 => "dup_x1",
TDupx2 => "dup_x2",
TEnd => "end",
TEndMethod => "endMethod",
TEnum => "enum",
TEof => "eof",
TF2d => "f2d",
TF2i => "f2i",
TF2l => "f2l",
TFadd => "fadd",
TFaload => "faload",
TFastore => "fastore",
TFcmpg => "fcmpg",
TFcmpl => "fcmpl",
TFconst0 => "fconst_0",
TFconst1 => "fconst_1",
TFconst2 => "fconst_2",
TFdiv => "fdiv",
TField => "field",
TFinal => "final",
TFload => "fload",
TFload0 => "fload_0",
TFload1 => "fload_1",
TFload2 => "fload_2",
TFload3 => "fload_3",
TFloat(..) => "float",
TFmul => "fmul",
TFneg => "fneg",
TFrem => "frem",
TFreturn => "freturn",
TFrom => "from",
TFstore => "fstore",
TFstore0 => "fstore_0",
TFstore1 => "fstore_1",
TFstore2 => "fstore_2",
TFstore3 => "fstore_3",
TFsub => "fsub",
TGetfield => "getfield",
TGetstatic => "getstatic",
TGoto => "goto",
TGotow => "gotow",
TI2b => "i2b",
TI2c => "i2c",
TI2d => "i2d",
TI2f => "i2f",
TI2l => "i2l",
TI2s => "i2s",
TIadd => "iadd",
TIaload => "iaload",
TIand => "iand",
TIastore => "iastore",
TIconst0 => "iconst_0",
TIconst1 => "iconst_1",
TIconst2 => "iconst_2",
TIconst3 => "iconst_3",
TIconst4 => "iconst_4",
TIconst5 => "iconst_5",
TIconstm1 => "iconst_m1",
TIdent(..) => "ident",
TIdiv => "idiv",
TIfacmpeq => "ifacmpeq",
TIfacmpne => "ifacmpne",
TIfeq => "ifeq",
TIfge => "ifge",
TIfgt => "ifgt",
TIficmpeq => "ificmpeq",
TIficmpge => "ificmpge",
TIficmpgt => "ificmpgt",
TIficmple => "ificmple",
TIficmplt => "ificmplt",
TIficmpne => "ificmpne",
TIfle => "ifle",
TIflt => "iflt",
TIfne => "ifne",
TIfnonnull => "ifnonnull",
TIfnull => "ifnull",
TIinc => "iinc",
TIload => "iload",
TIload0 => "iload_0",
TIload1 => "iload_1",
TIload2 => "iload_2",
TIload3 => "iload_3",
TImplements => "implements",
TImul => "imul",
TIneg => "ineg",
TInstanceof => "instanceof",
TInt(..) => "int",
TInterface => "interface",
TInvokeinterface => "invokeinterface",
TInvokespecial => "invokespecial",
TInvokestatic => "invokestatic",
TInvokevirtual => "invokevirtual",
TIor => "ior",
TIrem => "irem",
TIreturn => "ireturn",
TIs => "is",
TIshl => "ishl",
TIshr => "ishr",
TIstore => "istore",
TIstore0 => "istore_0",
TIstore1 => "istore_1",
TIstore2 => "istore_2",
TIstore3 => "istore_3",
TIsub => "isub",
TIushr => "iushr",
TIxor => "ixor",
TJsr => "jsr",
TJsrw => "jsrw",
TL2d => "l2d",
TL2f => "l2f",
TL2i => "l2i",
TLaload => "laload",
TLadd => "ladd",
TLand => "land",
TLastore => "lastore",
TLcmp => "lcmp",
TLconst0 => "lconst_0",
TLconst1 => "lconst_1",
TLdc => "ldc",
TLdc2w => "ldc2w",
TLdcw => "ldcw",
TLdiv => "ldiv",
TLeftParen => "leftParen",
TLimit => "limit",
TLine => "line",
TLload => "lload",
TLload0 => "lload_0",
TLload1 => "lload_1",
TLload2 => "lload_2",
TLload3 => "lload_3",
TLmul => "lmul",
TLneg => "lneg",
TLoaload => "loaload",
TLocals => "locals",
TLookupswitch => "lookupswitch",
TLor => "lor",
TLrem => "lrem",
TLreturn => "lreturn",
TLshl => "lshl",
TLshr => "lshr",
TLstore => "lstore",
TLstore0 => "lstore_0",
TLstore1 => "lstore_1",
TLstore2 => "lstore_2",
TLstore3 => "lstore_3",
TLsub => "lsub",
TLushr => "lushr",
TLxor => "lxor",
TMethod => "method",
TModule => "module",
TMonitorenter => "monitorenter",
TMonitorexit => "monitorexit",
TMultianewarray => "multianewarray",
TNative => "native",
TNew => "new",
TNewarray => "newarray",
TNop => "nop",
TPop => "pop",
TPop2 => "pop2",
TPrivate => "private",
TProtected => "protected",
TPublic => "public",
TPutfield => "putfield",
TPutstatic => "putstatic",
TRet => "ret",
TReturn => "return",
TRightParen => "rightParen",
TSaload => "saload",
TSastore => "sastore",
TSipush => "sipush",
TSource => "source",
TStack => "stack",
TStatic => "static",
TStrict => "strict",
TString(..) => "string",
TSuper => "super",
TSwap => "swap",
TSynchronized => "synchronized",
TSynthetic => "synthetic",
TTableswitch => "tableswitch",
TThrows => "throws",
TTo => "to",
TTransient => "transient",
TUsing => "using",
TVar => "var",
TVarargs => "varargs",
TVolatile => "volatile",
Twide => "wide",
}
)
}
}