mirror of
https://github.com/neovim/neovim.git
synced 2024-09-17 20:58:20 -04:00
vim-patch:75ab590f8504 (#18170)
Update runtime files
75ab590f85
omit builtin.txt change to `expand()` (depends on 8.2.4726)
This commit is contained in:
parent
147cc60d24
commit
0124a7bfa9
2
runtime/autoload/dist/ft.vim
vendored
2
runtime/autoload/dist/ft.vim
vendored
@ -1,7 +1,7 @@
|
||||
" Vim functions for file type detection
|
||||
"
|
||||
" Maintainer: Bram Moolenaar <Bram@vim.org>
|
||||
" Last Change: 2022 Apr 06
|
||||
" Last Change: 2022 Apr 13
|
||||
|
||||
" These functions are moved here from runtime/filetype.vim to make startup
|
||||
" faster.
|
||||
|
@ -69,6 +69,7 @@ Or use `:execute`: >
|
||||
:augroup mine | exe "au! BufRead *" | augroup END
|
||||
:augroup mine | exe "au BufRead * set tw=70" | augroup END
|
||||
|
||||
< *autocmd-expand*
|
||||
Note that special characters (e.g., "%", "<cword>") in the ":autocmd"
|
||||
arguments are not expanded when the autocommand is defined. These will be
|
||||
expanded when the Event is recognized, and the {cmd} is executed. The only
|
||||
@ -275,14 +276,14 @@ BufRead or BufReadPost When starting to edit a new buffer, after
|
||||
processing modelines. See |BufWinEnter| to do
|
||||
something after processing modelines.
|
||||
Also triggered:
|
||||
- when writing an unnamed buffer such that the
|
||||
buffer gets a name
|
||||
- when writing an unnamed buffer in a way that
|
||||
the buffer gets a name
|
||||
- after successfully recovering a file
|
||||
- for the "filetypedetect" group when
|
||||
executing ":filetype detect"
|
||||
Not triggered:
|
||||
- for ":r file"
|
||||
- if the file doesn't exist
|
||||
- for the `:read file` command
|
||||
- when the file doesn't exist
|
||||
*BufReadCmd*
|
||||
BufReadCmd Before starting to edit a new buffer. Should
|
||||
read the file into the buffer. |Cmd-event|
|
||||
@ -542,6 +543,15 @@ DirChangedPre When the |current-directory| is going to be
|
||||
switching window (or tab)
|
||||
<afile> is set to the new directory name.
|
||||
Non-recursive (event cannot trigger itself).
|
||||
*ExitPre*
|
||||
ExitPre When using `:quit`, `:wq` in a way it makes
|
||||
Vim exit, or using `:qall`, just after
|
||||
|QuitPre|. Can be used to close any
|
||||
non-essential window. Exiting may still be
|
||||
cancelled if there is a modified buffer that
|
||||
isn't automatically saved, use |VimLeavePre|
|
||||
for really exiting.
|
||||
See also |QuitPre|, |WinClosed|.
|
||||
*FileAppendCmd*
|
||||
FileAppendCmd Before appending to a file. Should do the
|
||||
appending to the file. Use the '[ and ']
|
||||
@ -568,15 +578,6 @@ FileChangedRO Before making the first change to a read-only
|
||||
*E881*
|
||||
If the number of lines changes saving for undo
|
||||
may fail and the change will be aborted.
|
||||
*ExitPre*
|
||||
ExitPre When using `:quit`, `:wq` in a way it makes
|
||||
Vim exit, or using `:qall`, just after
|
||||
|QuitPre|. Can be used to close any
|
||||
non-essential window. Exiting may still be
|
||||
cancelled if there is a modified buffer that
|
||||
isn't automatically saved, use |VimLeavePre|
|
||||
for really exiting.
|
||||
See also |QuitPre|, |WinClosed|.
|
||||
*FileChangedShell*
|
||||
FileChangedShell When Vim notices that the modification time of
|
||||
a file has changed since editing started.
|
||||
|
@ -1809,7 +1809,7 @@ execute({command} [, {silent}]) *execute()*
|
||||
`:redir`, error messages are dropped.
|
||||
|
||||
To get a list of lines use |split()| on the result: >
|
||||
split(execute('args'), "\n")
|
||||
execute('args')->split("\n")
|
||||
|
||||
< This function is not available in the |sandbox|.
|
||||
Note: If nested, an outer execute() will not observe output of
|
||||
|
@ -583,7 +583,7 @@ attack or other people reading your file). When Vim exits the directory and
|
||||
all files in it are deleted. When Vim has the setuid bit set this may cause
|
||||
problems, the temp file is owned by the setuid user but the filter command
|
||||
probably runs as the original user.
|
||||
Directory for temporary files is created in the first suitable directory of:
|
||||
Directory for temporary files is created in the first possible directory of:
|
||||
Unix: $TMPDIR, /tmp, current-dir, $HOME.
|
||||
Windows: $TMPDIR, $TMP, $TEMP, $USERPROFILE, current-dir.
|
||||
|
||||
|
@ -412,7 +412,8 @@ does apply like to other wildcards.
|
||||
Environment variables in the expression are expanded when evaluating the
|
||||
expression, thus this works: >
|
||||
:e `=$HOME .. '/.vimrc'`
|
||||
This does not work, $HOME is inside a string and used literally: >
|
||||
This uses $HOME inside a string and it will be used literally, most likely not
|
||||
what you intended: >
|
||||
:e `='$HOME' .. '/.vimrc'`
|
||||
|
||||
If the expression returns a string then names are to be separated with line
|
||||
@ -1494,7 +1495,7 @@ session or with another command (e.g., a filter command). Then you will know
|
||||
which version of the file you want to keep.
|
||||
|
||||
The accuracy of the time check depends on the filesystem. On Unix it is
|
||||
usually sub-second. With old file sytems and on MS-Windows it is normally one
|
||||
usually sub-second. With old file systems and on MS-Windows it is normally one
|
||||
second. Use `has('nanotime')` to check if sub-second time stamp checks are
|
||||
available.
|
||||
|
||||
|
@ -4302,7 +4302,7 @@ parentheses can be cut out from |v:exception| with the ":substitute" command.
|
||||
:
|
||||
:try
|
||||
:
|
||||
: " something with arithmetics and I/O
|
||||
: " something with arithmetic and I/O
|
||||
:
|
||||
:catch /^EXCEPT:MATHERR:RANGE/
|
||||
: let function = substitute(v:exception, '.*(\(\a\+\)).*', '\1', "")
|
||||
|
@ -1045,7 +1045,7 @@ in the current file (an indent is removed and a long line is truncated to fit
|
||||
in the window).
|
||||
|
||||
The marker ">" indicates the current position in the jumplist. It may not be
|
||||
shown when filtering the |:jump| command using |:filter|
|
||||
shown when filtering the |:jumps| command using |:filter|
|
||||
|
||||
You are currently in line 1167. If you then use the CTRL-O command, the
|
||||
cursor is put in line 1154. This results in:
|
||||
|
@ -265,6 +265,8 @@ Put focus on the gdb window to type commands there. Some common ones are:
|
||||
- next execute the current line and stop at the next line
|
||||
- step execute the current line and stop at the next statement,
|
||||
entering functions
|
||||
- until execute until past the current cursor line or past a specified
|
||||
position or the current stack frame returns
|
||||
- finish execute until leaving the current function
|
||||
- where show the stack
|
||||
- frame N go to the Nth stack frame
|
||||
@ -281,6 +283,7 @@ gdb:
|
||||
|
||||
*:Step* execute the gdb "step" command
|
||||
*:Over* execute the gdb "next" command (`:Next` is a Vim command)
|
||||
*:Until* execute the gdb "until" command
|
||||
*:Finish* execute the gdb "finish" command
|
||||
*:Continue* execute the gdb "continue" command
|
||||
*:Stop* interrupt the program
|
||||
|
@ -188,7 +188,7 @@ A syntax group name doesn't specify any color or attributes itself.
|
||||
|
||||
The name for a highlight or syntax group must consist of ASCII letters, digits
|
||||
and the underscore. As a regexp: "[a-zA-Z0-9_]*". However, Vim does not give
|
||||
an error when using other characters. The maxium length of a group name is
|
||||
an error when using other characters. The maximum length of a group name is
|
||||
about 200 bytes. *E1249*
|
||||
|
||||
To be able to allow each user to pick their favorite set of colors, there must
|
||||
|
@ -1,7 +1,7 @@
|
||||
" Vim support file to detect file types
|
||||
"
|
||||
" Maintainer: Bram Moolenaar <Bram@vim.org>
|
||||
" Last Change: 2022 Apr 07
|
||||
" Last Change: 2022 Apr 13
|
||||
|
||||
" Listen very carefully, I will say this only once
|
||||
if exists("did_load_filetypes")
|
||||
|
@ -31,7 +31,7 @@ Always use ":setlocal" to set 'indentexpr'. This avoids it being carried over
|
||||
to other buffers.
|
||||
|
||||
To trigger the indenting after typing a word like "endif", add the word to the
|
||||
'cinkeys' option with "+=".
|
||||
'indentkeys' option with "+=".
|
||||
|
||||
You normally set 'indentexpr' to evaluate a function and then define that
|
||||
function. That function only needs to be defined once for as long as Vim is
|
||||
|
130
runtime/indent/krl.vim
Normal file
130
runtime/indent/krl.vim
Normal file
@ -0,0 +1,130 @@
|
||||
" Vim indent file
|
||||
" Language: Kuka Robot Language
|
||||
" Maintainer: Patrick Meiser-Knosowski <knosowski@graeffrobotics.de>
|
||||
" Version: 3.0.0
|
||||
" Last Change: 15. Apr 2022
|
||||
" Credits: Based on indent/vim.vim
|
||||
|
||||
" Only load this indent file when no other was loaded.
|
||||
if exists("b:did_indent")
|
||||
finish
|
||||
endif
|
||||
let b:did_indent = 1
|
||||
|
||||
setlocal nolisp
|
||||
setlocal nocindent
|
||||
setlocal nosmartindent
|
||||
setlocal autoindent
|
||||
setlocal indentexpr=GetKrlIndent()
|
||||
setlocal indentkeys=!^F,o,O,=~end,0=~else,0=~case,0=~default,0=~until,0=~continue,=~part
|
||||
let b:undo_indent = "setlocal lisp< cindent< smartindent< autoindent< indentexpr< indentkeys<"
|
||||
|
||||
if get(g:,'krlSpaceIndent',1)
|
||||
" Use spaces, not tabs, for indention, 2 is enough.
|
||||
" More or even tabs would waste valuable space on the teach pendant.
|
||||
setlocal softtabstop=2
|
||||
setlocal shiftwidth=2
|
||||
setlocal expandtab
|
||||
setlocal shiftround
|
||||
let b:undo_indent = b:undo_indent." softtabstop< shiftwidth< expandtab< shiftround<"
|
||||
endif
|
||||
|
||||
" Only define the function once.
|
||||
if exists("*GetKrlIndent")
|
||||
finish
|
||||
endif
|
||||
let s:keepcpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
function GetKrlIndent() abort
|
||||
|
||||
let currentLine = getline(v:lnum)
|
||||
if currentLine =~? '\v^;(\s*(end)?fold>)@!' && !get(g:, 'krlCommentIndent', 0)
|
||||
" If current line has a ; in column 1 and is no fold, keep zero indent.
|
||||
" This may be usefull if code is commented out at the first column.
|
||||
return 0
|
||||
endif
|
||||
|
||||
" Find a non-blank line above the current line.
|
||||
let preNoneBlankLineNum = s:KrlPreNoneBlank(v:lnum - 1)
|
||||
if preNoneBlankLineNum == 0
|
||||
" At the start of the file use zero indent.
|
||||
return 0
|
||||
endif
|
||||
|
||||
let preNoneBlankLine = getline(preNoneBlankLineNum)
|
||||
let ind = indent(preNoneBlankLineNum)
|
||||
|
||||
" Define add 'shiftwidth' pattern
|
||||
let addShiftwidthPattern = '\v^\s*('
|
||||
if get(g:, 'krlIndentBetweenDef', 1)
|
||||
let addShiftwidthPattern ..= '(global\s+)?def(fct|dat)?\s+\$?\w'
|
||||
let addShiftwidthPattern ..= '|'
|
||||
endif
|
||||
let addShiftwidthPattern ..= 'if>|while>|for>|loop>'
|
||||
let addShiftwidthPattern ..= '|else>'
|
||||
let addShiftwidthPattern ..= '|case>|default>'
|
||||
let addShiftwidthPattern ..= '|repeat>'
|
||||
let addShiftwidthPattern ..= '|skip>|(ptp_)?spline>'
|
||||
let addShiftwidthPattern ..= '|time_block\s+(start|part)>'
|
||||
let addShiftwidthPattern ..= '|const_vel\s+start>'
|
||||
let addShiftwidthPattern ..= ')'
|
||||
|
||||
" Define Subtract 'shiftwidth' pattern
|
||||
let subtractShiftwidthPattern = '\v^\s*('
|
||||
if get(g:, 'krlIndentBetweenDef', 1)
|
||||
let subtractShiftwidthPattern ..= 'end(fct|dat)?>'
|
||||
let subtractShiftwidthPattern ..= '|'
|
||||
endif
|
||||
let subtractShiftwidthPattern ..= 'end(if|while|for|loop)>'
|
||||
let subtractShiftwidthPattern ..= '|else>'
|
||||
let subtractShiftwidthPattern ..= '|case>|default>|endswitch>'
|
||||
let subtractShiftwidthPattern ..= '|until>'
|
||||
let subtractShiftwidthPattern ..= '|end(skip|spline)>'
|
||||
let subtractShiftwidthPattern ..= '|time_block\s+(part|end)>'
|
||||
let subtractShiftwidthPattern ..= '|const_vel\s+end>'
|
||||
let subtractShiftwidthPattern ..= ')'
|
||||
|
||||
" Add shiftwidth
|
||||
if preNoneBlankLine =~? addShiftwidthPattern
|
||||
let ind += &sw
|
||||
endif
|
||||
|
||||
" Subtract shiftwidth
|
||||
if currentLine =~? subtractShiftwidthPattern
|
||||
let ind = ind - &sw
|
||||
endif
|
||||
|
||||
" First case after a switch gets the indent of the switch.
|
||||
if currentLine =~? '\v^\s*case>'
|
||||
\&& preNoneBlankLine =~? '\v^\s*switch>'
|
||||
let ind = ind + &sw
|
||||
endif
|
||||
|
||||
" align continue with the following instruction
|
||||
if currentLine =~? '\v^\s*continue>'
|
||||
\&& getline(v:lnum + 1) =~? subtractShiftwidthPattern
|
||||
let ind = ind - &sw
|
||||
endif
|
||||
|
||||
return ind
|
||||
endfunction
|
||||
|
||||
" This function works almost like prevnonblank() but handles &-headers,
|
||||
" comments and continue instructions like blank lines
|
||||
function s:KrlPreNoneBlank(lnum) abort
|
||||
|
||||
let nPreNoneBlank = prevnonblank(a:lnum)
|
||||
|
||||
while nPreNoneBlank > 0 && getline(nPreNoneBlank) =~? '\v^\s*(\&\w\+|;|continue>)'
|
||||
" Previouse none blank line irrelevant. Look further aback.
|
||||
let nPreNoneBlank = prevnonblank(nPreNoneBlank - 1)
|
||||
endwhile
|
||||
|
||||
return nPreNoneBlank
|
||||
endfunction
|
||||
|
||||
let &cpo = s:keepcpo
|
||||
unlet s:keepcpo
|
||||
|
||||
" vim:sw=2 sts=2 et
|
148
runtime/indent/testdir/krl.in
Normal file
148
runtime/indent/testdir/krl.in
Normal file
@ -0,0 +1,148 @@
|
||||
; vim: set ft=krl :
|
||||
|
||||
; START_INDENT
|
||||
|
||||
def One()
|
||||
int i
|
||||
If i==1 then
|
||||
While i>=1
|
||||
For i=1 to 5 step 2
|
||||
Loop
|
||||
i = i+1
|
||||
EndLoop
|
||||
EndFor
|
||||
EndWhile
|
||||
Else
|
||||
Repeat
|
||||
Switch i
|
||||
Case 1
|
||||
Skip 123
|
||||
i = i+1
|
||||
EndSkip 123
|
||||
Spline with $acc=100, $vel.cp=3
|
||||
slin {x 100}
|
||||
scirc {x 110, y 110}, {x 120, y 90}
|
||||
slin {x 200} c_dis
|
||||
Time_Block Start
|
||||
slin {x 300} c_dis
|
||||
Time_Block Part = 22.2
|
||||
slin {y 400} c_dis
|
||||
Time_Block Part = 33.3
|
||||
Time_Block End = 10
|
||||
slin {y 200} c_dis
|
||||
Const_Vel Start +100 OnStart
|
||||
slin {y 300} c_dis
|
||||
slin {x 100}
|
||||
Const_Vel End -5.5
|
||||
slin {y 200} c_dis
|
||||
EndSpline
|
||||
Case 2,3
|
||||
PTP_Spline with $acc=100, $vel.ptp=100
|
||||
sptp {a1 0} c_ptp
|
||||
sptp {a1 90}
|
||||
EndSpline c_spl
|
||||
Default
|
||||
i = i+1
|
||||
EndSwitch
|
||||
Continue
|
||||
Until False
|
||||
EndIf
|
||||
end
|
||||
|
||||
DEF Two()
|
||||
int i
|
||||
END
|
||||
|
||||
global def Three()
|
||||
int i
|
||||
end
|
||||
|
||||
GLOBAL DEF Four()
|
||||
int i
|
||||
END
|
||||
|
||||
Global Def Five()
|
||||
int i
|
||||
End
|
||||
|
||||
deffct bool fOne()
|
||||
int i
|
||||
endfct
|
||||
|
||||
DEFFCT bool fTwo()
|
||||
int i
|
||||
ENDFCT
|
||||
|
||||
global deffct bool fThree()
|
||||
int i
|
||||
endfct
|
||||
|
||||
GLOBAL DEFFCT bool fFour()
|
||||
int i
|
||||
ENDFCT
|
||||
|
||||
Global DefFct bool fFive()
|
||||
int i
|
||||
EndFct
|
||||
|
||||
DefDat datfile()
|
||||
global int i=1
|
||||
; don't indent column 1 comments unless g:krlCommentIndent is set
|
||||
; global int o=2
|
||||
EndDat
|
||||
|
||||
; END_INDENT
|
||||
|
||||
; START_INDENT
|
||||
; INDENT_EXE let g:krlSpaceIndent = 0
|
||||
; INDENT_EXE set shiftwidth=4
|
||||
|
||||
def bla()
|
||||
int i
|
||||
end
|
||||
|
||||
; END_INDENT
|
||||
|
||||
; START_INDENT
|
||||
; INDENT_EXE let g:krlCommentIndent = 1
|
||||
def bla()
|
||||
; indent this first column comment because of g:krlCommentIndent=1
|
||||
end
|
||||
; END_INDENT
|
||||
|
||||
; START_INDENT
|
||||
; INDENT_EXE let g:krlIndentBetweenDef = 0
|
||||
def bla()
|
||||
int i ; don't indent this line because of g:krlIndentBetweenDef=0
|
||||
end
|
||||
; END_INDENT
|
||||
|
||||
; START_INDENT
|
||||
; INDENT_AT this-line
|
||||
def Some()
|
||||
int f
|
||||
if true then
|
||||
f = 1 ; this-line
|
||||
endif
|
||||
end
|
||||
; END_INDENT
|
||||
|
||||
; START_INDENT
|
||||
; INDENT_NEXT next-line
|
||||
def Some()
|
||||
int i
|
||||
; next-line
|
||||
i = 1 ; should get indent of line 'int i' above
|
||||
end
|
||||
; END_INDENT
|
||||
|
||||
; START_INDENT
|
||||
; INDENT_PREV prev-line
|
||||
def Some()
|
||||
int f
|
||||
if true then
|
||||
f = 1
|
||||
; prev-line
|
||||
endif
|
||||
end
|
||||
; END_INDENT
|
148
runtime/indent/testdir/krl.ok
Normal file
148
runtime/indent/testdir/krl.ok
Normal file
@ -0,0 +1,148 @@
|
||||
; vim: set ft=krl :
|
||||
|
||||
; START_INDENT
|
||||
|
||||
def One()
|
||||
int i
|
||||
If i==1 then
|
||||
While i>=1
|
||||
For i=1 to 5 step 2
|
||||
Loop
|
||||
i = i+1
|
||||
EndLoop
|
||||
EndFor
|
||||
EndWhile
|
||||
Else
|
||||
Repeat
|
||||
Switch i
|
||||
Case 1
|
||||
Skip 123
|
||||
i = i+1
|
||||
EndSkip 123
|
||||
Spline with $acc=100, $vel.cp=3
|
||||
slin {x 100}
|
||||
scirc {x 110, y 110}, {x 120, y 90}
|
||||
slin {x 200} c_dis
|
||||
Time_Block Start
|
||||
slin {x 300} c_dis
|
||||
Time_Block Part = 22.2
|
||||
slin {y 400} c_dis
|
||||
Time_Block Part = 33.3
|
||||
Time_Block End = 10
|
||||
slin {y 200} c_dis
|
||||
Const_Vel Start +100 OnStart
|
||||
slin {y 300} c_dis
|
||||
slin {x 100}
|
||||
Const_Vel End -5.5
|
||||
slin {y 200} c_dis
|
||||
EndSpline
|
||||
Case 2,3
|
||||
PTP_Spline with $acc=100, $vel.ptp=100
|
||||
sptp {a1 0} c_ptp
|
||||
sptp {a1 90}
|
||||
EndSpline c_spl
|
||||
Default
|
||||
i = i+1
|
||||
EndSwitch
|
||||
Continue
|
||||
Until False
|
||||
EndIf
|
||||
end
|
||||
|
||||
DEF Two()
|
||||
int i
|
||||
END
|
||||
|
||||
global def Three()
|
||||
int i
|
||||
end
|
||||
|
||||
GLOBAL DEF Four()
|
||||
int i
|
||||
END
|
||||
|
||||
Global Def Five()
|
||||
int i
|
||||
End
|
||||
|
||||
deffct bool fOne()
|
||||
int i
|
||||
endfct
|
||||
|
||||
DEFFCT bool fTwo()
|
||||
int i
|
||||
ENDFCT
|
||||
|
||||
global deffct bool fThree()
|
||||
int i
|
||||
endfct
|
||||
|
||||
GLOBAL DEFFCT bool fFour()
|
||||
int i
|
||||
ENDFCT
|
||||
|
||||
Global DefFct bool fFive()
|
||||
int i
|
||||
EndFct
|
||||
|
||||
DefDat datfile()
|
||||
global int i=1
|
||||
; don't indent column 1 comments unless g:krlCommentIndent is set
|
||||
; global int o=2
|
||||
EndDat
|
||||
|
||||
; END_INDENT
|
||||
|
||||
; START_INDENT
|
||||
; INDENT_EXE let g:krlSpaceIndent = 0
|
||||
; INDENT_EXE set shiftwidth=4
|
||||
|
||||
def bla()
|
||||
int i
|
||||
end
|
||||
|
||||
; END_INDENT
|
||||
|
||||
; START_INDENT
|
||||
; INDENT_EXE let g:krlCommentIndent = 1
|
||||
def bla()
|
||||
; indent this first column comment because of g:krlCommentIndent=1
|
||||
end
|
||||
; END_INDENT
|
||||
|
||||
; START_INDENT
|
||||
; INDENT_EXE let g:krlIndentBetweenDef = 0
|
||||
def bla()
|
||||
int i ; don't indent this line because of g:krlIndentBetweenDef=0
|
||||
end
|
||||
; END_INDENT
|
||||
|
||||
; START_INDENT
|
||||
; INDENT_AT this-line
|
||||
def Some()
|
||||
int f
|
||||
if true then
|
||||
f = 1 ; this-line
|
||||
endif
|
||||
end
|
||||
; END_INDENT
|
||||
|
||||
; START_INDENT
|
||||
; INDENT_NEXT next-line
|
||||
def Some()
|
||||
int i
|
||||
; next-line
|
||||
i = 1 ; should get indent of line 'int i' above
|
||||
end
|
||||
; END_INDENT
|
||||
|
||||
; START_INDENT
|
||||
; INDENT_PREV prev-line
|
||||
def Some()
|
||||
int f
|
||||
if true then
|
||||
f = 1
|
||||
; prev-line
|
||||
endif
|
||||
end
|
||||
; END_INDENT
|
@ -2,7 +2,7 @@
|
||||
"
|
||||
" Author: Bram Moolenaar
|
||||
" Copyright: Vim license applies, see ":help license"
|
||||
" Last Change: 2022 Jan 17
|
||||
" Last Change: 2022 Apr 16
|
||||
"
|
||||
" WORK IN PROGRESS - The basics works stable, more to come
|
||||
" Note: In general you need at least GDB 7.12 because this provides the
|
||||
@ -466,7 +466,7 @@ endfunc
|
||||
func s:StartDebugCommon(dict)
|
||||
" Sign used to highlight the line where the program has stopped.
|
||||
" There can be only one.
|
||||
sign define debugPC linehl=debugPC
|
||||
call sign_define('debugPC', #{linehl: 'debugPC'})
|
||||
|
||||
" Install debugger commands in the text window.
|
||||
call win_gotoid(s:sourcewin)
|
||||
@ -700,7 +700,9 @@ func s:EndDebugCommon()
|
||||
endif
|
||||
endif
|
||||
endfor
|
||||
exe was_buf .. "buf"
|
||||
if bufexists(was_buf)
|
||||
exe was_buf .. "buf"
|
||||
endif
|
||||
|
||||
call s:DeleteCommands()
|
||||
|
||||
@ -759,8 +761,8 @@ func s:HandleDisasmMsg(msg)
|
||||
|
||||
let lnum = search('^' . s:asm_addr)
|
||||
if lnum != 0
|
||||
exe 'sign unplace ' . s:asm_id
|
||||
exe 'sign place ' . s:asm_id . ' line=' . lnum . ' name=debugPC'
|
||||
call sign_unplace('TermDebug', #{id: s:asm_id})
|
||||
call sign_place(s:asm_id, 'TermDebug', 'debugPC', '%', #{lnum: lnum})
|
||||
endif
|
||||
|
||||
call win_gotoid(curwinid)
|
||||
@ -846,6 +848,7 @@ func s:InstallCommands()
|
||||
command Clear call s:ClearBreakpoint()
|
||||
command Step call s:SendResumingCommand('-exec-step')
|
||||
command Over call s:SendResumingCommand('-exec-next')
|
||||
command -nargs=? Until call s:Until(<q-args>)
|
||||
command Finish call s:SendResumingCommand('-exec-finish')
|
||||
command -nargs=* Run call s:Run(<q-args>)
|
||||
command -nargs=* Arguments call s:SendResumingCommand('-exec-arguments ' . <q-args>)
|
||||
@ -904,6 +907,7 @@ func s:DeleteCommands()
|
||||
delcommand Clear
|
||||
delcommand Step
|
||||
delcommand Over
|
||||
delcommand Until
|
||||
delcommand Finish
|
||||
delcommand Run
|
||||
delcommand Arguments
|
||||
@ -933,22 +937,30 @@ func s:DeleteCommands()
|
||||
unlet s:k_map_saved
|
||||
endif
|
||||
|
||||
exe 'sign unplace ' . s:pc_id
|
||||
for [id, entries] in items(s:breakpoints)
|
||||
for subid in keys(entries)
|
||||
exe 'sign unplace ' . s:Breakpoint2SignNumber(id, subid)
|
||||
endfor
|
||||
endfor
|
||||
call sign_unplace('TermDebug')
|
||||
unlet s:breakpoints
|
||||
unlet s:breakpoint_locations
|
||||
|
||||
sign undefine debugPC
|
||||
for val in s:BreakpointSigns
|
||||
exe "sign undefine debugBreakpoint" . val
|
||||
endfor
|
||||
call sign_undefine('debugPC')
|
||||
call sign_undefine(s:BreakpointSigns->map("'debugBreakpoint' .. v:val"))
|
||||
let s:BreakpointSigns = []
|
||||
endfunc
|
||||
|
||||
" :Until - Execute until past a specified position or current line
|
||||
func s:Until(at)
|
||||
if s:stopped
|
||||
" reset s:stopped here, it may take a bit of time before we get a response
|
||||
let s:stopped = 0
|
||||
" call ch_log('assume that program is running after this command')
|
||||
" Use the fname:lnum format
|
||||
let at = empty(a:at) ?
|
||||
\ fnameescape(expand('%:p')) . ':' . line('.') : a:at
|
||||
call s:SendCommand('-exec-until ' . at)
|
||||
" else
|
||||
" call ch_log('dropping command, program is running: exec-until')
|
||||
endif
|
||||
endfunc
|
||||
|
||||
" :Break - Set a breakpoint at the cursor position.
|
||||
func s:SetBreakpoint(at)
|
||||
" Setting a breakpoint may not work while the program is running.
|
||||
@ -982,7 +994,8 @@ func s:ClearBreakpoint()
|
||||
" Assume this always works, the reply is simply "^done".
|
||||
call s:SendCommand('-break-delete ' . id)
|
||||
for subid in keys(s:breakpoints[id])
|
||||
exe 'sign unplace ' . s:Breakpoint2SignNumber(id, subid)
|
||||
call sign_unplace('TermDebug',
|
||||
\ #{id: s:Breakpoint2SignNumber(id, subid)})
|
||||
endfor
|
||||
unlet s:breakpoints[id]
|
||||
unlet s:breakpoint_locations[bploc][idx]
|
||||
@ -1304,8 +1317,8 @@ func s:GotoAsmwinOrCreateIt()
|
||||
call s:SendCommand('disassemble $pc')
|
||||
endif
|
||||
else
|
||||
exe 'sign unplace ' . s:asm_id
|
||||
exe 'sign place ' . s:asm_id . ' line=' . lnum . ' name=debugPC'
|
||||
call sign_unplace('TermDebug', #{id: s:asm_id})
|
||||
call sign_place(s:asm_id, 'TermDebug', 'debugPC', '%', #{lnum: lnum})
|
||||
endif
|
||||
endif
|
||||
endfunc
|
||||
@ -1340,8 +1353,8 @@ func s:HandleCursor(msg)
|
||||
if lnum == 0
|
||||
call s:SendCommand('disassemble $pc')
|
||||
else
|
||||
exe 'sign unplace ' . s:asm_id
|
||||
exe 'sign place ' . s:asm_id . ' line=' . lnum . ' name=debugPC'
|
||||
call sign_unplace('TermDebug', #{id: s:asm_id})
|
||||
call sign_place(s:asm_id, 'TermDebug', 'debugPC', '%', #{lnum: lnum})
|
||||
endif
|
||||
|
||||
call win_gotoid(curwinid)
|
||||
@ -1378,8 +1391,9 @@ func s:HandleCursor(msg)
|
||||
endif
|
||||
exe lnum
|
||||
normal! zv
|
||||
exe 'sign unplace ' . s:pc_id
|
||||
exe 'sign place ' . s:pc_id . ' line=' . lnum . ' name=debugPC file=' . fname
|
||||
call sign_unplace('TermDebug', #{id: s:pc_id})
|
||||
call sign_place(s:pc_id, 'TermDebug', 'debugPC', fname,
|
||||
\ #{lnum: lnum, priority: 110})
|
||||
if !exists('b:save_signcolumn')
|
||||
let b:save_signcolumn = &signcolumn
|
||||
call add(s:signcolumn_buflist, bufnr())
|
||||
@ -1387,7 +1401,7 @@ func s:HandleCursor(msg)
|
||||
setlocal signcolumn=yes
|
||||
endif
|
||||
elseif !s:stopped || fname != ''
|
||||
exe 'sign unplace ' . s:pc_id
|
||||
call sign_unplace('TermDebug', #{id: s:pc_id})
|
||||
endif
|
||||
|
||||
call win_gotoid(wid)
|
||||
@ -1404,7 +1418,9 @@ func s:CreateBreakpoint(id, subid, enabled)
|
||||
else
|
||||
let hiName = "debugBreakpoint"
|
||||
endif
|
||||
exe "sign define debugBreakpoint" . nr . " text=" . substitute(nr, '\..*', '', '') . " texthl=" . hiName
|
||||
call sign_define('debugBreakpoint' .. nr,
|
||||
\ #{text: substitute(nr, '\..*', '', ''),
|
||||
\ texthl: hiName})
|
||||
endif
|
||||
endfunc
|
||||
|
||||
@ -1482,7 +1498,9 @@ endfunc
|
||||
|
||||
func s:PlaceSign(id, subid, entry)
|
||||
let nr = printf('%d.%d', a:id, a:subid)
|
||||
exe 'sign place ' . s:Breakpoint2SignNumber(a:id, a:subid) . ' line=' . a:entry['lnum'] . ' name=debugBreakpoint' . nr . ' priority=110 file=' . a:entry['fname']
|
||||
call sign_place(s:Breakpoint2SignNumber(a:id, a:subid), 'TermDebug',
|
||||
\ 'debugBreakpoint' .. nr, a:entry['fname'],
|
||||
\ #{lnum: a:entry['lnum'], priority: 110})
|
||||
let a:entry['placed'] = 1
|
||||
endfunc
|
||||
|
||||
@ -1496,7 +1514,8 @@ func s:HandleBreakpointDelete(msg)
|
||||
if has_key(s:breakpoints, id)
|
||||
for [subid, entry] in items(s:breakpoints[id])
|
||||
if has_key(entry, 'placed')
|
||||
exe 'sign unplace ' . s:Breakpoint2SignNumber(id, subid)
|
||||
call sign_unplace('TermDebug',
|
||||
\ #{id: s:Breakpoint2SignNumber(id, subid)})
|
||||
unlet entry['placed']
|
||||
endif
|
||||
endfor
|
||||
|
458
runtime/syntax/krl.vim
Normal file
458
runtime/syntax/krl.vim
Normal file
@ -0,0 +1,458 @@
|
||||
" Vim syntax file
|
||||
" Language: Kuka Robot Language
|
||||
" Maintainer: Patrick Meiser-Knosowski <knosowski@graeffrobotics.de>
|
||||
" Version: 3.0.0
|
||||
" Last Change: 18. Apr 2022
|
||||
" Credits: Thanks for contributions to this to Michael Jagusch
|
||||
" Thanks for beta testing to Thomas Baginski
|
||||
"
|
||||
" Note to self:
|
||||
" for testing perfomance
|
||||
" open a 1000 lines file.
|
||||
" :syntime on
|
||||
" G
|
||||
" hold down CTRL-U until reaching top
|
||||
" :syntime report
|
||||
|
||||
" Init {{{
|
||||
if exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
let s:keepcpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
" if colorscheme is tortus(less)? krlGroupName defaults to 1
|
||||
if get(g:, 'colors_name', " ") =~ '\<tortus'
|
||||
\&& !exists("g:krlGroupName")
|
||||
let g:krlGroupName=1
|
||||
endif
|
||||
" krlGroupName defaults to 0 if it's not initialized yet or 0
|
||||
if !get(g:, "krlGroupName", 0)
|
||||
let g:krlGroupName = 0
|
||||
endif
|
||||
|
||||
" krl does ignore case
|
||||
syn case ignore
|
||||
" take #, $ and & into keyword (syntax only)
|
||||
syn iskeyword @,48-57,_,192-255,#,$,&
|
||||
" spell checking
|
||||
syn spell notoplevel
|
||||
" }}} init
|
||||
|
||||
" Comment and Folding {{{
|
||||
|
||||
" Special Comment
|
||||
|
||||
" TODO Comment
|
||||
syn keyword krlTodo contained TODO FIXME XXX
|
||||
highlight default link krlTodo Todo
|
||||
|
||||
" Debug Comment
|
||||
syn keyword krlDebug contained DEBUG
|
||||
highlight default link krlDebug Debug
|
||||
|
||||
" Comment
|
||||
" none move fold comment until second ;
|
||||
syn match krlFoldComment /\c\v^\s*;\s*%(end)?fold>[^;]*/ containedin=krlFold contains=krlSingleQuoteString,krlInteger,krlFloat,krlMovement,krlDelimiter,krlBoolean
|
||||
highlight default link krlFoldComment Comment
|
||||
|
||||
" move fold comment until second ;
|
||||
syn match krlMoveFoldComment /\c\v^\s*;\s*fold>[^;]*<s?%(ptp|lin|circ|spl)(_rel)?>[^;]*/ containedin=krlFold contains=krlInteger,krlFloat,krlMovement,krlDelimiter
|
||||
highlight default link krlMoveFoldComment Comment
|
||||
|
||||
" things to highlight in a fold line
|
||||
syn keyword krlFoldHighlights CONT IN SYN OUT containedin=krlFoldComment
|
||||
syn match krlFoldHighlights /\c\v<(M|F|E|A|t|i|bin|binin|UP|SPSMAKRO)\d+>/ containedin=krlFoldComment
|
||||
if g:krlGroupName
|
||||
highlight default link krlFoldHighlights Sysvars
|
||||
else
|
||||
" default color for Fold Highlights
|
||||
endif
|
||||
syn keyword krlVkrcFoldConstants EIN AUS containedin=krlFoldComment
|
||||
highlight default link krlVkrcFoldConstants Boolean
|
||||
|
||||
" Comment without Fold, also includes endfold lines and fold line part after second ;
|
||||
syn match krlComment /\c\v;\s*%(<%(end)?fold>)@!.*$/ containedin=krlFold contains=krlTodo,krlDebug,@Spell
|
||||
" Commented out Fold line: "; ;FOLD PTP..."
|
||||
syn match krlComment /\c\v^\s*;\s*;.*$/ contains=krlTodo,krlDebug
|
||||
highlight default link krlComment Comment
|
||||
|
||||
if has("conceal") && get(g:, 'krlConcealFoldTail', 1)
|
||||
syn match krlConcealFoldTail /\c\v(^\s*;\s*fold[^;]*)@250<=;%(--|\s*<fold>|\s*<endfold>)@!.*$/ transparent containedin=krlComment conceal cchar=*
|
||||
endif
|
||||
" }}} Comment and Folding
|
||||
|
||||
" Header {{{
|
||||
syn match krlHeader /&\a\w*/
|
||||
highlight default link krlHeader PreProc
|
||||
" }}} Header
|
||||
|
||||
" Operator {{{
|
||||
" Boolean operator
|
||||
syn keyword krlBoolOperator and or exor not b_and b_or b_exor b_not
|
||||
highlight default link krlBoolOperator Operator
|
||||
" Arithmetic operator
|
||||
syn match krlArithOperator /[+-]/ containedin=krlFloat
|
||||
syn match krlArithOperator /[*/]/
|
||||
highlight default link krlArithOperator Operator
|
||||
" Compare operator
|
||||
syn match krlCompOperator /[<>=]/
|
||||
highlight default link krlCompOperator Operator
|
||||
" Geometric operator
|
||||
" Do not move the : operator
|
||||
" Must be present befor krlParamdef
|
||||
syn match krlGeomOperator /[:]/
|
||||
" syn match krlGeomOperator /[:]/ containedin=krlLabel,krlParamdef
|
||||
highlight default link krlGeomOperator Operator
|
||||
" }}} Operator
|
||||
|
||||
" Type, StorageClass and Typedef {{{
|
||||
" Simple data types
|
||||
syn keyword krlType bool char real int containedin=krlAnyType
|
||||
" External program and function
|
||||
syn keyword krlType ext extfct extfctp extp containedin=krlAnyType
|
||||
" Communication
|
||||
syn keyword krlType signal channel containedin=krlAnyType
|
||||
highlight default link krlType Type
|
||||
" StorageClass
|
||||
syn keyword krlStorageClass decl global const struc enum
|
||||
highlight default link krlStorageClass StorageClass
|
||||
" .dat file public
|
||||
syn keyword krlDatStorageClass public
|
||||
highlight default link krlDatStorageClass StorageClass
|
||||
" Parameter StorageClass
|
||||
" Do not move the :in/:out
|
||||
" Must be present after krlGeomOperator
|
||||
syn match krlParamdef /[:]\s*in\>/
|
||||
syn match krlParamdef /[:]\s*out\>/
|
||||
highlight default link krlParamdef StorageClass
|
||||
" Not a typedef but I like to have those highlighted
|
||||
" different then types, structures or strorage classes
|
||||
syn keyword krlTypedef DEF DEFFCT ENDFCT DEFDAT ENDDAT
|
||||
syn match krlTypedef /^\s*END\>/
|
||||
highlight default link krlTypedef Typedef
|
||||
" }}} Type, StorageClass and Typedef
|
||||
|
||||
" Delimiter {{{
|
||||
syn match krlDelimiter /[\[\](),\\]/
|
||||
highlight default link krlDelimiter Delimiter
|
||||
" }}} Delimiter
|
||||
|
||||
" Constant values {{{
|
||||
" Boolean
|
||||
syn keyword krlBoolean true false containedin=krlStructVal
|
||||
highlight default link krlBoolean Boolean
|
||||
" Binary integer
|
||||
syn match krlBinaryInt /'b[01]\+'/ containedin=krlStructVal
|
||||
highlight default link krlBinaryInt Number
|
||||
" Hexadecimal integer
|
||||
syn match krlHexInt /'h[0-9a-fA-F]\+'/ containedin=krlStructVal
|
||||
highlight default link krlHexInt Number
|
||||
" Integer
|
||||
syn match krlInteger /\W\@1<=[+-]\?\d\+/ containedin=krlStructVal,krlFloat contains=krlArithOperator
|
||||
highlight default link krlInteger Number
|
||||
" Float
|
||||
syn match krlFloat /\v\W@1<=[+-]?\d+\.?\d*%(\s*[eE][+-]?\d+)?/ containedin=krlStructVal
|
||||
highlight default link krlFloat Float
|
||||
" String
|
||||
syn region krlString start=/"/ end=/"/ oneline containedin=krlStructVal contains=@Spell
|
||||
highlight default link krlString String
|
||||
syn match krlSpecialChar /[|]/ containedin=krlString
|
||||
highlight default link krlSpecialChar SpecialChar
|
||||
" String within a fold line
|
||||
syn region krlSingleQuoteString start=/'/ end=/'/ oneline contained contains=@Spell
|
||||
highlight default link krlSingleQuoteString String
|
||||
" Enum
|
||||
syn match krlEnumVal /#\s*\a\w*/ containedin=krlStructVal
|
||||
highlight default link krlEnumVal Constant
|
||||
" }}} Constant values
|
||||
|
||||
" Predefined Structure and Enum {{{
|
||||
" Predefined structures and enums found in
|
||||
" /r1/mada/$*.dat, /r1/steu/$*.dat and
|
||||
" /r1/system/$config.dat as well as
|
||||
" basisTech, gripperTech and spotTech
|
||||
"
|
||||
" Predefined data types found in krc1
|
||||
syn keyword krlStructure servopara keymove powermodul trace techangle tech techfct techcps techfctctrl axis_inc axis_cal date display_var pro_ip con bus
|
||||
syn keyword krlEnum ident_state sig_state move_state async_state emt_mode boxmode msg_prm_typ msg_typ cmd_stat asys trace_state trace_mode direction techsys techgeoref techclass techmode hpu_key_val pro_state eax transsys mode_move cosys device rotsys emstop cause_t
|
||||
"
|
||||
" Predefined data types found in kss functions
|
||||
syn keyword krlEnum ediagstate rdc_fs_state ret_c_psync_e var_type cancel_psync_e sys_vars
|
||||
syn keyword krlStructure siginf rw_rdc_file rw_mam_file diagpar_t error_t stopmess case_sense_t msgbuf_t e3pos e3axis diagopt_t
|
||||
"
|
||||
" Predefined structures for movement
|
||||
syn keyword krlStructure frame e6pos pos e6axis axis
|
||||
syn keyword krlStructure fdat ldat pdat
|
||||
syn keyword krlStructure load inertia
|
||||
"
|
||||
" Predefined structures for shapes
|
||||
syn keyword krlStructure axbox cylinder box
|
||||
"
|
||||
" Predefined structures and enums found in /r1/mada/$machine.dat
|
||||
syn keyword krlStructure cp fra acc_car jerk_struc dhart spin trpspin ex_kin et_ax maxtool
|
||||
syn keyword krlEnum individual_mames supply_voltage kinclass main_axis wrist_axis sw_onoff
|
||||
"
|
||||
" Predefined structures and enums found in /r1/mada/$robcor.dat
|
||||
" syn keyword krlStructure
|
||||
syn keyword krlEnum adap_acc model_type control_parameter eko_mode
|
||||
"
|
||||
" Predefined structures and enums found in /steu/mada/$custom.dat
|
||||
syn keyword krlStructure pro_io_t ser ext_mod_t coop_krc ws_config bin_type coop_update_t ldc_reaction
|
||||
syn keyword krlEnum axis_of_coordinates spline_para_variant target_status cp_vel_type cp_statmon
|
||||
"
|
||||
" Predefined structures and enums found in /steu/mada/$machine.dat
|
||||
syn keyword krlStructure emstop_path boxstatesafein boxstatesafeout
|
||||
syn keyword krlEnum digincode
|
||||
"
|
||||
" Predefined structures and enums found in /steu/mada/$option.dat
|
||||
syn keyword krlStructure msg_t
|
||||
" syn keyword krlEnum
|
||||
"
|
||||
" Predefined structures and enums found in /r1/system/$config.dat
|
||||
" BasisTech
|
||||
syn keyword krlStructure dig_out_type ctrl_in_t ctrl_out_t fct_out_t fct_in_t odat basis_sugg_t out_sugg_t md_state machine_def_t machine_tool_t machine_frame_t trigger_para constvel_para condstop_para adat tm_sugg_t tqm_tqdat_t sps_prog_type
|
||||
syn keyword krlEnum bas_command out_modetype ipo_m_t apo_mode_t funct_type p00_command timer_actiontype
|
||||
"
|
||||
" GripperTech
|
||||
syn keyword krlStructure grp_typ grp_types grp_sugg_t
|
||||
syn keyword krlEnum on_off_typ apo_typ
|
||||
"
|
||||
" SpotTech
|
||||
syn keyword krlStructure spot_type spot_sugg_t
|
||||
syn keyword krlEnum s_command s_pair_slct command_retr
|
||||
"
|
||||
" VW
|
||||
syn keyword krlStructure vw_mpara_typ zangentyp zangenbedingung ibszangentyp last_ibs_typ verr_typ verrcheck_t t_fb_state kollisionsdaten state_t modus_t
|
||||
syn keyword krlEnum synctype dir_typ subtype ari_typ bool_typ vw_command ibgn_command vw_user_cmd move_types adv_t_type bas_type ibs_mode_typ vw_user_cmd pro_mode mode_op
|
||||
"
|
||||
" ProgCoop
|
||||
syn keyword krlStructure ydat
|
||||
" syn keyword krlEnum
|
||||
"
|
||||
" bas.src
|
||||
syn keyword krlStructure cont
|
||||
syn keyword krlEnum esys ipo_mode circ_mode circ_type ori_type var_state
|
||||
"
|
||||
" MsgLib.src
|
||||
syn keyword krlStructure KrlMsg_T KrlMsgParType_T KrlMsgPar_T KrlMsgOpt_T KrlMsgDlgSK_T
|
||||
syn keyword krlEnum EKrlMsgType
|
||||
"
|
||||
highlight default link krlStructure Structure
|
||||
highlight default link krlEnum Structure
|
||||
" }}} Predefined Structure and Enum
|
||||
|
||||
" System variable {{{
|
||||
syn match krlSysvars /\<\$\a[a-zA-Z0-9_.]*/
|
||||
if g:krlGroupName
|
||||
highlight default link krlSysvars Sysvars
|
||||
else
|
||||
" default color for Sysvars
|
||||
endif
|
||||
" }}} System variable
|
||||
|
||||
" Statements, keywords et al {{{
|
||||
" continue
|
||||
syn keyword krlContinue continue
|
||||
if g:krlGroupName
|
||||
highlight default link krlContinue Continue
|
||||
else
|
||||
highlight default link krlContinue Statement
|
||||
endif
|
||||
" interrupt
|
||||
syn match krlStatement /\v\c%(<global>\s+)?<INTERRUPT>%(\s+<decl>)?/ contains=krlStorageClass
|
||||
" keywords
|
||||
syn keyword krlStatement wait on off enable disable stop trigger with when distance onstart delay do prio import is minimum maximum confirm on_error_proceed
|
||||
syn match krlStatement /\v\c%(<wait\s+)@7<=<sec>/
|
||||
syn match krlStatement /\v\c%(<when\s+)@7<=<path>/
|
||||
highlight default link krlStatement Statement
|
||||
" Conditional
|
||||
syn keyword krlConditional if then else endif switch case default endswitch skip endskip
|
||||
highlight default link krlConditional Conditional
|
||||
" Repeat
|
||||
syn keyword krlRepeat for to step endfor while endwhile repeat until loop endloop exit
|
||||
highlight default link krlRepeat Repeat
|
||||
" Label
|
||||
syn keyword krlLabel goto
|
||||
syn match krlLabel /^\s*\w\+:\ze\s*\%(;.*\)\?$/
|
||||
highlight default link krlLabel Label
|
||||
" Keyword
|
||||
syn keyword krlKeyword anin anout digin
|
||||
highlight default link krlKeyword Keyword
|
||||
" Exception
|
||||
syn keyword krlException return resume halt
|
||||
highlight default link krlException Exception
|
||||
" }}} Statements, keywords et al
|
||||
|
||||
" special keywords for movement commands {{{
|
||||
syn keyword krlMovement PTP PTP_REL LIN LIN_REL CIRC CIRC_REL SPL SPL_REL SPTP SPTP_REL SLIN SLIN_REL SCIRC SCIRC_REL
|
||||
syn keyword krlMovement ASYPTP ASYCONT ASYSTOP ASYCANCEL MOVE_EMI
|
||||
syn match krlMovement /\v\c^\s*<BRAKE(\s+F)?>/
|
||||
if g:krlGroupName
|
||||
highlight default link krlMovement Movement
|
||||
else
|
||||
highlight default link krlMovement Special
|
||||
endif
|
||||
" movement modifiers
|
||||
syn match krlMoveBlockInst /\c\v^\s*TIME_BLOCK\s+(START|PART|END)/
|
||||
syn match krlMoveBlockInst /\c\v^\s*CONST_VEL\s+(START|END)/
|
||||
syn keyword krlMoveBlockInst ptp_spline spline endspline
|
||||
highlight default link krlMoveBlockInst Statement
|
||||
syn keyword krlMoveMod ca c_ptp c_dis c_vel c_ori c_spl
|
||||
if g:krlGroupName
|
||||
highlight default link krlMoveMod Movement
|
||||
else
|
||||
highlight default link krlMoveMod Special
|
||||
endif
|
||||
" }}} special keywords for movement commands
|
||||
|
||||
" Structure value {{{
|
||||
" avoid coloring structure component names
|
||||
syn match krlNames /\.[a-zA-Z_][.a-zA-Z0-9_$]*/
|
||||
syn match krlNames contained /[a-zA-Z_][.a-zA-Z0-9_$]*/
|
||||
" highlight default link krlNames None
|
||||
" Structure value
|
||||
syn region krlStructVal start=/{/ end=/}/ oneline containedin=krlStructVal contains=krlNames
|
||||
highlight default link krlStructVal Delimiter
|
||||
" }}} Structure value
|
||||
|
||||
" BuildInFunction {{{
|
||||
syn keyword krlBuildInFunction contained Pulse
|
||||
syn keyword krlBuildInFunction contained m_comment
|
||||
syn keyword krlBuildInFunction contained is_key_pressed
|
||||
syn keyword krlBuildInFunction contained set_opt_filter
|
||||
syn keyword krlBuildInFunction contained timer_limit
|
||||
syn keyword krlBuildInFunction contained tool_adj
|
||||
syn keyword krlBuildInFunction contained FRand
|
||||
syn keyword krlBuildInFunction contained ExecFunc eb_test EB EK EO LK mbx_rec
|
||||
" safe robot
|
||||
syn keyword krlbuildinfunction contained get_AxesMask get_BrakeTest_Time
|
||||
" math
|
||||
syn keyword krlBuildInFunction contained Abs Sin Cos Acos Tan Atan Atan2 Sqrt
|
||||
syn keyword krlBuildInFunction contained Forward Inverse inv_pos
|
||||
" cFoo sFoo
|
||||
syn keyword krlBuildInFunction contained cClose cOpen cRead cWrite sRead sWrite
|
||||
" string
|
||||
syn keyword krlBuildInFunction contained StrToBool StrToInt StrToReal StrToString StrToFrame StrToPos StrToE3Pos StrToE6Pos StrToAxis StrToE3Axis StrToE6Axis
|
||||
syn keyword krlBuildInFunction contained StrAdd StrClear StrCopy StrComp StrFind StrLen StrDeclLen StrToBool StrToInt StrToReal StrToString
|
||||
" diag
|
||||
syn keyword krlBuildInFunction contained diag_start diag_stop get_DiagState
|
||||
" rdc mam pid
|
||||
syn keyword krlBuildInFunction contained CheckPidOnRdc check_mam_on_rdc get_rdc_fs_state
|
||||
syn keyword krlBuildInFunction contained set_mam_on_hd copy_mam_hd_to_rdc copy_mam_rdc_to_hd
|
||||
syn keyword krlBuildInFunction contained PidToHd PidToRdc
|
||||
syn keyword krlBuildInFunction contained cal_to_rdc rdc_file_to_hd
|
||||
syn keyword krlBuildInFunction contained delete_pid_on_rdc delete_rdc_content
|
||||
syn keyword krlBuildInFunction contained create_rdc_archive restore_rdc_archive
|
||||
" ioctl
|
||||
syn keyword krlBuildInFunction contained IOCtl cIOCtl
|
||||
syn keyword krlBuildInFunction contained WSpaceGive WSpaceTake
|
||||
" sync
|
||||
syn keyword krlBuildInFunction contained Sync SyncCmd CancelProgSync
|
||||
" remote
|
||||
syn keyword krlBuildInFunction contained RemoteCmd RemoteRead
|
||||
" msg/dlg
|
||||
syn keyword krlBuildInFunction contained IsMessageSet clear_KrlMsg get_MsgBuffer exists_KrlDlg exists_KrlMsg set_KrlDlg set_KrlDlgAnswer set_KrlMsg
|
||||
" robvers
|
||||
syn keyword krlBuildInFunction contained maximize_UsedxRobvers set_UsedxRobvers
|
||||
" md_foo
|
||||
syn keyword krlBuildInFunction contained md_Cmd md_GetState md_SetState md_Asgn
|
||||
" emi
|
||||
syn keyword krlBuildInFunction contained emi_ActPos emi_EndPos emi_StartPos emi_RecState emi_RecName
|
||||
" var
|
||||
syn keyword krlBuildInFunction contained cast_from cast_to
|
||||
syn keyword krlBuildInFunction contained GetVarsize GetCycDef get_sig_inf get_decl_place VarType VarState
|
||||
" sys
|
||||
syn keyword krlBuildInFunction contained GetSysState get_system_data set_system_data set_system_data_delayed
|
||||
" err
|
||||
syn keyword krlBuildInFunction contained err_clear err_raise
|
||||
" motion
|
||||
syn keyword krlBuildInFunction contained delete_backward_buffer rob_stop rob_stop_release set_brake_delay suppress_repositioning VectorMoveOn VectorMoveOff
|
||||
" torque
|
||||
syn keyword krlBuildInFunction contained set_torque_limits reset_torque_limits
|
||||
" krc1
|
||||
syn keyword krlBuildInFunction contained cLcopy cCurpos cNew cClear cRelease cKey
|
||||
if g:krlGroupName
|
||||
highlight default link krlBuildInFunction BuildInFunction
|
||||
else
|
||||
highlight default link krlBuildInFunction Function
|
||||
endif
|
||||
" }}} BuildInFunction
|
||||
|
||||
" Function {{{
|
||||
syn match krlFunction /[a-zA-Z_]\w* *(/me=e-1 contains=krlBuildInFunction
|
||||
highlight default link krlFunction Function
|
||||
" }}} Function
|
||||
|
||||
" Error {{{
|
||||
if get(g:, 'krlShowError', 1)
|
||||
" some more or less common typos
|
||||
"
|
||||
" vars or funcs >24 chars are not possible in krl. a234567890123456789012345
|
||||
syn match krlError0 /\w\{25,}/ containedin=krlFunction,krlNames,krlLabel,krlAnyType,krlEnumVal,krlSysvars
|
||||
"
|
||||
" should be interrupt (on|off) \w+
|
||||
syn match krlError1 /\vinterrupt[ \t(]+[_$a-zA-Z0-9]+[_$a-zA-Z0-9.\[\]()+\-*/]*[ \t)]+o%(n|ff)>/
|
||||
"
|
||||
" for bla==5 to 7...
|
||||
" ||
|
||||
syn match krlError3 /\v%(^\s*for%(\(|\s)+[_$a-zA-Z]+[_$a-zA-Z0-9.\[\]()+\-*/ ]*\s*)@<=[:=]\=/
|
||||
"
|
||||
" TODO optimize performance
|
||||
" wait for a=b
|
||||
" |
|
||||
syn match krlError4 /\v%(^\s*%(return|wait\s+for|if|while|until|%(global\s+)?interrupt\s+decl)>[^;]+[^;<>=])@<=\=[^=]/
|
||||
"
|
||||
" wait for a><b
|
||||
" ||
|
||||
syn match krlError5 /\v%(^\s*%(return|wait\s+for|if|while|until|%(global\s+)?interrupt\s+decl)>[^;]+)@<=\>\s*\</
|
||||
"
|
||||
" if (a==5) (b==6) ...
|
||||
" |||
|
||||
syn match krlError6 /\v%(^\s*%(return|wait\s+for|if|while|until|%(global\s+)?interrupt\s+decl)>[^;]+[^;])@<=\)\s*\(/
|
||||
"
|
||||
" TODO optimize performance
|
||||
" a == b + 1
|
||||
" a := b + 1
|
||||
" ||
|
||||
syn match krlError7 /\v%(^\s*%(return|wait\s+for|if|while|until|%(global\s+)?interrupt\s+decl)>[^;]+[^;])@1<!%(^\s*[_$a-zA-Z]+[_$a-zA-Z0-9.\[\],+\-*/]*\s*)@<=[:=]\=/
|
||||
syn match krlError7 /\v\c%(^\s*%(decl\s+)%(global\s+)?%(const\s+)?\w+\s+\w+\s*)@<=[:=]\=/
|
||||
syn match krlError7 /\v\c%(^\s*%(decl\s+)?%(global\s+)?%(const\s+)?%(bool\s+|int\s+|real\s+|char\s+)\w+\s*)@<=[:=]\=/
|
||||
"
|
||||
" this one is tricky. Make sure this does not match trigger instructions; OK, next try, now search for false positives
|
||||
" TODO optimize performance
|
||||
" a = b and c or (int1=int2)
|
||||
" |
|
||||
syn match krlError8 /\v(^\s*[_$a-zA-Z]+[_$a-zA-Z0-9.\[\]()+\-*/]*\s*\=[^;]*[^;<>=])@<=\=\ze[^=]/
|
||||
"
|
||||
" <(distance|delay|prio)> :=
|
||||
" <(distance|delay|prio)> ==
|
||||
" ||
|
||||
syn match krlError9 /\v(^[^;]*<(distance|delay|prio|minimum|maximum)\s*)@<=[:=]\=/
|
||||
"
|
||||
" 'for', 'while' or 'repeat' followed by 'do'
|
||||
syn match krlError10 /\c\v^\s*(until|while|for)>[^;]*<do>/
|
||||
"
|
||||
highlight default link krlError0 Error
|
||||
highlight default link krlError1 Error
|
||||
highlight default link krlError2 Error
|
||||
highlight default link krlError3 Error
|
||||
highlight default link krlError4 Error
|
||||
highlight default link krlError5 Error
|
||||
highlight default link krlError6 Error
|
||||
highlight default link krlError7 Error
|
||||
highlight default link krlError8 Error
|
||||
highlight default link krlError9 Error
|
||||
highlight default link krlError10 Error
|
||||
endif
|
||||
" }}} Error
|
||||
|
||||
" Finish {{{
|
||||
let &cpo = s:keepcpo
|
||||
unlet s:keepcpo
|
||||
|
||||
let b:current_syntax = "krl"
|
||||
" }}} Finish
|
||||
|
||||
" vim:sw=2 sts=2 et fdm=marker
|
129
runtime/syntax/openscad.vim
Normal file
129
runtime/syntax/openscad.vim
Normal file
@ -0,0 +1,129 @@
|
||||
" Vim syntax file
|
||||
" Language: OpenSCAD
|
||||
" Maintainer: Niklas Adam <adam@oddodd.org>
|
||||
" Last change: 2022-04-15
|
||||
"
|
||||
"
|
||||
" From salkin-mada/openscad.nvim
|
||||
" Building on the work of Sirtaj Singh Kang and others for vim-openscad
|
||||
"
|
||||
|
||||
" quit when a syntax file was already loaded
|
||||
if exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
syntax case ignore
|
||||
|
||||
setlocal iskeyword=a-z,A-Z,48-57,_
|
||||
|
||||
syn match openscadAoperator "{"
|
||||
syn match openscadAoperator "}"
|
||||
syn match openscadLi "\["
|
||||
syn match openscadLi "\]"
|
||||
syn match openscadPar "("
|
||||
syn match openscadPar ")"
|
||||
|
||||
syn match openscadSpecialVariable "\$[a-zA-Z_]\+\>" display
|
||||
syn match openscadModifier "^\s*[\*\!\#\%]" display
|
||||
|
||||
syn match openscadBinaryoperator "+"
|
||||
syn match openscadBinaryoperator "-"
|
||||
syn match openscadBinaryoperator "*"
|
||||
syn match openscadBinaryoperator "/"
|
||||
syn match openscadBinaryoperator "%"
|
||||
syn match openscadBinaryoperator "\*\*"
|
||||
syn match openscadBinaryoperator "<"
|
||||
syn match openscadBinaryoperator "<="
|
||||
syn match openscadBinaryoperator ">"
|
||||
syn match openscadBinaryoperator ">="
|
||||
syn match openscadBinaryoperator "="
|
||||
syn match openscadBinaryoperator "=="
|
||||
syn match openscadBinaryoperator "==="
|
||||
syn match openscadBinaryoperator "!="
|
||||
syn match openscadBinaryoperator "!=="
|
||||
syn match openscadBinaryoperator "&"
|
||||
syn match openscadBinaryoperator "|"
|
||||
syn match openscadBinaryoperator "<!"
|
||||
syn match openscadBinaryoperator "?"
|
||||
syn match openscadBinaryoperator "??"
|
||||
syn match openscadBinaryoperator "!?"
|
||||
syn match openscadBinaryoperator "!"
|
||||
syn match openscadBinaryoperator "#"
|
||||
syn match openscadBinaryoperator "_"
|
||||
syn match openscadBinaryoperator "\.\."
|
||||
syn match openscadBinaryoperator "\.\.\."
|
||||
syn match openscadBinaryoperator "`"
|
||||
syn match openscadBinaryoperator ":"
|
||||
|
||||
syn keyword openscadFunctionDef function nextgroup=openscadFunction skipwhite skipempty
|
||||
syn match openscadFunction /\<\h\w*\>/ contained display
|
||||
|
||||
syn keyword openscadModuleDef module nextgroup=openscadModule skipwhite skipempty
|
||||
syn match openscadModule /\<\h\w*\>/ contained display
|
||||
|
||||
syn keyword openscadStatement echo assign let assert
|
||||
syn keyword openscadConditional if else
|
||||
syn keyword openscadRepeat for intersection_for
|
||||
syn keyword openscadInclude include use
|
||||
syn keyword openscadCsgKeyword union difference intersection render intersection_for
|
||||
syn keyword openscadTransform scale rotate translate resize mirror multmatrix color minkowski hull projection linear_extrude rotate_extrude offset
|
||||
syn keyword openscadPrimitiveSolid cube sphere cylinder polyhedron surface
|
||||
syn keyword openscadPrimitive2D square circle polygon import_dxf text
|
||||
syn keyword openscadPrimitiveImport import child children
|
||||
|
||||
syn match openscadNumbers "\<\d\|\.\d" contains=openscadNumber display transparent
|
||||
syn match openscadNumber "\d\+" display contained
|
||||
syn match openscadNumber "\.\d\+" display contained
|
||||
|
||||
syn region openscadString start=/"/ skip=/\\"/ end=/"/
|
||||
|
||||
syn keyword openscadBoolean true false
|
||||
|
||||
syn keyword openscadCommentTodo TODO FIXME XXX NOTE contained display
|
||||
syn match openscadInlineComment ://.*$: contains=openscadCommentTodo
|
||||
syn region openscadBlockComment start=:/\*: end=:\*/: fold contains=openscadCommentTodo
|
||||
|
||||
syn region openscadBlock start="{" end="}" transparent fold
|
||||
syn region openscadVector start="\[" end="\]" transparent fold
|
||||
|
||||
syn keyword openscadBuiltin abs acos asin atan atan2 ceil cos exp floor ln log
|
||||
syn keyword openscadBuiltin lookup max min pow rands round sign sin sqrt tan
|
||||
syn keyword openscadBuiltin str len search version version_num concat chr ord cross norm
|
||||
syn keyword openscadBuiltin parent_module
|
||||
syn keyword openscadBuiltin dxf_cross dxf_dim
|
||||
syn keyword openscadBuiltinSpecial PI undef
|
||||
|
||||
"""""""""""""""""""""""""""""""""""""""""
|
||||
" linkage
|
||||
"""""""""""""""""""""""""""""""""""""""""
|
||||
hi def link openscadFunctionDef Structure
|
||||
hi def link openscadAoperator Function
|
||||
hi def link openscadLi Function
|
||||
" hi def link openscadPar Structure
|
||||
hi def link openscadBuiltinSpecial Special
|
||||
hi def link openscadBinaryoperator Special
|
||||
hi def link openscadFunction Function
|
||||
hi def link openscadModuleDef Structure
|
||||
hi def link openscadModule Function
|
||||
hi def link openscadBlockComment Comment
|
||||
hi def link openscadBoolean Boolean
|
||||
hi def link openscadBuiltin Function
|
||||
hi def link openscadConditional Conditional
|
||||
hi def link openscadCsgKeyword Structure
|
||||
hi def link openscadInclude Include
|
||||
hi def link openscadInlineComment Comment
|
||||
hi def link openscadModifier Special
|
||||
hi def link openscadStatement Statement
|
||||
hi def link openscadNumbers Number
|
||||
hi def link openscadNumber Number
|
||||
hi def link openscadPrimitiveSolid Keyword
|
||||
hi def link openscadPrimitive2D Keyword
|
||||
hi def link openscadPrimitiveImport Keyword
|
||||
hi def link openscadRepeat Repeat
|
||||
hi def link openscadSpecialVariable Special
|
||||
hi def link openscadString String
|
||||
hi def link openscadTransform Statement
|
||||
hi def link openscadCommentTodo Todo
|
||||
|
||||
let b:current_syntax = 'openscad'
|
@ -1,6 +1,6 @@
|
||||
" Vim syntax support file
|
||||
" Maintainer: Bram Moolenaar <Bram@vim.org>
|
||||
" Last Change: 2020 Apr 13
|
||||
" Last Change: 2022 Apr 12
|
||||
|
||||
" This file sets up for syntax highlighting.
|
||||
" It is loaded from "syntax.vim" and "manual.vim".
|
||||
|
@ -1,6 +1,6 @@
|
||||
" Vim syntax support file
|
||||
" Maintainer: Bram Moolenaar <Bram@vim.org>
|
||||
" Last Change: 2001 Sep 04
|
||||
" Last Change: 2022 Apr 12
|
||||
|
||||
" This file is used for ":syntax on".
|
||||
" It installs the autocommands and starts highlighting for all buffers.
|
||||
|
Loading…
Reference in New Issue
Block a user