📄 directionnode.java
字号:
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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -