add maude syntax

This commit is contained in:
rhiannon morris 2022-03-15 04:40:25 +01:00
parent 3f989733ee
commit e5d888ae01
3 changed files with 120 additions and 0 deletions

View file

@ -33,6 +33,10 @@ EXECS = \
CABAL_FLAGS ?= -O -v0 CABAL_FLAGS ?= -O -v0
SYNTAXDIR := syntax
SYNTAXFLAGS = \
$(patsubst %,--syntax-definition=%,$(shell find $(SYNTAXDIR) -name '*.xml'))
.PHONY: all .PHONY: all
all: build all: build
@ -59,6 +63,7 @@ define pandoc
DIRNAME="$(basename $@)" \ DIRNAME="$(basename $@)" \
FILENAME="$@" \ FILENAME="$@" \
pandoc -s --toc --template $(TEMPLATEDIR)/$(1).html -o $@ $< \ pandoc -s --toc --template $(TEMPLATEDIR)/$(1).html -o $@ $< \
$(SYNTAXFLAGS) \
--filter $(LANGFILTER) --filter $(NICE_DATE) --mathjax --filter $(LANGFILTER) --filter $(NICE_DATE) --mathjax
endef endef

View file

@ -376,3 +376,14 @@ blockquote {
padding-left: 1em; padding-left: 1em;
margin: auto; margin: auto;
} }
/* syntax highlighting for maude
* [todo] does this also look ok for other langs */
.maude .pp { color: hsl(343deg, 100%, 40%); font-weight: 500; }
.maude .dt { color: hsl(173deg, 100%, 24%); font-weight: 500; }
.maude .fu { color: hsl(34deg, 100%, 30%); font-weight: 500; }
.maude .va { color: hsl(203deg, 100%, 30%); font-weight: 500; }
.maude .cf { color: hsl(276deg, 75%, 35%); font-weight: 500; }
.maude .op { color: hsl(220deg, 10%, 28%); }
.maude .co { color: hsl(221deg, 10%, 39%); font-style: italic; }

104
syntax/maude.xml Normal file
View file

@ -0,0 +1,104 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE language SYSTEM "language.dtd">
<language name="Maude" section="Sources" extensions="*.maude"
version="1" kateversion="2.4">
<highlighting>
<list name="modules">
<item>mod</item> <item>endm</item> <item>is</item>
<item>fmod</item> <item>endfm</item>
<item>th</item> <item>endth</item>
<item>fth</item> <item>endfth</item>
<item>view</item> <item>endv</item>
<item>from</item> <item>to</item>
</list>
<list name="import">
<item>protecting</item> <item>pr</item>
<item>including</item> <item>inc</item>
<item>extending</item> <item>ex</item>
</list>
<list name="sorts">
<item>sort</item> <item>sorts</item>
<item>subsort</item> <item>subsorts</item>
</list>
<list name="ops"> <item>op</item> <item>ops</item> </list>
<list name="vars"> <item>var</item> <item>vars</item> </list>
<list name="eqs"> <item>eq</item> <item>ceq</item> </list>
<list name="rules"> <item>rl</item> <item>crl</item> </list>
<list name="members"> <item>mb</item> <item>cmb</item> </list>
<list name="if"> <item>if</item> </list>
<contexts>
<context attribute="default" lineEndContext="#stay" name="Default">
<keyword attribute="modules" context="#stay" String="modules" />
<keyword attribute="import" context="#stay" String="import" />
<keyword attribute="sorts" context="#stay" String="sorts" />
<keyword attribute="ops" context="#stay" String="ops" />
<keyword attribute="vars" context="#stay" String="vars" />
<keyword attribute="eqs" context="#stay" String="eqs" />
<keyword attribute="rules" context="#stay" String="rules" />
<keyword attribute="members" context="#stay" String="members" />
<keyword attribute="if" context="#stay" String="if" />
<RegExpr attribute="if" context="#stay" String="/\\" />
<RegExpr attribute="punc" context="#stay"
String="(?&lt;=^|\s)(?:::?|->|=>|=(?:=|/=)?)(?=\s|$)" />
<RegExpr attribute="delim" context="#stay"
String="[{}\[\](),]|(?&lt;=^|\s)\.(?=\s|$)" />
<DetectChar attribute="string" context="String" char="&quot;" />
<Int attribute="int" context="#stay" />
<Float attribute="float" context="#stay" />
<RegExpr attribute="rat" context="#stay" String="\d+/\d+" />
<RegExpr attribute="comment" context="comment s"
String="(?:---|\*\*\*)(?!\()" />
<RegExpr attribute="comment" context="comment m"
String="(?:---|\*\*\*)\(" />
</context>
<context attribute="string" lineEndContext="#stay" name="String">
<RegExpr attribute="string" context="#stay" String="\\." />
<DetectChar attribute="string esc" context="#pop" char="&quot;" />
</context>
<context attribute="comment" lineEndContext="#pop" name="comment s" />
<context attribute="comment" lineEndContext="#stay" name="comment m">
<DetectChar attribute="comment" context="comment m" char="(" />
<DetectChar attribute="comment" context="#pop" char=")" />
</context>
</contexts>
<itemDatas>
<itemData name="default" defStyleNum="dsNormal" />
<itemData name="modules" defStyleNum="dsPreprocessor" />
<itemData name="import" defStyleNum="dsPreprocessor" />
<itemData name="sorts" defStyleNum="dsDataType" />
<itemData name="ops" defStyleNum="dsFunction" />
<itemData name="vars" defStyleNum="dsVariable" />
<itemData name="eqs" defStyleNum="dsFunction" />
<itemData name="rules" defStyleNum="dsControlFlow" />
<itemData name="members" defStyleNum="dsKeyword" />
<itemData name="if" defStyleNum="dsControlFlow" />
<itemData name="punc" defStyleNum="dsOperator" />
<itemData name="delim" defStyleNum="dsNormal" />
<itemData name="string" defStyleNum="dsString" />
<itemData name="string esc" defStyleNum="dsSpecialChar" />
<itemData name="int" defStyleNum="dsDecVal" />
<itemData name="float" defStyleNum="dsFloat" />
<itemData name="rat" defStyleNum="dsFloat" />
<itemData name="comment" defStyleNum="dsComment" />
</itemDatas>
</highlighting>
<general>
<keywords casesensitive="true" />
</general>
</language>