summaryrefslogtreecommitdiff
path: root/syntax/pvx.vim
diff options
context:
space:
mode:
Diffstat (limited to 'syntax/pvx.vim')
-rw-r--r--syntax/pvx.vim76
1 files changed, 76 insertions, 0 deletions
diff --git a/syntax/pvx.vim b/syntax/pvx.vim
new file mode 100644
index 0000000..d7210a4
--- /dev/null
+++ b/syntax/pvx.vim
@@ -0,0 +1,76 @@
+" Vim syntax file
+" Language: ProvideX / PVX (Sage 100 business object source, *.pvxsrc)
+" Maintainer: native-sage-connector
+
+if exists("b:current_syntax")
+ finish
+endif
+
+" PVX keywords are case-insensitive in practice (mixed-case is common).
+syntax case ignore
+
+" --- Comments -------------------------------------------------------
+syn keyword pvxTodo TODO FIXME XXX NOTE contained
+syn match pvxComment "!.*$" contains=pvxTodo,@Spell
+
+" --- Strings & literals ---------------------------------------------
+" Doubled quotes ("") inside a string are a literal embedded quote.
+syn region pvxString start=/"/ skip=/""/ end=/"/
+
+" $$ is the "any/blank key" marker used in select/begin ranges.
+syn match pvxByteLiteral "\$\$"
+" $XX$ is a two-digit hex byte literal, e.g. $8A$ (field separator).
+syn match pvxByteLiteral "\$[0-9A-Fa-f][0-9A-Fa-f]\$"
+
+syn match pvxNumber "\<\d\+\(\.\d\+\)\?\>"
+
+" Pseudo-labels used as err=/dom= targets (*next, *break, *resume, ...)
+syn match pvxPseudoLabel "\*\h\w*"
+
+" Labels: BARE_WORD: alone on a line (optionally trailing a comment)
+syn match pvxLabel "^\s*[A-Za-z_][A-Za-z0-9_.]*:\s*\(!.*\)\=$"
+
+" Object method-call operator: obj'MethodName(
+syn match pvxMethodCall "'\h\w*"
+
+" --- Statements / control flow --------------------------------------
+syn keyword pvxConditional if then else switch case default
+syn keyword pvxRepeat for to step next while wend repeat until
+syn keyword pvxLabelKw break continue exit goto gosub return stop
+
+syn keyword pvxStatement
+ \ open close read write dim remove call select from begin where
+ \ sep iol rec key err dom execute drop object on error try catch
+ \ finally let print input rem
+
+syn keyword pvxStructure
+ \ def class like function perform local public global common
+ \ create delete required end
+
+syn keyword pvxOperator and or not
+
+" --- Built-in functions ----------------------------------------------
+syn keyword pvxFunction
+ \ nul pos tbl ucs lcs mid str stp pad varchar sub new find len
+ \ num evn clear msg dte lst vis dll max min val kec tim mod fib
+ \ lof eof dir exists chr asc int sqr rnd cvs cvt day abs kgen
+ \ ioc iol ios opt lpt ptr env exp log pi sgn dle fin fid dlm dod
+
+" --- Highlight links --------------------------------------------------
+hi def link pvxComment Comment
+hi def link pvxTodo Todo
+hi def link pvxString String
+hi def link pvxByteLiteral SpecialChar
+hi def link pvxNumber Number
+hi def link pvxPseudoLabel Special
+hi def link pvxLabel Label
+hi def link pvxMethodCall Function
+hi def link pvxConditional Conditional
+hi def link pvxRepeat Repeat
+hi def link pvxLabelKw Keyword
+hi def link pvxStatement Statement
+hi def link pvxStructure Structure
+hi def link pvxOperator Operator
+hi def link pvxFunction Function
+
+let b:current_syntax = "pvx"