Permalink
Browse files

primitive modularization for different languages.

  • Loading branch information...
1 parent f854014 commit 3d91d611d51a82d582bd5c2699c50082eeec6e2a @yinwang0 committed Aug 1, 2011
Showing with 112 additions and 140 deletions.
  1. +6 −21 diff-cpp.ss
  2. +4 −19 diff-js.ss
  3. +1 −1 diff-s.css
  4. +3 −12 diff-scheme.ss
  5. +1 −1 nav-div.js
  6. +7 −2 parse-cpp.ss
  7. +1 −1 parse-js.ss
  8. +2 −3 parse-scheme.ss
  9. +86 −79 parsec.ss
  10. +1 −1 utils.ss
View
@@ -1,4 +1,4 @@
-;; yDiff - a language-aware tool for comparing programs
+;; ydiff - a language-aware tool for comparing programs
;; Copyright (C) 2011 Yin Wang (yinwang0@gmail.com)
;; This program is free software: you can redistribute it and/or modify
@@ -17,34 +17,17 @@
-(load "parse-cpp.ss")
-(load "diff.ss")
-
-
-;-------------------------------------------------------------
-; settings
-;-------------------------------------------------------------
-
-(define *move-ratio* 0)
-(define *move-size* 5)
-
-
-
;-------------------------------------------------------------
; overrides
;-------------------------------------------------------------
(define get-name
(lambda (node)
- (let ([id-exp
- (get-property
- (get-property
- (get-property node 'name)
- 'identifier)
- 'id)])
+ (let ([id-exp (match-tags node '(name identifier id))])
(and id-exp (get-symbol (car (Expr-elts id-exp)))))))
-; (get-name (car (parse1 $statement "int f(int x) {}")))
+;; (get-name (car (parse1 $statement "int f(int x) {}")))
+
;; (same-def? (car (parse1 $statement "int f(int x) {}"))
;; (car (parse1 $statement "int f(int x) {}")))
@@ -58,6 +41,8 @@
;---------------------------------------------
(define diff-cpp
(lambda (file1 file2)
+ (load "parse-cpp.ss")
+ (load "diff.ss")
(diff file1 file2 parse-cpp)))
View
@@ -1,4 +1,4 @@
-;; yDiff - a language-aware tool for comparing programs
+;; ydiff - a language-aware tool for comparing programs
;; Copyright (C) 2011 Yin Wang (yinwang0@gmail.com)
;; This program is free software: you can redistribute it and/or modify
@@ -16,31 +16,14 @@
-(load "parse-js.ss")
-(load "diff.ss")
-
-
-;-------------------------------------------------------------
-; settings
-;-------------------------------------------------------------
-
-(define *move-ratio* 0)
-(define *move-size* 5)
-
-
;-------------------------------------------------------------
; overrides
;-------------------------------------------------------------
(define get-name
(lambda (node)
- (let ([id-exp
- (get-property
- (get-property
- (get-property node 'name)
- 'identifier)
- 'id)])
+ (let ([id-exp (match-tags node '(name identifier id))])
(and id-exp (get-symbol (car (Expr-elts id-exp)))))))
@@ -55,6 +38,8 @@
;---------------------------------------------
(define diff-js
(lambda (file1 file2)
+ (load "parse-js.ss")
+ (load "diff.ss")
(diff file1 file2 parse-js)))
; (diff-js "tests/nav.js" "tests/nav-div.js")
View
@@ -1,4 +1,4 @@
-/* yDiff - a language-aware tool for comparing programs */
+/* ydiff - a language-aware tool for comparing programs */
/* Copyright (C) 2011 Yin Wang (yinwang0@gmail.com) */
View
@@ -1,4 +1,4 @@
-;; yDiff - a language-aware tool for comparing programs
+;; ydiff - a language-aware tool for comparing programs
;; Copyright (C) 2011 Yin Wang (yinwang0@gmail.com)
;; This program is free software: you can redistribute it and/or modify
@@ -16,17 +16,6 @@
-(load "parse-scheme.ss")
-(load "diff.ss")
-
-
-;-------------------------------------------------------------
-; settings
-;-------------------------------------------------------------
-
-(define *move-ratio* 0)
-(define *move-size* 5)
-
;-------------------------------------------------------------
; overrides
@@ -99,6 +88,8 @@
;-----------------------------------------
(define diff-scheme
(lambda (file1 file2)
+ (load "parse-scheme.ss")
+ (load "diff.ss")
(diff file1 file2 parse-scheme)))
View
@@ -1,4 +1,4 @@
-// yDiff - a language-aware tool for comparing programs
+// ydiff - a language-aware tool for comparing programs
// Copyright (C) 2011 Yin Wang (yinwang0@gmail.com)
View
@@ -1,4 +1,4 @@
-;; yDiff - a language-aware tool for comparing programs
+;; ydiff - a language-aware tool for comparing programs
;; Copyright (C) 2011 Yin Wang (yinwang0@gmail.com)
;; This program is free software: you can redistribute it and/or modify
@@ -17,6 +17,12 @@
(load "parsec.ss")
+
+
+;-------------------------------------------------------------
+; scanner settings
+;-------------------------------------------------------------
+
(define *delims* (list "(" ")" "[" "]" "{" "}" "," "`" ";" "#"))
(define *operators*
@@ -30,7 +36,6 @@
"^" "|" "&" "~"
))
-;;---------------- parameters for the scanner ---------------
(define *line-comment* (list "//"))
(define *comment-start* "/*")
(define *comment-end* "*/")
View
@@ -1,4 +1,4 @@
-;; yDiff - a language-aware tool for comparing programs
+;; ydiff - a language-aware tool for comparing programs
;; Copyright (C) 2011 Yin Wang (yinwang0@gmail.com)
;; This program is free software: you can redistribute it and/or modify
View
@@ -1,4 +1,4 @@
-;; yDiff - a language-aware tool for comparing programs
+;; ydiff - a language-aware tool for comparing programs
;; Copyright (C) 2011 Yin Wang (yinwang0@gmail.com)
;; This program is free software: you can redistribute it and/or modify
@@ -25,9 +25,8 @@
; single quote is considered a delimeter in s-expression
(define *delims* (list "(" ")" "[" "]" "{" "}" "'" "`" "," ))
-
(define *line-comment* (list ";"))
-(define *comment-start* "") ; no block comments for lisp
+(define *comment-start* "")
(define *comment-end* "")
(define *operators* '())
(define *quotation-marks* '(#\"))
Oops, something went wrong. Retry.

0 comments on commit 3d91d61

Please sign in to comment.