@@ -2072,6 +2072,167 @@ CodeMirror.defineMode("gfm", function(config, modeConfig) {
20722072 CodeMirror . defineMIME ( "text/x-gfm" , "gfm" ) ;
20732073} ) ;
20742074
2075+ Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
2076+ var CodeMirror$2 = require ( "codemirror" ) ;
2077+ require ( "codemirror/addon/mode/simple" ) ;
2078+ // Optional but recommended if authoring Eve documents rather than individual blocks.
2079+ // import "codemirror/addon/mode/overlay";
2080+ // import "codemirror/addon/mode/multiplex";
2081+ // import "codemirror/mode/gfm/gfm";
2082+ // import "codemirror/mode/markdown/markdown";
2083+ // import "codemirror/mode/javascript/javascript";
2084+ // Just some type silliness to tell TS to preserve the static keys but type their values as Patterns.
2085+ function asPatterns ( patterns ) {
2086+ return patterns ;
2087+ }
2088+ var _identifierPattern = / [ ^ \s | \[ \] ( ) { } " ' , . : = # ] + / ;
2089+ var patterns = asPatterns ( {
2090+ start_search : {
2091+ regex : / s e a r c h / ,
2092+ token : "keyword.section.search" ,
2093+ indent : true ,
2094+ push : "search" ,
2095+ } ,
2096+ start_action : {
2097+ regex : / ( b i n d | c o m m i t ) / ,
2098+ token : "keyword.section.action" ,
2099+ indent : true ,
2100+ dedent : true ,
2101+ push : "action"
2102+ } ,
2103+ start_record : {
2104+ regex : / \[ / ,
2105+ token : "syntax" ,
2106+ indent : true ,
2107+ push : "record" ,
2108+ } ,
2109+ stop_record : {
2110+ regex : / \] / ,
2111+ token : "syntax" ,
2112+ dedent : true ,
2113+ pop : true
2114+ } ,
2115+ start_function : {
2116+ regex : / ( [ a - z A - Z ] [ a - z A - Z 0 - 9 \- _ \? ! \/ ] * ) ( \[ ) / ,
2117+ token : [ "identifier.function" , "syntax" ] ,
2118+ indent : true ,
2119+ push : "record" ,
2120+ } ,
2121+ start_not : {
2122+ regex : / ( n o t ) ( \( ) / ,
2123+ token : [ "keyword.not" , "syntax" ] ,
2124+ indent : true ,
2125+ push : "not" ,
2126+ } ,
2127+ stop_not : {
2128+ regex : / \) / ,
2129+ token : "syntax.end-not" ,
2130+ dedent : true ,
2131+ pop : true ,
2132+ } ,
2133+ start_string : { regex : / (?: (? ! \\ ) ) " / , token : "literal.string" , push : "string" } ,
2134+ stop_string : { regex : / (?: (? ! \\ ) ) " / , token : "literal.string" , pop : true } ,
2135+ string_inner : { regex : / (?: [ ^ " \\ { ] | \\ .) + / , token : "literal.string" } ,
2136+ start_interpolation : { regex : / (?: (? ! \\ ) ) { { / , token : "syntax" , push : "interpolation" } ,
2137+ stop_interpolation : { regex : / (?: (? ! \\ ) ) } } / , token : "syntax" , pop : true } ,
2138+ if : { regex : / i f | e l s e i f / , token : "keyword.if" , indent : true } ,
2139+ then : { regex : / t h e n / , token : "keyword.if" , dedent : true } ,
2140+ else : { regex : / e l s e / , token : "keyword.if" } ,
2141+ number : { regex : / [ - + ] ? (?: \. \d + | \d + \. ? \d * ) / , token : "literal.number" } ,
2142+ comment : { regex : / \/ \/ .* / , token : "comment" } ,
2143+ identifier : { regex : _identifierPattern , token : "identifier" } ,
2144+ tag : { regex : new RegExp ( "#" + _identifierPattern . source ) , token : "tag" } ,
2145+ infix : { regex : / - | \+ | \/ | \* / , token : "operator.infix" } ,
2146+ filter : { regex : / < | < = | > | > = | ! = / , token : "operator.filter" } ,
2147+ update : { regex : / \+ = | - = | : = | < - / , token : "operator.update" } ,
2148+ misc_syntax : { regex : / [: ., ] / , token : "syntax.misc" }
2149+ } ) ;
2150+ function compose ( ) {
2151+ var states = [ ] ;
2152+ for ( var _i = 0 ; _i < arguments . length ; _i ++ ) {
2153+ states [ _i ] = arguments [ _i ] ;
2154+ }
2155+ var result = [ ] ;
2156+ for ( var _a = 0 , states_1 = states ; _a < states_1 . length ; _a ++ ) {
2157+ var state = states_1 [ _a ] ;
2158+ result . push . apply ( result , state ) ;
2159+ }
2160+ return result ;
2161+ }
2162+ var expr = [
2163+ patterns . infix ,
2164+ patterns . start_string ,
2165+ patterns . start_function ,
2166+ patterns . identifier ,
2167+ patterns . number
2168+ ] ;
2169+ var union_or_choose = [
2170+ patterns . if ,
2171+ patterns . then ,
2172+ patterns . else
2173+ ] ;
2174+ var mode = CodeMirror$2 . defineSimpleMode ( "eve" , {
2175+ meta : {
2176+ //dontIndentStates: ["comment"],
2177+ lineComment : "//"
2178+ } ,
2179+ start : [
2180+ patterns . comment ,
2181+ patterns . start_search ,
2182+ patterns . start_action
2183+ ] ,
2184+ record : compose ( [
2185+ patterns . comment ,
2186+ patterns . stop_record ,
2187+ patterns . start_record ,
2188+ patterns . tag ,
2189+ patterns . filter ,
2190+ patterns . misc_syntax
2191+ ] , expr ) ,
2192+ search : compose ( [
2193+ patterns . comment ,
2194+ patterns . tag ,
2195+ patterns . start_action ,
2196+ patterns . start_record ,
2197+ patterns . start_not ,
2198+ ] , union_or_choose , [
2199+ patterns . filter ,
2200+ patterns . misc_syntax
2201+ ] , expr ) ,
2202+ not : compose ( [
2203+ patterns . comment ,
2204+ patterns . stop_not ,
2205+ patterns . start_record ,
2206+ patterns . filter ,
2207+ patterns . misc_syntax
2208+ ] , expr ) ,
2209+ action : compose ( [
2210+ patterns . comment ,
2211+ patterns . start_record ,
2212+ // @FIXME : begin hack for whitespace syntax
2213+ patterns . start_search ,
2214+ patterns . start_action ,
2215+ patterns . filter ,
2216+ // @FIXME : end hack for whitespace syntax
2217+ patterns . update ,
2218+ patterns . tag ,
2219+ patterns . misc_syntax
2220+ ] , expr ) ,
2221+ string : [
2222+ patterns . start_interpolation ,
2223+ patterns . string_inner ,
2224+ patterns . stop_string ,
2225+ { regex : / ./ , token : "string" }
2226+ ] ,
2227+ interpolation : compose ( [
2228+ patterns . comment ,
2229+ patterns . stop_interpolation ,
2230+ patterns . start_record ,
2231+ patterns . misc_syntax
2232+ ] , expr )
2233+ } ) ;
2234+ CodeMirror$2 . defineMIME ( "text/eve" , "eve" ) ;
2235+
20752236//import "../eve-mode.js";
20762237var documentMode = { name : "gfm" , fencedCodeBlocks : true , taskLists : true } ;
20772238var blockMode = "eve" ;
0 commit comments