cat /usr/share/katepart/syntax/logohighlightstyle.en_GB.xml这好像有分词高亮的,我考虑一下是不是可以……
绝句有些软关键字(就是仍然可以直接作为名字的,一般它们都跟在其他关键字后面)
不过没关系,可以全都视作关键字看待
https://kate-editor.org/syntax/data/syntax/kotlin.xml
牛批啊,这么说我就照着Kotlin的样子不需要几秒钟能定义 syntax highlight? 🤪??
牛批啊,这么说我就照着Kotlin的样子不需要几秒钟能定义 syntax highlight? 🤪??
package import sealed data class enum interface companion object private public protected internal open final get set fun var val constructor inline reified crossinline tailrec in out is as by where vararg get set return throw typealias typeof override infix operator if else when for while do try catch finally continue break yield this super null true false Unit Nothing String Char Int Long Byte Short Float Double Boolean
包 为 其中 引 引全 成 除
定记法 引记法 属别名 类 物 例 况物 储物 例物 记物 内物 内联物 伴生例
私下 族内 公开 内部
开放 终定 覆写
抽象 实现
待例 实际
内联 晚成
算符 尾递归
许多 跨嵌 不嵌
记法
若 否则
判 判断 于
对 解对 里的
重复若 重复 若
尝试 接迎 成 终焉
真 入 出
属 不属 作 试作 存于 不存于
回 抛下 停下 略过 断续
造于 我 亲
空 真 假
效果 断止 文 字
真假 字节 短数 数 长数 短实数 实数
取者 置者 代者
事 量 解量 常 变 常参 变参
包 为 其中 引 引全 成 除
定记法 引记法 属别名 类 物 例 况物 储物 例物 记物 内物 内联物 伴生例
私下 族内 公开 内部
开放 终定 覆写
抽象 实现
待例 实际
内联 晚成
算符 尾递归
许多 跨嵌 不嵌
记法
若 否则
判 判断 于
对 解对 里的
重复若 重复 若
尝试 接迎 成 终焉
真 入 出
属 不属 作 试作 存于 不存于
回 抛下 停下 略过 断续
造于 我 亲
空 真 假
效果 断止 文 字
真假 字节 短数 数 长数 短实数 实数
取者 置者 代者
事 量 解量 常 变 常参 变参
https://kate-editor.org/2005/03/24/writing-a-syntax-highlighting-file/
我真是服了,这么多明显是机器做的东西他们搞个什么 detect2Chars, detectWord, detect... 还甚至lineEndContext, lineBeginContext,写Haskell规则的那位那么Haskell都没见能支持Indented Heredoc(当然词法阶段和目的也没法怎么样)
我开始考虑那种Heredoc虽然看起不错,是不是对许多语言工具都会产生大问题,还是去掉,和Kotlin一样trimIndent、trimPrefix好了……
好利害的样子啊…… 居然能够支持 heredoc…… 而且死板一点的 layout 布局文法也可以支持吧,不过那就是文法阶段的事情了。
我真是服了,这么多明显是机器做的东西他们搞个什么 detect2Chars, detectWord, detect... 还甚至lineEndContext, lineBeginContext,写Haskell规则的那位那么Haskell都没见能支持Indented Heredoc(当然词法阶段和目的也没法怎么样)
我开始考虑那种Heredoc虽然看起不错,是不是对许多语言工具都会产生大问题,还是去掉,和Kotlin一样trimIndent、trimPrefix好了……
dynamic if true, the context remembers strings/placeholders saved by dynamic rules. This is needed for HERE documents for example. Default: false. 好利害的样子啊…… 居然能够支持 heredoc…… 而且死板一点的 layout 布局文法也可以支持吧,不过那就是文法阶段的事情了。
Kate | Get an Edge in Editing
Writing a Syntax Highlighting File
Note: Please refer to the Kate Handbook for the most recent version of how to write syntax highlighting files.
Hint: If you want to write a syntax highlighting file, the XML Completion plugin might be …
Hint: If you want to write a syntax highlighting file, the XML Completion plugin might be …
9012 年了还用XML且不提供其他的翻译方案,真不知道那语言支持规则该如何维护是好。
想要弄回来还得『反编译』,也真是佩服工程师们的精力和耐力。
想要弄回来还得『反编译』,也真是佩服工程师们的精力和耐力。
来给整理一下,这Kotlin词法(包括TODO,『待写』):
Symbol 符号
Comment 注释
Char 常字
"Data Type" 物类
Annotation 记物修饰
Import 书引入
Function 事定义
ControlFlow 控制流构词
Keyword 普通构词
"Normal Text" 代码文本
很绝望,我估计如果加了基于布局的"Heredoc",不能支持的编辑器会多10k倍…… 🤪
\b[_\w][_\w\d]*(\.[_\w][_\w\d]*)*(\.\*)? 据说这是全称名(qualified-name)的regex,绝句里叫『无的复名』,因为能带「的」的全称更常见Symbol 符号
Comment 注释
“(Comment|.)*?”"String Char" Unicode转义
\\u[0-9a-fA-F]{4}
String 常文Char 常字
'(Unicode转义|.)'Decimal 常数
"Data Type" 物类
Annotation 记物修饰
Import 书引入
包 (无的复名) 为Variable 变量
引 (复名) [成 名]
引全 (复名) [除 joinBy(同行空格(、),名)]
定记法 「.+」
引记法 无的复名 [除] 「.+」
Function 事定义
ControlFlow 控制流构词
Keyword 普通构词
"Normal Text" 代码文本
很绝望,我估计如果加了基于布局的"Heredoc",不能支持的编辑器会多10k倍…… 🤪
绝句词法.txt
2.3 KB
虽然最后(而且现在太晚了……)没有完成对 「的」「去」的高亮分词兼容,但是我总结出了这个,很方便继续修改。
flatMap :: forall t a. (a -> t a) -> (t a) -> (t a)
join :: forall t a -> t a -> t a -> t a
但是就可以注意到,类型推导 join 其实是写 t a 还是 a 都没问题的,就像 Kotlin 写
join :: forall t a -> t a -> t a -> t a
但是就可以注意到,类型推导 join 其实是写 t a 还是 a 都没问题的,就像 Kotlin 写
fun T?.wtf(): T 和 fun T.wtf() 一样,总感觉实现起来会要去 ? 一样的……引记法 绝句.额联 「令为」
事 階乘(甲:数):数 为
若甲是一,回一。
否则,
量 乙 = 甲-1
量 丙 = 阶乘(乙)
量 丁 = 甲去乘(丙);回丁
事 入口() 为
阶乘(5)令为(::说)https://codon.com/hello-declarative-world
Either(|) Both(&) 这不是比 disjuction, conjuction 对非英语母语的人友好多了么,我英文词感不算差偶尔脑力都跟不上辨别「disj是或」还是「conj是或」。
Either(|) Both(&) 这不是比 disjuction, conjuction 对非英语母语的人友好多了么,我英文词感不算差偶尔脑力都跟不上辨别「disj是或」还是「conj是或」。
duangsuse::Echo
https://codon.com/hello-declarative-world Either(|) Both(&) 这不是比 disjuction, conjuction 对非英语母语的人友好多了么,我英文词感不算差偶尔脑力都跟不上辨别「disj是或」还是「conj是或」。
因为内联图片不能打印(要不然耗费太多墨水),我在这里把内联图片内容写一下:
more abstract(抽象级提升) →
unstructured(无结构编程) → procedural(过程式) → | imperative(表述式) → declarative(定义式) | → functional(函数式) → relational(关系式)
从函数式到关系又有一个断层:
programmer(human): what → solver(machine): how
Function:
(\x y. x+y) ← (x)19 ← (y)23
→ 42
Relation:
(\x y. x=y) ← (x)5 ← (y)?
→Yes. y=5
(\x y. x<y) ←(x)? ←(y)5
→Yes. x=4
→Yes. x=3
...
→Yes. x=0
State-Goal:
"State → Goal → State0, State1, ..."
Variable: (equal v v) (either g g)
State: "with variables x, y, ..., g" (both g g)
Some Functions:
['a', 'b', 'c'] → ('a', ('b', ('c', nil)))
3 → (:+, (:+, (:+, nil)))
more abstract(抽象级提升) →
unstructured(无结构编程) → procedural(过程式) → | imperative(表述式) → declarative(定义式) | → functional(函数式) → relational(关系式)
从函数式到关系又有一个断层:
programmer(human): what → solver(machine): how
Function:
(\x y. x+y) ← (x)19 ← (y)23
→ 42
Relation:
(\x y. x=y) ← (x)5 ← (y)?
→Yes. y=5
(\x y. x<y) ←(x)? ←(y)5
→Yes. x=4
→Yes. x=3
...
→Yes. x=0
State-Goal:
"State → Goal → State0, State1, ..."
Variable: (equal v v) (either g g)
State: "with variables x, y, ..., g" (both g g)
Some Functions:
['a', 'b', 'c'] → ('a', ('b', ('c', nil)))
3 → (:+, (:+, (:+, nil)))
duangsuse::Echo
https://codon.com/hello-declarative-world Either(|) Both(&) 这不是比 disjuction, conjuction 对非英语母语的人友好多了么,我英文词感不算差偶尔脑力都跟不上辨别「disj是或」还是「conj是或」。
Array.prototype.zipWith = function*(ys) { const minLenIn2=Math.min(this.length, ys.length); for (let i=0; i<minLenIn2; ++i) yield([this[i], ys[i]]); };
—const imgContents = String.raw`
LRUG August 2015 "Hello, declarative world"
by Tom Stuart 10.08 2015
skillsmatter.com
—
more abstract(抽象级提升) →
unstructured(无结构编程) → procedural(过程式) → | imperative(表述式) → declarative(定义式) | → functional(函数式) → relational(关系式)
—
从函数式到关系又有一个断层:
programmer(human): what → solver(machine): how
—
more abstract(抽象级提升) →
unstructured(无结构编程) → procedural(过程式) → | imperative(表述式) → declarative(定义式) | → functional(函数式) → relational(关系式)
—
Function:
(\x y. x+y) ← (x)19 ← (y)23
→ 42
—
Relation:
(\x y. x=y) ← (x)5 ← (y)?
→Yes. y=5
—
(\x y. x<y) ←(x)? ←(y)5
→Yes. x=4
→Yes. x=3
...
→Yes. x=0
—
State-Goal:
"State → Goal → State0, State1, ..."
—
Six Primitives:
Variable: (equal v v) (either g g)
State: "with variables x, y, ..., g" (both g g)
—
Array to Pairs
['a', 'b', 'c'] → ('a', ('b', ('c', nil)))
—
Number to Pairs
3 → (:+, (:+, (:+, nil)))
`.split("—").map(s => s.trim());
document.querySelector('html').style.background='white'
let documentImages = [...document.querySelectorAll('img')];
let imgWithNewContents = [...documentImages.zipWith(imgContents)];
imgWithNewContents.forEach(t => { t[0].src=''; t[0].alt=t[1]; });
document.querySelectorAll('pre, blockquote').forEach(it => it.style.overflow = 'hidden')
—
body { width: auto !important; padding: unset !important; }
body { font: unset !important; }