Java 类jdk.nashorn.internal.runtime.regexp.RegExpFactory 实例源码

项目:openjdk-jdk10    文件:JdkRegExpTest.java   
/**
 * Compile a regular expression using the JDK implementation
 */
@Test
public void testMatcher() {
    final RegExp regexp = new RegExpFactory().compile("f(o)o", "");
    final RegExpMatcher matcher = regexp.match("foo");
    assertNotNull(matcher);
    assertTrue(matcher.search(0));
    assertEquals(matcher.getInput(), "foo");
    assertEquals(matcher.groupCount(), 1);
    assertEquals(matcher.group(), "foo");
    assertEquals(matcher.start(), 0);
    assertEquals(matcher.end(), 3);
    assertEquals(matcher.group(1), "o");
    assertEquals(matcher.start(1), 1);
    assertEquals(matcher.end(1), 2);
}
项目:openjdk9    文件:JdkRegExpTest.java   
/**
 * Compile a regular expression using the JDK implementation
 */
@Test
public void testMatcher() {
    final RegExp regexp = new RegExpFactory().compile("f(o)o", "");
    final RegExpMatcher matcher = regexp.match("foo");
    assertNotNull(matcher);
    assertTrue(matcher.search(0));
    assertEquals(matcher.getInput(), "foo");
    assertEquals(matcher.groupCount(), 1);
    assertEquals(matcher.group(), "foo");
    assertEquals(matcher.start(), 0);
    assertEquals(matcher.end(), 3);
    assertEquals(matcher.group(1), "o");
    assertEquals(matcher.start(1), 1);
    assertEquals(matcher.end(1), 2);
}
项目:kaziranga    文件:JdkRegExpTest.java   
/**
 * Compile a regular expression using the JDK implementation
 */
@Test
public void testMatcher() {
    final RegExp regexp = new RegExpFactory().compile("f(o)o", "");
    final RegExpMatcher matcher = regexp.match("foo");
    assertNotNull(matcher);
    assertTrue(matcher.search(0));
    assertEquals(matcher.getInput(), "foo");
    assertEquals(matcher.groupCount(), 1);
    assertEquals(matcher.group(), "foo");
    assertEquals(matcher.start(), 0);
    assertEquals(matcher.end(), 3);
    assertEquals(matcher.group(1), "o");
    assertEquals(matcher.start(1), 1);
    assertEquals(matcher.end(1), 2);
}
项目:lookaside_java-1.8.0-openjdk    文件:JdkRegExpTest.java   
/**
 * Compile a regular expression using the JDK implementation
 */
@Test
public void testMatcher() {
    final RegExp regexp = new RegExpFactory().compile("f(o)o", "");
    final RegExpMatcher matcher = regexp.match("foo");
    assertNotNull(matcher);
    assertTrue(matcher.search(0));
    assertEquals(matcher.getInput(), "foo");
    assertEquals(matcher.groupCount(), 1);
    assertEquals(matcher.group(), "foo");
    assertEquals(matcher.start(), 0);
    assertEquals(matcher.end(), 3);
    assertEquals(matcher.group(1), "o");
    assertEquals(matcher.start(1), 1);
    assertEquals(matcher.end(1), 2);
}
项目:jdk8u_nashorn    文件:JdkRegExpTest.java   
/**
 * Compile a regular expression using the JDK implementation
 */
