mirror of
https://github.com/cheat/cheat.git
synced 2024-11-16 17:08:29 +01:00
51 lines
40 KiB
Go
51 lines
40 KiB
Go
|
package o
|
||
|
|
||
|
import (
|
||
|
. "github.com/alecthomas/chroma" // nolint
|
||
|
"github.com/alecthomas/chroma/lexers/internal"
|
||
|
)
|
||
|
|
||
|
// OpenedgeAbl lexer.
|
||
|
var OpenEdgeABL = internal.Register(MustNewLazyLexer(
|
||
|
&Config{
|
||
|
Name: "OpenEdge ABL",
|
||
|
Aliases: []string{"openedge", "abl", "progress", "openedgeabl"},
|
||
|
Filenames: []string{"*.p", "*.cls", "*.w", "*.i"},
|
||
|
MimeTypes: []string{"text/x-openedge", "application/x-openedge"},
|
||
|
},
|
||
|
func() Rules {
|
||
|
return Rules{
|
||
|
"root": {
|
||
|
{`/\*`, CommentMultiline, Push("comment")},
|
||
|
{`//.*?$`, CommentSingle, nil},
|
||
|
{`\{`, CommentPreproc, Push("preprocessor")},
|
||
|
{`\s*&.*`, CommentPreproc, nil},
|
||
|
{`0[xX][0-9a-fA-F]+[LlUu]*`, LiteralNumberHex, nil},
|
||
|
{`(?i)(DEFINE|DEF|DEFI|DEFIN)\b`, KeywordDeclaration, nil},
|
||
|
{`(?i)(^|(?<=[^\w\-]))(CHARACTER|CHAR|CHARA|CHARAC|CHARACT|CHARACTE|COM-HANDLE|DATE|DATETIME|DATETIME-TZ|DECIMAL|DEC|DECI|DECIM|DECIMA|HANDLE|INT64|INTEGER|INT|INTE|INTEG|INTEGE|LOGICAL|LONGCHAR|MEMPTR|RAW|RECID|ROWID)\s*($|(?=[^\w\-]))`, KeywordType, nil},
|
||
|
{Words(`(?i)(^|(?<=[^\w\-]))`, `\s*($|(?=[^\w\-]))`, `ABS`, `ABSO`, `ABSOL`, `ABSOLU`, `ABSOLUT`, `ABSOLUTE`, `ABSTRACT`, `ACCELERATOR`, `ACCUM`, `ACCUMU`, `ACCUMUL`, `ACCUMULA`, `ACCUMULAT`, `ACCUMULATE`, `ACTIVE-FORM`, `ACTIVE-WINDOW`, `ADD`, `ADD-BUFFER`, `ADD-CALC-COLUMN`, `ADD-COLUMNS-FROM`, `ADD-EVENTS-PROCEDURE`, `ADD-FIELDS-FROM`, `ADD-FIRST`, `ADD-INDEX-FIELD`, `ADD-LAST`, `ADD-LIKE-COLUMN`, `ADD-LIKE-FIELD`, `ADD-LIKE-INDEX`, `ADD-NEW-FIELD`, `ADD-NEW-INDEX`, `ADD-SCHEMA-LOCATION`, `ADD-SUPER-PROCEDURE`, `ADM-DATA`, `ADVISE`, `ALERT-BOX`, `ALIAS`, `ALL`, `ALLOW-COLUMN-SEARCHING`, `ALLOW-REPLICATION`, `ALTER`, `ALWAYS-ON-TOP`, `AMBIG`, `AMBIGU`, `AMBIGUO`, `AMBIGUOU`, `AMBIGUOUS`, `ANALYZ`, `ANALYZE`, `AND`, `ANSI-ONLY`, `ANY`, `ANYWHERE`, `APPEND`, `APPL-ALERT`, `APPL-ALERT-`, `APPL-ALERT-B`, `APPL-ALERT-BO`, `APPL-ALERT-BOX`, `APPL-ALERT-BOXE`, `APPL-ALERT-BOXES`, `APPL-CONTEXT-ID`, `APPLICATION`, `APPLY`, `APPSERVER-INFO`, `APPSERVER-PASSWORD`, `APPSERVER-USERID`, `ARRAY-MESSAGE`, `AS`, `ASC`, `ASCE`, `ASCEN`, `ASCEND`, `ASCENDI`, `ASCENDIN`, `ASCENDING`, `ASK-OVERWRITE`, `ASSEMBLY`, `ASSIGN`, `ASYNC-REQUEST-COUNT`, `ASYNC-REQUEST-HANDLE`, `ASYNCHRONOUS`, `AT`, `ATTACHED-PAIRLIST`, `ATTR`, `ATTR-SPACE`, `ATTRI`, `ATTRIB`, `ATTRIBU`, `ATTRIBUT`, `AUDIT-CONTROL`, `AUDIT-ENABLED`, `AUDIT-EVENT-CONTEXT`, `AUDIT-POLICY`, `AUTHENTICATION-FAILED`, `AUTHORIZATION`, `AUTO-COMP`, `AUTO-COMPL`, `AUTO-COMPLE`, `AUTO-COMPLET`, `AUTO-COMPLETI`, `AUTO-COMPLETIO`, `AUTO-COMPLETION`, `AUTO-END-KEY`, `AUTO-ENDKEY`, `AUTO-GO`, `AUTO-IND`, `AUTO-INDE`, `AUTO-INDEN`, `AUTO-INDENT`, `AUTO-RESIZE`, `AUTO-RET`, `AUTO-RETU`, `AUTO-RETUR`, `AUTO-RETURN`, `AUTO-SYNCHRONIZE`, `AUTO-Z`, `AUTO-ZA`, `AUTO-ZAP`, `AUTOMATIC`, `AVAIL`, `AVAILA`, `AVAILAB`, `AVAILABL`, `AVAILABLE`, `AVAILABLE-FORMATS`, `AVE`, `AVER`, `AVERA`, `AVERAG`, `AVERAGE`, `AVG`, `BACK`, `BACKG`, `BACKGR`, `BACKGRO`, `BACKGROU`, `BACKGROUN`, `BACKGROUND`, `BACKWARD`, `BACKWARDS`, `BASE64-DECODE`, `BASE64-ENCODE`, `BASE-ADE`, `BASE-KEY`, `BATCH`, `BATCH-`, `BATCH-M`, `BATCH-MO`, `BATCH-MOD`, `BATCH-MODE`, `BATCH-SIZE`, `BEFORE-H`, `BEFORE-HI`, `BEFORE-HID`, `BEFORE-HIDE`, `BEGIN-EVENT-GROUP`, `BEGINS`, `BELL`, `BETWEEN`, `BGC`, `BGCO`, `BGCOL`, `BGCOLO`, `BGCOLOR`, `BIG-ENDIAN`, `BINARY`, `BIND`, `BIND-WHERE`, `BLANK`, `BLOCK-ITERATION-DISPLAY`, `BLOCK-LEVEL`, `BORDER-B`, `BORDER-BO`, `BORDER-BOT`, `BORDER-BOTT`, `BORDER-BOTTO`, `BORDER-BOTTOM-CHARS`, `BORDER-BOTTOM-P`, `BORDER-BOTTOM-PI`, `BORDER-BOTTOM-PIX`, `BORDER-BOTTOM-PIXE`, `BORDER-BOTTOM-PIXEL`, `BORDER-BOTTOM-PIXELS`, `BORDER-L`, `BORDER-LE`, `BORDER-LEF`, `BORDER-LEFT`, `BORDER-LEFT-`, `BORDER-LEFT-C`, `BORDER-LEFT-CH`, `BORDER-LEFT-CHA`, `BORDER-LEFT-CHAR`, `BORDER-LEFT-CHARS`, `BORDER-LEFT-P`, `BORDER-LEFT-PI`, `BORDER-LEFT-PIX`, `BORDER-LEFT-PIXE`, `BORDER-LEFT-PIXEL`, `BORDER-LEFT-PIXELS`, `BORDER-R`, `BORDER-RI`, `BORDER-RIG`, `BORDER-RIGH`, `BORDER-RIGHT`, `BORDER-RIGHT-`, `BORDER-RIGHT-C`, `BORDER-RIGHT-CH`, `BORDER-RIGHT-CHA`, `BORDER-RIGHT-CHAR`, `BORDER-RIGHT-CHARS`, `BORDER-RIGHT-P`, `BORDER-RIGHT-PI`, `BORDER-RIGHT-PIX`, `BORDER-RIGHT-PIXE`, `BORDER-RIGHT-PIXEL`, `BORDER-RIGHT-PIXELS`, `BORDER-T`, `BORDER-TO`, `BORDER-TOP`, `BORDER-TOP-`, `BORDER-TOP-C`, `BORDER-TOP-CH`, `BORDER-TOP-CHA`, `BORDER-TOP-CHAR`, `BORDER-TOP-CHARS`, `BORDER-TOP-P`, `BORDER-TOP-PI`, `BORDER-TOP-PIX`, `BORDER-TOP-PIXE`, `BORDER-TOP-PIXEL`, `BORDER-TOP-PIXELS`, `BOX`, `BOX-SELECT`, `BOX-SELECTA`, `BOX-SELECTAB`, `BOX-SELECTABL`, `BOX-SELECTABLE`, `BREAK`, `BROWSE`, `BUFFER`, `BUFFER-CHARS`, `BUFFER-COMPARE`, `BUFFER-COPY`, `BUFFER-CREATE`, `BUFFER-DELETE`, `BUFFER-FIELD`, `BUFFER-HANDLE`, `BUFFER-LINES`, `BUFFER-NAME`, `BUFFER-PARTITION-ID`, `BUFFER-RELEASE`, `BUFFER-VALUE`, `BUTTON`, `BUTTONS`, `BY`, `BY-POINTER`, `BY-VARIANT-POINTER`, `CACHE`, `CACHE-SIZE`, `CALL`, `CALL-NAME`, `CALL-TYPE`, `CAN-CREATE`, `CAN-DELETE`, `CAN-DO`, `CAN-DO-DOMAIN-SUPPORT`, `CAN-FIND`, `CAN-QUERY`, `CAN-READ`, `CAN-SET`, `CAN-WRITE`, `CANCEL-BREAK`, `CANCEL-BUTTON`, `CAPS`, `CAREFUL-PAINT`, `CASE`, `CASE-SEN`, `CASE-SENS`, `CASE-SENSI`, `
|
||
|
{`"(\\\\|\\[^\\]|[^"\\])*"`, LiteralStringDouble, nil},
|
||
|
{`'(\\\\|\\[^\\]|[^'\\])*'`, LiteralStringSingle, nil},
|
||
|
{`[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?`, LiteralNumberFloat, nil},
|
||
|
{`[0-9]+`, LiteralNumberInteger, nil},
|
||
|
{`\s+`, Text, nil},
|
||
|
{`[+*/=-]`, Operator, nil},
|
||
|
{`[.:()]`, Punctuation, nil},
|
||
|
{`.`, NameVariable, nil},
|
||
|
},
|
||
|
"comment": {
|
||
|
{`[^*/]`, CommentMultiline, nil},
|
||
|
{`/\*`, CommentMultiline, Push()},
|
||
|
{`\*/`, CommentMultiline, Pop(1)},
|
||
|
{`[*/]`, CommentMultiline, nil},
|
||
|
{`\/\/`, CommentSingle, nil},
|
||
|
},
|
||
|
"preprocessor": {
|
||
|
{`[^{}]`, CommentPreproc, nil},
|
||
|
{`\{`, CommentPreproc, Push()},
|
||
|
{`\}`, CommentPreproc, Pop(1)},
|
||
|
},
|
||
|
}
|
||
|
},
|
||
|
))
|