diff --git a/syntax/stxAsm.go b/syntax/stxAsm.go index 54592f1..7264ef5 100644 --- a/syntax/stxAsm.go +++ b/syntax/stxAsm.go @@ -6,10 +6,6 @@ func init() { syntaxMap["asm"] = &lazySyntax{init: func() []byte { return []byte(`filetype: asm rules: - # This file is made for NASM assembly - - ## Instructions - # x86 - statement: "\\b(?i)(mov|aaa|aad|aam|aas|adc|add|and|call|cbw|clc|cld|cli|cmc|cmp|cmpsb|cmpsw|cwd|daa|das|dec|div|esc|hlt|idiv|imul|in|inc|int|into|iret|ja|jae|jb|jbe|jc|je|jg|jge|jl|jle|jna|jnae|jnb|jnbe|jnc|jne|jng|jnge|jnl|jnle|jno|jnp|jns|jnz|jo|jp|jpe|jpo|js|jz|jcxz|jmp|lahf|lds|lea|les|lock|lodsb|lodsw|loop|loope|loopne|loopnz|loopz|movsb|movsw|mul|neg|nop|or|pop|popf|push|pushf|rcl|rcr|rep|repe|repne|repnz|repz|ret|retn|retf|rol|ror|sahf|sal|sar|sbb|scasb|scasw|shl|shr|stc|std|sti|stosb|stosw|sub|test|wait|xchg|xlat|xor)(?-i)\\b" - statement: "\\b(?i)(bound|enter|ins|leave|outs|popa|pusha)(?-i)\\b" - statement: "\\b(?i)(arpl|clts|lar|lgdt|lidt|lldt|lmsw|loadall|lsl|ltr|sgdt|sidt|sldt|smsw|str|verr|verw)(?-i)\\b" @@ -27,8 +23,6 @@ rules: - statement: "\\b(?i)(vmptrdl|vmptrst|vmclear|vmread|vmwrite|vmcall|vmlaunch|vmresume|vmxoff|vmxon)(?-i)\\b" - statement: "\\b(?i)(lzcnt|popcnt)(?-i)\\b" - statement: "\\b(?i)(bextr|blcfill|blci|blcic|blcmask|blcs|blsfill|blsic|t1mskc|tzmsk)(?-i)\\b" - - # x87 - statement: "\\b(?i)(f2xm1|fabs|fadd|faddp|fbld|fbstp|fchs|fclex|fcom|fcomp|fcompp|fdecstp|fdisi|fdiv|fvidp|fdivr|fdivrp|feni|ffree|fiadd|ficom|ficomp|fidiv|fidivr|fild|fimul|fincstp|finit|fist|fistp|fisub|fisubr|fld|fld1|fldcw|fldenv|fldenvw|fldl2e|fldl2t|fldlg2|fldln2|fldpi|fldz|fmul|fmulp|fnclex|fndisi|fneni|fninit|fnop|fnsave|fnsavenew|fnstcw|fnstenv|fnstenvw|fnstsw|fpatan|fprem|fptan|frndint|frstor|frstorw|fsave|fsavew|fscale|fsqrt|fst|fstcw|fstenv|fstenvw|fstp|fstpsw|fsub|fsubp|fsubr|fsubrp|ftst|fwait|fxam|fxch|fxtract|fyl2x|fyl2xp1)(?-i)\\b" - statement: "\\b(?i)(fsetpm)(?-i)\\b" - statement: "\\b(?i)(fcos|fldenvd|fsaved|fstenvd|fprem1|frstord|fsin|fsincos|fstenvd|fucom|fucomp|fucompp)(?-i)\\b" @@ -37,8 +31,6 @@ rules: - statement: "\\b(?i)(fxrstor|fxsave)(?-i)\\b" - statement: "\\b(?i)(fisttp)(?-i)\\b" - statement: "\\b(?i)(ffreep)(?-i)\\b" - - # SIMD - statement: "\\b(?i)(emms|movd|movq|packssdw|packsswb|packuswb|paddb|paddw|paddd|paddsb|paddsw|paddusb|paddusw|pand|pandn|por|pxor|pcmpeqb|pcmpeqw|pcmpeqd|pcmpgtb|pcmpgtw|pcmpgtd|pmaddwd|pmulhw|pmullw|psllw|pslld|psllq|psrad|psraw|psrlw|psrld|psrlq|psubb|psubw|psubd|psubsb|psubsw|psubusb|punpckhbw|punpckhwd|punpckhdq|punkcklbw|punpckldq|punpcklwd)(?-i)\\b" - statement: "\\b(?i)(paveb|paddsiw|pmagw|pdistib|psubsiw|pmwzb|pmulhrw|pmvnzb|pmvlzb|pmvgezb|pmulhriw|pmachriw)(?-i)\\b" - statement: "\\b(?i)(femms|pavgusb|pf2id|pfacc|pfadd|pfcmpeq|pfcmpge|pfcmpgt|pfmax|pfmin|pfmul|pfrcp|pfrcpit1|pfrcpit2|pfrsqit1|pfrsqrt|pfsub|pfsubr|pi2fd|pmulhrw|prefetch|prefetchw)(?-i)\\b" @@ -58,15 +50,9 @@ rules: - statement: "\\b(?i)(extrq|insertq|movntsd|movntss)(?-i)\\b" - statement: "\\b(?i)(crc32|pcmpestri|pcmpestrm|pcmpistri|pcmpistrm|pcmpgtq)(?-i)\\b" - statement: "\\b(?i)(vfmaddpd|vfmaddps|vfmaddsd|vfmaddss|vfmaddsubpd|vfmaddsubps|vfmsubaddpd|vfmsubaddps|vfmsubpd|vfmsubps|vfmsubsd|vfmsubss|vfnmaddpd|vfnmaddps|vfnmaddsd|vfnmaddss|vfnmsubps|vfnmsubsd|vfnmsubss)(?-i)\\b" - - # Crypto - statement: "\\b(?i)(aesenc|aesenclast|aesdec|aesdeclast|aeskeygenassist|aesimc)(?-i)\\b" - statement: "\\b(?i)(sha1rnds4|sha1nexte|sha1msg1|sha1msg2|sha256rnds2|sha256msg1|sha256msg2)(?-i)\\b" - - # Undocumented - statement: "\\b(?i)(aam|aad|salc|icebp|loadall|loadalld|ud1)(?-i)\\b" - - ## Registers - identifier: "\\b(?i)(al|ah|bl|bh|cl|ch|dl|dh|bpl|sil|r8b|r9b|r10b|r11b|dil|spl|r12b|r13b|r14b|r15)(?-i)\\b" - identifier: "\\b(?i)(cw|sw|tw|fp_ds|fp_opc|fp_ip|fp_dp|fp_cs|cs|ss|ds|es|fs|gs|gdtr|idtr|tr|ldtr|ax|bx|cx|dx|bp|si|r8w|r9w|r10w|r11w|di|sp|r12w|r13w|r14w|r15w|ip)(?-i)\\b" - identifier: "\\b(?i)(fp_dp|fp_ip|eax|ebx|ecx|edx|ebp|esi|r8d|r9d|r10d|r11d|edi|esp|r12d|r13d|r14d|r15d|eip|eflags|mxcsr)(?-i)\\b" @@ -75,35 +61,25 @@ rules: - identifier: "\\b(?i)(xmm0|xmm1|xmm2|xmm3|xmm4|xmm5|xmm6|xmm7|xmm8|xmm9|xmm10|xmm11|xmm12|xmm13|xmm14|xmm15)(?-i)\\b" - identifier: "\\b(?i)(ymm0|ymm1|ymm2|ymm3|ymm4|ymm5|ymm6|ymm7|ymm8|ymm9|ymm10|ymm11|ymm12|ymm13|ymm14|ymm15)(?-i)\\b" - identifier: "\\b(?i)(zmm0|zmm1|zmm2|zmm3|zmm4|zmm5|zmm6|zmm7|zmm8|zmm9|zmm10|zmm11|zmm12|zmm13|zmm14|zmm15|zmm16|zmm17|zmm18|zmm19|zmm20|zmm21|zmm22|zmm23|zmm24|zmm25|zmm26|zmm27|zmm28|zmm29|zmm30|zmm31)(?-i)\\b" - - ## Constants - # Number - it works - constant.number: "\\b(|h|A|0x)+[0-9]+(|h|A)+\\b" - constant.number: "\\b0x[0-9 a-f A-F]+\\b" - - ## Preprocessor (NASM) - preproc: "%+(\\+|\\?|\\?\\?|)[a-z A-Z 0-9]+" - preproc: "%\\[[. a-z A-Z 0-9]*\\]" - - ## Other - statement: "\\b(?i)(extern|global|section|segment|_start|\\.text|\\.data|\\.bss)(?-i)\\b" - statement: "\\b(?i)(db|dw|dd|dq|dt|ddq|do)(?-i)\\b" - identifier: "[a-z A-Z 0-9 _]+:" - - constant.string: start: "\"" end: "\"" skip: "\\\\." rules: - constant.specialChar: "\\\\." - - constant.string: start: "'" end: "'" skip: "\\\\." rules: - constant.specialChar: "\\\\." - - comment: start: ";" end: "$" diff --git a/syntax/stxBash.go b/syntax/stxBash.go index 5f2ff6a..4c0a6e3 100644 --- a/syntax/stxBash.go +++ b/syntax/stxBash.go @@ -6,38 +6,28 @@ func init() { syntaxMap["bash"] = &lazySyntax{init: func() []byte { return []byte(`filetype: shell rules: - # Numbers - constant.number: "\\b[0-9]+\\b" - # Conditionals and control flow - statement: "\\b(case|do|done|elif|else|esac|exit|fi|for|function|if|in|local|read|return|select|shift|then|time|until|while)\\b" - # Shell commands - type: "\\b(cd|echo|export|let|set|umask|unset)\\b" - # Common linux commands - type: "\\b((g|ig)?awk|bash|dash|find|\\w{0,4}grep|kill|killall|\\w{0,4}less|make|pkill|sed|sh|tar|ping|traceroute|service|dpkg|apt|apt-get|apt-cache|aptitude|dpkg-buildpackage|yum)\\b" - # Coreutils commands - type: "\\b(which|sudo|base64|basename|cat|chcon|chgrp|chmod|chown|chroot|cksum|comm|cp|csplit|cut|date|(l)?dd|df|dir|dircolors|dirname|du|env|expand|expr|factor|false|fmt|fold|head|hostid|id|install|join|link|ln|logname|ls|md5sum|mkdir|mkfifo|mknod|mktemp|mv|nice|nl|nohup|nproc|numfmt|od|paste|pathchk|pinky|pr|printenv|printf|ptx|pwd|readlink|realpath|rm|rmdir|runcon|seq|(sha1|sha224|sha256|sha384|sha512)sum|shred|shuf|sleep|sort|split|stat|stdbuf|stty|sum|sync|tac|tail|tee|test|time|timeout|touch|tr|true|truncate|tsort|tty|uname|unexpand|uniq|unlink|users|vdir|wc|who|whoami|yes)\\b" - identifier.var: "(^([[:space:]]+)?[A-Za-z0-9_]+)" - special: "(\\{|\\}|\\(|\\)|\\;|\\]|\\[|` + "`" + `|\\\\|\\$|<|>|!|=|&|\\|)" - # Conditional flags - statement: "--[a-z-]+" - statement: "\\ -[a-z]+" - - identifier: "\\$\\{?[0-9A-Z_!@#$*?-]+\\}?" - identifier: "\\$\\{?[0-9A-Z_!@#$*?-]+\\}?" - symbol.brackets: "(\\[|\\]|\\{|\\}|[()])" - - constant.string: start: "\"" end: "\"" skip: "\\\\." rules: - constant.specialChar: "\\\\." - - constant.string: start: "'" end: "'" rules: [] - - comment: start: "#" end: "$" diff --git a/syntax/stxC.go b/syntax/stxC.go index 457379c..ab67797 100644 --- a/syntax/stxC.go +++ b/syntax/stxC.go @@ -19,22 +19,18 @@ rules: - constant: "'([^'\\\\]|(\\\\[\"'abfnrtv\\\\]))'" - constant: "'\\\\(([0-3]?[0-7]{1,2}))'" - constant: "'\\\\x[0-9A-Fa-f]{1,2}'" - # GCC builtins - statement: "__attribute__[[:space:]]*\\(\\([^)]*\\)\\)" - statement: "__(aligned|asm|builtin|hidden|inline|packed|restrict|section|typeof|weak)__" - # Operator Color - symbol.operator: "([.:;,+*|=!\\%]|<|>|/|-|&)" - symbol.brackets: "[(){}]|\\[|\\]" - constant.number: "(\\b[0-9]+\\b|\\b0x[0-9A-Fa-f]+\\b)" - constant.number: "NULL" - - constant.string: start: "\"" end: "\"" skip: "\\\\." rules: - constant.specialChar: "\\\\." - - constant.string: start: "'" end: "'" @@ -42,13 +38,11 @@ rules: rules: - preproc: "..+" - constant.specialChar: "\\\\." - - comment: start: "//" end: "$" rules: - todo: "(TODO|XXX|FIXME):?" - - comment: start: "/\\*" end: "\\*/" diff --git a/syntax/stxCaddyfile.go b/syntax/stxCaddyfile.go index 25e3fa9..5add466 100644 --- a/syntax/stxCaddyfile.go +++ b/syntax/stxCaddyfile.go @@ -16,7 +16,6 @@ rules: skip: "\\\\." rules: - constant.specialChar: "\\\\." - - preproc: "\\{(\\w+|\\$\\w+|%\\w+%)\\}" - comment: start: "#" diff --git a/syntax/stxCmake.go b/syntax/stxCmake.go index 49e9e4b..59a4dbb 100644 --- a/syntax/stxCmake.go +++ b/syntax/stxCmake.go @@ -8,34 +8,27 @@ func init() { rules: - identifier.var: "^[[:space:]]*[A-Z0-9_]+" - preproc: "^[[:space:]]*(include|include_directories|include_external_msproject)\\b" - - statement: "^[[:space:]]*\\b((else|end)?if|else|(end)?while|(end)?foreach|break)\\b" - statement: "\\b(COPY|NOT|COMMAND|PROPERTY|POLICY|TARGET|EXISTS|IS_(DIRECTORY|ABSOLUTE)|DEFINED)\\b[[:space:]]" - statement: "[[:space:]]\\b(OR|AND|IS_NEWER_THAN|MATCHES|(STR|VERSION_)?(LESS|GREATER|EQUAL))\\b[[:space:]]" - - special: "^[[:space:]]*\\b((end)?(function|macro)|return)" - - constant.string: start: "\"" end: "\"" skip: "\\\\." rules: - constant.specialChar: "\\\\." - - constant.string: start: "'" end: "'" skip: "\\\\." rules: - constant.specialChar: "\\\\." - - preproc: start: "\\$(\\{|ENV\\{)" end: "\\}" rules: [] - - identifier.macro: "\\b(APPLE|UNIX|WIN32|CYGWIN|BORLAND|MINGW|MSVC(_IDE|60|71|80|90)?)\\b" - - comment: start: "#" end: "$" diff --git a/syntax/stxCpp.go b/syntax/stxCpp.go index 13634ab..b03d0a7 100644 --- a/syntax/stxCpp.go +++ b/syntax/stxCpp.go @@ -6,7 +6,6 @@ func init() { syntaxMap["cpp"] = &lazySyntax{init: func() []byte { return []byte(`filetype: c++ rules: - - identifier: "\\b[A-Z_][0-9A-Z_]+\\b" - type: "\\b(auto|float|double|bool|char|int|short|long|sizeof|enum|void|static|const|constexpr|struct|union|typedef|extern|(un)?signed|inline)\\b" - type: "\\b((s?size)|((u_?)?int(8|16|32|64|ptr)))_t\\b" @@ -16,25 +15,17 @@ rules: - statement: "\\b(goto|continue|break|return)\\b" - preproc: "^[[:space:]]*#[[:space:]]*(define|pragma|include|(un|ifn?)def|endif|el(if|se)|if|warning|error)" - constant: "('([^'\\\\]|(\\\\[\"'abfnrtv\\\\]))'|'\\\\(([0-3]?[0-7]{1,2}))'|'\\\\x[0-9A-Fa-f]{1,2}')" - - # GCC builtins - statement: "(__attribute__[[:space:]]*\\(\\([^)]*\\)\\)|__(aligned|asm|builtin|hidden|inline|packed|restrict|section|typeof|weak)__)" - - # Operator Color - symbol.operator: "([.:;,+*|=!\\%]|<|>|/|-|&)" - # Parenthetical Color - symbol.brackets: "[(){}]|\\[|\\]" - - constant.number: "(\\b[0-9]+\\b|\\b0x[0-9A-Fa-f]+\\b)" - constant.bool: "(\\b(true|false)\\b|NULL)" - - constant.string: start: "\"" end: "\"" skip: "\\\\." rules: - constant.specialChar: "\\\\." - - constant.string: start: "'" end: "'" @@ -42,13 +33,11 @@ rules: rules: - preproc: "..+" - constant.specialChar: "\\\\." - - comment: start: "//" end: "$" rules: - todo: "(TODO|XXX|FIXME):?" - - comment: start: "/\\*" end: "\\*/" diff --git a/syntax/stxCsharp.go b/syntax/stxCsharp.go index 08fc12f..4f980d5 100644 --- a/syntax/stxCsharp.go +++ b/syntax/stxCsharp.go @@ -6,23 +6,17 @@ func init() { syntaxMap["csharp"] = &lazySyntax{init: func() []byte { return []byte(`filetype: csharp rules: - # Class - identifier.class: "class +[A-Za-z0-9]+ *((:) +[A-Za-z0-9.]+)?" - - # Annotation - identifier.var: "@[A-Za-z]+" - - identifier: "[A-Za-z_][A-Za-z0-9_]*[[:space:]]*[()]" - type: "\\b(bool|byte|sbyte|char|decimal|double|float|IntPtr|int|uint|long|ulong|object|short|ushort|string|base|this|var|void)\\b" - statement: "\\b(alias|as|case|catch|checked|default|do|dynamic|else|finally|fixed|for|foreach|goto|if|is|lock|new|null|return|switch|throw|try|unchecked|while)\\b" - statement: "\\b(abstract|async|class|const|delegate|enum|event|explicit|extern|get|implicit|in|internal|interface|namespace|operator|out|override|params|partial|private|protected|public|readonly|ref|sealed|set|sizeof|stackalloc|static|struct|typeof|unsafe|using|value|virtual|volatile|yield)\\b" - # LINQ-only keywords (ones that cannot be used outside of a LINQ query - lots others can) - statement: "\\b(from|where|select|group|info|orderby|join|let|in|on|equals|by|ascending|descending)\\b" - special: "\\b(break|continue)\\b" - constant.bool: "\\b(true|false)\\b" - symbol.operator: "[\\-+/*=<>?:!~%&|]" - constant.number: "\\b([0-9._]+|0x[A-Fa-f0-9_]+|0b[0-1_]+)[FL]?\\b" - - constant.string: start: "\"" end: "\"" @@ -30,7 +24,6 @@ rules: rules: - constant.specialChar: "\\\\([btnfr]|'|\\\"|\\\\)" - constant.specialChar: "\\\\u[A-Fa-f0-9]{4}" - - constant.string: start: "'" end: "'" @@ -38,13 +31,11 @@ rules: rules: - constant.specialChar: "\\\\([btnfr]|'|\\\"|\\\\)" - constant.specialChar: "\\\\u[A-Fa-f0-9]{4}" - - comment: start: "//" end: "$" rules: - todo: "(TODO|XXX|FIXME):?" - - comment: start: "/\\*" end: "\\*/" diff --git a/syntax/stxCss.go b/syntax/stxCss.go index b8f9017..35b25a3 100644 --- a/syntax/stxCss.go +++ b/syntax/stxCss.go @@ -6,24 +6,12 @@ func init() { syntaxMap["css"] = &lazySyntax{init: func() []byte { return []byte(`filetype: css rules: - # Classes and IDs - statement: "(?i)." - # - normal: - # start: "\\{" - # end: "\\}" - # rules: [] - # css commands - type: "(align-content|align-items|alignment-baseline|align-self|all|animation|animation-delay|animation-direction|animation-duration|animation-fill-mode|animation-iteration-count|animation-name|animation-play-state|animation-timing-function|appearance|azimuth|backface-visibility|background|background-attachment|background-blend-mode|background-clip|background-color|background-image|background-origin|background-position|background-repeat|background-size|baseline-shift|bookmark-label|bookmark-level|bookmark-state|border|border-bottom|border-bottom-color|border-bottom-left-radius|border-bottom-right-radius|border-bottom-style|border-bottom-width|border-boundary|border-collapse|border-color|border-image|border-image-outset|border-image-repeat|border-image-slice|border-image-source|border-image-width|border-left|border-left-color|border-left-style|border-left-width|border-radius|border-right|border-right-color|border-right-style|border-right-width|border-spacing|border-style|border-top|border-top-color|border-top-left-radius|border-top-right-radius|border-top-style|border-top-width|border-width|bottom|box-decoration-break|box-shadow|box-sizing|box-snap|box-suppress|break-after|break-before|break-inside|caption-side|caret|caret-animation|caret-color|caret-shape|chains|clear|clip|clip-path|clip-rule|color|color-interpolation-filters|column-count|column-fill|column-gap|column-rule|column-rule-color|column-rule-style|column-rule-width|columns|column-span|column-width|content|continue|counter-increment|counter-reset|counter-set|cue|cue-after|cue-before|cursor|direction|display|dominant-baseline|elevation|empty-cells|filter|flex|flex-basis|flex-direction|flex-flow|flex-grow|flex-shrink|flex-wrap|float|float-defer|float-offset|float-reference|flood-color|flood-opacity|flow|flow-from|flow-into|font|font-family|font-feature-settings|font-kerning|font-language-override|font-size|font-size-adjust|font-stretch|font-style|font-synthesis|font-variant|font-variant-alternates|font-variant-caps|font-variant-east-asian|font-variant-ligatures|font-variant-numeric|font-variant-position|font-weight|footnote-display|footnote-policy|glyph-orientation-vertical|grid|grid-area|grid-auto-columns|grid-auto-flow|grid-auto-rows|grid-column|grid-column-end|grid-column-gap|grid-column-start|grid-gap|grid-row|grid-row-end|grid-row-gap|grid-row-start|grid-template|grid-template-areas|grid-template-columns|grid-template-rows|hanging-punctuation|height|hyphenate-character|hyphenate-limit-chars|hyphenate-limit-last|hyphenate-limit-lines|hyphenate-limit-zone|hyphens|image-orientation|image-rendering|image-resolution|initial-letter|initial-letter-align|initial-letter-wrap|isolation|justify-content|justify-items|justify-self|left|letter-spacing|lighting-color|line-break|line-grid|line-height|line-snap|list-style|list-style-image|list-style-position|list-style-type|margin|margin-bottom|margin-left|margin-right|margin-top|marker|marker-end|marker-knockout-left|marker-knockout-right|marker-mid|marker-pattern|marker-segment|marker-side|marker-start|marquee-direction|marquee-loop|marquee-speed|marquee-style|mask|mask-border|mask-border-mode|mask-border-outset|mask-border-repeat|mask-border-slice|mask-border-source|mask-border-width|mask-clip|mask-composite|mask-image|mask-mode|mask-origin|mask-position|mask-repeat|mask-size|mask-type|max-height|max-lines|max-width|min-height|min-width|mix-blend-mode|motion|motion-offset|motion-path|motion-rotation|nav-down|nav-left|nav-right|nav-up|object-fit|object-position|offset-after|offset-before|offset-end|offset-start|opacity|order|orphans|outline|outline-color|outline-offset|outline-style|outline-width|overflow|overflow-style|overflow-wrap|overflow-x|overflow-y|padding|padding-bottom|padding-left|padding-right|padding-top|page|page-break-after|page-break-before|page-break-inside|pause|pause-after|pause-before|perspective|perspective-origin|pitch|pitch-range|play-during|polar-anchor|polar-angle|polar-distance|polar-origin|position|presentation-level|quotes|region-fragment|resize|rest|rest-after|rest-before|richness|right|rotation|rotation-point|ruby-align|ruby-merge|ruby-position|running|scroll-behavior|scroll-snap-align|scroll-snap-margin|scroll-snap-margin-block|scroll-snap-margin-block-end|scroll-snap-margin-block-start|scroll-snap-margin-bottom|scroll-snap-margin-inline|scroll-snap-margin-inline-end|scroll-snap-margin-inline-start|scroll-snap-margin-left|scroll-snap-margin-right|scroll-snap-margin-top|scroll-snap-padding|scroll-snap-padding-block|scroll-snap-padding-block-end|scroll-snap-padding-block-start|scroll-snap-padding-bottom|scroll-snap-padding-inline|scroll-snap-padding-inline-end|scroll-snap-padding-inline-start|scroll-snap-padding-left|scroll-snap-padding-right|scroll-snap-padding-top|scroll-snap-type|shape-image-threshold|shape-inside|shape-margin|shape-outside|size|speak|speak-as|speak-header|speak-numeral|speak-punctuation|speech-rate|stress|string-set|stroke|stroke-alignment|stroke-dashadjust|stroke-dasharray|stroke-dashcorner|stroke-dashoffset|stroke-linecap|stroke-linejoin|stroke-miterlimit|stroke-opacity|stroke-width|table-layout|tab-size|text-align|text-align-all|text-align-last|text-combine-upright|text-decoration|text-decoration-color|text-decoration-line|text-decoration-skip|text-decoration-style|text-emphasis|text-emphasis-color|text-emphasis-position|text-emphasis-style|text-indent|text-justify|text-orientation|text-overflow|text-shadow|text-space-collapse|text-space-trim|text-spacing|text-transform|text-underline-position|text-wrap|top|transform|transform-box|transform-origin|transform-style|transition|transition-delay|transition-duration|transition-property|transition-timing-function|unicode-bidi|user-select|vertical-align|visibility|voice-balance|voice-duration|voice-family|voice-pitch|voice-range|voice-rate|voice-stress|voice-volume|volume|white-space|widows|width|will-change|word-break|word-spacing|word-wrap|wrap-after|wrap-before|wrap-flow|wrap-inside|wrap-through|writing-mode|z-index):" - # - default: - # start: ":" - # end: "[;^\\{]" - # rules: [] - special: "!important" - identifier: ":active|:focus|:hover|:link|:visited|:link|:after|:before|$" - special: "(\\{|\\}|\\(|\\)|\\;|:|\\]|~|<|>|,)" - # SCSS Varaibles - statement: "@import|@mixin|@extend" - # Strings - constant.string: start: "\"" end: "\"" @@ -37,7 +25,6 @@ rules: rules: - constant.specialChar: "\\\\." - special: "\"|'" - # Comments & TODOs - comment: start: "\\/\\*" end: "\\*\\/" diff --git a/syntax/stxD.go b/syntax/stxD.go index 3d148ea..91be547 100644 --- a/syntax/stxD.go +++ b/syntax/stxD.go @@ -6,59 +6,38 @@ func init() { syntaxMap["d"] = &lazySyntax{init: func() []byte { return []byte(`filetype: d rules: - # Operators and punctuation - statement: "(\\*|/|%|\\+|-|>>|<<|>>>|&|\\^(\\^)?|\\||~)?=" - statement: "\\.\\.(\\.)?|!|\\*|&|~|\\(|\\)|\\[|\\]|\\\\|/|\\+|-|%|<|>|\\?|:|;" - # Octal integer literals are deprecated - error: "(0[0-7_]*)(L[uU]?|[uU]L?)?" - # Decimal integer literals - constant.number: "([0-9]|[1-9][0-9_]*)(L[uU]?|[uU]L?)?" - # Binary integer literals - constant: "(0[bB][01_]*)(L[uU]?|[uU]L?)?" - # Decimal float literals - constant.number: "[0-9][0-9_]*\\.([0-9][0-9_]*)([eE][+-]?([0-9][0-9_]*))?[fFL]?i?" - constant.number: "[0-9][0-9_]*([eE][+-]?([0-9][0-9_]*))[fFL]?i?" - constant.number: "[^.]\\.([0-9][0-9_]*)([eE][+-]?([0-9][0-9_]*))?[fFL]?i?" - constant.number: "[0-9][0-9_]*([fFL]?i|[fF])" - # Hexadecimal integer literals - constant.number: "(0[xX]([0-9a-fA-F][0-9a-fA-F_]*|[0-9a-fA-F_]*[0-9a-fA-F]))(L[uU]?|[uU]L?)?" - # Hexadecimal float literals - constant.number: "0[xX]([0-9a-fA-F][0-9a-fA-F_]*|[0-9a-fA-F_]*[0-9a-fA-F])(\\.[0-9a-fA-F][0-9a-fA-F_]*|[0-9a-fA-F_]*[0-9a-fA-F])?[pP][+-]?([0-9][0-9_]*)[fFL]?i?" - constant.number: "0[xX]\\.([0-9a-fA-F][0-9a-fA-F_]*|[0-9a-fA-F_]*[0-9a-fA-F])[pP][+-]?([0-9][0-9_]*)[fFL]?i?" - # Character literals - constant.string: start: "'" end: "'" rules: - constant.specialChar: "\\\\." - # Keywords - # a-e - statement: "\\b(abstract|alias|align|asm|assert|auto|body|break|case|cast|catch|class|const|continue|debug|default|delegate|do|else|enum|export|extern)\\b" - # f-l - statement: "\\b(false|final|finally|for|foreach|foreach_reverse|function|goto|if|immutable|import|in|inout|interface|invariant|is|lazy)\\b" - # m-r - statement: "\\b(macro|mixin|module|new|nothrow|null|out|override|package|pragma|private|protected|public|pure|ref|return)\\b" - # s-w - statement: "\\b(scope|shared|static|struct|super|switch|synchronized|template|this|throw|true|try|typeid|typeof|union|unittest|version|while|with)\\b" - # __ - statement: "\\b(__FILE__|__MODULE__|__LINE__|__FUNCTION__|__PRETTY_FUNCTION__|__gshared|__traits|__vector|__parameters)\\b" - # Deprecated keywords - error: "\\b(delete|deprecated|typedef|volatile)\\b" - # Primitive types - type: "\\b(bool|byte|cdouble|cent|cfloat|char|creal|dchar|double|float|idouble|ifloat|int|ireal|long|real|short|ubyte|ucent|uint|ulong|ushort|void|wchar)\\b" - # Globally defined symbols - type: "\\b(string|wstring|dstring|size_t|ptrdiff_t)\\b" - # Special tokens - constant: "\\b(__DATE__|__EOF__|__TIME__|__TIMESTAMP__|__VENDOR__|__VERSION__)\\b" - # String literals - # DoubleQuotedString - constant.string: start: "\"" end: "\"" skip: "\\\\." rules: - constant.specialChar: "\\\\." - # WysiwygString - constant.string: start: "r\"" end: "\"" @@ -69,13 +48,11 @@ rules: end: "` + "`" + `" rules: - constant.specialChar: "\\\\." - # HexString - constant.string: start: "x\"" end: "\"" rules: - constant.specialChar: "\\\\." - # DelimitedString - constant.string: start: "q\"\\(" end: "\\)\"" @@ -106,7 +83,6 @@ rules: end: "\"" rules: - constant.specialChar: "\\\\." - # Comments - comment: start: "//" end: "$" diff --git a/syntax/stxDart.go b/syntax/stxDart.go index e767761..d4a9f2a 100644 --- a/syntax/stxDart.go +++ b/syntax/stxDart.go @@ -19,26 +19,22 @@ rules: - statement: "[-+/*=<>!~%?:&|]" - constant: "/[^*]([^/]|(\\\\/))*[^\\\\]/[gim]*" - constant: "\\\\[0-7][0-7]?[0-7]?|\\\\x[0-9a-fA-F]+|\\\\[bfnrt'\"\\?\\\\]" - - comment: start: "//" end: "$" rules: - todo: "TODO:?" - - comment: start: "/\\*" end: "\\*/" rules: - todo: "TODO:?" - - constant.string: start: "\"" end: "\"" skip: "\\\\." rules: - constant.specialChar: "\\\\." - - constant.string: start: "'" end: "'" diff --git a/syntax/stxDockerfile.go b/syntax/stxDockerfile.go index a958346..b8543fc 100644 --- a/syntax/stxDockerfile.go +++ b/syntax/stxDockerfile.go @@ -6,29 +6,20 @@ func init() { syntaxMap["dockerfile"] = &lazySyntax{init: func() []byte { return []byte(`filetype: dockerfile rules: - ## Keywords - keyword: "(?i)^(FROM|MAINTAINER|RUN|CMD|LABEL|EXPOSE|ENV|ADD|COPY|ENTRYPOINT|VOLUME|USER|WORKDIR|ONBUILD|ARG|HEALTHCHECK|STOPSIGNAL|SHELL)[[:space:]]" - - ## Brackets & parenthesis - statement: "(\\(|\\)|\\[|\\])" - - ## Double ampersand - special: "&&" - - ## Comments - comment: start: "#" end: "$" rules: - todo: "(TODO|XXX|FIXME):?" - - constant.string: start: "\"" end: "\"" skip: "\\\\." rules: - constant.specialChar: "\\\\." - - constant.string: start: "'" end: "'" diff --git a/syntax/stxFish.go b/syntax/stxFish.go index f2fdc3f..5ac423c 100644 --- a/syntax/stxFish.go +++ b/syntax/stxFish.go @@ -6,41 +6,26 @@ func init() { syntaxMap["fish"] = &lazySyntax{init: func() []byte { return []byte(`filetype: fish rules: - # Numbers - constant: "\\b[0-9]+\\b" - - # Conditionals and control flow - statement: "\\b(and|begin|break|case|continue|else|end|for|function|if|in|not|or|return|select|shift|switch|while)\\b" - special: "(\\{|\\}|\\(|\\)|\\;|\\]|\\[|` + "`" + `|\\\\|\\$|<|>|^|!|=|&|\\|)" - - # Fish commands - type: "\\b(bg|bind|block|breakpoint|builtin|cd|count|command|commandline|complete|dirh|dirs|echo|emit|eval|exec|exit|fg|fish|fish_config|fish_ident|fish_pager|fish_prompt|fish_right_prompt|fish_update_completions|fishd|funced|funcsave|functions|help|history|jobs|math|mimedb|nextd|open|popd|prevd|psub|pushd|pwd|random|read|set|set_color|source|status|string|trap|type|ulimit|umask|vared)\\b" - - # Common linux commands - type: "\\b((g|ig)?awk|bash|dash|find|\\w{0,4}grep|kill|killall|\\w{0,4}less|make|pkill|sed|sh|tar)\\b" - - # Coreutils commands - type: "\\b(base64|basename|cat|chcon|chgrp|chmod|chown|chroot|cksum|comm|cp|csplit|cut|date|dd|df|dir|dircolors|dirname|du|env|expand|expr|factor|false|fmt|fold|head|hostid|id|install|join|link|ln|logname|ls|md5sum|mkdir|mkfifo|mknod|mktemp|mv|nice|nl|nohup|nproc|numfmt|od|paste|pathchk|pinky|pr|printenv|printf|ptx|pwd|readlink|realpath|rm|rmdir|runcon|seq|(sha1|sha224|sha256|sha384|sha512)sum|shred|shuf|sleep|sort|split|stat|stdbuf|stty|sum|sync|tac|tail|tee|test|time|timeout|touch|tr|true|truncate|tsort|tty|uname|unexpand|uniq|unlink|users|vdir|wc|who|whoami|yes)\\b" - - # Conditional flags - statement: "--[a-z-]+" - statement: "\\ -[a-z]+" - - identifier: "(?i)\\$\\{?[0-9A-Z_!@#$*?-]+\\}?" - - constant.string: start: "\"" end: "\"" skip: "\\\\." rules: - constant.specialChar: "\\\\." - - constant.string: start: "'" end: "'" skip: "\\\\." rules: [] - - comment: start: "#" end: "$" diff --git a/syntax/stxFortran.go b/syntax/stxFortran.go index 4a9d9fc..51763ca 100644 --- a/syntax/stxFortran.go +++ b/syntax/stxFortran.go @@ -15,7 +15,6 @@ rules: - type: "(?i)\\b(operator|optional|pack|parameter|pointer|position|private)\\b" - type: "(?i)\\b(program|public|real|recl|recursive|selected_int_kind)\\b" - type: "(?i)\\b(selected_real_kind|subroutine|status)\\b" - - constant: "(?i)\\b(abs|achar|adjustl|adjustr|allocate|bit_size|call|char)\\b" - constant: "(?i)\\b(close|contains|count|cpu_time|cshift|date_and_time)\\b" - constant: "(?i)\\b(deallocate|digits|dot_product|eor|eoshift|function|iachar)\\b" @@ -27,36 +26,25 @@ rules: - constant: "(?i)\\b(reshape|rewind|save|scan|sequence|shape|sign|size|spacing)\\b" - constant: "(?i)\\b(spread|sum|system_clock|target|transfer|transpose|trim)\\b" - constant: "(?i)\\b(ubound|unpack|verify|write|tiny|type|use|yes)\\b" - - statement: "(?i)\\b(.and.|case|do|else|else?if|else?where|end|end?do|end?if)\\b" - statement: "(?i)\\b(end?select|.eqv.|forall|if|lge|lgt|lle|llt|.neqv.|.not.)\\b" - statement: "(?i)\\b(.or.|repeat|select case|then|where|while)\\b" - - special: "(?i)\\b(continue|cycle|exit|go?to|result|return)\\b" - - #Operator Color - symbol.operator: "[.:;,+*|=!\\%]|/|-|&" - - #Parenthetical Color - symbol.bracket: "[(){}]|\\[|\\]" - - # Add preprocessor commands. - preproc: "^[[:space:]]*#[[:space:]]*(define|include|(un|ifn?)def|endif|el(if|se)|if|warning|error)" - - constant.string: start: "\"" end: "\"" skip: "\\\\." rules: - constant.specialChar: "\\\\." - - constant.string: start: "'" end: "'" skip: "\\\\." rules: - constant.specialChar: "\\\\." - - comment: start: "!" end: "$" diff --git a/syntax/stxGdscript.go b/syntax/stxGdscript.go index 2f79979..069ba79 100644 --- a/syntax/stxGdscript.go +++ b/syntax/stxGdscript.go @@ -6,65 +6,43 @@ func init() { syntaxMap["gdscript"] = &lazySyntax{init: func() []byte { return []byte(`filetype: gdscript rules: - # built-in objects - constant: "\\b(null|self|true|false)\\b" - # built-in attributes - # color constant "\\b()\\b" - # built-in functions - identifier: "\\b(abs|acos|asin|atan|atan2|ceil|clamp|convert|cos|cosh|db2linear|decimals|deg2rad|ease|exp|float|floor|fmod|fposmod|hash|int|isinf|isnan|lerp|linear2db|load|log|max|min|nearest_po2|pow|preload|print|printerr|printraw|prints|printt|rad2deg|rand_range|rand_seed|randomize|randi|randf|range|round|seed|sin|slerp|sqrt|str|str2var|tan|typeof|var2str|weakref)\\b" - # special method names - identifier: "\\b(AnimationPlayer|AnimationTreePlayer|Button|Control|HTTPClient|HTTPRequest|Input|InputEvent|MainLoop|Node|Node2D|SceneTree|Spatial|SteamPeer|PacketPeer|PacketPeerUDP|Timer|Tween)\\b" - # types - type: "\\b(Vector2|Vector3)\\b" - # definitions - identifier: "func [a-zA-Z_0-9]+" - # keywords - statement: "\\b(and|as|assert|break|breakpoint|class|const|continue|elif|else|export|extends|for|func|if|in|map|not|onready|or|pass|return|signal|var|while|yield)\\b" - - # decorators - special: "@.*[(]" - - # operators - statement: "[.:;,+*|=!\\%@]|<|>|/|-|&" - - # parentheses - statement: "[(){}]|\\[|\\]" - - # numbers - constant: "\\b[0-9]+\\b" - constant.number: "\\b([0-9]+|0x[0-9a-fA-F]*)\\b|'.'" - - comment: start: "\"\"\"" end: "\"\"\"" rules: - todo: "(TODO|XXX|FIXME):?" - - comment: start: "'''" end: "'''" rules: - todo: "(TODO|XXX|FIXME):?" - - constant.string: start: "\"" end: "\"" skip: "\\\\." rules: - constant.specialChar: "\\\\([0-7]{3}|x[A-Fa-f0-9]{2}|u[A-Fa-f0-9]{4}|U[A-Fa-f0-9]{8})" - - constant.string: start: "'" end: "'" skip: "\\\\." rules: - constant.specialChar: "\\\\([0-7]{3}|x[A-Fa-f0-9]{2}|u[A-Fa-f0-9]{4}|U[A-Fa-f0-9]{8})" - - constant.string: start: "` + "`" + `" end: "` + "`" + `" rules: [] - - comment: start: "#" end: "$" diff --git a/syntax/stxGo.go b/syntax/stxGo.go index f3ccb09..68fb845 100644 --- a/syntax/stxGo.go +++ b/syntax/stxGo.go @@ -6,29 +6,20 @@ func init() { syntaxMap["go"] = &lazySyntax{init: func() []byte { return []byte(`filetype: go rules: - # Conditionals and control flow - special: "\\b(break|case|continue|default|go|goto|range|return)\\b" - statement: "\\b(else|for|if|switch)\\b" - preproc: "\\b(package|import|const|var|type|struct|func|go|defer|iota)\\b" - symbol.operator: "[-+/*=<>!~%&|^]|:=" - - # Types - special: "[a-zA-Z0-9]*\\(" - symbol: "(,|\\.)" - type: "\\b(u?int(8|16|32|64)?|float(32|64)|complex(64|128))\\b" - type: "\\b(uintptr|byte|rune|string|interface|bool|map|chan|error)\\b" - ##I'm... not sure, but aren't structs a type? - type.keyword: "\\b(struct)\\b" - constant.bool: "\\b(true|false|nil)\\b" - - # Brackets - symbol.brackets: "(\\{|\\})" - symbol.brackets: "(\\(|\\))" - symbol.brackets: "(\\[|\\])" - - # Numbers and strings - constant.number: "\\b([0-9]+|0x[0-9a-fA-F]*)\\b|'.'" - - constant.string: start: "\"" end: "\"" @@ -37,7 +28,6 @@ rules: - constant.specialChar: "%." - constant.specialChar: "\\\\[abfnrtv'\\\"\\\\]" - constant.specialChar: "\\\\([0-7]{3}|x[A-Fa-f0-9]{2}|u[A-Fa-f0-9]{4}|U[A-Fa-f0-9]{8})" - - constant.string: start: "'" end: "'" @@ -47,18 +37,15 @@ rules: - constant.specialChar: "%." - constant.specialChar: "\\\\[abfnrtv'\\\"\\\\]" - constant.specialChar: "\\\\([0-7]{3}|x[A-Fa-f0-9]{2}|u[A-Fa-f0-9]{4}|U[A-Fa-f0-9]{8})" - - constant.string: start: "` + "`" + `" end: "` + "`" + `" rules: [] - - comment: start: "//" end: "$" rules: - todo: "(TODO|XXX|FIXME):?" - - comment: start: "/\\*" end: "\\*/" diff --git a/syntax/stxHaskell.go b/syntax/stxHaskell.go index 1c0a860..cd480d8 100644 --- a/syntax/stxHaskell.go +++ b/syntax/stxHaskell.go @@ -6,49 +6,32 @@ func init() { syntaxMap["haskell"] = &lazySyntax{init: func() []byte { return []byte(`filetype: haskell rules: - # Keywords - statement: "[ ](as|case|of|class|data|default|deriving|do|forall|foreign|hiding|if|then|else|import|infix|infixl|infixr|instance|let|in|mdo|module|newtype|qualified|type|where)[ ]" - statement: "(^data|^foreign|^import|^infix|^infixl|^infixr|^instance|^module|^newtype|^type)[ ]" - statement: "[ ](as$|case$|of$|class$|data$|default$|deriving$|do$|forall$|foreign$|hiding$|if$|then$|else$|import$|infix$|infixl$|infixr$|instance$|let$|in$|mdo$|module$|newtype$|qualified$|type$|where$)" - - # Various symbols - symbol: "(\\||@|!|:|_|~|=|\\\\|;|\\(\\)|,|\\[|\\]|\\{|\\})" - - # Operators - symbol.operator: "(==|/=|&&|\\|\\||<|>|<=|>=)" - - # Various symbols - special: "(->|<-)" - symbol: "\\.|\\$" - - # Data constructors - constant.bool: "\\b(True|False)\\b" - constant: "(Nothing|Just|Left|Right|LT|EQ|GT)" - - # Data classes - identifier.class: "[ ](Read|Show|Enum|Eq|Ord|Data|Bounded|Typeable|Num|Real|Fractional|Integral|RealFrac|Floating|RealFloat|Monad|MonadPlus|Functor)" - - # Strings - constant.string: start: "\"" end: "\"" skip: "\\\\." rules: - constant.specialChar: "\\\\." - - # Comments - comment: start: "--" end: "$" rules: - todo: "(TODO|XXX|FIXME):?" - - comment: start: "\\{-" end: "-\\}" rules: - todo: "(TODO|XXX|FIXME):?" - - identifier.micro: "undefined"`) }} } diff --git a/syntax/stxHtml.go b/syntax/stxHtml.go index abbadb2..f923c25 100644 --- a/syntax/stxHtml.go +++ b/syntax/stxHtml.go @@ -13,30 +13,22 @@ rules: - symbol: "[:=]" - identifier: "(alt|bgcolor|height|href|id|label|longdesc|name|on(click|focus|load|mouseover)|size|span|src|target|type|value|width)=" - constant.number: "(?i)#[0-9A-F]{6,6}" - # - default: - # start: ">" - # end: "<" - # rules: [] - - symbol.tag: "<|>" - constant.string.url: "(ftp(s)?|http(s)?|git|chrome)://[^ ]+" - comment: "" - preproc: "" - - constant.string: start: "\"" end: "\"" skip: "\\\\." rules: - constant.specialChar: "\\\\." - - default: start: "" end: "" limit-group: symbol.tag rules: - include: "javascript" - - default: start: "" end: "" diff --git a/syntax/stxHtml5.go b/syntax/stxHtml5.go index 6e3abfc..0dd9f0c 100644 --- a/syntax/stxHtml5.go +++ b/syntax/stxHtml5.go @@ -19,7 +19,6 @@ rules: start: ">" end: "<" rules: [] - - symbol.tag: "<|>" - constant.string.url: "(ftp(s)?|http(s)?|git|chrome)://[^ ]+" - comment: "" diff --git a/syntax/stxIno.go b/syntax/stxIno.go index b7c78c2..efcb841 100644 --- a/syntax/stxIno.go +++ b/syntax/stxIno.go @@ -7,80 +7,34 @@ func init() { return []byte(`filetype: ino rules: - identifier: "\\b[A-Z_][0-9A-Z_]+\\b" - - ## - type: "\\b((s?size)|((u_?)?int(8|16|32|64|ptr)))_t\\b" - - ## Constants - constant: "(?i)\\b(HIGH|LOW|INPUT|OUTPUT)\\b" - - ## Serial Print - constant: "(?i)\\b(DEC|BIN|HEX|OCT|BYTE)\\b" - - ## PI Constants - constant: "(?i)\\b(PI|HALF_PI|TWO_PI)\\b" - - ## ShiftOut - constant: "(?i)\\b(LSBFIRST|MSBFIRST)\\b" - - ## Attach Interrupt - constant: "(?i)\\b(CHANGE|FALLING|RISING)\\b" - - ## Analog Reference - constant: "(?i)\\b(DEFAULT|EXTERNAL|INTERNAL|INTERNAL1V1|INTERNAL2V56)\\b" - - ## === FUNCTIONS === ## - - ## Data Types - type: "\\b(boolean|byte|char|float|int|long|word)\\b" - - ## Control Structions - statement: "\\b(case|class|default|do|double|else|false|for|if|new|null|private|protected|public|short|signed|static|String|switch|this|throw|try|true|unsigned|void|while)\\b" - statement: "\\b(goto|continue|break|return)\\b" - - ## Math - identifier: "\\b(abs|acos|asin|atan|atan2|ceil|constrain|cos|degrees|exp|floor|log|map|max|min|radians|random|randomSeed|round|sin|sq|sqrt|tan)\\b" - - ## Bits & Bytes - identifier: "\\b(bitRead|bitWrite|bitSet|bitClear|bit|highByte|lowByte)\\b" - - ## Analog I/O - identifier: "\\b(analogReference|analogRead|analogWrite)\\b" - - ## External Interrupts - identifier: "\\b(attachInterrupt|detachInterrupt)\\b" - - ## Time - identifier: "\\b(delay|delayMicroseconds|millis|micros)\\b" - - ## Digital I/O - identifier: "\\b(pinMode|digitalWrite|digitalRead)\\b" - - ## Interrupts - identifier: "\\b(interrupts|noInterrupts)\\b" - - ## Advanced I/O - identifier: "\\b(noTone|pulseIn|shiftIn|shiftOut|tone)\\b" - - ## Serial - identifier: "\\b(Serial|Serial1|Serial2|Serial3|begin|end|peek|read|print|println|available|flush)\\b" - - ## Structure - identifier: "\\b(setup|loop)\\b" - - ## - statement: "^[[:space:]]*#[[:space:]]*(define|include(_next)?|(un|ifn?)def|endif|el(if|se)|if|warning|error|pragma)" - - ## GCC builtins - constant: "(__attribute__[[:space:]]*\\(\\([^)]*\\)\\)|__(aligned|asm|builtin|hidden|inline|packed|restrict|section|typeof|weak)__)" - - constant.string: start: "\"" end: "\"" skip: "\\\\." rules: - constant.specialChar: "\\\\." - - constant.string: start: "'" end: "'" @@ -88,13 +42,11 @@ rules: rules: - preproc: "..+" - constant.specialChar: "\\\\." - - comment: start: "//" end: "$" rules: - todo: "(TODO|XXX|FIXME):?" - - comment: start: "/\\*" end: "\\*/" diff --git a/syntax/stxJava.go b/syntax/stxJava.go index afd0c83..c08f0a4 100644 --- a/syntax/stxJava.go +++ b/syntax/stxJava.go @@ -11,14 +11,12 @@ rules: - type: "\\b(abstract|class|extends|final|implements|import|instanceof|interface|native|package|private|protected|public|static|strictfp|super|synchronized|throws|volatile)\\b" - constant: "\\b(true|false|null)\\b" - constant.number: "\\b[0-9]+\\b" - - constant.string: start: "\"" end: "\"" skip: "\\\\." rules: - constant.specialChar: "\\\\." - - constant.string: start: "'" end: "'" @@ -26,12 +24,10 @@ rules: rules: - preproc: "..+" - constant.specialChar: "\\\\." - - comment: start: "//" end: "$" rules: [] - - comment: start: "/\\*" end: "\\*/" diff --git a/syntax/stxJs.go b/syntax/stxJs.go index 1cf2a1d..22d2792 100644 --- a/syntax/stxJs.go +++ b/syntax/stxJs.go @@ -23,26 +23,22 @@ rules: - statement: "[-+/*=<>!~%?:&|]" - constant: "/[^*]([^/]|(\\\\/))*[^\\\\]/[gim]*" - constant: "\\\\[0-7][0-7]?[0-7]?|\\\\x[0-9a-fA-F]+|\\\\[bfnrt'\"\\?\\\\]" - - constant.string: start: "\"" end: "\"" skip: "\\\\." rules: - constant.specialChar: "\\\\." - - constant.string: start: "'" end: "'" skip: "\\\\." rules: - constant.specialChar: "\\\\." - - comment: start: "//" end: "$" rules: [] - - comment: start: "/\\*" end: "\\*/" diff --git a/syntax/stxJson.go b/syntax/stxJson.go index 5cf933e..509b886 100644 --- a/syntax/stxJson.go +++ b/syntax/stxJson.go @@ -23,7 +23,6 @@ rules: skip: "\\\\." rules: - constant.specialChar: "\\\\." - - statement: "\\\"(\\\\\"|[^\"])*\\\"[[:space:]]*:\" \"'(\\'|[^'])*'[[:space:]]*:" - constant: "\\\\u[0-9a-fA-F]{4}|\\\\[bfnrt'\"/\\\\]"`) }} diff --git a/syntax/stxLua.go b/syntax/stxLua.go index 004c5ef..8882606 100644 --- a/syntax/stxLua.go +++ b/syntax/stxLua.go @@ -25,39 +25,32 @@ rules: - statement: "(\\b(dofile|require|include)|%q|%!|%Q|%r|%x)\\b" - constant.number: "\\b([0-9]+)\\b" - symbol: "(\\(|\\)|\\[|\\]|\\{|\\}|\\*\\*|\\*|/|%|\\+|-|\\^|>|>=|<|<=|~=|=|\\.\\.)" - - constant.string: start: "\"" end: "\"" skip: "\\\\." rules: - constant.specialChar: "\\\\." - - constant.string: start: "'" end: "'" skip: "\\\\." rules: - constant.specialChar: "\\\\." - - constant.string: start: "\\[\\[" end: "\\]\\]" rules: - constant.specialChar: "\\\\." - - special: "\\\\[0-7][0-7][0-7]|\\\\x[0-9a-fA-F][0-9a-fA-F]|\\\\[abefnrs]|(\\\\c|\\\\C-|\\\\M-|\\\\M-\\\\C-)." - - comment: start: "#" end: "$" rules: [] - - comment: start: "\\-\\-" end: "$" rules: [] - - comment: start: "\\-\\-\\[\\[" end: "\\]\\]" diff --git a/syntax/stxObjc.go b/syntax/stxObjc.go index 04185a8..ffc9aae 100644 --- a/syntax/stxObjc.go +++ b/syntax/stxObjc.go @@ -11,7 +11,6 @@ rules: - type: "\\b[A-Z][A-Z][[:alnum:]]*\\b" - type: "\\b[A-Za-z0-9_]*_t\\b" - type: "\\bdispatch_[a-zA-Z0-9_]*_t\\b" - - statement: "(__attribute__[[:space:]]*\\(\\([^)]*\\)\\)|__(aligned|asm|builtin|hidden|inline|packed|restrict|section|typeof|weak)__|__unused|_Nonnull|_Nullable|__block|__builtin.*)" - statement: "\\b(class|namespace|template|public|protected|private|typename|this|friend|virtual|using|mutable|volatile|register|explicit)\\b" - statement: "\\b(for|if|while|do|else|case|default|switch)\\b" @@ -19,41 +18,33 @@ rules: - statement: "\\b(goto|continue|break|return)\\b" - statement: "\\b(nonatomic|atomic|readonly|readwrite|strong|weak|assign)\\b" - statement: "@(encode|end|interface|implementation|class|selector|protocol|synchronized|try|catch|finally|property|optional|required|import|autoreleasepool)" - - preproc: "^[[:space:]]*#[[:space:]]*(define|include|import|(un|ifn?)def|endif|el(if|se)|if|warning|error|pragma).*$" - preproc: "__[A-Z0-9_]*__" - - special: "^[[:space:]]*[#|@][[:space:]]*(import|include)[[:space:]]*[\"|<].*\\/?[>|\"][[:space:]]*$" - - statement: "([.:;,+*|=!\\%\\[\\]]|<|>|/|-|&)" - - constant.number: "(\\b(-?)?[0-9]+\\b|\\b\\[0-9]+\\.[0-9]+\\b|\\b0x[0-9A-F]+\\b)" - constant: "(@\\[(\\\\.|[^\\]])*\\]|@\\{(\\\\.|[^\\}])*\\}|@\\((\\\\.|[^\\)])*\\))" - constant: "\\b<(\\\\.[^\\>])*\\>\\b" - constant: "\\b(nil|NULL|YES|NO|TRUE|true|FALSE|false|self)\\b" - constant: "\\bk[[:alnum]]*\\b" - constant.string: "'.'" - - constant.string: start: "@\"" end: "\"" skip: "\\\\." rules: - constant.specialChar: "\\\\." - - constant.string: start: "\"" end: "\"" skip: "\\\\." rules: - constant.specialChar: "\\\\." - - comment: start: "//" end: "$" rules: - todo: "(TODO|XXX|FIXME):?" - - comment: start: "/\\*" end: "\\*/" diff --git a/syntax/stxOcaml.go b/syntax/stxOcaml.go index 5dc0e6f..4676a33 100644 --- a/syntax/stxOcaml.go +++ b/syntax/stxOcaml.go @@ -6,22 +6,12 @@ func init() { syntaxMap["ocaml"] = &lazySyntax{init: func() []byte { return []byte(`filetype: ocaml rules: - # Numbers - ## Integers - ### Binary - constant.number: "-?0[bB][01][01_]*" - ### Octal - constant.number: "-?0[oO][0-7][0-7_]*" - ### Decimal - constant.number: "-?\\d[\\d_]*" - ### Hexadecimal - constant.number: "-?0[xX][0-9a-fA-F][0-9a-fA-F_]*" - ## Real - ### Decimal - constant.number: "-?\\d[\\d_]*.\\d[\\d_]*([eE][+-]\\d[\\d_]*.\\d[\\d_]*)?" - ### Hexadecimal - constant.number: "-?0[xX][0-9a-fA-F][0-9a-fA-F_]*.[0-9a-fA-F][0-9a-fA-F_]*([pP][+-][0-9a-fA-F][0-9a-fA-F_]*.[0-9a-fA-F][0-9a-fA-F_]*)?" - # Comments - comment: start: "\\(\\*" end: "\\*\\)" diff --git a/syntax/stxPerl.go b/syntax/stxPerl.go index 641a659..a3c1a7b 100644 --- a/syntax/stxPerl.go +++ b/syntax/stxPerl.go @@ -12,14 +12,12 @@ rules: start: "[$@%]" end: "((?i) |[^0-9A-Z_]|-)" rules: [] - - constant.string: "\".*\"|qq\\|.*\\|" - default: "[sm]/.*/" - preproc: start: "(^use| = new)" end: ";" rules: [] - - comment: "#.*" - identifier.macro: start: "<< 'STOP'" diff --git a/syntax/stxPhp.go b/syntax/stxPhp.go index 0eea0ea..96ecc17 100644 --- a/syntax/stxPhp.go +++ b/syntax/stxPhp.go @@ -45,7 +45,6 @@ rules: start: "/\\*" end: "\\*/" rules: [] - - preproc: "<\\?(php|=)?" - preproc: "\\?>" - preproc: ""`) diff --git a/syntax/stxPython3.go b/syntax/stxPython3.go index fc32f65..fd0a49a 100644 --- a/syntax/stxPython3.go +++ b/syntax/stxPython3.go @@ -6,53 +6,37 @@ func init() { syntaxMap["python3"] = &lazySyntax{init: func() []byte { return []byte(`filename: python3 rules: - # built-in objects - constant: "\\b(None|self|True|False)\\b" - # built-in attributes - constant: "\\b(__bases__|__builtin__|__class__|__debug__|__dict__|__doc__|__file__|__members__|__methods__|__name__|__self__)\\b" - # built-in functions - identifier: "\\b(abs|all|any|ascii|bin|callable|chr|compile|delattr|dir|divmod|eval|exec|format|getattr|globals|hasattr|hash|help|hex|id|input|isinstance|issubclass|iter|len|locals|max|min|next|oct|open|ord|pow|print|repr|round|setattr|sorted|sum|vars|__import__)\\b" - # special method names - identifier: "\\b(__abs__|__add__|__and__|__call__|__cmp__|__coerce__|__complex__|__concat__|__contains__|__del__|__delattr__|__delitem__|__delslice__|__div__|__divmod__|__float__|__getattr__|__getitem__|__getslice__|__hash__|__hex__|__init__|__int__|__inv__|__invert__|__len__|__dict__|__long__|__lshift__|__mod__|__mul__|__neg__|__next__|__nonzero__|__oct__|__or__|__pos__|__pow__|__radd__|__rand__|__rcmp__|__rdiv__|__rdivmod__|__repeat__|__repr__|__rlshift__|__rmod__|__rmul__|__ror__|__rpow__|__rrshift__|__rshift__|__rsub__|__rxor__|__setattr__|__setitem__|__setslice__|__str__|__sub__|__xor__)\\b" - # types - type: "\\b(bool|bytearray|bytes|classmethod|complex|dict|enumerate|filter|float|frozenset|int|list|map|memoryview|object|property|range|reversed|set|slice|staticmethod|str|super|tuple|type|zip)\\b" - # definitions - identifier: "def [a-zA-Z_0-9]+" - # keywords - statement: "\\b(and|as|assert|break|class|continue|def|del|elif|else|except|finally|for|from|global|if|import|in|is|lambda|nonlocal|not|or|pass|raise|return|try|while|with|yield)\\b" - # decorators - brightgreen: "@.*[(]" - # operators - statement: "([.:;,+*|=!\\%@]|<|>|/|-|&)" - # parentheses - statement: "([(){}]|\\[|\\])" - # numbers - constant.number: "\\b[0-9]+\\b" - - comment: start: "\"\"\"" end: "\"\"\"" rules: [] - - comment: start: "'''" end: "'''" rules: [] - - constant.string: start: "\"" end: "\"" skip: "\\\\." rules: - constant.specialChar: "\\\\." - - constant.string: start: "'" end: "'" skip: "\\\\." rules: - constant.specialChar: "\\\\." - - comment: start: "#" end: "$" diff --git a/syntax/stxRuby.go b/syntax/stxRuby.go index 2851cf9..fa55fce 100644 --- a/syntax/stxRuby.go +++ b/syntax/stxRuby.go @@ -26,7 +26,6 @@ rules: start: "<<-?'?EOT'?" end: "^EOT" rules: [] - - todo: "(XXX|TODO|FIXME|\\?\\?\\?)" - preproc.shebang: "^#!.+?( |$)"`) }} diff --git a/syntax/stxRust.go b/syntax/stxRust.go index b2a73fb..491ed34 100644 --- a/syntax/stxRust.go +++ b/syntax/stxRust.go @@ -6,43 +6,32 @@ func init() { syntaxMap["rust"] = &lazySyntax{init: func() []byte { return []byte(`filetype: rust rules: - # function definition - identifier: "fn [a-z0-9_]+" - # Reserved words - statement: "\\b(abstract|alignof|as|become|box|break|const|continue|crate|do|else|enum|extern|false|final|fn|for|if|impl|in|let|loop|macro|match|mod|move|mut|offsetof|override|priv|pub|pure|ref|return|sizeof|static|self|struct|super|true|trait|type|typeof|unsafe|unsized|use|virtual|where|while|yield)\\b" - # macros - special: "[a-z_]+!" - # Constants - constant: "[A-Z][A-Z_]+" - # Numbers - constant.number: "\\b[0-9]+\\b" - # Traits/Enums/Structs/Types/etc. - type: "[A-Z][a-z]+" - - constant.string: start: "\"" end: "\"" skip: "\\\\." rules: - constant.specialChar: "\\\\." - - constant.string: start: "r#+\"" end: "\"#+" rules: [] - - comment: start: "//" end: "$" rules: - todo: "(TODO|XXX|FIXME):?" - - comment: start: "/\\*" end: "\\*/" rules: - todo: "(TODO|XXX|FIXME):?" - - special: start: "#!\\[" end: "\\]" diff --git a/syntax/stxSwift.go b/syntax/stxSwift.go index 6c5ad84..1694876 100644 --- a/syntax/stxSwift.go +++ b/syntax/stxSwift.go @@ -6,45 +6,32 @@ func init() { syntaxMap["swift"] = &lazySyntax{init: func() []byte { return []byte(`filetype: swift rules: - # Operators - statement: "([.:;,+*|=!?\\%]|<|>|/|-|&)" - - # Statements - statement: "(class|import|let|var|struct|enum|func|if|else|switch|case|default|for|in|internal|external|unowned|private|public|throws)\\ " - statement: "(prefix|postfix|operator|extension|lazy|get|set|self|willSet|didSet|override|super|convenience|weak|strong|mutating|return|guard)\\ " - - # Keywords - statement: "(print)" - statement: "(init)" - - # Numbers - constant.number: "([0-9]+)" - - # Standard Types - type: "\\ ((U)?Int(8|16|32|64))" - constant: "(true|false|nil)" - type: "\\ (Double|String|Float|Boolean|Dictionary|Array|Int)" - type: "\\ (AnyObject)" - - constant.string: start: "\"" end: "\"" skip: "\\\\." rules: - constant.specialChar: "\\\\." - - comment: start: "//" end: "$" rules: - todo: "(TODO|XXX|FIXME):?" - - comment: start: "///" end: "$" rules: - todo: "(TODO|XXX|FIXME):?" - - comment: start: "/\\*\\*" end: "\\*/" diff --git a/syntax/stxToml.go b/syntax/stxToml.go index 265c3b5..b485d60 100644 --- a/syntax/stxToml.go +++ b/syntax/stxToml.go @@ -8,34 +8,26 @@ func init() { rules: - statement: "(.*)[[:space:]]=" - special: "=" - - # Bracket thingies - special: "(\\[|\\])" - - # Numbers and strings - constant.number: "\\b([0-9]+|0x[0-9a-fA-F]*)\\b|'.'" - constant.number: "\\\\([0-7]{3}|x[A-Fa-f0-9]{2}|u[A-Fa-f0-9]{4}|U[A-Fa-f0-9]{8})" - - constant.string: start: "\"" end: "\"" skip: "\\\\." rules: - constant.specialChar: "\\\\." - - constant.string: start: "'" end: "'" skip: "\\\\." rules: - constant.specialChar: "\\\\." - - constant.string: start: "` + "`" + `" end: "` + "`" + `" rules: - constant.specialChar: "\\\\." - - comment: start: "#" end: "$" diff --git a/syntax/stxYaml.go b/syntax/stxYaml.go index 60f7cbc..6f8f4c3 100644 --- a/syntax/stxYaml.go +++ b/syntax/stxYaml.go @@ -14,21 +14,18 @@ rules: - type: "[-.\\w]+:" - statement: ":" - special: "(^---|^\\.\\.\\.|^%YAML|^%TAG)" - - constant.string: start: "\"" end: "\"" skip: "\\\\." rules: - constant.specialChar: "\\\\." - - constant.string: start: "'" end: "'" skip: "\\\\." rules: - constant.specialChar: "\\\\." - - comment: start: "#" end: "$" diff --git a/syntax/stxZsh.go b/syntax/stxZsh.go index b9f3a7f..b8d2009 100644 --- a/syntax/stxZsh.go +++ b/syntax/stxZsh.go @@ -6,46 +6,27 @@ func init() { syntaxMap["zsh"] = &lazySyntax{init: func() []byte { return []byte(`filetype: zsh rules: - ## Numbers - constant.number: "\\b[0-9]+\\b" - - ## Conditionals and control flow - statement: "\\b(always|break|bye|case|continue|disown|do|done|elif|else|esac|exit|fi|for|function|if|in|local|read|return|select|shift|then|time|until|while)\\b" - - statement: "(\\{|\\}|\\(|\\)|\\;|\\]|\\[|` + "`" + `|\\\\|\\$|<|>|!|=|&|\\|)" - ## Conditional flags - special: "-[Ldefgruwx]\\b" - special: "-(eq|ne|gt|lt|ge|le|s|n|z)\\b" - - ## Bash-inherited - statement: "\\b((un)?alias|bindkey|builtin|cd|declare|eval|exec|export|jobs|let|popd|pushd|set|source|typeset|umask|unset)\\b" - ## ZSH-specific - type: "\\b(add-zsh-hook|autoload|chdir|compinit|dirs|(dis|en)able|echotc|emulate|print|prompt(init)?|(un)?setopt|zle|zmodload|zstyle|whence)\\b" - - ## Common linux commands - statement: "\\b((g|ig)?awk|find|\\w{0,4}grep|kill|killall|\\w{0,4}less|make|pkill|sed|tar)\\b" - - ## Coreutils commands - statement: "\\b(base64|basename|cat|chcon|chgrp|chmod|chown|chroot|cksum|comm|cp|csplit|cut|date|dd|df|dir|dircolors|dirname|du|echo|env|expand|expr|factor|false|fmt|fold|head|hostid|id|install|join|link|ln|logname|ls|md5sum|mkdir|mkfifo|mknod|mktemp|mv|nice|nl|nohup|nproc|numfmt|od|paste|pathchk|pinky|pr|printenv|printf|ptx|pwd|readlink|realpath|rm|rmdir|runcon|seq|(sha1|sha224|sha256|sha384|sha512)sum|shred|shuf|sleep|sort|split|stat|stdbuf|stty|sum|sync|tac|tail|tee|test|timeout|touch|tr|true|truncate|tsort|tty|uname|unexpand|uniq|unlink|users|vdir|wc|who|whoami|yes)\\b" - - ## Function definition - identifier: "^\\s+(function\\s+)[0-9A-Z_]+\\s+\\(\\)" # (i) - - ## Variables - identifier: "\\$\\{?[0-9A-Z_!@#$*?-]+\\}?" #(i) - - constant.string: start: "\"" end: "\"" skip: "\\\\." rules: - constant.specialChar: "\\\\." - - constant.string: start: "'" end: "'" rules: [] - - comment: start: "#" end: "$"