Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds Scheme Rules #185

Merged
merged 3 commits into from
Dec 14, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ There is currently basic support for the following languages:
* Ruby
* Rust
* Scala
* Scheme
* Swift

If you have any issues with the existing languages, or you want support for another one, then please [open an issue](https://github.com/jacktasia/dumb-jump/issues). PRs are also welcome. If you'd like to add a language these PRs for [lua](https://github.com/jacktasia/dumb-jump/pull/33) and [rust](https://github.com/jacktasia/dumb-jump/pull/57) are good examples.
Expand Down
44 changes: 42 additions & 2 deletions dumb-jump.el
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,42 @@ or most optimal searcher."
:tests ("(defun blah (test)" "(defun blah (test blah)" "(defun (blah test)")
:not ("(defun blah (test-1)" "(defun blah (test-2 blah)" "(defun (blah test-3)"))

;; scheme
(:type "function" :supports ("ag" "grep" "rg" "git-grep") :language "scheme"
:regex "\\\(define\\s+\\(\\s*JJJ\\j"
:tests ("(define (test blah)" "(define (test\n")
:not ("(define test blah" "(define (test-asdf blah)" "(define test (lambda (blah"))

(:type "function" :supports ("ag" "grep" "rg" "git-grep") :language "scheme"
:regex "\\\(define\\s+JJJ\\s*\\\(\\s*lambda"
:tests ("(define test (lambda (blah" "(define test (lambda\n")
:not ("(define test blah" "(define test-asdf (lambda (blah)" "(define (test)" "(define (test blah) (lambda (foo"))

(:type "function" :supports ("ag" "grep" "rg" "git-grep") :language "scheme"
:regex "\\\(let\\s+JJJ\\s*(\\\(|\\\[)*"
:tests ("(let test ((blah foo) (bar bas))" "(let test\n" "(let test [(foo")
:not ("(let ((test blah"))

(:type "variable" :supports ("ag" "grep" "rg" "git-grep") :language "scheme"
:regex "\\\(define\\s+JJJ\\j"
:tests ("(define test " "(define test\n")
:not ("(define (test"))

(:type "variable" :supports ("ag" "grep" "rg" "git-grep") :language "scheme"
:regex "(\\\(|\\\[)\\s*JJJ\\s+"
:tests ("(let ((test 'foo" "(let [(test 'foo" "(let [(test 'foo" "(let [[test 'foo" "(let ((blah 'foo) (test 'bar)")
:not ("{test foo"))

(:type "variable" :supports ("ag" "grep" "rg" "git-grep") :language "scheme"
:regex "\\\(lambda\\s+\\\(?[^\(\)]*\\s*JJJ\\j\\s*\\\)?"
:tests ("(lambda (test)" "(lambda (foo test)" "(lambda test (foo)")
:not ("(lambda () test"))

(:type "variable" :supports ("ag" "grep" "rg" "git-grep") :language "scheme"
:regex "\\\(define\\s+\\\([^\(\)]+\\s*JJJ\\j\\s*\\\)?"
:tests ("(define (foo test)" "(define (foo test bar)")
:not ("(define foo test" "(define (test foo" "(define (test)"))

;; c++
(:type "function" :supports ("ag" "rg" "git-grep") :language "c++"
:regex "\\bJJJ(\\s|\\))*\\((\\w|[,&*.<>]|\\s)*(\\))\\s*(const|->|\\{|$)|typedef\\s+(\\w|[(*]|\\s)+JJJ(\\)|\\s)*\\("
Expand Down Expand Up @@ -664,7 +700,7 @@ or most optimal searcher."
:regex "macro\\s*JJJ\\("
:tests ("macro test(a)=1" " macro test(a,b)=1*8"))

(:type "variable" :supports ("ag" "rg") :language "julia"
(:type "variable" :supports ("ag" "rg") :language "julia"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Er, this was me habitually removing trailing whitespace when Emacs tells me to.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No worries. It should be gone anyway. Thanks!

:regex "const\\s+JJJ\\b"
:tests ("const test = "))

Expand Down Expand Up @@ -998,6 +1034,8 @@ or most optimal searcher."
(:language "rust" :ext "rs" :agtype "rust" :rgtype "rust")
(:language "scala" :ext "scala" :agtype "scala" :rgtype "scala")
(:language "scheme" :ext "scm" :agtype "scheme" :rgtype "lisp")
(:language "scheme" :ext "ss" :agtype "scheme" :rgtype "lisp")
(:language "scheme" :ext "sld" :agtype "scheme" :rgtype "lisp")
(:language "shell" :ext "sh" :agtype nil :rgtype nil)
(:language "shell" :ext "bash" :agtype nil :rgtype nil)
(:language "shell" :ext "csh" :agtype nil :rgtype nil)
Expand Down Expand Up @@ -1028,7 +1066,9 @@ or most optimal searcher."
(:language "javascript" :type "variable" :right "^;" :left nil)
(:language "perl" :type "function" :right "^(" :left nil)
(:language "elisp" :type "function" :right nil :left "($")
(:language "elisp" :type "variable" :right "^)" :left nil))
(:language "elisp" :type "variable" :right "^)" :left nil)
(:language "scheme" :type "function" :right nil :left "($")
(:language "scheme" :type "variable" :right "^)" :left nil))

"List of under points contexts for each language.
This helps limit the number of regular expressions we use
Expand Down