Last active
July 5, 2024 08:19
-
-
Save awilkins/8d553e86b046d2c817b9062efc692779 to your computer and use it in GitHub Desktop.
Sublime syntax for SoftwareAG Natural, useful for `bat`, based on Unnatural Sublime Package (with fixed hex pattern)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| %YAML 1.2 | |
| --- | |
| # http://www.sublimetext.com/docs/syntax.html | |
| name: Natural | |
| file_extensions: | |
| - NSA # Parameter data area (PDA) | |
| - NSC # Copycode | |
| - NSD # DDM | |
| - NSG # Global data area (GDA) | |
| - NSH # Helproutine | |
| - NSL # Local data area (LDA) | |
| - NSM # Map | |
| - NSN # Subprogram | |
| - NSP # Program | |
| - NSS # Subroutine | |
| - NST # Text | |
| - NS4 # Class | |
| - NS5 # Command processor | |
| - NS7 # Function | |
| - NS8 # Adapter | |
| scope: source.natural | |
| contexts: | |
| main: | |
| - include: data-definition | |
| - include: wrong | |
| - include: placeholder | |
| - include: trailing-space | |
| - include: comments | |
| - include: subroutine | |
| - include: hash-vars | |
| - include: operators | |
| - include: keywords | |
| - include: date-and-time | |
| - include: labels | |
| - include: numbers | |
| - include: strings | |
| - include: keys | |
| - include: system-vars | |
| - include: variable-modifier | |
| comments: | |
| - match: (^\*.*$|\/\*.*$) | |
| scope: comment.natural | |
| data-definition: | |
| - match: (?i:define\s+data) | |
| captures: | |
| 0: keyword.natural | |
| push: | |
| - meta_scope: data.definition.natural | |
| - match: (?i:end-define) | |
| captures: | |
| 0: keyword.natural | |
| pop: true | |
| - include: comments | |
| - include: data-definition-keywords | |
| - include: external-storage-area | |
| - include: variable-level | |
| - include: variable-modifier | |
| - include: variable-type | |
| - include: view-definition | |
| - include: system-vars | |
| - include: hash-vars | |
| - include: placeholder | |
| - include: numbers | |
| - include: strings | |
| - include: wrong | |
| data-definition-keywords: | |
| - match: '(?<![\w-])(?i:with|view|value|result|redefine|parameter|optional|of|object|local|init|independent|global|dynamic|context|constant|const|by)(?![\w-])' | |
| scope: keyword.natural | |
| date-and-time: | |
| - match: '([tTdDeE]?)\''[0-9:\/\.\-]+\''' | |
| scope: support.constant.datetime.natural | |
| captures: | |
| 1: punctuation.definition.datetime.natural | |
| external-storage-area: | |
| - match: '(?i:(using)\s+([a-z0-9]+))' | |
| scope: storage.definition.using.natural | |
| captures: | |
| 1: keyword.natural | |
| 2: string.object.natural | |
| hash-vars: | |
| - match: '\#[a-zA-Z0-9-]+' | |
| scope: variable.natural | |
| keys: | |
| - match: '(?<![\w-])(?i:p[af][0-9]+|entr|clr|)(?![\w-])' | |
| scope: support.constant.key.natural | |
| keywords: | |
| - match: '(?<![\w-])(?i:year|xml|write|work|with|window|while|where|when|view|via|vertically|vert|variables|variable|vargraphic|values|value|val|using|user|used|upper|upload|update|until|unknown|unique|union|underlined|types|type|true|treq|translate|transfer|transaction|trailer|total|top|to|title|timezone|timestamp|time|thru|then|them|than|textvariable|textarea|text|terminate|tan|system|sync|symbol|suspend|suppressed|suppress|sum|subtract|substring|substr|subroutine|subprograms|subprogram|store|stop|step|status|static|statement|starting|start|stack|sqrt|sqlid|sql|specified|space|sound|sortkey|sorted|sort|some|skip|size|single|sin|show|short|sgn|settime|sets|set|server|sequence|separate|sensitive|send|selection|select|second|scroll|screen|scan|same|run|rulevar|rows|row|routine|rounded|rollback|right|reversed|returns|return|retry|retained|retain|ret|result|restore|response|resize|resetting|reset|required|request|reposition|reporter|report|replace|repeat|remainder|release|relationship|relation|rel|reject|reinput|referencing|referenced|reduce|redefine|recursively|records|record|rec|readonly|read|queryno|quarter|prty|prototype|property|program|profile|processing|process|printer|print|prefix|position|pos|policy|physical|pgup|pgdn|perform|pen|pattern|path|password|passw|pass|parse|parent|parameters|parameter|page|packageset|output|outer|order|or|options|optional|optimize|open|only|once|on|old|offset|off|of|occurrences|obtain|object|numeric|number|null-handle|null|notitle|notit|not|normalized|normalize|none|nohdr|node|no|nmin|newpage|ne|ncount|naver|native|namespace|named|name|multiply|multi-fetch|moving|move|more|month|module|modified|modal|minute|min|microsecond|mgid|method|messages|max|mask|mark|map|macroarea|lt|lower|loop|logical|log-ps|log-ls|log|locks|local|listed|lines|lindicator|limit|like|library-password|library|libpw|lib|level|less|length|left|leaving|leave|le|last|language|keys|key|keep|justified|just|join|isn|is|investigate|inverted|into|intersect|intermediate|interface4|interface|intercepted|integer|int|insert|insensitive|input|inner|initial|init|indicator|indexed|index|independent|incmac|including|included|include|incdir|incdic|inccont|inc|in|import|immediate|ignore|if|identical|id|hours|hour|horizontally|horiz|hold|histogram|hex|header|having|gui|gt|greater|globals|global|giving|give|gfid|get|generated|gen|ge|functions|function|full|from|framed|frac|found|forward|forms|formatting|formatted|format|form|for|float|first|find|final|filler|fill|file|fields|field|fetch|false|extracting|external|export|expand|exp|exit|exists|except|examine|every|event|even|escape|errors|error|erase|equal|eq|entire|enter|ending|endhoc|end-work|end-toppage|end-subroutine|end-start|end-sort|end-select|end-result|end-repeat|end-read|end-prototype|end-property|end-process|end-parse|end-parameters|end-norec|end-method|end-loop|end-interface|end-if|end-histogram|end-function|end-for|end-find|end-file|end-error|end-endpage|end-endfile|end-enddata|end-define|end-decide|end-class|end-browse|end-break|end-before|end-all|end|encoded|else|eject|edited|dynamic|download|doend|document|do|dnret|dnative|dlogon|dlogoff|divide|distinct|display|disp|disabled|direction|digits|dialog-id|dialog|descending|desc|delimiters|delimiter|delimited|delete|definition|define|decimal|decide|days|day|date|dataarea|data|cursor|current|coupled|count|cos|copy|copies|conversation|control|context|constant|const|condition|concat|compute|compress|compose|commit|command|codepage|coalesce|close|class|cipher|ciph|child|charposition|charlength|char|cdid|case|captioned|cap|callnat|calling|calldbproc|call|cabinet|by|but|browse|break|bottom|bot|block|between|before|base|backward|backout|avg|aver|auto|authorization|auth|attributes|att|atn|at|async|assigning|assign|ascending|asc|as|array|application|appl|any|and|alphabetically|alpha|all|alarm|after|add|activation|action|accept|absolute|abs)(?![\w-])' | |
| scope: keyword.natural | |
| labels: | |
| - match: '^\s*(?i:[a-z0-9]+\.)(?![\w])' | |
| scope: entity.name.tag.natural | |
| - match: '(?<=\()(?i:[a-z0-9]+\.)' | |
| scope: entity.name.tag.reference.natural | |
| numbers: | |
| - match: '(?<![\w-])[\+\-]?[0-9]+[,.]?[0-9]*(?![\w-])' | |
| scope: constant.numeric.natural | |
| - match: '([hH]?)\''[0-9a-fA-F]+\''' | |
| scope: constant.numeric.hex.natural | |
| captures: | |
| 1: punctuation.definition.hex.natural | |
| operators: | |
| - match: '(?<![\w-])(?i:thru|or|notequal|not|ne|lt|less\s+than\s+or\s+equal\s+to|less\s+than|less\s+equal|le|gt|greater\s+than\s+or\s+equal\s+to|greater\s+than|greater\s+equal|ge|equal\s+to|equal|eq|but|and)(?![\w-])' | |
| scope: keyword.operator.natural | |
| placeholder: | |
| - match: '(?<![\w-])(?i:[0-9]+x)(?![\w-])' | |
| scope: support.constant.placeholder.natural | |
| strings: | |
| - match: '([uU]?)\''' | |
| captures: | |
| 1: punctuation.definition.string.unicode.natural | |
| push: | |
| - meta_scope: string.natural | |
| - match: \'\' | |
| scope: constant.character.escape.natural | |
| - match: \' | |
| pop: true | |
| - match: '([uU]?)\"' | |
| captures: | |
| 1: punctuation.definition.string.unicode.natural | |
| push: | |
| - meta_scope: string.natural | |
| - match: \"\" | |
| scope: constant.character.escape.natural | |
| - match: \" | |
| pop: true | |
| - match: '(?i:(uh)\''[0-9a-f]+\'')' | |
| scope: string.unicode.hex.natural | |
| captures: | |
| 1: punctuation.definition.string.unicode.natural | |
| subroutine: | |
| - match: '(?<=subroutine)\s+([a-z0-9\-]+)' | |
| scope: definition.subroutine.natural | |
| captures: | |
| 1: entity.name.function.natural | |
| system-vars: | |
| - match: (?i:\*(winmgrvers|winmgr|window-ps|window-pos|window-ls|username|user|ui|ubound|type|tpvers|tpsys|tp|timx|timn|timestmp|timeout|time|timd|this-object|subroutine|steplib|startup|server-type|screenio|rowcount|program|pid|pf-name|pf-key|patch-level|parse-type|parse-row|pars-namespace-uri|parse-level|parse-col|parm-user|pagesize|page-number|pagelevel|page-event|osvers|os|opsys|occurrence|number|net-user|natvers|machineclass|log-ps|log-ls|locale|linesize|line-count|line|library-id|level|length|lbound|language|isn|init-user|init-program|initid|hostname|hardware|hardcopy|group|etid|error-ta|error-nr|error-line|devicedatx|datvs|datv|datu|datn|datj|dati|datg|date|datd|data|dat4u|dat4j|dat4i|da4e|dat4d|cursor|curs-line|curs-field|curs-col|current-unit|cputime|counter|convid|com|codepage|browser-io|applic-name|applic-id)) | |
| scope: constant.language.natural | |
| trailing-space: | |
| - match: '[ \t]+$' | |
| scope: invalid.deprecated.trailing-whitespace | |
| variable-level: | |
| - match: '^\s*[0-9]+' | |
| scope: support.constant.level.natural | |
| variable-modifier: | |
| - match: '(?<=\()(?i:ad|al|bx|cd|em|hd|pm)=[^\)]+' | |
| scope: variable.parameter.natural | |
| variable-type: | |
| - match: '(?<=\()(?i:[abu][0-9]*|[np][0-9\,\.]+|i0*[148]|f0*[48]|[cdlt])' | |
| scope: storage.type.natural | |
| view-definition: | |
| - match: '([a-zA-Z0-9\-]+)(?=\s+view)' | |
| scope: definition.view.natural | |
| wrong: | |
| - match: \t | |
| scope: invalid |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment