Add a basic Go parser

pull/25/head
Wilfred Hughes 2021-07-25 23:46:33 +07:00
parent e6693d2204
commit 7701e38510
2 changed files with 25 additions and 0 deletions

@ -7,6 +7,8 @@ Fixed handling of `@`, `<` and `>` in elisp.
Fixed crash on binary files. Difftastic now simply shows "binary" for
files that don't look like text.
Added a basic Go parser.
### Diffing
Fixed an issue where comment replacements were not detected.

@ -170,3 +170,26 @@ comment_patterns = [
]
open_delimiter_pattern = '(\[|\{|\()'
close_delimiter_pattern = '(\]|\}|\))'
[Go]
extensions = ["go"]
atom_patterns = [
# Numbers
'[0-9]+',
# Symbols (e.g. variable names)
'[a-zA-Z0-9_]+!?',
# Two character operators
'(!=|:=|&&|\|\|)',
# Single character operators
'[.;:,=&!*+-]',
# Double-quoted strings
'"((\\.)|[^"])*"',
]
comment_patterns = [
# Single line comments
'//.*(\n|$)',
# Multi-line comments
'/\*(?s:.)*?\*/',
]
open_delimiter_pattern = '\[|\{|\('
close_delimiter_pattern = '\]|\}|\)'