提交 c32b1ae1 authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Add fast paths for TRUE and FALSE to Parser.readBooleanSetting()

上级 5abc5fa0
...@@ -3456,14 +3456,21 @@ public class Parser { ...@@ -3456,14 +3456,21 @@ public class Parser {
} }
private boolean readBooleanSetting() { private boolean readBooleanSetting() {
if (currentTokenType == VALUE) { switch (currentTokenType) {
case TRUE:
read();
return true;
case FALSE:
read();
return false;
case VALUE:
boolean result = currentValue.getBoolean(); boolean result = currentValue.getBoolean();
read(); read();
return result; return result;
} }
if (readIf("TRUE") || readIf("ON")) { if (readIf("ON")) {
return true; return true;
} else if (readIf("FALSE") || readIf("OFF")) { } else if (readIf("OFF")) {
return false; return false;
} else { } else {
throw getSyntaxError(); throw getSyntaxError();
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论