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.0.0.beta7 platform/shared/xruby/src/com/xruby/compiler/codedom/RegexpExpressionWithExpressionSubstitution.java
rhodes-2.0.0.beta6 platform/shared/xruby/src/com/xruby/compiler/codedom/RegexpExpressionWithExpressionSubstitution.java
rhodes-2.0.0.beta4 platform/shared/xruby/src/com/xruby/compiler/codedom/RegexpExpressionWithExpressionSubstitution.java
rhodes-2.0.0.beta3 platform/shared/xruby/src/com/xruby/compiler/codedom/RegexpExpressionWithExpressionSubstitution.java
rhodes-1.5.5 platform/shared/xruby/src/com/xruby/compiler/codedom/RegexpExpressionWithExpressionSubstitution.java
rhodes-2.0.0.beta2 platform/shared/xruby/src/com/xruby/compiler/codedom/RegexpExpressionWithExpressionSubstitution.java
rhodes-2.0.0.beta1 platform/shared/xruby/src/com/xruby/compiler/codedom/RegexpExpressionWithExpressionSubstitution.java
rhodes-1.5.4 platform/shared/xruby/src/com/xruby/compiler/codedom/RegexpExpressionWithExpressionSubstitution.java
rhodes-1.5.3 platform/shared/xruby/src/com/xruby/compiler/codedom/RegexpExpressionWithExpressionSubstitution.java
rhodes-1.5.2 platform/shared/xruby/src/com/xruby/compiler/codedom/RegexpExpressionWithExpressionSubstitution.java
rhodes-1.5.1 platform/shared/xruby/src/com/xruby/compiler/codedom/RegexpExpressionWithExpressionSubstitution.java
rhodes-1.5.0 platform/shared/xruby/src/com/xruby/compiler/codedom/RegexpExpressionWithExpressionSubstitution.java
rhodes-1.4.2 platform/shared/xruby/src/com/xruby/compiler/codedom/RegexpExpressionWithExpressionSubstitution.java
rhodes-1.4.1 platform/shared/xruby/src/com/xruby/compiler/codedom/RegexpExpressionWithExpressionSubstitution.java
rhodes-1.4.0 platform/shared/xruby/src/com/xruby/compiler/codedom/RegexpExpressionWithExpressionSubstitution.java