📄 lexicalunitimpl.java
字号:
public String toDebugString() { StringBuffer sb = new StringBuffer(); switch (_type) { case SAC_OPERATOR_COMMA: sb.append("SAC_OPERATOR_COMMA"); break; case SAC_OPERATOR_PLUS: sb.append("SAC_OPERATOR_PLUS"); break; case SAC_OPERATOR_MINUS: sb.append("SAC_OPERATOR_MINUS"); break; case SAC_OPERATOR_MULTIPLY: sb.append("SAC_OPERATOR_MULTIPLY"); break; case SAC_OPERATOR_SLASH: sb.append("SAC_OPERATOR_SLASH"); break; case SAC_OPERATOR_MOD: sb.append("SAC_OPERATOR_MOD"); break; case SAC_OPERATOR_EXP: sb.append("SAC_OPERATOR_EXP"); break; case SAC_OPERATOR_LT: sb.append("SAC_OPERATOR_LT"); break; case SAC_OPERATOR_GT: sb.append("SAC_OPERATOR_GT"); break; case SAC_OPERATOR_LE: sb.append("SAC_OPERATOR_LE"); break; case SAC_OPERATOR_GE: sb.append("SAC_OPERATOR_GE"); break; case SAC_OPERATOR_TILDE: sb.append("SAC_OPERATOR_TILDE"); break; case SAC_INHERIT: sb.append("SAC_INHERIT"); break; case SAC_INTEGER: sb.append("SAC_INTEGER(") .append(String.valueOf(getIntegerValue())) .append(")"); break; case SAC_REAL: sb.append("SAC_REAL(") .append(trimFloat(getFloatValue())) .append(")"); break; case SAC_EM: sb.append("SAC_EM(") .append(trimFloat(getFloatValue())) .append(getDimensionUnitText()) .append(")"); break; case SAC_EX: sb.append("SAC_EX(") .append(trimFloat(getFloatValue())) .append(getDimensionUnitText()) .append(")"); break; case SAC_PIXEL: sb.append("SAC_PIXEL(") .append(trimFloat(getFloatValue())) .append(getDimensionUnitText()) .append(")"); break; case SAC_INCH: sb.append("SAC_INCH(") .append(trimFloat(getFloatValue())) .append(getDimensionUnitText()) .append(")"); break; case SAC_CENTIMETER: sb.append("SAC_CENTIMETER(") .append(trimFloat(getFloatValue())) .append(getDimensionUnitText()) .append(")"); break; case SAC_MILLIMETER: sb.append("SAC_MILLIMETER(") .append(trimFloat(getFloatValue())) .append(getDimensionUnitText()) .append(")"); break; case SAC_POINT: sb.append("SAC_POINT(") .append(trimFloat(getFloatValue())) .append(getDimensionUnitText()) .append(")"); break; case SAC_PICA: sb.append("SAC_PICA(") .append(trimFloat(getFloatValue())) .append(getDimensionUnitText()) .append(")"); break; case SAC_PERCENTAGE: sb.append("SAC_PERCENTAGE(") .append(trimFloat(getFloatValue())) .append(getDimensionUnitText()) .append(")"); break; case SAC_DEGREE: sb.append("SAC_DEGREE(") .append(trimFloat(getFloatValue())) .append(getDimensionUnitText()) .append(")"); break; case SAC_GRADIAN: sb.append("SAC_GRADIAN(") .append(trimFloat(getFloatValue())) .append(getDimensionUnitText()) .append(")"); break; case SAC_RADIAN: sb.append("SAC_RADIAN(") .append(trimFloat(getFloatValue())) .append(getDimensionUnitText()) .append(")"); break; case SAC_MILLISECOND: sb.append("SAC_MILLISECOND(") .append(trimFloat(getFloatValue())) .append(getDimensionUnitText()) .append(")"); break; case SAC_SECOND: sb.append("SAC_SECOND(") .append(trimFloat(getFloatValue())) .append(getDimensionUnitText()) .append(")"); break; case SAC_HERTZ: sb.append("SAC_HERTZ(") .append(trimFloat(getFloatValue())) .append(getDimensionUnitText()) .append(")"); break; case SAC_KILOHERTZ: sb.append("SAC_KILOHERTZ(") .append(trimFloat(getFloatValue())) .append(getDimensionUnitText()) .append(")"); break; case SAC_DIMENSION: sb.append("SAC_DIMENSION(") .append(trimFloat(getFloatValue())) .append(getDimensionUnitText()) .append(")"); break; case SAC_URI: sb.append("SAC_URI(url(") .append(getStringValue()) .append("))"); break; case SAC_COUNTER_FUNCTION: sb.append("SAC_COUNTER_FUNCTION(counter("); appendParams(sb, _params); sb.append("))"); break; case SAC_COUNTERS_FUNCTION: sb.append("SAC_COUNTERS_FUNCTION(counters("); appendParams(sb, _params); sb.append("))"); break; case SAC_RGBCOLOR: sb.append("SAC_RGBCOLOR(rgb("); appendParams(sb, _params); sb.append("))"); break; case SAC_IDENT: sb.append("SAC_IDENT(") .append(getStringValue()) .append(")"); break; case SAC_STRING_VALUE: sb.append("SAC_STRING_VALUE(\"") .append(getStringValue()) .append("\")"); break; case SAC_ATTR: sb.append("SAC_ATTR(attr("); appendParams(sb, _params); sb.append("))"); break; case SAC_RECT_FUNCTION: sb.append("SAC_RECT_FUNCTION(rect("); appendParams(sb, _params); sb.append("))"); break; case SAC_UNICODERANGE: sb.append("SAC_UNICODERANGE(") .append(getStringValue()) .append(")"); break; case SAC_SUB_EXPRESSION: sb.append("SAC_SUB_EXPRESSION(") .append(getStringValue()) .append(")"); break; case SAC_FUNCTION: sb.append("SAC_FUNCTION(") .append(getFunctionName()) .append("("); appendParams(sb, _params); sb.append("))"); break; } return sb.toString(); } private void appendParams(StringBuffer sb, LexicalUnit first) { LexicalUnit l = first; while (l != null) { sb.append(l.toString()); l = l.getNextLexicalUnit(); } } private String trimFloat(float f) { String s = String.valueOf(getFloatValue()); return (f - (int) f != 0) ? s : s.substring(0, s.length() - 2); } private static float value(char op, String s) { return ((op == '-') ? -1 : 1) * Float.valueOf(s).floatValue(); } public static LexicalUnit createNumber(LexicalUnit prev, float f) { if (f > (int) f) { return new LexicalUnitImpl(prev, LexicalUnit.SAC_REAL, f); } else { return new LexicalUnitImpl(prev, (int) f); } } public static LexicalUnit createPercentage(LexicalUnit prev, float f) { return new LexicalUnitImpl(prev, LexicalUnit.SAC_PERCENTAGE, f); } public static LexicalUnit createPixel(LexicalUnit prev, float f) { return new LexicalUnitImpl(prev, LexicalUnit.SAC_PIXEL, f); } public static LexicalUnit createCentimeter(LexicalUnit prev, float f) { return new LexicalUnitImpl(prev, LexicalUnit.SAC_CENTIMETER, f); } public static LexicalUnit createMillimeter(LexicalUnit prev, float f) { return new LexicalUnitImpl(prev, LexicalUnit.SAC_MILLIMETER, f); } public static LexicalUnit createInch(LexicalUnit prev, float f) { return new LexicalUnitImpl(prev, LexicalUnit.SAC_INCH, f); } public static LexicalUnit createPoint(LexicalUnit prev, float f) { return new LexicalUnitImpl(prev, LexicalUnit.SAC_POINT, f); } public static LexicalUnit createPica(LexicalUnit prev, float f) { return new LexicalUnitImpl(prev, LexicalUnit.SAC_PICA, f); } public static LexicalUnit createEm(LexicalUnit prev, float f) { return new LexicalUnitImpl(prev, LexicalUnit.SAC_EM, f); } public static LexicalUnit createEx(LexicalUnit prev, float f) { return new LexicalUnitImpl(prev, LexicalUnit.SAC_EX, f); } public static LexicalUnit createDegree(LexicalUnit prev, float f) { return new LexicalUnitImpl(prev, LexicalUnit.SAC_DEGREE, f); } public static LexicalUnit createRadian(LexicalUnit prev, float f) { return new LexicalUnitImpl(prev, LexicalUnit.SAC_RADIAN, f); } public static LexicalUnit createGradian(LexicalUnit prev, float f) { return new LexicalUnitImpl(prev, LexicalUnit.SAC_GRADIAN, f); } public static LexicalUnit createMillisecond(LexicalUnit prev, float f) { return new LexicalUnitImpl(prev, LexicalUnit.SAC_MILLISECOND, f); } public static LexicalUnit createSecond(LexicalUnit prev, float f) { return new LexicalUnitImpl(prev, LexicalUnit.SAC_SECOND, f); } public static LexicalUnit createHertz(LexicalUnit prev, float f) { return new LexicalUnitImpl(prev, LexicalUnit.SAC_HERTZ, f); } public static LexicalUnit createDimension(LexicalUnit prev, float f, String dim) { return new LexicalUnitImpl(prev, LexicalUnit.SAC_DIMENSION, dim, f); } public static LexicalUnit createKiloHertz(LexicalUnit prev, float f) { return new LexicalUnitImpl(prev, LexicalUnit.SAC_KILOHERTZ, f); } public static LexicalUnit createCounter(LexicalUnit prev, LexicalUnit params) { return new LexicalUnitImpl(prev, LexicalUnit.SAC_COUNTER_FUNCTION, "counter", params); } public static LexicalUnit createCounters(LexicalUnit prev, LexicalUnit params) { return new LexicalUnitImpl(prev, LexicalUnit.SAC_COUNTERS_FUNCTION, "counters", params); } public static LexicalUnit createAttr(LexicalUnit prev, LexicalUnit params) { return new LexicalUnitImpl(prev, LexicalUnit.SAC_ATTR, "attr", params); } public static LexicalUnit createRect(LexicalUnit prev, LexicalUnit params) { return new LexicalUnitImpl(prev, LexicalUnit.SAC_RECT_FUNCTION, "rect", params); } public static LexicalUnit createRgbColor(LexicalUnit prev, LexicalUnit params) { return new LexicalUnitImpl(prev, LexicalUnit.SAC_RGBCOLOR, "rgb", params); } public static LexicalUnit createFunction(LexicalUnit prev, String name, LexicalUnit params) { return new LexicalUnitImpl(prev, LexicalUnit.SAC_FUNCTION, name, params); } public static LexicalUnit createString(LexicalUnit prev, String value) { return new LexicalUnitImpl(prev, LexicalUnit.SAC_STRING_VALUE, value); } public static LexicalUnit createIdent(LexicalUnit prev, String value) { return new LexicalUnitImpl(prev, LexicalUnit.SAC_IDENT, value); } public static LexicalUnit createURI(LexicalUnit prev, String value) { return new LexicalUnitImpl(prev, LexicalUnit.SAC_URI, value); } public static LexicalUnit createComma(LexicalUnit prev) { return new LexicalUnitImpl(prev, SAC_OPERATOR_COMMA); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -