PageRenderTime 224ms CodeModel.GetById 121ms app.highlight 1ms RepoModel.GetById 101ms app.codeStats 0ms

/diff-cpp.ss

http://github.com/yinwang0/ydiff
Scheme | 56 lines | 10 code | 22 blank | 24 comment | 0 complexity | a4591b2c8bfefe6b4f116104c57b7f05 MD5 | raw file
 1;; ydiff - a language-aware tool for comparing programs
 2;; Copyright (C) 2011 Yin Wang (yinwang0@gmail.com)
 3
 4;; This program is free software: you can redistribute it and/or modify
 5;; it under the terms of the GNU General Public License as published by
 6;; the Free Software Foundation, either version 3 of the License, or
 7;; (at your option) any later version.
 8
 9;; This program is distributed in the hope that it will be useful,
10;; but WITHOUT ANY WARRANTY; without even the implied warranty of
11;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12;; GNU General Public License for more details.
13
14;; You should have received a copy of the GNU General Public License
15;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
16
17
18
19(load "parse-cpp.ss")
20(load "diff.ss")
21
22
23
24;-------------------------------------------------------------
25;                      overrides
26;-------------------------------------------------------------
27
28(define get-name
29  (lambda (node)
30    (let ([id-exp (match-tags node '(name identifier id))])
31      (and id-exp (get-symbol (car (Expr-elts id-exp)))))))
32
33;; (get-name (car (parse1 $statement "int f(int x) {}")))
34
35
36;; (same-def? (car (parse1 $statement "int f(int x) {}"))
37;;            (car (parse1 $statement "int f(int x) {}")))
38
39
40;; (different-def? (car (parse1 $statement "int f(int x) {}"))
41;;                 (car (parse1 $statement "int g(int x) {}")))
42
43
44
45;---------------------------------------------
46(define diff-cpp
47  (lambda (file1 file2)
48    (load "diff-cpp.ss")
49    (diff file1 file2 parse-cpp)))
50
51
52
53;---------------------------------------------
54; (diff-cpp "tests/simulator-mips.cc" "tests/simulator-arm.cc")
55; (diff-cpp "tests/d8-3404.cc" "tests/d8-8424.cc")
56