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.4
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 * Control, declarative and other statements are assigned URLs to sap documentation website:
28 * http://help.sap.com/abapdocu/en/ABAP<statement_name>.htm
32 * 2009/02/25 (1.0.8.3)
33 * - Some more rework of the language file
34 * 2009/01/04 (1.0.8.2)
35 * - Major Release, more than 1000 statements and keywords added = whole abap 7.1 (Sandra Rossi)
41 * - in DATA data TYPE type, 2nd "data" and 2nd "type" are highlighted with data
42 * style, but should be ignored. Same problem for all words!!! This is quite impossible to
43 * solve it as we should define syntaxes of all statements (huge effort!) and use a lex
44 * or something like that instead of regexp I guess.
45 * - Some words are considered as being statement names (report, tables, etc.) though they
46 * are used as keyword in some statements. For example: FORM xxxx TABLES itab. It was
47 * arbitrary decided to define them as statement instead of keyword, because it may be
48 * useful to have the URL to SAP help for some of them.
49 * - if a comment is between 2 words of a keyword (for example SEPARATED "comment \n BY),
50 * it is not considered as a keyword, but it should!
51 * - for statements like "READ DATASET", GeSHi does not allow to set URLs because these
52 * statements are determined by REGEXPS. For "READ DATASET", the URL should be
53 * ABAPREAD_DATASET.htm. If a technical solution is found, be careful : URLs
54 * are sometimes not valid because the URL does not exist. For example, for "AT NEW"
55 * statement, the URL should be ABAPAT_ITAB.htm (not ABAPAT_NEW.htm).
56 * There are many other exceptions.
57 * Note: for adding this functionality within your php program, you can execute this code:
58 * function add_urls_to_multi_tokens( $matches ) {
59 * $url = preg_replace( "/[ \n]+/" , "_" , $matches[3] );
60 * if( $url == $matches[3] ) return $matches[0] ;
61 * else return $matches[1]."<a href=\"http://help.sap.com/abapdocu/en/ABAP".strtoupper($url).".htm\">".$matches[3]."</a>".$matches[4];
63 * $html = $geshi->parse_code();
64 * $html = preg_replace_callback( "£(zzz:(control|statement|data);\">)(.+?)(</span>)£s", "add_urls_to_multi_tokens", $html );
66 * - Numbers followed by a dot terminating the statement are not properly recognized
68 *************************************************************************************
70 * This file is part of GeSHi.
72 * GeSHi is free software; you can redistribute it and/or modify
73 * it under the terms of the GNU General Public License as published by
74 * the Free Software Foundation; either version 2 of the License, or
75 * (at your option) any later version.
77 * GeSHi is distributed in the hope that it will be useful,
78 * but WITHOUT ANY WARRANTY; without even the implied warranty of
79 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
80 * GNU General Public License for more details.
82 * You should have received a copy of the GNU General Public License
83 * along with GeSHi; if not, write to the Free Software
84 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
86 ************************************************************************************/
88 $language_data = array(
89 'LANG_NAME' => 'ABAP',
90 'COMMENT_SINGLE' => array(
93 'COMMENT_MULTI' => array(),
94 'COMMENT_REGEXP' => array(
95 // lines beginning with star at 1st position are comments
96 // (star anywhere else is not a comment, especially be careful with
97 // "assign dref->* to <fs>" statement)
100 'CASE_KEYWORDS' => 0,
101 'QUOTEMARKS' => array(
108 //***********************************************
109 // Section 2 : process sequences of several tokens
110 //***********************************************
126 'at selection-screen',
129 'assign table field',
131 'call customer-function',
132 'call customer subscreen',
137 'call selection-screen',
139 'call transformation',
145 'convert time stamp',
156 'exit from step-loop',
160 'generate subroutine-pool',
176 'leave list-processing',
179 'leave to list-processing',
180 'leave to transaction',
193 'receive results from function',
201 'set extended check',
205 'set left scroll-boundary',
211 'set run time analyzer',
212 'set run time clock',
224 'accepting duplicate keys',
226 'accepting truncation',
229 'adjacent duplicates',
237 'and return to screen',
239 'and skip first screen',
244 'archiving parameters',
251 'as search patterns',
257 'at cursor-selection',
259 'at next application statement',
266 'begin of common part',
269 'begin of tabbed block',
291 'corresponding fields of table',
292 'corresponding fields of',
303 'dataset expiration',
304 'daylight saving time',
314 'during line-selection',
315 'dynamic selections',
319 'end of common part',
323 'end of tabbed block',
328 'enhancement options into',
330 'environment time format',
332 'exporting list to memory',
339 'first occurrence of',
340 'fixed-point arithmetic',
359 'frame program from',
364 'from number format',
378 'ignoring conversion errors',
379 'ignoring structure boundaries',
380 'implementations from',
382 'in background task',
383 'in background unit',
386 'in char-to-hex mode',
389 'in legacy binary mode',
390 'in legacy text mode',
398 'include program from',
409 'into sortable code',
412 'keeping directory entry',
413 'keeping logical unit of work',
443 'maximum width into',
450 'new list identification',
452 'no database selection',
459 'no standard page heading',
462 'non-unique sorted key',
463 'not at end of mode',
478 'on help-request for',
479 'on radiobutton group',
481 'on value-request for',
483 'option class-coding',
494 'preferred parameter',
495 'preserving identifier escaping',
502 'radiobutton groups',
507 'reduced functionality',
513 'renaming with suffix',
514 'replacement character',
516 'replacement length',
518 'replacement offset',
534 'shared memory enabled',
535 'skipping byte-order mark',
566 'transporting no fields',
575 'using no edit mask',
577 'using selection-screen',
578 'using selection-set',
579 'using selection-sets of program',
585 'via selection-screen',
590 'with byte-order mark',
592 'with current switchstates',
593 'with explicit enhancements',
595 'with free selections',
596 'with further secondary keys',
599 'with implicit enhancements',
600 'with inactive enhancements',
604 'with list tokenization',
605 'with native linefeed',
606 'with non-unique key',
609 'with precompiled headers',
610 'with selection-table',
611 'with smart linefeed',
616 'with unix linefeed',
617 'with windows linefeed',
618 'without further secondary keys',
619 'without selection-screen',
620 'without spool dynpro',
626 //**********************************************************
627 // Other abap statements
628 //**********************************************************
655 'divide-corresponding',
659 'end-enhancement-section',
676 'enhancement-section',
715 'move-corresponding',
717 'multiply-corresponding',
748 'start-of-selection',
751 'subtract-corresponding',
772 //**********************************************************
774 //**********************************************************
1109 'scale_preserving_scientific',
1111 'scientific_with_leading_zero',
1209 //**********************************************************
1210 // screen statements
1211 //**********************************************************
1226 //**********************************************************
1227 // internal statements
1228 //**********************************************************
1238 'scan and check abap-source',
1239 'syntax-check for dynpro',
1240 'syntax-check for program',
1244 'verification-message'
1247 //**********************************************************
1248 // Control statements
1249 //**********************************************************
1282 //**********************************************************
1283 // variable declaration statements
1284 //**********************************************************
1306 '(', ')', '{', '}', '[', ']', '+', '-', '*', '/', '!', '%', '^', '&', ':', ',', '.'
1309 '>=', '<=', '<', '>', '='
1315 'CASE_SENSITIVE' => array(
1316 GESHI_COMMENTS
=> false,
1328 'KEYWORDS' => array(
1329 1 => 'color: #000066; text-transform: uppercase; font-weight: bold; zzz:control;', //control statements
1330 2 => 'color: #cc4050; text-transform: uppercase; font-weight: bold; zzz:data;', //data statements
1331 3 => 'color: #005066; text-transform: uppercase; font-weight: bold; zzz:statement;', //first token of other statements
1332 4 => 'color: #500066; text-transform: uppercase; font-weight: bold; zzz:keyword;', // next tokens of other statements ("keywords")
1333 5 => 'color: #005066; text-transform: uppercase; font-weight: bold; zzz:statement;',
1334 6 => 'color: #000066; text-transform: uppercase; font-weight: bold; zzz:control;',
1335 7 => 'color: #000066; text-transform: uppercase; font-weight: bold; zzz:control;',
1336 8 => 'color: #005066; text-transform: uppercase; font-weight: bold; zzz:statement;',
1337 9 => 'color: #500066; text-transform: uppercase; font-weight: bold; zzz:keyword;'
1339 'COMMENTS' => array(
1340 1 => 'color: #808080; font-style: italic;',
1341 2 => 'color: #339933;',
1342 'MULTI' => 'color: #808080; font-style: italic;'
1344 'ESCAPE_CHAR' => array(
1345 0 => 'color: #000099; font-weight: bold;'
1347 'BRACKETS' => array(
1348 0 => 'color: #808080;'
1351 0 => 'color: #4da619;'
1354 0 => 'color: #3399ff;'
1357 1 => 'color: #202020;',
1358 2 => 'color: #202020;'
1361 0 => 'color: #808080;',
1362 1 => 'color: #800080;',
1363 2 => 'color: #0000ff;'
1371 1 => 'http://help.sap.com/abapdocu/en/ABAP{FNAMEU}.htm',
1372 2 => 'http://help.sap.com/abapdocu/en/ABAP{FNAMEU}.htm',
1373 3 => 'http://help.sap.com/abapdocu/en/ABAP{FNAMEU}.htm',
1382 'OBJECT_SPLITTERS' => array(
1388 'STRICT_MODE_APPLIES' => GESHI_NEVER
,
1389 'SCRIPT_DELIMITERS' => array(
1391 'HIGHLIGHT_STRICT_BLOCK' => array(
1393 'PARSER_CONTROL' => array(
1394 'KEYWORDS' => array(
1396 'SPACE_AS_WHITESPACE' => true
1399 'SPACE_AS_WHITESPACE' => true
1402 'SPACE_AS_WHITESPACE' => true