-
-
Notifications
You must be signed in to change notification settings - Fork 162
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: move to JSON-formatted tests
- Loading branch information
Showing
13 changed files
with
213 additions
and
130 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package code | ||
|
||
import ( | ||
"regexp" | ||
|
||
"github.com/smacker/go-tree-sitter/golang" | ||
) | ||
|
||
func Go() *Language { | ||
return &Language{ | ||
Delims: regexp.MustCompile(`//\s?|/\*\s?|\s?\*/`), | ||
Parser: golang.GetLanguage(), | ||
Query: `(comment)+ @comment`, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package code | ||
|
||
import ( | ||
"regexp" | ||
|
||
"github.com/smacker/go-tree-sitter/python" | ||
) | ||
|
||
func Python() *Language { | ||
return &Language{ | ||
Delims: regexp.MustCompile(`#\s?`), | ||
Parser: python.GetLanguage(), | ||
Query: `(comment)+ @comment`, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package code | ||
|
||
import ( | ||
"regexp" | ||
|
||
"github.com/smacker/go-tree-sitter/rust" | ||
) | ||
|
||
func Rust() *Language { | ||
return &Language{ | ||
Delims: regexp.MustCompile(`/{2,3}\s?`), | ||
Parser: rust.GetLanguage(), | ||
Query: `(line_comment)+ @comment`, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package code | ||
|
||
import "encoding/json" | ||
|
||
func toJSON(comments []Comment) string { | ||
j, _ := json.MarshalIndent(comments, "", " ") | ||
return string(j) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.