directionnode.java
来自「是有关解释器的.用JAVA编写.可以解释一般的JAVA程序.」· Java 代码 · 共 36 行
JAVA
36 行
class DirectionNode extends EvaluatableNode
{
String vDirectionType;
static DirectionNode parserDirection(Environment env,Scanner s) throws ParserException, ScannerException
{
String tmpDirectionType= null;
if(mIsDirection(s))
{
tmpDirectionType=matchIdentifier(s);
}
return new DirectionNode(tmpDirectionType);
}
static boolean mIsDirection(Scanner s)throws ScannerException
{
return isIdentifierToken(s,"North")||isIdentifierToken(s,"West")||isIdentifierToken(s,"South")||isIdentifierToken(s,"East");
}
DirectionNode(String aDirectionType)
{
vDirectionType=aDirectionType;
}
String format(int indent)
{
return vDirectionType.toUpperCase();
}
Value evaluate(Environment env) throws InterpreterException
{
return new DirectionValue(vDirectionType);
}
//type checker returns true
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?