author | Lorenzo Bettini <bettini@dsi.unifi.it> | 2015年03月28日 10:49:49 +0100 |
---|---|---|
committer | Lorenzo Bettini <bettini@dsi.unifi.it> | 2015年03月28日 10:49:49 +0100 |
commit | c1ac69c55c03c2f763e901b2ea68d51be7d10b0b (patch) | |
tree | 693a83116e4fb1ebcb210191f890924446974b7d | |
parent | 3c074cd1b6678c9af85369100d9aa45ebb5c2ec3 (diff) | |
download | src-highlite-c1ac69c55c03c2f763e901b2ea68d51be7d10b0b.tar.gz |
-rw-r--r-- | THANKS | 1 | ||||
-rw-r--r-- | src/Makefile.am | 2 | ||||
-rw-r--r-- | src/go.lang | 35 | ||||
-rw-r--r-- | src/lang.map | 3 | ||||
-rw-r--r-- | tests/Makefile.am | 7 | ||||
-rw-r--r-- | tests/lang.list | 1 | ||||
-rw-r--r-- | tests/test.go | 13 | ||||
-rw-r--r-- | tests/test.go.html | 18 |
@@ -42,6 +42,7 @@ Maxim Dementiev Osvaldo Pinali Doederlein Kaloian Doganov Paul Dubuc +Peter Eisentraut Andrea Ercolino Oliver Fischer Richard Freedman diff --git a/src/Makefile.am b/src/Makefile.am index 6440c9d..27b2364 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -85,7 +85,7 @@ manifest.lang asm.lang todo.lang applescript.lang \ vbscript.lang awk.lang bat.lang clipper.lang cobol.lang d.lang \ errors.lang erlang.lang proto.lang vala.lang lisp.lang islisp.lang \ scheme.lang po.lang opa.lang javalog.lang upc.lang tml.lang \ -lilypond.lang coffeescript.lang \ +lilypond.lang coffeescript.lang go.lang \ r.lang s.lang LANGFILES_NOTTOCHECK= \ diff --git a/src/go.lang b/src/go.lang new file mode 100644 index 0000000..dadb10f --- /dev/null +++ b/src/go.lang @@ -0,0 +1,35 @@ +# see http://golang.org/ref/spec + +include "c_comment.lang" + +label = '^[[:blank:]]*[[:alnum:]]+:[[:blank:]]*\z' + +(keyword,normal,classname) = + `(\<(?:interface|struct))([[:blank:]]+)([[:alnum:]_]+)` + +environment string delim "\"" "\"" escape "\\" begin + specialchar = '\\.' +end +environment string delim "'" "'" escape "\\" begin + specialchar = '\\.' +end +string delim "`" "`" multiline + +keyword = "break|case|chan|const|continue|default|defer|else|fallthrough", + "for|func|go|goto|if|import|interface|map|package|range|return", + "select|struct|switch|type|var" + +type = "bool", + "uint8|uint16|uint32|uint64|int8|int16|int32|int64|float32|float64|complex64|complex128|byte|rune", + "string" + +include "number.lang" + +symbol = "+","-","*","/","%","&","\|","^","<<",">>","&^", + "+=","-=","*=","/=","%=","&=","\|=","^=","<<=",">>=","&^=", + "&&","\|\|","<-","++","--","==","<",">","=","!", + "!=","<=",">=",":=","...","(",")","[","]",",",".",";",":" + +cbracket = "{|}" + +function = '([[:alpha:]]|_)[[:word:]:]*(?=\()' diff --git a/src/lang.map b/src/lang.map index 9421758..8a26a08 100644 --- a/src/lang.map +++ b/src/lang.map @@ -9,6 +9,7 @@ coffee = coffeescript.lang coffeescript = coffeescript.lang cs = csharp.lang csharp = csharp.lang +go = go.lang h = cpp.lang hh = cpp.lang H = cpp.lang @@ -159,4 +160,4 @@ javalog = javalog.lang upc = upc.lang tml = tml.lang lilypond = lilypond.lang -ly = lilypond.lang
\ No newline at end of file +ly = lilypond.lang diff --git a/tests/Makefile.am b/tests/Makefile.am index 3735823..14e952e 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -254,6 +254,7 @@ test.bib test.bib.html \ test.makefile test.makefile.html \ test.css test.css.html \ test.ps test.ps.html \ +test.go test.go.html \ $(WRONGFILES) \ $(WRONGFILESOUT) \ $(WRONGSTYLES) $(WRONGSTYLESOUT) \ @@ -423,6 +424,7 @@ check_makefile \ check_asm \ check_css \ check_ps \ +check_go \ check_docbook \ check_namedgroups \ check_slang \ @@ -967,6 +969,11 @@ check_ps: @echo expect no output from diff $(DIFF) $(srcdir)/test.ps.html test.ps.out.html +check_go: + $(PROGNAME) -i $(srcdir)/test.go -o test.go.out.html + @echo expect no output from diff + $(DIFF) $(srcdir)/test.go.html test.go.out.html + check_lang: $(LANG2HTML) -i $(top_srcdir)/src/log.lang -o log.lang.out.html $(LANG2HTML) -i $(top_srcdir)/src/c.lang -o c.lang.out.html diff --git a/tests/lang.list b/tests/lang.list index e2436ba..acdf187 100644 --- a/tests/lang.list +++ b/tests/lang.list @@ -48,6 +48,7 @@ flex = flex.lang fortran = fortran.lang free-fortran = fortran.lang glsl = glsl.lang +go = go.lang h = cpp.lang haskell = haskell.lang haxe = haxe.lang diff --git a/tests/test.go b/tests/test.go new file mode 100644 index 0000000..e390fc0 --- /dev/null +++ b/tests/test.go @@ -0,0 +1,13 @@ +// Example Go file for source-highlight. + +package main + +import "fmt" + +func main() { + var words = []string{"foo", "bar", "baz"} + greeting := `Hello` + for _, word := range words { + fmt.Printf("%s, %s!\n", greeting, word) + } +} diff --git a/tests/test.go.html b/tests/test.go.html new file mode 100644 index 0000000..a44bfc6 --- /dev/null +++ b/tests/test.go.html @@ -0,0 +1,18 @@ +<!-- Generator: GNU source-highlight +by Lorenzo Bettini +http://www.lorenzobettini.it +http://www.gnu.org/software/src-highlite --> +<pre><tt><i><font color="#9A1900">// Example Go file for source-highlight.</font></i> + +<b><font color="#0000FF">package</font></b> main + +<b><font color="#0000FF">import</font></b> <font color="#FF0000">"fmt"</font> + +<b><font color="#0000FF">func</font></b> <b><font color="#000000">main</font></b><font color="#990000">()</font> <font color="#FF0000">{</font> + <b><font color="#0000FF">var</font></b> words <font color="#990000">=</font> <font color="#990000">[]</font><font color="#009900">string</font><font color="#FF0000">{</font><font color="#FF0000">"foo"</font><font color="#990000">,</font> <font color="#FF0000">"bar"</font><font color="#990000">,</font> <font color="#FF0000">"baz"</font><font color="#FF0000">}</font> + greeting <font color="#990000">:=</font> <font color="#FF0000">`Hello`</font> + <b><font color="#0000FF">for</font></b> _<font color="#990000">,</font> word <font color="#990000">:=</font> <b><font color="#0000FF">range</font></b> words <font color="#FF0000">{</font> + fmt<font color="#990000">.</font><b><font color="#000000">Printf</font></b><font color="#990000">(</font><font color="#FF0000">"%s, %s!\n"</font><font color="#990000">,</font> greeting<font color="#990000">,</font> word<font color="#990000">)</font> + <font color="#FF0000">}</font> +<font color="#FF0000">}</font> +</tt></pre> |