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-7.6.0 platform/shared/xruby/src/com/xruby/compiler/codedom/RegexpExpressionWithExpressionSubstitution.java
rhodes-7.5.1 platform/shared/xruby/src/com/xruby/compiler/codedom/RegexpExpressionWithExpressionSubstitution.java
rhodes-7.4.1 platform/shared/xruby/src/com/xruby/compiler/codedom/RegexpExpressionWithExpressionSubstitution.java
rhodes-7.1.17 platform/shared/xruby/src/com/xruby/compiler/codedom/RegexpExpressionWithExpressionSubstitution.java
rhodes-6.2.0 platform/shared/xruby/src/com/xruby/compiler/codedom/RegexpExpressionWithExpressionSubstitution.java
rhodes-6.0.11 platform/shared/xruby/src/com/xruby/compiler/codedom/RegexpExpressionWithExpressionSubstitution.java
rhodes-5.5.18 platform/shared/xruby/src/com/xruby/compiler/codedom/RegexpExpressionWithExpressionSubstitution.java
rhodes-5.5.17 platform/shared/xruby/src/com/xruby/compiler/codedom/RegexpExpressionWithExpressionSubstitution.java
rhodes-5.5.15 platform/shared/xruby/src/com/xruby/compiler/codedom/RegexpExpressionWithExpressionSubstitution.java
rhodes-5.5.0.22 platform/shared/xruby/src/com/xruby/compiler/codedom/RegexpExpressionWithExpressionSubstitution.java
rhodes-5.5.2 platform/shared/xruby/src/com/xruby/compiler/codedom/RegexpExpressionWithExpressionSubstitution.java
rhodes-5.5.0.7 platform/shared/xruby/src/com/xruby/compiler/codedom/RegexpExpressionWithExpressionSubstitution.java
rhodes-5.5.0.3 platform/shared/xruby/src/com/xruby/compiler/codedom/RegexpExpressionWithExpressionSubstitution.java
rhodes-5.5.0 platform/shared/xruby/src/com/xruby/compiler/codedom/RegexpExpressionWithExpressionSubstitution.java
tauplatform-1.0.3 platform/shared/xruby/src/com/xruby/compiler/codedom/RegexpExpressionWithExpressionSubstitution.java
tauplatform-1.0.2 platform/shared/xruby/src/com/xruby/compiler/codedom/RegexpExpressionWithExpressionSubstitution.java
tauplatform-1.0.1 platform/shared/xruby/src/com/xruby/compiler/codedom/RegexpExpressionWithExpressionSubstitution.java
rhodes-3.5.1.12 platform/shared/xruby/src/com/xruby/compiler/codedom/RegexpExpressionWithExpressionSubstitution.java
rhodes-3.3.5 platform/shared/xruby/src/com/xruby/compiler/codedom/RegexpExpressionWithExpressionSubstitution.java
rhodes-3.4.2 platform/shared/xruby/src/com/xruby/compiler/codedom/RegexpExpressionWithExpressionSubstitution.java