Sha256: 398927c9c7002d5451d7ce91064a89ca55f19ef3b4ac2f3528cd7488366457ec

Contents?: true

Size: 1.18 KB

Versions: 111

Compression:

Stored size: 1.18 KB

Contents

/**
 * Copyright 2005-2007 Xue Yong Zhi
 * Distributed under the BSD License
 */

package com.xruby.compiler.codedom;

public class AsciiValueExpression extends Expression {
	private int value_;
	private String str_value_ = null;

	public AsciiValueExpression(String value) {

		if (value.startsWith("?\\M-\\C-")) {
			value_ = (int)(value.charAt(7) & 0x9f | 0x80);
			return;
		} else if (value.startsWith("?\\C-")) {
			value_ = (int)(value.charAt(4) & 0x9f);
			return;
		} else if (value.startsWith("?\\M-")) {
			value_ = (int)(value.charAt(4) | 0x80);
			return;
		} else if (value.charAt(1) == '\\') {
			switch (value.charAt(2)) {
			case 'n':
				value_ = '\n';
				return;
			case 'r':
				value_ = '\r';
				return;
			case 'x':
				value_ = Integer.valueOf(value.substring(3), 16);
				return;
			default:
				//TODO more escped value
				value_ = (int)value.charAt(2);
				return;

			}
		} else if (value.charAt(0) == '?') {
			str_value_ = value.substring(1);
		} else {
			value_ = (int)value.charAt(1);
			return;
		}
	}

	public void accept(CodeVisitor visitor) {
		if (str_value_ != null )
			visitor.visitStringExpression(str_value_);
		else	
			visitor.visitFixnumExpression(value_);
	}
}

Version data entries

111 entries across 111 versions & 2 rubygems

Version Path
rhodes-7.6.0 platform/shared/xruby/src/com/xruby/compiler/codedom/AsciiValueExpression.java
rhodes-7.5.1 platform/shared/xruby/src/com/xruby/compiler/codedom/AsciiValueExpression.java
rhodes-7.4.1 platform/shared/xruby/src/com/xruby/compiler/codedom/AsciiValueExpression.java
rhodes-7.1.17 platform/shared/xruby/src/com/xruby/compiler/codedom/AsciiValueExpression.java
rhodes-6.2.0 platform/shared/xruby/src/com/xruby/compiler/codedom/AsciiValueExpression.java
rhodes-6.0.11 platform/shared/xruby/src/com/xruby/compiler/codedom/AsciiValueExpression.java
rhodes-5.5.18 platform/shared/xruby/src/com/xruby/compiler/codedom/AsciiValueExpression.java
rhodes-5.5.17 platform/shared/xruby/src/com/xruby/compiler/codedom/AsciiValueExpression.java
rhodes-5.5.15 platform/shared/xruby/src/com/xruby/compiler/codedom/AsciiValueExpression.java
rhodes-5.5.0.22 platform/shared/xruby/src/com/xruby/compiler/codedom/AsciiValueExpression.java
rhodes-5.5.2 platform/shared/xruby/src/com/xruby/compiler/codedom/AsciiValueExpression.java
rhodes-5.5.0.7 platform/shared/xruby/src/com/xruby/compiler/codedom/AsciiValueExpression.java
rhodes-5.5.0.3 platform/shared/xruby/src/com/xruby/compiler/codedom/AsciiValueExpression.java
rhodes-5.5.0 platform/shared/xruby/src/com/xruby/compiler/codedom/AsciiValueExpression.java
tauplatform-1.0.3 platform/shared/xruby/src/com/xruby/compiler/codedom/AsciiValueExpression.java
tauplatform-1.0.2 platform/shared/xruby/src/com/xruby/compiler/codedom/AsciiValueExpression.java
tauplatform-1.0.1 platform/shared/xruby/src/com/xruby/compiler/codedom/AsciiValueExpression.java
rhodes-3.5.1.12 platform/shared/xruby/src/com/xruby/compiler/codedom/AsciiValueExpression.java
rhodes-3.3.5 platform/shared/xruby/src/com/xruby/compiler/codedom/AsciiValueExpression.java
rhodes-3.4.2 platform/shared/xruby/src/com/xruby/compiler/codedom/AsciiValueExpression.java