开发者

Token Enumeration in Java

I'm writing a lexer using jflex for a made up programming language. It requires an enumeration java class w开发者_如何学运维hich holds a bunch of tokens for the made up language. Things like STRING_TKN, ON_TKN, GOTO_TKN, COMMAND_TKN, etc. I haven't used java in a while so I forget how to set these up.

Thanks


Java as an enum type.

http://download.oracle.com/javase/tutorial/java/javaOO/enum.html

An example:

public enum Colors{
    RED,BLUE,GREEN;
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