From 0ac7193c4ddc66e69af25018d982ed790377dddb Mon Sep 17 00:00:00 2001 From: Zachary Yedidia Date: Fri, 15 Jul 2022 11:40:32 -0700 Subject: [PATCH 01/12] Fix cross compilation from macOS --- Makefile | 2 +- tools/info-plist.go | 44 ++++++++++++++++++++++---------------------- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/Makefile b/Makefile index af3fc987..0034173a 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,7 @@ DATE = $(shell GOOS=$(shell go env GOHOSTOS) GOARCH=$(shell go env GOHOSTARCH) \ go run tools/build-date.go) ADDITIONAL_GO_LINKER_FLAGS = $(shell GOOS=$(shell go env GOHOSTOS) \ GOARCH=$(shell go env GOHOSTARCH) \ - go run tools/info-plist.go "$(VERSION)") + go run tools/info-plist.go "$(GOOS)" "$(VERSION)") GOBIN ?= $(shell go env GOPATH)/bin GOVARS = -X github.com/zyedidia/micro/v2/internal/util.Version=$(VERSION) -X github.com/zyedidia/micro/v2/internal/util.CommitHash=$(HASH) -X 'github.com/zyedidia/micro/v2/internal/util.CompileDate=$(DATE)' DEBUGVAR = -X github.com/zyedidia/micro/v2/internal/util.Debug=ON diff --git a/tools/info-plist.go b/tools/info-plist.go index b2beee78..d57a7b24 100644 --- a/tools/info-plist.go +++ b/tools/info-plist.go @@ -1,4 +1,5 @@ -//+build ignore +//go:build ignore +// +build ignore package main @@ -6,7 +7,6 @@ import ( "fmt" "io/ioutil" "os" - "runtime" ) func check(e error) { @@ -16,32 +16,32 @@ func check(e error) { } func main() { - if runtime.GOOS == "darwin" { - if len(os.Args) == 2 { + if len(os.Args) == 3 { + if os.Args[1] == "darwin" { rawInfoPlistString := ` - - - - CFBundleIdentifier - io.github.micro-editor - CFBundleName - micro - CFBundleInfoDictionaryVersion - 6.0 - CFBundlePackageType - APPL - CFBundleShortVersionString - ` + os.Args[1] + ` - - -` + + + + CFBundleIdentifier + io.github.micro-editor + CFBundleName + micro + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + APPL + CFBundleShortVersionString + ` + os.Args[2] + ` + + + ` infoPlistData := []byte(rawInfoPlistString) err := ioutil.WriteFile("/tmp/micro-info.plist", infoPlistData, 0644) check(err) fmt.Println("-linkmode external -extldflags -Wl,-sectcreate,__TEXT,__info_plist,/tmp/micro-info.plist") - } else { - panic("missing argument for version number!") } + } else { + panic("missing arguments") } } From 37ed9dfe1eb06dff0c36c35e51ec80ed4351c861 Mon Sep 17 00:00:00 2001 From: USAMI Kenta Date: Mon, 18 Jul 2022 04:16:17 +0900 Subject: [PATCH 02/12] PHP: Add enum and keyword, and modify types (#2204) * Add enum keyword to PHP (8.1) syntax * Specify only keywords that are valid as type declarations as PHP types boolean, integer and resource are not valid type name. * Add match keyword to PHP (8.2) syntax --- runtime/syntax/php.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/runtime/syntax/php.yaml b/runtime/syntax/php.yaml index 56b003f2..a4e20dec 100644 --- a/runtime/syntax/php.yaml +++ b/runtime/syntax/php.yaml @@ -17,14 +17,14 @@ rules: - comment: "" - default: "<\\?(php|=)\" end=\"\\?>" - identifier.class: "([a-zA-Z0-9_-]+)\\(" - - type: "\\b(array|bool(ean)?|callable|callback|float|int(eger)?|iterable|object|resource|mixed|string|void)\\b" + - type: "\\b(array|bool|callable|float|int|iterable|object|mixed|string|void)\\b" - identifier.class: "[a-zA-Z\\\\]+::" - identifier: "\\b([A-Z][a-zA-Z0-9_]+)\\b" - identifier: "([A-Z0-9_]+)[;|\\s|\\)|,]" - type.keyword: "\\b(global|final|public|private|protected|static|const|var)\\b" - - statement: "\\b(abstract|catch|class|declare|do|else(if)?|end(declare|for(each)?|if|switch|while)|finally|for(each)|function|if|interface|namespace|switch|trait|try|while)\\b" + - statement: "\\b(abstract|catch|class|declare|do|else(if)?|end(declare|for(each)?|if|switch|while)|enum|finally|for(each)|function|if|interface|namespace|switch|trait|try|while)\\b" - identifier: "\\bnew\\s+([a-zA-Z0-9\\\\]+)" - - special: "\\b(as|and|break|case|clone|continue|default|die|fn|echo|empty|eval|exit|extends|goto|or|include(_once)?|implements|instanceof|insteadof|isset|list|new|print|return|require(_once)?|unset|use|throw|xor|yield(\\s+from))\\b" + - special: "\\b(as|and|break|case|clone|continue|default|die|fn|echo|empty|eval|exit|extends|goto|or|include(_once)?|implements|instanceof|insteadof|isset|list|match|new|print|return|require(_once)?|unset|use|throw|xor|yield(\\s+from))\\b" - constant.bool: "\\b(true|false|null|TRUE|FALSE|NULL)\\b" - constant: "[\\s|=|\\s|\\(|/|+|-|\\*|\\[]" - constant.number: "[0-9]" From 191438b4816f52816accfe6d20cc253a158203e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vil=C3=A9m=20Zouhar?= Date: Sun, 17 Jul 2022 21:16:27 +0200 Subject: [PATCH 03/12] add new logo with white shadow, change readme title logo (#2497) --- README.md | 2 +- assets/micro-logo-drop.svg | 104 +++++++++++++++++++++++++++++++++++++ 2 files changed, 105 insertions(+), 1 deletion(-) create mode 100644 assets/micro-logo-drop.svg diff --git a/README.md b/README.md index 457d732a..72f3e62c 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -micro logo +micro logo [![Build Status](https://travis-ci.org/zyedidia/micro.svg?branch=master)](https://travis-ci.org/zyedidia/micro) [![Go Report Card](https://goreportcard.com/badge/github.com/zyedidia/micro)](https://goreportcard.com/report/github.com/zyedidia/micro) diff --git a/assets/micro-logo-drop.svg b/assets/micro-logo-drop.svg new file mode 100644 index 00000000..3b4dc8f8 --- /dev/null +++ b/assets/micro-logo-drop.svg @@ -0,0 +1,104 @@ + + + +image/svg+xml From d89db64829c9987c5ac1a59c5c70f512e8ec5346 Mon Sep 17 00:00:00 2001 From: Waldir Pimenta Date: Sun, 17 Jul 2022 20:16:35 +0100 Subject: [PATCH 04/12] syntax/git-rebase-todo.yaml: support more commands (#2495) For reference, see the list of supported commands in the help text of git's interactive rebase: https://github.com/git/git/blob/v2.37.1/rebase-interactive.c#L43-L59 --- runtime/syntax/git-rebase-todo.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/syntax/git-rebase-todo.yaml b/runtime/syntax/git-rebase-todo.yaml index e2dd588a..0d31d13a 100644 --- a/runtime/syntax/git-rebase-todo.yaml +++ b/runtime/syntax/git-rebase-todo.yaml @@ -5,7 +5,7 @@ detect: rules: # Rebase commands - - statement: "^(p(ick)?|r(eword)?|e(dit)?|s(quash)?|f(ixup)?|x|exec|d(rop)?)\\b" + - statement: "^(p(ick)?|r(eword)?|e(dit)?|s(quash)?|f(ixup)?|x|exec|b(reak)?|d(rop)?|l(abel)?|t|reset|m(erge)?)\\b" # Commit IDs - identifier: "\\b([0-9a-f]{7,40})\\b" From 80bfaf1c546917e4dd591760610644b6e541f8f5 Mon Sep 17 00:00:00 2001 From: Peder Bergebakken Sundt Date: Sun, 17 Jul 2022 21:16:47 +0200 Subject: [PATCH 05/12] runtime/syntax/nix: Add support for block comments (#2488) --- runtime/syntax/nix.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/runtime/syntax/nix.yaml b/runtime/syntax/nix.yaml index edc42eec..a60780a4 100644 --- a/runtime/syntax/nix.yaml +++ b/runtime/syntax/nix.yaml @@ -25,3 +25,8 @@ rules: start: "#" end: "$" rules: [] + + - comment: + start: "/\\*" + end: "\\*/" + rules: [] From 77c784def48d819f241595d687404ab5103db906 Mon Sep 17 00:00:00 2001 From: Matthias Thym Date: Sun, 17 Jul 2022 21:16:57 +0200 Subject: [PATCH 06/12] Add nushell syntax highlighting (#2486) --- runtime/syntax/nu.yaml | 114 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 114 insertions(+) create mode 100644 runtime/syntax/nu.yaml diff --git a/runtime/syntax/nu.yaml b/runtime/syntax/nu.yaml new file mode 100644 index 00000000..827f70ed --- /dev/null +++ b/runtime/syntax/nu.yaml @@ -0,0 +1,114 @@ +filetype: nu + +detect: + filename: "\\.nu$" + +rules: + - symbol: "[-+/*=<>!~%?:&|]" + # https://www.nushell.sh/book/command_reference.html + - statement: "\\b(agg-groups|agg|alias|all-false|all-true|all?|ansi gradient)\\b" + - statement: "\\b(ansi strip|ansi|any?|append|append|arg-max)\\b" + - statement: "\\b(arg-min|arg-sort|arg-true|arg-unique|as-date)\\b" + - statement: "\\b(as-datetime|as|benchmark|build-string|cache|cal|cd)\\b" + - statement: "\\b(char|clear|col|collect|columns|compact|complete)\\b" + - statement: "\\b(concatenate|config|config env|config nu|contains)\\b" + - statement: "\\b(count|count-null|cp|cumulative|date format|date humanize)\\b" + - statement: "\\b(date list-timezone|date now|date to-record|date to-table)\\b" + - statement: "\\b(date to-timezone|date|db and|db as|db col|db collect)\\b" + - statement: "\\b(db describe|db fn|db from|db group-by|db join|db limit)\\b" + - statement: "\\b(db open|db or|db order-by|db over|db query|db schema)\\b" + - statement: "\\b(db select|db testing|db where|db|debug|decode)\\b" + - statement: "\\b(def-env|default|def|describe|describe|detect columns)\\b" + - statement: "\\b(df-not|do|drop|drop|drop column|drop nth|drop-duplicates)\\b" + - statement: "\\b(drop-nulls|dtypes|du|each while|each|echo|empty?)\\b" + - statement: "\\b(enter|env|error make|every|exec|exit|explode)\\b" + - statement: "\\b(export alias|export def|export def-env|export env)\\b" + - statement: "\\b(export extern|export|expr-not|extern|fetch|fill-na)\\b" + - statement: "\\b(fill-null|filter-with|find|first|flatten)\\b" + - statement: "\\b(fmt|format filesize|format|for|from csv|from eml)\\b" + - statement: "\\b(from ics|from ini|from json|from nuon|from ods|from ssv)\\b" + - statement: "\\b(from toml|from tsv|from url|from vcf|from xlsx|from xml)\\b" + - statement: "\\b(from yaml|from yml|from|get-day|get-hour|get-minute)\\b" + - statement: "\\b(get-month|get-nanosecond|get-ordinal|get-second|get-week)\\b" + - statement: "\\b(get-weekday|get-year|get|glob|grid|group-by)\\b" + - statement: "\\b(group|gstat|g|hash base64|hash md5|hash sha256|hash)\\b" + - statement: "\\b(headers|help|hide|histogram|history|if|ignore)\\b" + - statement: "\\b(inc|input|insert|into binary|into bool|into datetime|into decimal)\\b" + - statement: "\\b(into duration|into filesize|into int|into string|into)\\b" + - statement: "\\b(is-admin|is-duplicated|is-in|is-not-null)\\b" + - statement: "\\b(is-null|is-unique|join|keep|keep until)\\b" + - statement: "\\b(keep while|keybindings default|keybindings listen|keybindings list)\\b" + - statement: "\\b(keybindings|kill|last|length|let-env|let)\\b" + - statement: "\\b(lines|list|lit|load-env|ls|ls-df|match|math abs)\\b" + - statement: "\\b(math avg|math ceil|math eval|math floor|math max)\\b" + - statement: "\\b(math median|math min|math mode|math product|math round)\\b" + - statement: "\\b(math sqrt|math stddev|math sum|math variance|math|max)\\b" + - statement: "\\b(mean|median|melt|merge|metadata)\\b" + - statement: "\\b(min|mkdir|module|move|mv|n|n-unique|n-unique)\\b" + - statement: "\\b(nth|nu-highlight|open|open-df|otherwise|overlay)\\b" + - statement: "\\b(overlay add|overlay list|overlay new|overlay remove|p)\\b" + - statement: "\\b(par-each|parse|path basename|path dirname|path exists)\\b" + - statement: "\\b(path expand|path join|path parse|path relative-to|path split)\\b" + - statement: "\\b(path type|path|pivot|post|prepend|print|ps|quantile)\\b" + - statement: "\\b(quantile|query json|query web|query xml|query|random bool)\\b" + - statement: "\\b(random chars|random decimal|random dice|random integer)\\b" + - statement: "\\b(random uuid|random|range|reduce|register|reject|rename)\\b" + - statement: "\\b(replace|replace-all|reverse|reverse|rm|roll down)\\b" + - statement: "\\b(roll left|roll right|roll up|rolling|roll|rotate)\\b" + - statement: "\\b(run-external|sample|save|select|select|seq|seq char)\\b" + - statement: "\\b(seq date|set|set-with-idx|shape|shells|shift|shuffle)\\b" + - statement: "\\b(size|skip until|skip while|skip|sleep|slice|sort)\\b" + - statement: "\\b(sort-by|source|split chars|split column|split row)\\b" + - statement: "\\b(split-by|split|std|std|str camel-case|str capitalize)\\b" + - statement: "\\b(str collect|str contains|str downcase|str ends-with|str find-replace)\\b" + - statement: "\\b(str index-of|str kebab-case|str length|str lpad|str pascal-case)\\b" + - statement: "\\b(str replace|str reverse|str rpad|str screaming-snake-case)\\b" + - statement: "\\b(str snake-case|str starts-with|str substring|str title-case)\\b" + - statement: "\\b(str to-datetime|str to-decimal|str to-int|str trim|str upcase)\\b" + - statement: "\\b(str-lengths|str-slice|strftime|str|sum|sys|table)\\b" + - statement: "\\b(take until|take while|take|term size|to csv)\\b" + - statement: "\\b(to html|to json|to md|to nuon|to text|to toml|to tsv)\\b" + - statement: "\\b(to url|to xml|to yaml|to-csv|to-df|to-dummies|to-lazy)\\b" + - statement: "\\b(to-lowercase|to-nu|to-parquet|to-uppercase|touch|to)\\b" + - statement: "\\b(transpose|tutor|unalias|uniq|unique|update|update cells)\\b" + - statement: "\\b(upsert|url host|url path|url query|url scheme|url)\\b" + - statement: "\\b(use|value-counts|var|version|view-source|watch)\\b" + - statement: "\\b(when|where|which|window|with-column|with-env|wrap)\\b" + # https://www.nushell.sh/book/types_of_data.html#booleans + - constant: "\\b(false|true)\\b" + - constant.number: "\\b[-+]?([1-9][0-9])*\\b" + # https://www.nushell.sh/book/types_of_data.html#binary-data + - constant.number: "\\b[-+]?(0(x|b|o)\\[[0-9a-fA-F ]+\\])" + # https://www.nushell.sh/book/types_of_data.html#file-sizes + - constant.number: "\\b[-+]?([0-9]+[BbMmGgTtPp][i]?[Bb]?)?\\b" + # https://www.nushell.sh/book/types_of_data.html#duration + - constant.number: "\\b[-+]?([0-9]+[num]?[s])?\\b" + - constant.number: "\\b[-+]?([0-9]+(sec|min|hr|day|wk))?\\b" + # https://www.nushell.sh/book/types_of_data.html#dates + - constant.number: "\\b([0-9]+[-][0-9]+[-][0-9]+([T][0-9]+[:][0-9]+[:][0-9]+)?([\\+][0-9]+[:][0-9]+)?)\\b" + # https://www.nushell.sh/book/types_of_data.html#ranges + - constant.number: "([0-9]+(\\.\\.)[0-9]+)?" + # https://www.nushell.sh/book/types_of_data.html#open-ended-ranges + - constant.number: "((\\.\\.)[0-9]+)?" + - constant.number: "([0-9]+(\\.\\.))?" + - comment: + start: "#" + end: "$" + rules: [] + - comment: + start: "/\\*" + end: "\\*/" + rules: + - todo: "(FIXME|TODO|NOTE):?" + - constant.string: + start: "\"" + end: "\"" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\." + - constant.string: + start: "'" + end: "'" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\." From fc21fc9816329c2ab21284734cd564292304059d Mon Sep 17 00:00:00 2001 From: raidenXR <70112686+raidenXR@users.noreply.github.com> Date: Sun, 17 Jul 2022 15:17:11 -0400 Subject: [PATCH 07/12] Gnuplot Syntax highlighting (#2483) * gnuplot syntax support * Update gnuplot.yaml * Add files via upload * Update gnuplot.yaml --- runtime/syntax/gnuplot.yaml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 runtime/syntax/gnuplot.yaml diff --git a/runtime/syntax/gnuplot.yaml b/runtime/syntax/gnuplot.yaml new file mode 100644 index 00000000..cf324f6f --- /dev/null +++ b/runtime/syntax/gnuplot.yaml @@ -0,0 +1,15 @@ +filetype: gnuplot + +detect: + filename: "\\.(gnu|gpi|plt|gp)$" + +rules: + - statement: "\\b(set|unset|plot|splot|replot|if|else|do|for|while|fit)\\b" + - symbol.operator: "[-+/*=<>?:!~%&|^$]" + - constant.number: "\\b([0-9]+|0x[0-9a-fA-F]*)\\b" + + - comment: + start: "#" + end: "$" + rules: + - todo: "TODO:?" From 585dcc7d19a6f39004e153a7c8c15f3eebac77fa Mon Sep 17 00:00:00 2001 From: Ben Hammond <42008155+flber@users.noreply.github.com> Date: Sun, 17 Jul 2022 12:18:11 -0700 Subject: [PATCH 08/12] Adds options for tab bar and tab color reversing (#2480) * Adds options for tab bar and tab color reversing * Fixes small bug with tabreverse, options now work fully as expected --- internal/config/settings.go | 6 +++-- internal/display/tabwindow.go | 49 +++++++++++++++++++++++------------ runtime/help/options.md | 10 +++++++ 3 files changed, 47 insertions(+), 18 deletions(-) diff --git a/internal/config/settings.go b/internal/config/settings.go index ce1f1d4b..2c23f39b 100644 --- a/internal/config/settings.go +++ b/internal/config/settings.go @@ -335,10 +335,12 @@ var DefaultGlobalOnlySettings = map[string]interface{}{ "mouse": true, "parsecursor": false, "paste": false, - "savehistory": true, - "sucmd": "sudo", "pluginchannels": []string{"https://raw.githubusercontent.com/micro-editor/plugin-channel/master/channel.json"}, "pluginrepos": []string{}, + "savehistory": true, + "sucmd": "sudo", + "tabhighlight": false, + "tabreverse": true, "xterm": false, } diff --git a/internal/display/tabwindow.go b/internal/display/tabwindow.go index 70694504..8e31922c 100644 --- a/internal/display/tabwindow.go +++ b/internal/display/tabwindow.go @@ -2,6 +2,7 @@ package display import ( runewidth "github.com/mattn/go-runewidth" + "github.com/zyedidia/tcell/v2" "github.com/zyedidia/micro/v2/internal/buffer" "github.com/zyedidia/micro/v2/internal/config" "github.com/zyedidia/micro/v2/internal/screen" @@ -94,16 +95,27 @@ func (w *TabWindow) Display() { x := -w.hscroll done := false - tabBarStyle := config.DefStyle.Reverse(true) - if style, ok := config.Colorscheme["tabbar"]; ok { - tabBarStyle = style - } - tabBarActiveStyle := tabBarStyle - if style, ok := config.Colorscheme["tabbar.active"]; ok { - tabBarActiveStyle = style - } + globalTabReverse := config.GetGlobalOption("tabreverse").(bool) + globalTabHighlight := config.GetGlobalOption("tabhighlight").(bool) - draw := func(r rune, n int, active bool) { + // xor of reverse and tab highlight to get tab character (as in filename and surrounding characters) reverse state + tabCharHighlight := (globalTabReverse || globalTabHighlight) && !(globalTabReverse && globalTabHighlight) + + reverseStyles := func(reverse bool) (tcell.Style, tcell.Style) { + tabBarStyle := config.DefStyle.Reverse(reverse) + if style, ok := config.Colorscheme["tabbar"]; ok { + tabBarStyle = style + } + tabBarActiveStyle := tabBarStyle + if style, ok := config.Colorscheme["tabbar.active"]; ok { + tabBarActiveStyle = style + } + return tabBarStyle, tabBarActiveStyle + } + + draw := func(r rune, n int, active bool, reversed bool) { + tabBarStyle, tabBarActiveStyle := reverseStyles(reversed) + style := tabBarStyle if active { style = tabBarActiveStyle @@ -131,28 +143,33 @@ func (w *TabWindow) Display() { for i, n := range w.Names { if i == w.active { - draw('[', 1, true) + draw('[', 1, true, tabCharHighlight) } else { - draw(' ', 1, false) + draw(' ', 1, false, tabCharHighlight) } + for _, c := range n { - draw(c, 1, i == w.active) + draw(c, 1, i == w.active, tabCharHighlight) } + if i == len(w.Names)-1 { done = true } + if i == w.active { - draw(']', 1, true) - draw(' ', 2, true) + draw(']', 1, true, tabCharHighlight) + draw(' ', 2, true, globalTabReverse) } else { - draw(' ', 3, false) + draw(' ', 1, false, tabCharHighlight) + draw(' ', 2, false, globalTabReverse) } + if x >= w.Width { break } } if x < w.Width { - draw(' ', w.Width-x, false) + draw(' ', w.Width-x, false, globalTabReverse) } } diff --git a/runtime/help/options.md b/runtime/help/options.md index 89d85396..8c28c185 100644 --- a/runtime/help/options.md +++ b/runtime/help/options.md @@ -365,6 +365,14 @@ Here are the available options: default value: `false` +* `tabhighlight`: inverts the tab characters' (filename, save indicator, etc) colors with respect to the tab bar. + + default value: false + +* `tabreverse`: reverses the tab bar colors when active. + + default value: true + * `tabsize`: the size in spaces that a tab character should be displayed with. default value: `4` @@ -491,6 +499,8 @@ so that you can see what the formatting should look like. "sucmd": "sudo", "syntax": true, "tabmovement": false, + "tabhighlight": true, + "tabreverse": false, "tabsize": 4, "tabstospaces": false, "useprimary": true, From 515ec57b77ed4f814c54c86b887d8f60f75c29b9 Mon Sep 17 00:00:00 2001 From: yeti Date: Sun, 17 Jul 2022 20:18:30 +0100 Subject: [PATCH 09/12] improve fortran syntax highlighting (#2479) * support integer highlighting * add missing keywords and move some to where they fit better * add missing operators * fix previous commit * add and * add import --- runtime/syntax/fortran.yaml | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/runtime/syntax/fortran.yaml b/runtime/syntax/fortran.yaml index b30e5443..9e3ed173 100644 --- a/runtime/syntax/fortran.yaml +++ b/runtime/syntax/fortran.yaml @@ -5,18 +5,18 @@ detect: rules: - type: "(?i)\\b(action|advance|all|allocatable|allocated|any|apostrophe)\\b" - - type: "(?i)\\b(append|asis|assign|assignment|associated|character|common)\\b" + - type: "(?i)\\b(append|asis|assign|assignment|associated|bind|character|common)\\b" - type: "(?i)\\b(complex|data|default|delim|dimension|double precision)\\b" - - type: "(?i)\\b(elemental|epsilon|external|file|fmt|form|format|huge)\\b" + - type: "(?i)\\b(elemental|enum|enumerator|epsilon|external|file|fmt|form|format|huge)\\b" - type: "(?i)\\b(implicit|include|index|inquire|integer|intent|interface)\\b" - type: "(?i)\\b(intrinsic|iostat|kind|logical|module|none|null|only)\\\\b" - 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" + - type: "(?i)\\b(selected_real_kind|subroutine|status|module|function|logical)\\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" + - constant: "(?i)\\b(deallocate|digits|dot_product|eor|eoshift|iachar)\\b" - constant: "(?i)\\b(iand|ibclr|ibits|ibset|ichar|ieor|iolength|ior|ishft|ishftc)\\b" - constant: "(?i)\\b(lbound|len|len_trim|matmul|maxexponent|maxloc|maxval|merge)\\b" - constant: "(?i)\\b(minexponent|minloc|minval|mvbits|namelist|nearest|nullify)\\b" @@ -24,16 +24,18 @@ rules: - constant: "(?i)\\b(random_number|random_seed|range|read|readwrite|replace)\\b" - 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" + - constant: "(?i)\\b(ubound|unpack|verify|write|tiny|type|use|yes|true|false|not)\\b" + + - constant.number: "\\b([0-9]+)\\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" + - statement: "(?i)\\b(or|and|repeat|select|case|then|where|while|import)\\b" - special: "(?i)\\b(continue|cycle|exit|go?to|result|return)\\b" #Operator Color - - symbol.operator: "[.:;,+*|=!\\%]|/|-|&" + - symbol.operator: "[.:;,+*|=!\\%]|/|-|>|<|&" #Parenthetical Color - symbol.bracket: "[(){}]|\\[|\\]" @@ -60,4 +62,3 @@ rules: end: "$" rules: - todo: "(TODO|XXX|FIXME):?" - From 5e035efbcb48d638eab39bf0d78b36dd79123ef7 Mon Sep 17 00:00:00 2001 From: Aaron Clark Date: Sun, 17 Jul 2022 12:18:39 -0700 Subject: [PATCH 10/12] added support for HolyC (#2473) --- runtime/syntax/hc.yaml | 52 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 runtime/syntax/hc.yaml diff --git a/runtime/syntax/hc.yaml b/runtime/syntax/hc.yaml new file mode 100644 index 00000000..1d085d25 --- /dev/null +++ b/runtime/syntax/hc.yaml @@ -0,0 +1,52 @@ +filetype: hc + +detect: + filename: "(\\.(hc|HC)$|\\.(hh|HH)$|\\.ii?$|\\.(def)$)" + +rules: + - identifier: "\\b[A-Z_][0-9A-Z_]+\\b" + - type: "\\b(F64|I8|U8|I16|U16|I32|U32|I64|U64|sizeof|enum|U0|static|extern|struct|union|class|intern|public|argc|argv|asm)\\b" + + - statement: "\\b(for|if|while|do|else|case|default|switch)\\b" + - statement: "\\b(try|catch|throw|goto|continue|break|return)\\b" + - preproc: "^[[:space:]]*#[[:space:]]*(define|pragma|include|(un|ifn?)def|endif|el(if|se)|if|help_index|ifjit|ifaot|exe)" + + # Operator Color + - symbol.operator: "([.:;,+*|=!\\%]|<|>|/|-|&)" + - symbol.brackets: "[(){}]|\\[|\\]" + # Integer Constants + - constant.number: "(\\b([1-9][0-9]*|0[0-7]*|0[Xx][0-9A-Fa-f]+|0[Bb][01]+)([Uu]?[Ll][Ll]?|[Ll][Ll]?[Uu]?)?\\b)" + # Decimal Floating Constants + - constant.number: "(\\b(([0-9]*[.][0-9]+|[0-9]+[.][0-9]*)([Ee][+-]?[0-9]+)?|[0-9]+[Ee][+-]?[0-9]+)[FfLl]?\\b)" + # Hexadecimal Floating Constants + - constant.number: "(\\b0[Xx]([0-9A-Za-z]*[.][0-9A-Za-z]+|[0-9A-Za-z]+[.][0-9A-Za-z]*)[Pp][+-]?[0-9]+[FfLl]?\\b)" + - constant.number: "NULL" + - constant.number: "TRUE" + - constant.number: "FALSE" + + - constant.string: + start: "\"" + end: "\"" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\([\"'abfnrtv\\\\]|[0-3]?[0-7]{1,2}|x[0-9A-Fa-f]{1,2}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})" + + - constant.string: + start: "'" + end: "'" + skip: "\\\\." + rules: + - error: "..+" + - constant.specialChar: "\\\\([\"'abfnrtv\\\\]|[0-3]?[0-7]{1,2}|x[0-9A-Fa-f]{1,2}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})" + + - comment: + start: "//" + end: "$" + rules: + - todo: "(TODO|XXX|FIXME):?" + + - comment: + start: "/\\*" + end: "\\*/" + rules: + - todo: "(TODO|XXX|FIXME):?" From 3d4012850afa8d64a5e145d43c82d78a62b1f94b Mon Sep 17 00:00:00 2001 From: Mikko Date: Sun, 17 Jul 2022 22:18:56 +0300 Subject: [PATCH 11/12] fix javascript syntax recognizing parts of words as keywords (#2462) --- runtime/syntax/javascript.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/syntax/javascript.yaml b/runtime/syntax/javascript.yaml index 467f3820..4006931b 100644 --- a/runtime/syntax/javascript.yaml +++ b/runtime/syntax/javascript.yaml @@ -22,7 +22,7 @@ rules: - statement: "\\b(get|if|import|from|in|of|instanceof|let|new|reject|resolve|return)\\b" - statement: "\\b(set|static|super|switch|this|throw|try|typeof|var|void|while|with|yield)\\b" # reserved but unassigned - - error: "\\b(enum|implements|interface|package|private|protected|public)" + - error: "\\b(enum|implements|interface|package|private|protected|public)\\b" - constant: "\\b(globalThis|Infinity|null|undefined|NaN)\\b" - constant: "\\b(null|undefined|NaN)\\b" - constant: "\\b(true|false)\\b" From 6aa3ea70dc9b48182e708a244afd3e037f786830 Mon Sep 17 00:00:00 2001 From: Naftoli Gugenheim <98384+nafg@users.noreply.github.com> Date: Sun, 17 Jul 2022 15:19:07 -0400 Subject: [PATCH 12/12] scala.yaml: add support for .sc extension (#2452) It's used for Ammonite scripts and Scala worksheets --- runtime/syntax/scala.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/syntax/scala.yaml b/runtime/syntax/scala.yaml index c6685d94..b0348740 100644 --- a/runtime/syntax/scala.yaml +++ b/runtime/syntax/scala.yaml @@ -1,7 +1,7 @@ filetype: scala detect: - filename: "\\.scala$" + filename: "\\.sc(ala)?$" rules: - type: "\\b(boolean|byte|char|double|float|int|long|new|short|this|transient|void)\\b"