Skip to content

Commit 01140b5

Browse files
committed
Add support for golo IR
1 parent 2b45f57 commit 01140b5

File tree

3 files changed

+69
-1
lines changed

3 files changed

+69
-1
lines changed

ftdetect/golo.vim

-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
au BufRead,BufNewFile *.golo set filetype=golo
2-

ftdetect/goloir.vim

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
au BufRead,BufNewFile *.goloir set filetype=goloir
2+

syntax/goloir.vim

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
" Vim syntax file
2+
" Language: Golo Intermediate representation dump
3+
"
4+
if exists("b:current_syntax")
5+
finish
6+
endif
7+
8+
syn keyword goloIrNodeType Block Assignment Return LocalReference
9+
10+
syn match goloIrNodeType "Function \([^:]\+\)\@="
11+
syn match goloIrFunctionName "\%(Function \)\@<=<\=\h[a-zA-Z0-9$_]\+>\=\(\s\+\)\@="
12+
syn keyword goloIrNodeType Augmentation nextgroup=goloIrTarget
13+
syn match goloIrTarget "\%(Augmentation on \)\@<=\h[a-zA-Z0-9_.]\+"
14+
15+
syn match goloIrNodeType "Reference lookup"
16+
syn match goloIrNodeType "Binary operator"
17+
syn match goloIrNodeType "Method invocation"
18+
syn match goloIrNodeType "Function call\(:\)\@="
19+
syn match goloIrNodeType "Closure reference"
20+
21+
syn match goloIrDelimiter "{"
22+
syn match goloIrDelimiter "}"
23+
syn match goloIrDelimiter "|"
24+
syn match goloIrDelimiter "("
25+
syn match goloIrDelimiter ")"
26+
27+
syn keyword goloIrNodeProperty capture
28+
syn match goloIrNodeProperty "synthetic\( parameters\)\="
29+
syn match goloIrNodeProperty "null safe?"
30+
syn match goloIrNodeProperty "on reference?"
31+
syn match goloIrNodeProperty "on module state?"
32+
syn match goloIrNodeProperty "anonymous?"
33+
syn match goloIrNodeProperty "named arguments?"
34+
35+
syn match goloIrNodeProperty "kind=" nextgroup=goloIrConstant
36+
syn match goloIrNodeProperty "name=" nextgroup=goloIrString
37+
syn match goloIrNodeProperty "index=" nextgroup=goloIrNumber
38+
syn match goloIrNodeProperty "regular arguments at index" nextgroup=goloIrNumber skipwhite
39+
40+
syn keyword goloIrConstant true false CONSTANT MODULE_CONSTANT
41+
syn match goloIrString "'[^']*'"
42+
43+
44+
"== Numbers
45+
syn match goloIrNumber "\<\d\(\d\|_\d\)*\(_L\)\=\>"
46+
syn match goloIrNumber "\(\<\d\+\.\=\d*\|\.\d\+\)\(e[-+]\=\d\+\)\=\(_F\)\=\>"
47+
syn match goloIrNumber "\<\d\+\(e[-+]\=\d\+\)\=\>"
48+
49+
50+
" Other comment-like informations
51+
syn match goloIrComment "^>>>.*$"
52+
syn match goloIrLinePrefix "^#"
53+
syn match goloIrModule "\%(# \)\@<=\h[a-zA-Z0-9_.]\+"
54+
55+
let b:current_syntax = "goloir"
56+
57+
hi def link goloIrFunctionName Identifier
58+
hi def link goloIrTarget Identifier
59+
hi def link goloIrNodeType Type
60+
hi def link goloIrDelimiter Delimiter
61+
hi def link goloIrNodeProperty Keyword
62+
hi def link goloIrConstant Constant
63+
hi def link goloIrString String
64+
hi def link goloIrNumber Number
65+
hi def link goloIrComment Comment
66+
hi def link goloIrLinePrefix Comment
67+
hi def link goloIrModule Identifier

0 commit comments

Comments
 (0)