@Test
public void testMatcher() {
    final RegExp regexp = new RegExpFactory().compile("f(o)o", "");
    final RegExpMatcher matcher = regexp.match("foo");
    assertNotNull(matcher);
    assertTrue(matcher.search(0));
    assertEquals(matcher.getInput(), "foo");
    assertEquals(matcher.groupCount(), 1);
    assertEquals(matcher.group(), "foo");
    assertEquals(matcher.start(), 0);
    assertEquals(matcher.end(), 3);
    assertEquals(matcher.group(1), "o");
    assertEquals(matcher.start(1), 1);
    assertEquals(matcher.end(1), 2);
}
项目:OpenJSharp    文件:NativeRegExp.java   
NativeRegExp(final String input, final String flagString, final Global global) {
    this(global);
    try {
        this.regexp = RegExpFactory.create(input, flagString);
    } catch (final ParserException e) {
        // translate it as SyntaxError object and throw it
        e.throwAsEcmaException();
        throw new AssertionError(); //guard against null warnings below
    }

    this.setLastIndex(0);
}
项目:openjdk-jdk10    文件:NativeRegExp.java   
NativeRegExp(final String input, final String flagString, final Global global, final ScriptObject proto) {
    super(proto, $nasgenmap$);
    try {
        this.regexp = RegExpFactory.create(input, flagString);
    } catch (final ParserException e) {
        // translate it as SyntaxError object and throw it
        e.throwAsEcmaException();
        throw new AssertionError(); //guard against null warnings below
    }
    this.globalObject = global;
    this.setLastIndex(0);
}
项目:openjdk9    文件:NativeRegExp.java   
NativeRegExp(final String input, final String flagString, final Global global, final ScriptObject proto) {
    super(proto, $nasgenmap$);
    try {
        this.regexp = RegExpFactory.create(input, flagString);
    } catch (final ParserException e) {
        // translate it as SyntaxError object and throw it
        e.throwAsEcmaException();
        throw new AssertionError(); //guard against null warnings below
    }
    this.globalObject = global;
    this.setLastIndex(0);
}
项目:kaziranga    文件:NativeRegExp.java   
NativeRegExp(final String input, final String flagString, final Global global, final ScriptObject proto) {
    super(proto, $nasgenmap$);
    try {
        this.regexp = RegExpFactory.create(input, flagString);
    } catch (final ParserException e) {
        // translate it as SyntaxError object and throw it
        e.throwAsEcmaException();
        throw new AssertionError(); //guard against null warnings below
    }
    this.globalObject = global;
    this.setLastIndex(0);
}
项目:lookaside_java-1.8.0-openjdk    文件:NativeRegExp.java   
NativeRegExp(final String input, final String flagString, final Global global, final ScriptObject proto) {
    super(proto, $nasgenmap$);
    try {
        this.regexp = RegExpFactory.create(input, flagString);
    } catch (final ParserException e) {
        // translate it as SyntaxError object and throw it
        e.throwAsEcmaException();
        throw new AssertionError(); //guard against null warnings below
    }
    this.globalObject = global;
    this.setLastIndex(0);
}
项目:jdk8u_nashorn    文件:NativeRegExp.java   
NativeRegExp(final String input, final String flagString, final Global global, final ScriptObject proto) {
    super(proto, $nasgenmap$);
    try {
        this.regexp = RegExpFactory.create(input, flagString);
    } catch (final ParserException e) {
        // translate it as SyntaxError object and throw it
        e.throwAsEcmaException();
        throw new AssertionError(); //guard against null warnings below
    }
    this.globalObject = global;
    this.setLastIndex(0);
}
项目:infobip-open-jdk-8    文件:NativeRegExp.java   
NativeRegExp(final String input, final String flagString, final Global global) {
    this(global);
    try {
        this.regexp = RegExpFactory.create(input, flagString);
    } catch (final ParserException e) {
        // translate it as SyntaxError object and throw it
        e.throwAsEcmaException();
        throw new AssertionError(); //guard against null warnings below
    }

    this.setLastIndex(0);
}
项目:OLD-OpenJDK8    文件:NativeRegExp.java   
NativeRegExp(final String input, final String flagString, final Global global) {
    this(global);
    try {
        this.regexp = RegExpFactory.create(input, flagString);
    } catch (final ParserException e) {
        // translate it as SyntaxError object and throw it
        e.throwAsEcmaException();
        throw new AssertionError(); //guard against null warnings below
    }

    this.setLastIndex(0);
}
项目:nashorn-backport    文件:NativeRegExp.java   
NativeRegExp(final String input, final String flagString, final Global global) {
    this(global);
    try {
        this.regexp = RegExpFactory.create(input, flagString);
    } catch (final ParserException e) {
        // translate it as SyntaxError object and throw it
        e.throwAsEcmaException();
        throw new AssertionError(); //guard against null warnings below
    }

    this.setLastIndex(0);
}
项目:nashorn    文件:NativeRegExp.java   
NativeRegExp(final String input, final String flagString, final Global global) {
    this(global);
    try {
        this.regexp = RegExpFactory.create(input, flagString);
    } catch (final ParserException e) {
        // translate it as SyntaxError object and throw it
        e.throwAsEcmaException();
        throw new AssertionError(); //guard against null warnings below
    }

    this.setLastIndex(0);
}