Skip to content

Instantly share code, notes, and snippets.

@XWolfOverride
Forked from christianjianelli/shBrushAbap.js
Created February 28, 2016 11:58
Show Gist options
  • Save XWolfOverride/9bb5f0fdcbf952522864 to your computer and use it in GitHub Desktop.
Save XWolfOverride/9bb5f0fdcbf952522864 to your computer and use it in GitHub Desktop.
SyntaxHighlighter brush for ABAP code
/**
* SyntaxHighlighter
* http://alexgorbatchev.com/SyntaxHighlighter
*
* SyntaxHighlighter is donationware. If you are using it, please donate.
* http://alexgorbatchev.com/SyntaxHighlighter/donate.html
*
* @version
* 3.0.83 (July 02 2010)
*
* @copyright
* Copyright (C) 2004-2010 Alex Gorbatchev.
*
* @license
* Dual licensed under the MIT and GPL licenses.
*/
;(function()
{
// CommonJS
typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null;
function Brush()
{
var keywords = 'ABAP-SOURCE ABBREVIATED ABSTRACT ACCEPT ACCEPTING' +
' ACCORDING ACTIVATION ACTUAL ADD ADD-CORRESPONDING' +
' ADJACENT AFTER ALIAS ALIASES ALIGN' +
' ALL ALLOCATE ANALYSIS ANALYZER AND' +
' ANY APPEND APPENDAGE APPENDING APPLICATION' +
' ARCHIVE AREA ARITHMETIC AS ASCENDING' +
' ASSERT ASSIGN ASSIGNED ASSIGNING AT' +
' ATTRIBUTES AUTHORITY AUTHORITY-CHECK AVG BACK' +
' BACKGROUND BACKUP BACKWARD BADI BEFORE' +
' BEGIN BETWEEN BIG BINARY BIT' +
' BIT-AND BIT-NOT BIT-OR BIT-XOR BLACK' +
' BLANK BLANKS BLOB BLOCK BLOCKS' +
' BLUE BOUND BOUNDARIES BOUNDS BOXED' +
' BREAK-POINT BT BUFFER BY BYPASSING' +
' BYTE BYTE-CA BYTE-CN BYTE-CO BYTE-CS' +
' BYTE-NA BYTE-NS BYTE-ORDER CA CALL' +
' CALLING CASE CASTING CATCH CENTER' +
' CENTERED CHAIN CHAIN-INPUT CHAIN-REQUEST CHANGE' +
' CHANGING CHAR-TO-HEX CHARACTER CHECK CHECKBOX' +
' CI_ CIRCULAR CLASS CLASS-CODING CLASS-DATA' +
' CLASS-EVENTS CLASS-METHODS CLASS-POOL CLEANUP CLEAR' +
' CLIENT CLOB CLOCK CLOSE CN CS' +
' CO CODE CODING COL_BACKGROUND COL_GROUP' +
' COL_HEADING COL_KEY COL_NEGATIVE COL_NORMAL COL_POSITIVE' +
' COL_TOTAL COLLECT COLOR COLUMN COLUMNS' +
' COMMENT COMMENTS COMMIT COMMON COMMUNICATION' +
' COMPARING COMPONENT COMPONENTS COMPRESSION COMPUTE' +
' CONCATENATE CONDENSE CONDITION CONNECT CONNECTION' +
' CONSTANTS CONTEXT CONTEXTS CONTINUE CONTROL' +
' CONTROLS CONVERSION CONVERT COPIES COPY' +
' CORRESPONDING COUNT COUNTRY COVER CP' +
' CPI CREATE CREATING CRITICAL CS' +
' CURRENCY CURRENT CURSOR CURSOR-SELECTION CUSTOMER' +
' CUSTOMER-FUNCTION DANGEROUS DATA DATABASE DATAINFO' +
' DATASET DATE DAYLIGHT DD/MM/YY DD/MM/YYYY' +
' DDMMYY DEALLOCATE DECIMALS DEFAULT DEFERRED' +
' DEFINE DEFINING DEFINITION DELETE DELETING' +
' DEMAND DEPARTMENT DESCENDING DESCRIBE DESTINATION' +
' DETAIL DIALOG DIRECTORY DISCONNECT DISPLAY' +
' DISPLAY-MODE DISTANCE DISTINCT DIV DIVIDE' +
' DIVIDE-CORRESPONDING DO DUMMY DUPLICATE DUPLICATES' +
' DURATION DURING DYNAMIC DYNPRO E' +
' EDIT EDITOR-CALL ELSE ELSEIF ENABLED' +
' ENABLING ENCODING END END-ENHANCEMENT-SECTION END-LINES' +
' END-OF-DEFINITION END-OF-FILE END-OF-PAGE END-OF-SELECTION ENDAT' +
' ENDCASE ENDCATCH ENDCHAIN ENDCLASS ENDDO' +
' ENDENHANCEMENT ENDEXEC ENDFORM ENDFUNCTION ENDIAN' +
' ENDIF ENDING ENDINTERFACE ENDLOOP ENDMETHOD' +
' ENDMODULE ENDON ENDPROVIDE ENDSELECT ENDTRY' +
' ENDWHILE ENGINEERING ENHANCEMENT ENHANCEMENT-POINT ENHANCEMENT-SECTION' +
' ENHANCEMENTS ENTRIES ENTRY ENVIRONMENT EQ' +
' EQUIV ERRORMESSAGE ERRORS ESCAPE ESCAPING' +
' EVENT EVENTS EXACT EXCEPTION EXCEPTION-TABLE' +
' EXCEPTIONS EXCLUDE EXCLUDING EXEC EXECUTE' +
' EXISTS EXIT EXIT-COMMAND EXPAND EXPIRATION' +
' EXPLICIT EXPONENT EXPORT EXPORTING EXTENDED' +
' EXTENSION EXTRACT FETCH FIELD FIELD-GROUPS' +
' FIELD-SYMBOLS FIELDS FILE FILTER FILTER-TABLE' +
' FILTERS FINAL FIND FIRST FIRST-LINE' +
' FIXED-POINT FKEQ FKGE FLUSH FONT' +
' FOR FORM FORMAT FORWARD FOUND' +
' FRAME FRAMES FREE FRIENDS FROM' +
' FUNCTION FUNCTION-POOL FUNCTIONALITY FURTHER GAPS' +
' GE GENERATE GET GIVING GKEQ' +
' GKGE GLOBAL GREEN GROUP GROUPS' +
' GT HANDLE HANDLER HARMLESS HASHED' +
' HAVING HEAD-LINES HEADER HEADERS HEADING' +
' HELP-ID HELP-REQUEST HIDE HIGH HINT' +
' HOLD HOTSPOT I ICON ID' +
' IDENTIFICATION IDENTIFIER IDS IF IGNORING' +
' IMMEDIATELY IMPLEMENTATION IMPLEMENTATIONS IMPLICIT IMPORT' +
' IMPORTING IN INACTIVE INCL INCLUDE' +
' INCLUDES INCLUDING INCREMENT INDEX INDEX-LINE' +
' INFOTYPES INHERITING INIT INITIAL INITIALIZATION' +
' INNER INOUT INPUT INPUT INSERT' +
' INSTANCES INTENSIFIED INTERFACE INTERFACE-POOL INTERFACES' +
' INTERNAL INTERVALS INTO INVERSE INVERTED-DATE' +
' IS ISO JOB JOIN KEEP' +
' KEEPING KERNEL KEY KEYS KEYWORDS' +
' KIND LANGUAGE LAST LATE LAYOUT' +
' LE LEADING LEAVE LEFT LEFT-JUSTIFIED' +
' LEFTPLUS LEFTSPACE LEGACY LENGTH LEVEL' +
' LEVELS LIKE LINE LINE-COUNT LINE-SELECTION' +
' LINE-SIZE LINEFEED LINES LIST LIST-PROCESSING' +
' LISTBOX LITTLE LOAD LOAD-OF-PROGRAM LOB' +
' LOCAL LOCALE LOCATOR LOG-POINT LOGFILE' +
' LOGICAL LONG LOOP LOW LOWER' +
' LPI LT M MAIL MAIN' +
' MAJOR-ID MARGIN MARK MASK MATCH' +
' MATCHCODE MAX MAXIMUM MEDIUM MEMORY' +
' MESSAGE MESSAGE-ID MESSAGES METHOD METHODS' +
' MIN MINIMUM MINOR-ID MM/DD/YY MM/DD/YYYY' +
' MMDDYY MOD MODE MODIF MODIFIER' +
' MODIFY MODULE MOVE MOVE-CORRESPONDING MULTIPLY' +
' MULTIPLY-CORRESPONDING NA NAME NAMETAB NATIVE' +
' NB NE NESTING NEW NEW-LINE' +
' NEW-PAGE NEW-SECTION NEXT NO NO-DISPLAY' +
' NO-EXTENSION NO-GAP NO-GAPS NO-GROUPING NO-HEADING' +
' NO-SCROLLING NO-SIGN NO-TITLE NO-TOPOFPAGE NO-ZERO' +
' NODE NODES NON-UNICODE NON-UNIQUE NOT' +
' NP NS NULL NUMBER O' +
' OBJECT OBJECTS OBLIGATORY OCCURRENCE OCCURRENCES' +
' OCCURS OF OFF OFFSET OLE' +
' ON ONLY OPEN OPTION OPTIONAL' +
' OPTIONS OR ORDER OTHER OTHERS' +
' OUT OUTER OUTPUT OUTPUT-LENGTH OVERFLOW' +
' OVERLAY PACK PACKAGE PAD PADDING' +
' PAGE PAGES PARAMETER PARAMETER-TABLE PARAMETERS' +
' PART PATTERN PERCENTAGE PERFORM PERFORMING' +
' PERSON PF PF-STATUS PINK PLACES' +
' POOL POS_HIGH POS_LOW POSITION PRAGMAS' +
' PRECOMPILED PREFERRED PRESERVING PRIMARY PRINT' +
' PRINT-CONTROL PRIORITY PRIVATE PROCEDURE PROCESS' +
' PROGRAM PROPERTY PROTECTED PROVIDE PUBLIC' +
' PUSHBUTTON PUT QUEUE-ONLY QUICKINFO RADIOBUTTON' +
' RAISE RAISING RANGE RANGES RAW' +
' READ READ-ONLY READER RECEIVE RECEIVED' +
' RECEIVER RECEIVING RED REDEFINITION REDUCED' +
' REF REFERENCE REFRESH REGEX REJECT' +
' REMOTE RENAMING REPLACE REPLACEMENT REPLACING' +
' REPORT REQUEST REQUESTED RESERVE RESET' +
' RESOLUTION RESPECTING RESPONSIBLE RESULT RESULTS' +
' RESUMABLE RESUME RETRY RETURN RETURNCODE' +
' RETURNING RIGHT RIGHT-JUSTIFIED RIGHTPLUS RIGHTSPACE' +
' RISK RMC_COMMUNICATION_FAILURE RMC_INVALID_STATUS RMC_SYSTEM_FAILURE ROLLBACK' +
' ROUND ROWS RUN SAP SAP-SPOOL' +
' SAVING SCALE_PRESERVING SCALE_PRESERVING_SCIENTIFIC SCAN SCIENTIFIC' +
' SCIENTIFIC_WITH_LEADING_ZERO SCREEN SCROLL SCROLL-BOUNDARY SCROLLING' +
' SEARCH SECONDARY SECONDS SECTION SELECT' +
' SELECT-OPTIONS SELECTION SELECTION-SCREEN SELECTION-SET SELECTION-SETS' +
' SELECTION-TABLE SELECTIONS SEND SEPARATE SEPARATED' +
' SET SHARED SHIFT SHORT SHORTDUMP-ID' +
' SIGN SIGN_AS_POSTFIX SIMPLE SINGLE SIZE' +
' SKIP SKIPPING SMART SOME SORT' +
' SORTABLE SORTED SOURCE SPACE SPECIFIED' +
' SPLIT SPOOL SPOTS SQL STABLE' +
' STAMP STANDARD START-OF-SELECTION STARTING STATE' +
' STATEMENT STATEMENTS STATIC STATICS STATUSINFO' +
' STEP-LOOP STOP STRUCTURE STRUCTURES STYLE' +
' SUBKEY SUBMATCHES SUBMIT SUBROUTINE SUBSCREEN' +
' SUBSTRING SUBTRACT SUBTRACT-CORRESPONDING SUFFIX SUM' +
' SUMMARY SUMMING SUPPLIED SUPPLY SUPPRESS' +
' SWITCH SWITCHSTATES SYMBOL SYNCPOINTS SYNTAX-CHECK' +
' SYNTAX-TRACE SYSTEM-CALL SYSTEM-EXCEPTIONS SYSTEM-EXIT TAB' +
' TABBED TABLE TABLES TABLEVIEW TABSTRIP' +
' TASK TEST TESTING TEXT TEXTPOOL' +
' THEN TIME TIMES TIMESTAMP TIMEZONE' +
' TITLE TITLE-LINES TITLEBAR TO' +
' TOKENIZATION TOKENS TOP-LINES TOP-OF-PAGE TRACE-FILE' +
' TRACE-TABLE TRAILING TRANSACTION TRANSFER TRANSFORMATION' +
' TRANSLATE TRANSPORTING TRMAC TRUNCATE TRUNCATION' +
' TRY TYPE TYPE-POOL TYPE-POOLS TYPES' +
' ULINE UNASSIGN UNDER UNICODE UNIQUE' +
' UNIT UNIX UNPACK UNTIL UNWIND' +
' UP UPDATE UPPER USER USER-COMMAND' +
' USING UTF-8 VALID VALUE VALUE-REQUEST' +
' VALUES VARY VARYING VERIFICATION-MESSAGE VERSION' +
' VIA VISIBLE WAIT WARNING WHEN' +
' WHENEVER WHERE WHILE WIDTH WINDOW' +
' WINDOWS WITH WITH-HEADING WITH-TITLE WITHOUT' +
' WORD WORK WRITE WRITER XML' +
' YELLOW YES YYMMDD Z ZERO' +
' ZONE CALL METHOD CLASS ENDCLASS CLASS-DATA CLASS-EVENTS' +
' CLASS-METHODS CREATE OBJECT EVENTS INTERFACE INTERFACES' +
' METHOD ENDMETHOD METHODS PRIVATE SECTION PROTECTED SECTION' +
' PUBLIC SECTION RAISE EVENT SET HANDLER';
this.regexList = [
{ regex: /^[\*].*$|["].*$/gm, css: 'comments' }, // one line comments
{ regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings
{ regex: /\b([\d]+(\.[\d]+)?|0x[a-f0-9]+)\b/gi, css: 'value' }, // numbers
{ regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' } // abap keyword
];
this.forHtmlScript({
left : /(&lt;|<)%[@!=]?/g,
right : /%(&gt;|>)/g
});
};
Brush.prototype = new SyntaxHighlighter.Highlighter();
Brush.aliases = ['abap'];
SyntaxHighlighter.brushes.Abap = Brush;
// CommonJS
typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment