2 " Language: SAP - ABAP/R4
4 " Maintainer: Marius Piedallu van Wyk <marius@e.co.za>
5 " Last Change: 2006 Apr 13
7 " For version < 6.0: Clear all syntax items
8 " For version >= 6.0: Quit when a syntax file was already loaded
11 elseif exists("b:current_syntax")
19 syn match abapSymbolOperator "[+\-/=<>$]"
20 syn match abapSymbolOperator "\*"
21 syn match abapSymbolOperator "[<>]="
22 syn match abapSymbolOperator "<>"
23 syn match abapSymbolOperator "\*\*"
24 syn match abapSymbolOperator "[()]"
25 syn match abapSymbolOperator "[:,\.]"
28 syn region abapString matchgroup=abapString start="'" end="'" contains=abapStringEscape
29 syn match abapStringEscape contained "''"
31 syn match abapNumber "-\=\<\d\+\>"
32 syn region abapHex matchgroup=abapHex start="X'" end="'"
35 setlocal iskeyword=-,48-57,_,A-Z,a-z
37 set iskeyword=-,48-57,_,A-Z,a-z
41 syn keyword abapStatement ADD ADD-CORRESPONDING ASSIGN AT AUTHORITY-CHECK
42 syn keyword abapStatement BACK BREAK-POINT
43 syn keyword abapStatement CALL CASE CHECK CLEAR CLOSE CNT COLLECT COMMIT COMMUNICATION COMPUTE CONCATENATE CONDENSE CONSTANTS CONTINUE CONTROLS CONVERT CREATE CURRENCY
44 syn keyword abapStatement DATA DEFINE DELETE DESCRIBE DETAIL DIVIDE DIVIDE-CORRESPONDING DO
45 syn keyword abapStatement EDITOR-CALL ELSE ELSEIF END-OF-DEFINITION END-OF-PAGE END-OF-SELECTION ENDAT ENDCASE ENDDO ENDEXEC ENDFORM ENDFUNCTION ENDIF ENDIFEND ENDLOOP ENDMODULE ENDON ENDPROVIDE ENDSELECT ENDWHILE EXEC EXPORT EXPORTING EXTRACT
46 syn keyword abapStatement FETCH FIELD-GROUPS FIELD-SYMBOLS FIELDS FORM FORMAT FREE FUNCTION FUNCTION-POOL
47 syn keyword abapStatement GENERATE GET
48 syn keyword abapStatement HIDE
49 syn keyword abapStatement IF IMPORT IMPORTING INDEX INFOTYPES INITIALIZATION INPUT INSERT
50 syn keyword abapStatement LEAVE LIKE LOAD LOCAL LOOP
51 syn keyword abapStatement MESSAGE MODIFY MODULE MOVE MOVE-CORRESPONDING MULTIPLY MULTIPLY-CORRESPONDING
52 syn keyword abapStatement NEW-LINE NEW-PAGE NEW-SECTION
53 syn keyword abapStatement ON OVERLAY
54 syn keyword abapStatement PACK PARAMETERS PERFORM POSITION PRINT-CONTROL PROGRAM PROVIDE PUT
55 syn keyword abapStatement RAISE RANGES READ RECEIVE REFRESH REJECT REPLACE REPORT RESERVE RESTORE ROLLBACK RP-PROVIDE-FROM-LAST
56 syn keyword abapStatement SCAN SCROLL SEARCH SELECT SELECT-OPTIONS SELECTION-SCREEN SET SHIFT SKIP SORT SPLIT START-OF-SELECTION STATICS STOP SUBMIT SUBTRACT SUBTRACT-CORRESPONDING SUM SUMMARY SUPPRESS SYNTAX-CHECK SYNTAX-TRACE
57 syn keyword abapStatement TABLES TOP-OF-PAGE TRANSFER TRANSLATE TYPE TYPE-POOL TYPE-POOLS TYPES
58 syn keyword abapStatement UNPACK UPDATE
59 syn keyword abapStatement WHEN WHILE WINDOW WRITE
62 syn keyword abapStatement OCCURS STRUCTURE OBJECT PROPERTY
63 syn keyword abapStatement CASTING APPEND RAISING VALUE COLOR
64 syn keyword abapStatement LINE-SIZE LINE-COUNT MESSAGE-ID
65 syn keyword abapStatement CHANGING EXCEPTIONS DEFAULT CHECKBOX COMMENT
66 syn keyword abapStatement ID NUMBER FOR DISPLAY-MODE TITLE OUTPUT
68 " More multi-word statements
69 syn match abapStatement "\(\W\|^\)\(WITH\W\+\(HEADER\W\+LINE\|FRAME\|KEY\)\|WITH\)\(\W\|$\)"ms=s+1,me=e-1
70 syn match abapStatement "\(\W\|^\)NO\W\+STANDARD\W\+PAGE\W\+HEADING\(\W\|$\)"ms=s+1,me=e-1
71 syn match abapStatement "\(\W\|^\)\(EXIT\W\+FROM\W\+STEP\W\+LOOP\|EXIT\)\(\W\|$\)"ms=s+1,me=e-1
72 syn match abapStatement "\(\W\|^\)\(BEGIN\W\+OF\W\+\(BLOCK\|LINE\)\|BEGIN\W\+OF\)\(\W\|$\)"ms=s+1,me=e-1
73 syn match abapStatement "\(\W\|^\)\(END\W\+OF\W\+\(BLOCK\|LINE\)\|END\W\+OF\)\(\W\|$\)"ms=s+1,me=e-1
74 syn match abapStatement "\(\W\|^\)IS\W\+INITIAL\(\W\|$\)"ms=s+1,me=e-1
75 syn match abapStatement "\(\W\|^\)NO\W\+INTERVALS\(\W\|$\)"ms=s+1,me=e-1
76 syn match abapStatement "\(\W\|^\)SEPARATED\W\+BY\(\W\|$\)"ms=s+1,me=e-1
77 syn match abapStatement "\(\W\|^\)\(USING\W\+\(EDIT\W\+MASK\)\|USING\)\(\W\|$\)"ms=s+1,me=e-1
78 syn match abapStatement "\(\W\|^\)\(WHERE\W\+\(LINE\)\)\(\W\|$\)"ms=s+1,me=e-1
79 syn match abapStatement "\(\W\|^\)RADIOBUTTON\W\+GROUP\(\W\|$\)"ms=s+1,me=e-1
80 syn match abapStatement "\(\W\|^\)REF\W\+TO\(\W\|$\)"ms=s+1,me=e-1
82 " Special ABAP specific tables:
83 syn match abapSpecial "\(\W\|^\)\(sy\|\(p\|pa\)\d\d\d\d\|t\d\d\d.\|innnn\)\(\W\|$\)"ms=s+1,me=e-1
84 syn match abapSpecialTables "\(sy\|\(p\|pa\)\d\d\d\d\|t\d\d\d.\|innnn\)-"me=e-1 contained
85 syn match abapSpecial "\(\W\|^\)\w\+-\(\w\+-\w\+\|\w\+\)"ms=s+1 contains=abapSpecialTables
88 syn match abapSpecial "<\w\+>"
91 syn keyword abapSpecial TRUE FALSE NULL SPACE
94 syn region abapInclude start="include" end="." contains=abapComment
97 syn keyword abapTypes c n i p f d t x
99 " Atritmitic operators
100 syn keyword abapOperator abs sign ceil floor trunc frac acos asin atan cos sin tan
101 syn keyword abapOperator cosh sinh tanh exp log log10 sqrt
104 syn keyword abapOperator strlen xstrlen charlen numofchar dbmaxlen
107 syn keyword abapOperator lines
109 " Table operators (SELECT operators)
110 syn keyword abapOperator INTO FROM WHERE GROUP BY HAVING ORDER BY SINGLE
111 syn keyword abapOperator APPENDING CORRESPONDING FIELDS OF TABLE
112 syn keyword abapOperator LEFT RIGHT OUTER INNER JOIN AS CLIENT SPECIFIED BYPASSING BUFFER UP TO ROWS CONNECTING
113 syn keyword abapOperator EQ NE LT LE GT GE NOT AND OR XOR IN LIKE BETWEEN
115 " An error? Not strictly... but cannot think of reason this is intended.
116 syn match abapError "\.\."
119 syn region abapComment start="^\*" end="$" contains=abapTodo
120 syn match abapComment "\".*" contains=abapTodo
121 syn keyword abapTodo contained TODO NOTE
123 " Define the default highlighting.
124 " For version 5.7 and earlier: only when not done already
125 " For version 5.8 and later: only when an item doesn't have highlighting yet
126 if version >= 508 || !exists("did_abap_syntax_inits")
128 let did_abap_syntax_inits = 1
129 command -nargs=+ HiLink hi link <args>
131 command -nargs=+ HiLink hi def link <args>
134 HiLink abapError Error
135 HiLink abapComment Comment
136 HiLink abapInclude Include
137 HiLink abapSpecial Special
138 HiLink abapSpecialTables PreProc
139 HiLink abapSymbolOperator abapOperator
140 HiLink abapOperator Operator
141 HiLink abapStatement Statement
142 HiLink abapString String
143 HiLink abapFloat Float
144 HiLink abapNumber Number
145 HiLink abapHex Number
150 let b:current_syntax = "abap"