Closed cagdasgerede closed 7 years ago
Extend Demo2.java with
// Get Result.mapping -> int pairs
// Convert those pairs to (via MappingUtil):
// <Type, src position, target position,
// source label, target label>
// where type is enum {insert, delete, change, no change}
// For each tuple:
// ParseTreeWrapper nodeInOriginal = sourceParseTree.nodeAt(srcPos)
// ParseTreeWrapper nodeInUpdated = targetParseTree.nodeAt(targetPos)
// dataExtractionContext.sourceParser(sourceParseTree.parser())
// .targetParser(targetParseTree.parser())
// Pattern pattern = PatternRegistry.match(dataExtractionContext,
// nodeInOriginal,
// nodeInUpdated)
// assertNotNull(pattern)
// view = pattern.viewTemplate().generateView(dataExtractionContext,
// nodeInOrigianl,
// nodeInUpdated)
// System.out.println(view)
<Type, src position, target position, source label, target label> where type is enum {insert, delete, change, no change}
Get a list of mappings as above
Build mappings by hand 1->1, 2->2,..., 37->37 : No change 32 -> 32: change from param to paramNew
Build ParseCaches from source code, target code (use Demo2 as reference)
Implement Pattern and PatternMatcher
Write test that gives 2 caches, difference mapping, pattern registry to pattern matcher so that the matcher produces the desired view.