Package org.jruby.ast

Examples of org.jruby.ast.RegexpNode


        context.issueRedoEvent();
    }

    public void compileRegexp(Node node, BodyCompiler context) {
        RegexpNode reNode = (RegexpNode) node;

        context.createNewRegexp(reNode.getValue(), reNode.getOptions());
    }
View Full Code Here


                lexer.getPosition();
                return ' ';
            }
           
            if ((flags & RubyYaccLexer.STR_FUNC_REGEXP) != 0) {
                lexer.setValue(new RegexpNode(src.getPosition(), ByteList.create(""), parseRegexpFlags(src)));
                return Tokens.tREGEXP_END;
            }
           
            lexer.setValue(new Token("\"", lexer.getPosition()));
            return Tokens.tSTRING_END;
View Full Code Here

  {
      int options = ((RegexpNode)yyVals[0+yyTop]).getOptions();
      Node node = ((Node)yyVals[-1+yyTop]);

      if (node == null) {
                      yyVal = new RegexpNode(getPosition(((Token)yyVals[-2+yyTop])), ByteList.create(""), options & ~ReOptions.RE_OPTION_ONCE);
      } else if (node instanceof StrNode) {
                      yyVal = new RegexpNode(((Node)yyVals[-1+yyTop]).getPosition(), (ByteList) ((StrNode) node).getValue().clone(), options & ~ReOptions.RE_OPTION_ONCE);
      } else if (node instanceof DStrNode) {
                      yyVal = new DRegexpNode(getPosition(((Token)yyVals[-2+yyTop])), (DStrNode) node, options, (options & ReOptions.RE_OPTION_ONCE) != 0);
      } else {
          yyVal = new DRegexpNode(getPosition(((Token)yyVals[-2+yyTop])), options, (options & ReOptions.RE_OPTION_ONCE) != 0).add(node);
                  }
View Full Code Here

        visitor.flushStream();
        return out.getBuffer().toString();
    }

    public void testVisitRegexpNode() {
        RegexpNode n = new RegexpNode(new IDESourcePosition("", 0, 0, 2, 4), ByteList.create(".*"), 0);
        assertEquals("/.*/", visitNode(n));
    }
View Full Code Here

        // TODO: don't require pop
        if (!expr) context.consumeCurrentValue();
    }

    public void compileRegexp(Node node, BodyCompiler context, boolean expr) {
        RegexpNode reNode = (RegexpNode) node;

        if (expr) context.createNewRegexp(reNode.getValue(), reNode.getOptions().toEmbeddedOptions());
    }
View Full Code Here

            if ((flags & RubyYaccLexer.STR_FUNC_REGEXP) != 0) {
                RegexpOptions options = parseRegexpFlags(src);
                ByteList regexpBytelist = ByteList.create("");

                lexer.setValue(new RegexpNode(src.getPosition(), regexpBytelist, options));
                return Tokens.tREGEXP_END;
            }

            lexer.setValue(new Token("\"", lexer.getPosition()));
            return Tokens.tSTRING_END;
View Full Code Here

        boolean is19 = !lexer.isOneEight();

        if (contents == null) {
            ByteList newValue = ByteList.create("");
            regexpFragmentCheck(end, newValue);
            return new RegexpNode(position, newValue, options.withoutOnce());
        } else if (contents instanceof StrNode) {
            ByteList meat = (ByteList) ((StrNode) contents).getValue().clone();
            regexpFragmentCheck(end, meat);
            checkRegexpSyntax(meat, options.withoutOnce());
            return new RegexpNode(contents.getPosition(), meat, options.withoutOnce());
        } else if (contents instanceof DStrNode) {
            DStrNode dStrNode = (DStrNode) contents;

            for (Node fragment: dStrNode.childNodes()) {
                if (fragment instanceof StrNode) {
View Full Code Here

            if ((flags & RubyYaccLexer.STR_FUNC_REGEXP) != 0) {
                RegexpOptions options = parseRegexpFlags(src);
                ByteList regexpBytelist = ByteList.create("");

                lexer.setValue(new RegexpNode(src.getPosition(), regexpBytelist, options));
                return Tokens.tREGEXP_END;
            }

            lexer.setValue(new Token("\"", lexer.getPosition()));
            return Tokens.tSTRING_END;
View Full Code Here

            if ((flags & RubyLexer.STR_FUNC_REGEXP) != 0) {
                RegexpOptions options = parseRegexpFlags(lexer, src);
                ByteList regexpBytelist = ByteList.create("");

                lexer.setValue(new RegexpNode(src.getPosition(), regexpBytelist, options));
                return Tokens.tREGEXP_END;
            }

            lexer.setValue("" + end);
            return Tokens.tSTRING_END;
View Full Code Here

TOP

Related Classes of org.jruby.ast.RegexpNode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.