use of java.util.regex.Pattern in project jimfs by google.
the class PathNormalizationTest method assertNormalizedPatternMatches.
/**
* Asserts that the given strings match when one is compiled as a regex pattern using the current
* normalizer and matched against the other.
*/
private void assertNormalizedPatternMatches(String first, String second) {
Pattern pattern = PathNormalization.compilePattern(first, normalizations);
assertTrue("pattern '" + pattern + "' does not match '" + second + "'", pattern.matcher(second).matches());
pattern = PathNormalization.compilePattern(second, normalizations);
assertTrue("pattern '" + pattern + "' does not match '" + first + "'", pattern.matcher(first).matches());
}
use of java.util.regex.Pattern in project binnavi by google.
the class CBlockGenerator method createExpression.
@Override
public IFilterExpression<CViewWrapper> createExpression(final String text) {
final Pattern pattern = Pattern.compile(RULE_REGEX);
final Matcher matcher = pattern.matcher(text);
matcher.matches();
final FilterRelation predicate = FilterRelation.parse(matcher.group(1));
final String value = matcher.group(2);
return new CBlockFilterExpression(predicate, Long.valueOf(value));
}
use of java.util.regex.Pattern in project binnavi by google.
the class CEdgeGenerator method createExpression.
@Override
public IFilterExpression<CViewWrapper> createExpression(final String text) {
final Pattern pattern = Pattern.compile(RULE_REGEX);
final Matcher matcher = pattern.matcher(text);
matcher.matches();
final FilterRelation predicate = FilterRelation.parse(matcher.group(1));
final String value = matcher.group(2);
return new CEdgeFilterExpression(predicate, Long.valueOf(value));
}
use of java.util.regex.Pattern in project binnavi by google.
the class CModuleGenerator method createExpression.
@Override
public IFilterExpression<CAddressSpaceWrapper> createExpression(final String text) {
final Pattern pattern = Pattern.compile(RULE_REGEX);
final Matcher matcher = pattern.matcher(text);
matcher.matches();
final FilterRelation predicate = FilterRelation.parse(matcher.group(1));
final String value = matcher.group(2);
return new CModuleFilterExpression(predicate, Long.valueOf(value));
}
use of java.util.regex.Pattern in project binnavi by google.
the class ARMBaseTranslator method translateCondition.
private void translateCondition(final ITranslationEnvironment environment, final IInstruction instruction, final String prefix, final List<ReilInstruction> instructions, final int nopIndex) throws InternalTranslationException {
final long baseOffset = ReilHelpers.nextReilAddress(instruction, instructions);
// check if instruction is conditional
final Pattern condPattern = Pattern.compile(prefix + "(AL|CC|LO|CS|HS|EQ|GE|GT|HI|LE|LS|LT|MI|NE|NV|PL|VC|VS).{0,2}$");
final Matcher condMatcher = condPattern.matcher(instruction.getMnemonic());
if (condMatcher.matches()) {
// conditional execution is found call condition generator
final String jmpGoal = String.format("%d.%d", instruction.getAddress().toLong(), nopIndex);
ConditionGenerator.generate(baseOffset, environment, instruction, instructions, condMatcher.group(1), jmpGoal);
}
}
Aggregations