# ABAP keywords, builtins, RAP syntax and CDS syntax taken from 
#
# https://help.sap.com/doc/abapdocu_758_index_htm/7.58/en-US/index.htm?file=abenabap_shortref.htm
# https://help.sap.com/doc/abapdocu_758_index_htm/7.58/en-us/abenbuilt_in_functions_overview.htm
# https://help.sap.com/doc/abapdocu_758_index_htm/7.58/en-US/abencds_language_elements.htm
# https://help.sap.com/doc/abapdocu_758_index_htm/7.58/en-us/abenabap_words.htm
#
# Updated with modern ABAP 7.40+ and CDS keywords from ABAP 7.58 documentation
#
# This file is manually maintained by Manuel Laggner <manuel@laggner.info>
#
# Please contact them with any requests for updates.

module Rouge
  module Lexers
    class ABAP
      KEYWORDS = Set.new %w(
        *-INPUT ?TO ABAP-SOURCE ABBREVIATED ABS ABSTRACT ACCEPT ACCEPTING
        ACCESS ACCORDING ACCP ACTION ACTIVATION ACTUAL ADD
        ADD-CORRESPONDING ADJACENT ADJUST_NUMBERS AFTER ALIAS ALIASES ALIGN
        ALL ALLOCATE ALLOW_PRECISION_LOSS ALLOWED ALPHA ANALYSIS ANALYZER
        AMDP AND ANNOTATION ANNOTATIONS ANY APPEND APPENDAGE APPENDING
        APPLICATION ARCHIVE AREA ARITHMETIC AS ASCENDING ASPECT ASSERT ASSIGN
        ASSIGNED ASSIGNING ASSOCIATION ASSOCIATIONS ASYNCHRONOUS AT
        ATTRIBUTES AUTHORITY AUTHORITY-CHECK AUTHORIZATION AUTO AVG BACK
        BACKGROUND BACKUP BACKWARD BADI BASE BEFORE BEGIN BETWEEN BIG BINARY
        BINTOHEX BIT BIT-AND BIT-NOT BIT-OR BIT-XOR BITFIELD BLACK BLANK
        BLANKS BLOB BLOCK BLOCKED BLOCKS BLUE BOUND BOUNDARIES BOUNDS BOXED
        BREAK-POINT BREAKUP BT BUFFER BULK BY BYPASSING BYTE BYTE-CA BYTE-CN
        BYTE-CO BYTE-CS BYTE-NA BYTE-NS BYTE-ORDER CA CALL CALLING CASE CAST
        CASTING CATCH CEIL CENTER CENTERED CHAIN CHAIN-INPUT CHAIN-REQUEST
        CHANGE CHANGING CHANNELS CHAR CHAR-TO-HEX CHARACTER CHECK CHECKBOX
        CHECK_BEFORE_SAVE CHILD CI_ CID CIRCULAR CLASS CLASS-CODING
        CLASS-DATA CLASS-EVENTS CLASS-METHODS CLASS-POOL CDS CLEANUP
        CLEANUP_FINALIZE CLEAR CLIENT CLIENTS CLNT CLOB CLOCK CLOSE CN CO
        COALESCE CODE CODING COLLECT COLOR COLUMN COLUMNS COL_BACKGROUND
        COL_GROUP COL_HEADING COL_KEY COL_NEGATIVE COL_NORMAL COL_POSITIVE
        COL_TOTAL COMMENT COMMENTS COMMIT COMMON COMMUNICATION COMPARING
        COMPONENT COMPONENTS COMPOSITION COMPRESSION COMPUTE CONCAT
        CONCATENATE CONCAT_WITH_SPACE COND CONDENSE CONDITION CONNECT
        CONNECTION CONSTANTS CONTEXT CONTEXTS CONTINUE CONTROL CONTROLS CONV
        CONVERSION CONVERT COPIES COPY CORR CORR_SPEARMAN CORRESPONDING
        CORRSPEARMAN COUNT COUNTRY COVER CP CPI CREATE CREATING CRITICAL CS
        CUKY CURR CURRENCY CURRENCY_CONVERSION CURRENT CURSOR
        CURSOR-SELECTION CUSTOMER CUSTOMER-FUNCTION DANGEROUS DATA DATABASE
        DATAINFO DATASET DATE DATN DATN_ADD_DAYS DATN_ADD_MONTHS
        DATN_DAYS_BETWEEN DATS DATS_ADD_DAYS DATS_ADD_MONTHS
        DATS_DAYS_BETWEEN DATS_FROM_DATN DATS_IS_VALID DATS_TIMS_TO_TSTMP
        DATS_TO_DATN DAYLIGHT DAYNAME DB2 DB6 DD/MM/YY DD/MM/YYYY DDMMYY
        DEALLOCATE DEC DECFLOAT16 DECFLOAT16_DEC DECFLOAT34 DECFLOAT34_DEC
        DECIMALS DECIMAL_SHIFT DECLARATIONS DEEP DEFAULT DEFERRED DEFINE
        DEFINING DEFINITION DELETE DELETING DEMAND DENSE_RANK DEPARTMENT
        DEPTH DESCENDING DESCRIBE DESTINATION DETAIL DETERMINATION DETERMINE
        DETERMINISTIC DF16_DEC DF16_RAW DF16_SCL DF34_DEC DF34_RAW DF34_SCL
        DIALOG DIRECTORY DISABLE DISCARDING DISCONNECT DISPLAY DISPLAY-MODE
        DISTANCE DISTINCT DIV DIVIDE DIVIDE-CORRESPONDING DIVISION DO DUMMY
        DUPLICATE DUPLICATES DURATION DURING DYNAMIC DYNPRO E EARLY EDIT
        EDITOR-CALL ELSE ELSEIF EMPTY ENABLED ENABLING ENCODING END
        END-ENHANCEMENT-SECTION END-LINES END-OF-DEFINITION END-OF-FILE
        END-OF-EDITING END-OF-PAGE END-OF-SELECTION END-TEST-INJECTION
        END-TEST-SEAM ENDAT ENDCASE ENDCATCH ENDCHAIN ENDCLASS ENDDO
        ENDENHANCEMENT ENDEXEC ENDFORM ENDFUNCTION ENDIAN ENDIF ENDING
        ENDINTERFACE ENDLOOP ENDMETHOD ENDMODULE ENDON ENDPROVIDE ENDSELECT
        ENDTRY ENDWHILE ENDWITH ENGINEERING ENHANCEMENT ENHANCEMENT-POINT
        ENHANCEMENT-SECTION ENHANCEMENTS ENTITIES ENTITY ENTRIES ENTRY ENUM
        ENVIRONMENT EQ EQUIV ERROR ERRORMESSAGE ERRORS ESCAPE ESCAPING EVENT
        EVENTS EXACT EXCEPT EXCEPTION EXCEPTION-TABLE EXCEPTIONS EXCLUDE
        EXCLUDING EXEC EXECUTE EXISTS EXIT EXIT-COMMAND EXPAND EXPANDING
        EXPIRATION EXPLICIT EXPONENT EXPORT EXPORTING EXTEND EXTENDED
        EXTENSION EXTRACT EXTRACT_DAY EXTRACT_HOUR EXTRACT_MINUTE
        EXTRACT_MONTH EXTRACT_SECOND EXTRACT_YEAR FAIL FETCH FIELD
        FIELD-GROUPS FIELD-SYMBOL FIELD-SYMBOLS FIELDS FILE FILTER
        FILTER-TABLE FILTERS FINAL FIND FIRST FIRST-LINE FIRST_VALUE
        FIXED-POINT FKEQ FKGE FLOOR FLTP FLTP_TO_DEC FLUSH FOLLOWING FONT
        FOR FORM FORMAT FORWARD FOUND FRAME FRAMES FREE FRIENDS FROM FULL
        FUNCTION FUNCTION-POOL FUNCTIONALITY FURTHER GAPS GE GENERATE GET
        GGM1 GEOM_EWKB GIVING GKEQ GKGE GLOBAL GRANT GRAPH GREEN GROUP
        GROUPING GROUPS GT HANDLE HANDLER HARMLESS HASHED HAVING HDB
        HEAD-LINES HEADER HEADERS HEADING HELP-ID HELP-REQUEST HEXTOBIN HIDE
        HIERARCHY HIERARCHY_ANCESTORS HIERARCHY_ANCESTORS_AGGREGATE
        HIERARCHY_DESCENDANTS HIERARCHY_DESCENDANTS_AGGREGATE
        HIERARCHY_SIBLINGS HIGH HINT HOLD HOTSPOT I ICON ID IDENTIFICATION
        IDENTIFIER IDS IF IGNORE IGNORING IMMEDIATELY IMPLEMENTATION
        IMPLEMENTATIONS IMPLEMENTED IMPLICIT IMPORT IMPORTING IN INACTIVE
        INCL INCLUDE INCLUDES INCLUDING INCREMENT INDEX INDEX-LINE INFOTYPES
        INHERITING INIT INITIAL INITIALIZATION INNER INOUT INPUT INSERT
        INSTANCE INSTANCES INSTR INT1 INT2 INT4 INT8 INTENSIFIED INTERFACE
        INTERFACE-POOL INTERFACES INTERNAL INTERVALS INTO INVERSE
        INVERTED-DATE IS ISO IS_VALID ITNO JOB JOIN KEEP KEEPING KERNEL KEY
        KEYS KEYWORDS KIND LAG LANG LANGUAGE LAST LAST_VALUE LATE LAYOUT
        LCHR LDB_PROCESS LE LEAD LEADING LEAVE LEFT LEFT-JUSTIFIED LEFTPLUS
        LEFTSPACE LEGACY LENGTH LET LEVEL LEVELS LIKE LIKE_REGEXPR LINE
        LINE-COUNT LINE-SELECTION LINE-SIZE LINEFEED LINES LIST
        LIST-PROCESSING LISTBOX LITTLE LLANG LOAD LOAD-OF-PROGRAM LOB LOCAL
        LOCALE LOCATE LOCATE_REGEXPR LOCATE_REGEXPR_AFTER LOCATOR LOCK
        LOCKS LOG-POINT LOGFILE LOGICAL LONG LOOP LOW LOWER LPAD LPI LRAW
        LT LTRIM M MAIL MAIN MAJOR-ID MANY MAP_MESSAGES MAPPING MARGIN MARK
        MASK MATCH MATCH_RESULT MATCH_RESULT_TAB MATCHCODE MATCHED MAX
        MAXIMUM MEASURES MEDIAN MEDIUM MEMBERS MEMORY MESH MESSAGE
        MESSAGE-ID MESSAGES MESSAGING METHOD METHODS MIN MINIMUM MINOR-ID
        MM/DD/YY MM/DD/YYYY MMDDYY MOD MODE MODIF MODIFIER MODIFY MODULE
        MONTHNAME MOVE MOVE-CORRESPONDING MSSQLNT MULTIPLE MULTIPLY
        MULTIPLY-CORRESPONDING NA NAME NAMETAB NATIVE NB NE NESTED 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
        NTILE NULL NULLS NUMBER NUMBERING NUMC O OBJECT OBJECTS OBLIGATORY
        OCCURRENCE OCCURRENCES OCCURS OF OFF OFFSET ON ONE ONLY OPEN OPTION
        OPTIONAL OPTIONS OR ORACLE ORDER ORPHANS OTHER OTHERS OUT OUTER
        OUTPUT OUTPUT-LENGTH OVERFLOW OVERLAY PACK PACKAGE PAD PADDING PAGE
        PAGES PARAMETER PARAMETER-TABLE PARAMETERS PARENT PARENTS PART
        PARTIALLY PARTITION PATTERN PCRE PERCENTAGE PERFORM PERFORMING
        PERSON PF PF-STATUS PINK PLACES POOL POSITION POS_HIGH POS_LOW
        PRAGMAS PREC PRECEDING PRECOMPILED PREFERRED PRESERVING PRIMARY
        PRINT PRINT-CONTROL PRIORITY PRIVATE PROCEDURE PROCESS PROGRAM
        PROPERTY PROTECTED PROVIDE PUBLIC PUSH PUSHBUTTON PUT QUAN
        QUEUE-ONLY QUICKINFO RADIOBUTTON RAISE RAISING RANGE RANGES RAW
        RAWSTRING READ READ-ONLY READER RECEIVE RECEIVED RECEIVER RECEIVING
        RED REDEFINITION REDUCE REDUCED REF REFERENCE REFRESH REGEX REJECT
        RELATING REMOTE RENAMING REPLACE REPLACEMENT REPLACING REPORT
        REPORTED REQUEST REQUESTED REQUIRED RESERVE RESET RESOLUTION
        RESPECTING RESPONSE RESPONSES RESPONSIBLE RESULT RESULTS RESUMABLE
        RESUME RETRY RETURN RETURNCODE RETURNING RETURNS RIGHT
        RIGHT-JUSTIFIED RIGHTPLUS RIGHTSPACE RISK RMC_COMMUNICATION_FAILURE
        RMC_INVALID_STATUS RMC_SYSTEM_FAILURE ROLE ROLLBACK ROUND ROW
        ROW_NUMBER ROWS RPAD RTRIM RUN SAP SAP-SPOOL SAVING SCALAR
        SCALE_PRESERVING SCALE_PRESERVING_SCIENTIFIC SCAN SCIENTIFIC
        SCIENTIFIC_WITH_LEADING_ZERO SCHEMA 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 SESSION SET SETS
        SHARED SHIFT SHORT SHORTDUMP SHORTDUMP-ID SIBLINGS SIGN
        SIGN_AS_POSTFIX SIMPLE SINGLE SIZE SKIP SKIPPING SMART SOME SORT
        SORTABLE SORTED SOURCE SPACE SPANTREE SPECIFIED SPLIT SPOOL SPOTS
        SQL SQLSCRIPT SSTRING STABLE STAMP STANDARD START START-OF-EDITING
        START-OF-SELECTION STARTING STATE STATEMENT STATEMENTS STATIC
        STATICS STATUSINFO STDDEV STEP-LOOP STEP STOP STRING STRING_AGG
        STRUCTURE STRUCTURES STYLE SUBKEY SUBMATCH_RESULT
        SUBMATCH_RESULT_TAB SUBMATCHES SUBMIT SUBROUTINE SUBSCREEN SUBSTRING
        SUBSTRING_REGEXPR SUBTOTAL SUBTRACT SUBTRACT-CORRESPONDING SUFFIX
        SUM SUMMARY SUMMING SUPPLIED SUPPLY SUPPRESS SWITCH SWITCHSTATES
        SYMBOL SYBASE SYNCPOINTS SYNTAX SYNTAX-CHECK SYNTAX-TRACE SYST
        SYSTEM-CALL SYSTEM-EXCEPTIONS SYSTEM-EXIT T000 TAB TABBED TABLE
        TABLES TABLEVIEW TABSTRIP TARGET TASK TASKS TEST TEST-INJECTION
        TEST-SEAM TESTING TEXT TEXTPOOL THEN THROW TIME TIMES TIMESTAMP
        TIMEZONE TIMN TIMS TIMS_FROM_TIMN TIMS_IS_VALID TIMS_TO_TIMN TITLE
        TITLE-LINES TITLEBAR TO TOKENIZATION TOKENS TOP-LINES TOP-OF-PAGE
        TOTAL TRACE-ENTRY TRACE-FILE TRACE-TABLE TRAILING TRANSACTION
        TRANSFER TRANSFORMATION TRANSLATE TRANSPORTING TRDIR TRMAC TRUNCATE
        TRUNCATION TRY TSTMP_ADD_SECONDS TSTMP_CURRENT_UTCTIMESTAMP
        TSTMP_IS_VALID TSTMP_SECONDS_BETWEEN TYPE TYPE-POOL TYPE-POOLS
        TYPES ULINE UNASSIGN UNDER UNICODE UNION UNIQUE UNIT UNIT_CONVERSION
        UNIX UNBLOCKED UNBOUNDED UNPACK UNTIL UNWIND UP UPDATE UPPER USER
        USER-COMMAND USING UTF-8 VALID VALIDATE VALIDATION VALUE
        VALUE-REQUEST VALUES VAR VARC VARY VARYING VERBATIM
        VERIFICATION-MESSAGE VERSION VIA VIEW VISIBLE WAIT WARNING WEEKDAY
        WHEN WHENEVER WHERE WHILE WIDTH WINDOW WINDOWS WITH WITH-HEADING
        WITH-TITLE WITHOUT WORD WORK WORKSPACE WRITE WRITER XML XSD YELLOW
        YES YYMMDD Z ZERO ZONE
      )

      BUILTINS = Set.new %w(
        abs acos add_days add_months add_seconds asin atan attribute
        bintohex bit-set boolc boolx cast ceil cfunc charlen char_off
        class_constructor cmax cmin cnt coalesce concat concat_lines_of cond
        cond-var condense constructor contains contains_any_not_of
        contains_any_of conv corresponding cos cosh count count_any_not_of
        count_any_of curr_to_decfloat_amount currency_conversion
        current_utctimestamp datn_add_days datn_add_months datn_days_between
        dats_from_datn dats_to_datn days_between dbmaxlen dbtab deserialize
        distance div division escape exact exp filter find find_any_not_of
        find_any_of find_end floor fltp_to_dec frac get_numeric_value
        hextobin idx index insert ipow is_valid lines line_exists
        line_index log log10 match matches mod new nmax nmin numofchar reduce
        ref repeat replace replace_regexpr rescale reverse round
        seconds_between segment serialize shift_left shift_right sign sin
        sinh sqrt strlen substring substring_after substring_before
        substring_from substring_to sum switch switch-var table_line tan tanh
        tims_from_timn tims_to_timn to_lower to_mixed to_upper translate
        trunc tstmp_to_dats tstmp_to_dst tstmp_to_tims tstmpl_from_utcl
        tstmpl_to_utcl unit_conversion utcl_add_seconds utcl_current
        utcl_seconds_between utclong_add utclong_current utclong_diff value
        xsdbool xstrlen
      )
    end
  end
end
