-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refine the code for handling JavaScript.
- Loading branch information
Showing
15 changed files
with
197 additions
and
236 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
99 changes: 0 additions & 99 deletions
99
src/main/java/jp/vmi/selenium/selenese/mutator/CompoundMutator.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
src/main/java/jp/vmi/selenium/selenese/mutator/MutatorUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package jp.vmi.selenium.selenese.mutator; | ||
|
||
import java.util.regex.Matcher; | ||
import java.util.regex.Pattern; | ||
|
||
/** | ||
* Utilities for mutator. | ||
*/ | ||
public final class MutatorUtils { | ||
|
||
private MutatorUtils() { | ||
// no operation. | ||
} | ||
|
||
private static final Pattern RE = Pattern.compile("\\G\\s*(?:(\\w+)|(\\W))"); | ||
|
||
/** | ||
* Generate the pattern for testing presence of the code. | ||
* | ||
* @param code code. | ||
* @return pattern for testing. | ||
*/ | ||
public static Pattern generatePatternForCodePresence(String code) { | ||
StringBuilder pattern = new StringBuilder(code.length() * 2); | ||
Matcher matcher = RE.matcher(code); | ||
while (matcher.find()) { | ||
if (pattern.length() != 0) | ||
pattern.append("\\s*"); | ||
String symbol = matcher.group(1); | ||
if (symbol != null) | ||
pattern.append(symbol); | ||
else | ||
pattern.append(Pattern.quote(matcher.group(2))); | ||
} | ||
return Pattern.compile(pattern.toString()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.