2 /*************************************************************************************
5 * Author: Andres Picazo (andres@andrespicazo.com)
7 * - Sandra Rossi (sandra.rossi@gmail.com)
8 * - Jacob Laursen (jlu@kmd.dk)
9 * Copyright: (c) 2007 Andres Picazo
10 * Release Version: 1.0.8.3
11 * Date Started: 2004/06/04
13 * ABAP language file for GeSHi.
15 * Reference abap language documentation (abap 7.1) : http://help.sap.com/abapdocu/en/ABENABAP_INDEX.htm
17 * ABAP syntax is highly complex, several problems could not be addressed, see TODO below if you dare ;-)
18 * Be aware that in ABAP language, keywords may be composed of several tokens,
19 * separated by one or more spaces or carriage returns
20 * (for example CONCATENATE 'hello' 'world' INTO string SEPARATED BY ' ')
21 * it's why we must decode them with REGEXPS. As there are many keywords with several tokens,
22 * I had to create a separate section in the code to simplify the reading.
23 * Be aware that some words may be highlighted several times like for "ref to data", which is first
24 * highlighted for "ref to data", then secondly for "ref to". It is very important to
25 * position "ref to" after "ref to data" otherwise "data" wouldn't be highlighted because
26 * of the previous highlight.
27 * Styles used : keywords are all displayed in upper case, and they are organized into 4 categories :
28 * 1) control statements (blue), 2) declarative statements (red-maroon),
29 * 3) other statements (blue-green), 4) keywords (violet).
30 * + GeSHi : literals (red) + symbols (green) + methods/attributes (mauve)
31 * + unchanged style for other words.
32 * Control, declarative and other statements are assigned URLs to sap documentation website:
33 * http://help.sap.com/abapdocu/en/ABAP<statement_name>.htm
37 * 2009/02/25 (1.0.8.3)
38 * - Some more rework of the language file
39 * 2009/01/04 (1.0.8.2)
40 * - Major Release, more than 1000 statements and keywords added = whole abap 7.1 (Sandra Rossi)
46 * - in DATA data TYPE type, 2nd "data" and 2nd "type" are highlighted with data
47 * style, but should be ignored. Same problem for all words!!! This is quite impossible to
48 * solve it as we should define syntaxes of all statements (huge effort!) and use a lex
49 * or something like that instead of regexp I guess.
50 * - Some words are considered as being statement names (report, tables, etc.) though they
51 * are used as keyword in some statements. For example: FORM xxxx TABLES itab. It was
52 * arbitrary decided to define them as statement instead of keyword, because it may be
53 * useful to have the URL to SAP help for some of them.
54 * - if a comment is between 2 words of a keyword (for example SEPARATED "comment \n BY),
55 * it is not considered as a keyword, but it should!
56 * - for statements like "READ DATASET", GeSHi does not allow to set URLs because these
57 * statements are determined by REGEXPS. For "READ DATASET", the URL should be
58 * ABAPREAD_DATASET.htm. If a technical solution is found, be careful : URLs
59 * are sometimes not valid because the URL does not exist. For example, for "AT NEW"
60 * statement, the URL should be ABAPAT_ITAB.htm (not ABAPAT_NEW.htm).
61 * There are many other exceptions.
62 * Note: for adding this functionality within your php program, you can execute this code:
63 * function add_urls_to_multi_tokens( $matches ) {
64 * $url = preg_replace( "/[ \n]+/" , "_" , $matches[3] );
65 * if( $url == $matches[3] ) return $matches[0] ;
66 * else return $matches[1]."<a href=\"http://help.sap.com/abapdocu/en/ABAP".strtoupper($url).".htm\">".$matches[3]."</a>".$matches[4];
68 * $html = $geshi->parse_code();
69 * $html = preg_replace_callback( "£(zzz:(control|statement|data);\">)(.+?)(</span>)£s", "add_urls_to_multi_tokens", $html );
71 * - Numbers followed by a dot terminating the statement are not properly recognized
73 *************************************************************************************
75 * This file is part of GeSHi.
77 * GeSHi is free software; you can redistribute it and/or modify
78 * it under the terms of the GNU General Public License as published by
79 * the Free Software Foundation; either version 2 of the License, or
80 * (at your option) any later version.
82 * GeSHi is distributed in the hope that it will be useful,
83 * but WITHOUT ANY WARRANTY; without even the implied warranty of
84 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
85 * GNU General Public License for more details.
87 * You should have received a copy of the GNU General Public License
88 * along with GeSHi; if not, write to the Free Software
89 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
91 ************************************************************************************/
93 $language_data = array(
94 'LANG_NAME' => 'ABAP',
95 'COMMENT_SINGLE' => array(
98 'COMMENT_MULTI' => array(),
99 'COMMENT_REGEXP' => array(
100 // lines beginning with star at 1st position are comments
101 // (star anywhere else is not a comment, especially be careful with
102 // "assign dref->* to <fs>" statement)
105 'CASE_KEYWORDS' => 0,
106 'QUOTEMARKS' => array(
113 //***********************************************
114 // Section 2 : process sequences of several tokens
115 //***********************************************
131 'at selection-screen',
134 'assign table field',
136 'call customer-function',
137 'call customer subscreen',
142 'call selection-screen',
144 'call transformation',
150 'convert time stamp',
161 'exit from step-loop',
165 'generate subroutine-pool',
181 'leave list-processing',
184 'leave to list-processing',
185 'leave to transaction',
198 'receive results from function',
206 'set extended check',
210 'set left scroll-boundary',
216 'set run time analyzer',
217 'set run time clock',
229 'accepting duplicate keys',
231 'accepting truncation',
234 'adjacent duplicates',
242 'and return to screen',
244 'and skip first screen',
249 'archiving parameters',
256 'as search patterns',
262 'at cursor-selection',
264 'at next application statement',
271 'begin of common part',
274 'begin of tabbed block',
296 'corresponding fields of table',
297 'corresponding fields of',
308 'dataset expiration',
309 'daylight saving time',
319 'during line-selection',
320 'dynamic selections',
324 'end of common part',
328 'end of tabbed block',
333 'enhancement options into',
335 'environment time format',
337 'exporting list to memory',
344 'first occurrence of',
345 'fixed-point arithmetic',
364 'frame program from',
369 'from number format',
383 'ignoring conversion errors',
384 'ignoring structure boundaries',
385 'implementations from',
387 'in background task',
388 'in background unit',
391 'in char-to-hex mode',
394 'in legacy binary mode',
395 'in legacy text mode',
403 'include program from',
414 'into sortable code',
417 'keeping directory entry',
418 'keeping logical unit of work',
448 'maximum width into',
455 'new list identification',
457 'no database selection',
464 'no standard page heading',
467 'non-unique sorted key',
468 'not at end of mode',
483 'on help-request for',
484 'on radiobutton group',
486 'on value-request for',
488 'option class-coding',
499 'preferred parameter',
500 'preserving identifier escaping',
507 'radiobutton groups',
512 'reduced functionality',
518 'renaming with suffix',
519 'replacement character',
521 'replacement length',
523 'replacement offset',
539 'shared memory enabled',
540 'skipping byte-order mark',
571 'transporting no fields',
580 'using no edit mask',
582 'using selection-screen',
583 'using selection-set',
584 'using selection-sets of program',
590 'via selection-screen',
595 'with byte-order mark',
597 'with current switchstates',
598 'with explicit enhancements',
600 'with free selections',
601 'with further secondary keys',
604 'with implicit enhancements',
605 'with inactive enhancements',
609 'with list tokenization',
610 'with native linefeed',
611 'with non-unique key',
614 'with precompiled headers',
615 'with selection-table',
616 'with smart linefeed',
621 'with unix linefeed',
622 'with windows linefeed',
623 'without further secondary keys',
624 'without selection-screen',
625 'without spool dynpro',
631 //**********************************************************
632 // Other abap statements
633 //**********************************************************
660 'divide-corresponding',
664 'end-enhancement-section',
681 'enhancement-section',
720 'move-corresponding',
722 'multiply-corresponding',
753 'start-of-selection',
756 'subtract-corresponding',
777 //**********************************************************
779 //**********************************************************
1122 'scale_preserving_scientific',
1124 'scientific_with_leading_zero',
1224 //**********************************************************
1225 // screen statements
1226 //**********************************************************
1241 //**********************************************************
1242 // internal statements
1243 //**********************************************************
1253 'scan and check abap-source',
1254 'syntax-check for dynpro',
1255 'syntax-check for program',
1259 'verification-message'
1262 //**********************************************************
1263 // Control statements
1264 //**********************************************************
1297 //**********************************************************
1298 // variable declaration statements
1299 //**********************************************************
1323 '(', ')', '{', '}', '[', ']', '+', '-', '*', '/', '!', '%', '^', '&', ':'
1326 'CASE_SENSITIVE' => array(
1327 GESHI_COMMENTS => false,
1339 'KEYWORDS' => array(
1340 1 => 'color: #000066; text-transform: uppercase; font-weight: bold; zzz:control;', //control statements
1341 2 => 'color: #cc4050; text-transform: uppercase; font-weight: bold; zzz:data;', //data statements
1342 3 => 'color: #005066; text-transform: uppercase; font-weight: bold; zzz:statement;', //first token of other statements
1343 4 => 'color: #500066; text-transform: uppercase; font-weight: bold; zzz:keyword;', // next tokens of other statements ("keywords")
1344 5 => 'color: #005066; text-transform: uppercase; font-weight: bold; zzz:statement;',
1345 6 => 'color: #000066; text-transform: uppercase; font-weight: bold; zzz:control;',
1346 7 => 'color: #000066; text-transform: uppercase; font-weight: bold; zzz:control;',
1347 8 => 'color: #005066; text-transform: uppercase; font-weight: bold; zzz:statement;',
1348 9 => 'color: #500066; text-transform: uppercase; font-weight: bold; zzz:keyword;'
1350 'COMMENTS' => array(
1351 1 => 'color: #808080; font-style: italic;',
1352 2 => 'color: #339933;',
1353 'MULTI' => 'color: #808080; font-style: italic;'
1355 'ESCAPE_CHAR' => array(
1356 0 => 'color: #000099; font-weight: bold;'
1358 'BRACKETS' => array(
1359 0 => 'color: #808080;'
1362 0 => 'color: #4da619;'
1365 0 => 'color: #3399ff;'
1368 1 => 'color: #202020;',
1369 2 => 'color: #202020;'
1372 0 => 'color: #800080;',
1373 1 => 'color: #808080;'
1381 1 => 'http://help.sap.com/abapdocu/en/ABAP{FNAMEU}.htm',
1382 2 => 'http://help.sap.com/abapdocu/en/ABAP{FNAMEU}.htm',
1383 3 => 'http://help.sap.com/abapdocu/en/ABAP{FNAMEU}.htm',
1392 'OBJECT_SPLITTERS' => array(
1398 'STRICT_MODE_APPLIES' => GESHI_NEVER,
1399 'SCRIPT_DELIMITERS' => array(
1401 'HIGHLIGHT_STRICT_BLOCK' => array(
1403 'PARSER_CONTROL' => array(
1404 'KEYWORDS' => array(
1406 'SPACE_AS_WHITESPACE' => true
1409 'SPACE_AS_WHITESPACE' => true
1412 'SPACE_AS_WHITESPACE' => true