Sha256: 236a2474d36094e65d946f4c5973a3646ec03b707cf578cfa9e234337d2d1131

Contents?: true

Size: 1.92 KB

Versions: 135

Compression:

Stored size: 1.92 KB

Contents

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

package com.xruby.compiler.codedom;

public class RegexpExpressionWithExpressionSubstitution extends ExpressionWithExpressionSubstitution {

    private String option_;

    public RegexpExpressionWithExpressionSubstitution(String s) {
        addString(s);
    }

    public void addLastString(String value) {
        //A regexp "/abc/o" will look like "abc/o" now
        int index_of_back_slash = value.lastIndexOf("/");
        assert(index_of_back_slash >= 0);
        addString(value.substring(0, index_of_back_slash));
        option_ = value.substring(index_of_back_slash + 1);
    }

    public void accept(CodeVisitor visitor) {

        visitor.visitStringExpressionWithExpressionSubstitutionBegin();

        for (Object o : stmts_) {
            if (o instanceof String) {
                visitor.visitStringExpressionWithExpressionSubstitution((String)o);
            } else if (o instanceof InstanceVariableExpression) {
                ((InstanceVariableExpression)o).accept(visitor);
                visitor.visitStringExpressionWithExpressionSubstitution();
            } else if (o instanceof ClassVariableExpression) {
                ((ClassVariableExpression)o).accept(visitor);
                visitor.visitStringExpressionWithExpressionSubstitution();
            } else if (o instanceof GlobalVariableExpression) {
                ((GlobalVariableExpression)o).accept(visitor);
                visitor.visitStringExpressionWithExpressionSubstitution();
            } else if (o instanceof CompoundStatement){
                ((CompoundStatement)o).accept(visitor);
                visitor.visitStringExpressionWithExpressionSubstitution();
            } else {
                assert(false);
            }
        }

        visitor.visitRegexpExpressionWithExpressionSubstitutionEnd(option_);
    }

}

Version data entries

135 entries across 135 versions & 2 rubygems

Version Path
rhodes-2.4.0 platform/shared/xruby/src/com/xruby/compiler/codedom/RegexpExpressionWithExpressionSubstitution.java
rhodes-2.4.0.beta.2 platform/shared/xruby/src/com/xruby/compiler/codedom/RegexpExpressionWithExpressionSubstitution.java
rhodes-2.4.0.beta.1 platform/shared/xruby/src/com/xruby/compiler/codedom/RegexpExpressionWithExpressionSubstitution.java
rhodes-2.3.2 platform/shared/xruby/src/com/xruby/compiler/codedom/RegexpExpressionWithExpressionSubstitution.java
rhodes-2.3.2.beta.2 platform/shared/xruby/src/com/xruby/compiler/codedom/RegexpExpressionWithExpressionSubstitution.java
rhodes-2.3.2.beta.1 platform/shared/xruby/src/com/xruby/compiler/codedom/RegexpExpressionWithExpressionSubstitution.java
rhodes-2.3.1 platform/shared/xruby/src/com/xruby/compiler/codedom/RegexpExpressionWithExpressionSubstitution.java
rhodes-2.3.1.beta.1 platform/shared/xruby/src/com/xruby/compiler/codedom/RegexpExpressionWithExpressionSubstitution.java
rhodes-2.3.0 platform/shared/xruby/src/com/xruby/compiler/codedom/RegexpExpressionWithExpressionSubstitution.java
rhodes-2.3.0.beta.3 platform/shared/xruby/src/com/xruby/compiler/codedom/RegexpExpressionWithExpressionSubstitution.java
rhodes-2.3.0.beta.2 platform/shared/xruby/src/com/xruby/compiler/codedom/RegexpExpressionWithExpressionSubstitution.java
rhodes-2.3.0.beta.1 platform/shared/xruby/src/com/xruby/compiler/codedom/RegexpExpressionWithExpressionSubstitution.java
rhodes-2.2.6 platform/shared/xruby/src/com/xruby/compiler/codedom/RegexpExpressionWithExpressionSubstitution.java
rhodes-2.2.6.beta.1 platform/shared/xruby/src/com/xruby/compiler/codedom/RegexpExpressionWithExpressionSubstitution.java
rhodes-2.2.5 platform/shared/xruby/src/com/xruby/compiler/codedom/RegexpExpressionWithExpressionSubstitution.java
rhodes-2.2.5.beta.3 platform/shared/xruby/src/com/xruby/compiler/codedom/RegexpExpressionWithExpressionSubstitution.java
rhodes-2.2.5.beta.2 platform/shared/xruby/src/com/xruby/compiler/codedom/RegexpExpressionWithExpressionSubstitution.java
rhodes-2.2.5.beta.1 platform/shared/xruby/src/com/xruby/compiler/codedom/RegexpExpressionWithExpressionSubstitution.java
rhodes-2.2.4.beta.1 platform/shared/xruby/src/com/xruby/compiler/codedom/RegexpExpressionWithExpressionSubstitution.java
rhodes-2.2.3 platform/shared/xruby/src/com/xruby/compiler/codedom/RegexpExpressionWithExpressionSubstitution.java