Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
MCMS
Commits
53f587bc
Commit
53f587bc
authored
Dec 27, 2019
by
zhongyh
Browse files
提交资源文件
parent
f40087b8
Changes
278
Hide whitespace changes
Inline
Side-by-side
Too many changes to show.
To preserve performance only
18 of 278+
files are displayed.
Plain diff
Email patch
src/main/webapp/static/plugins/codemirror/5.48.4/mode/ruby/ruby.js
0 → 100644
View file @
53f587bc
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: https://codemirror.net/LICENSE
(
function
(
mod
)
{
if
(
typeof
exports
==
"
object
"
&&
typeof
module
==
"
object
"
)
// CommonJS
mod
(
require
(
"
../../lib/codemirror
"
));
else
if
(
typeof
define
==
"
function
"
&&
define
.
amd
)
// AMD
define
([
"
../../lib/codemirror
"
],
mod
);
else
// Plain browser env
mod
(
CodeMirror
);
})(
function
(
CodeMirror
)
{
"
use strict
"
;
CodeMirror
.
defineMode
(
"
ruby
"
,
function
(
config
)
{
function
wordObj
(
words
)
{
var
o
=
{};
for
(
var
i
=
0
,
e
=
words
.
length
;
i
<
e
;
++
i
)
o
[
words
[
i
]]
=
true
;
return
o
;
}
var
keywords
=
wordObj
([
"
alias
"
,
"
and
"
,
"
BEGIN
"
,
"
begin
"
,
"
break
"
,
"
case
"
,
"
class
"
,
"
def
"
,
"
defined?
"
,
"
do
"
,
"
else
"
,
"
elsif
"
,
"
END
"
,
"
end
"
,
"
ensure
"
,
"
false
"
,
"
for
"
,
"
if
"
,
"
in
"
,
"
module
"
,
"
next
"
,
"
not
"
,
"
or
"
,
"
redo
"
,
"
rescue
"
,
"
retry
"
,
"
return
"
,
"
self
"
,
"
super
"
,
"
then
"
,
"
true
"
,
"
undef
"
,
"
unless
"
,
"
until
"
,
"
when
"
,
"
while
"
,
"
yield
"
,
"
nil
"
,
"
raise
"
,
"
throw
"
,
"
catch
"
,
"
fail
"
,
"
loop
"
,
"
callcc
"
,
"
caller
"
,
"
lambda
"
,
"
proc
"
,
"
public
"
,
"
protected
"
,
"
private
"
,
"
require
"
,
"
load
"
,
"
require_relative
"
,
"
extend
"
,
"
autoload
"
,
"
__END__
"
,
"
__FILE__
"
,
"
__LINE__
"
,
"
__dir__
"
]);
var
indentWords
=
wordObj
([
"
def
"
,
"
class
"
,
"
case
"
,
"
for
"
,
"
while
"
,
"
until
"
,
"
module
"
,
"
then
"
,
"
catch
"
,
"
loop
"
,
"
proc
"
,
"
begin
"
]);
var
dedentWords
=
wordObj
([
"
end
"
,
"
until
"
]);
var
opening
=
{
"
[
"
:
"
]
"
,
"
{
"
:
"
}
"
,
"
(
"
:
"
)
"
};
var
closing
=
{
"
]
"
:
"
[
"
,
"
}
"
:
"
{
"
,
"
)
"
:
"
(
"
};
var
curPunc
;
function
chain
(
newtok
,
stream
,
state
)
{
state
.
tokenize
.
push
(
newtok
);
return
newtok
(
stream
,
state
);
}
function
tokenBase
(
stream
,
state
)
{
if
(
stream
.
sol
()
&&
stream
.
match
(
"
=begin
"
)
&&
stream
.
eol
())
{
state
.
tokenize
.
push
(
readBlockComment
);
return
"
comment
"
;
}
if
(
stream
.
eatSpace
())
return
null
;
var
ch
=
stream
.
next
(),
m
;
if
(
ch
==
"
`
"
||
ch
==
"
'
"
||
ch
==
'
"
'
)
{
return
chain
(
readQuoted
(
ch
,
"
string
"
,
ch
==
'
"
'
||
ch
==
"
`
"
),
stream
,
state
);
}
else
if
(
ch
==
"
/
"
)
{
if
(
regexpAhead
(
stream
))
return
chain
(
readQuoted
(
ch
,
"
string-2
"
,
true
),
stream
,
state
);
else
return
"
operator
"
;
}
else
if
(
ch
==
"
%
"
)
{
var
style
=
"
string
"
,
embed
=
true
;
if
(
stream
.
eat
(
"
s
"
))
style
=
"
atom
"
;
else
if
(
stream
.
eat
(
/
[
WQ
]
/
))
style
=
"
string
"
;
else
if
(
stream
.
eat
(
/
[
r
]
/
))
style
=
"
string-2
"
;
else
if
(
stream
.
eat
(
/
[
wxq
]
/
))
{
style
=
"
string
"
;
embed
=
false
;
}
var
delim
=
stream
.
eat
(
/
[^\w\s
=
]
/
);
if
(
!
delim
)
return
"
operator
"
;
if
(
opening
.
propertyIsEnumerable
(
delim
))
delim
=
opening
[
delim
];
return
chain
(
readQuoted
(
delim
,
style
,
embed
,
true
),
stream
,
state
);
}
else
if
(
ch
==
"
#
"
)
{
stream
.
skipToEnd
();
return
"
comment
"
;
}
else
if
(
ch
==
"
<
"
&&
(
m
=
stream
.
match
(
/^<
([
-~
])[\`\"\']?([
a-zA-Z_?
]\w
*
)[\`\"\']?(?:
;|$
)
/
)))
{
return
chain
(
readHereDoc
(
m
[
2
],
m
[
1
]),
stream
,
state
);
}
else
if
(
ch
==
"
0
"
)
{
if
(
stream
.
eat
(
"
x
"
))
stream
.
eatWhile
(
/
[\d
a-fA-F
]
/
);
else
if
(
stream
.
eat
(
"
b
"
))
stream
.
eatWhile
(
/
[
01
]
/
);
else
stream
.
eatWhile
(
/
[
0-7
]
/
);
return
"
number
"
;
}
else
if
(
/
\d
/
.
test
(
ch
))
{
stream
.
match
(
/^
[\d
_
]
*
(?:\.[\d
_
]
+
)?(?:[
eE
][
+
\-]?[\d
_
]
+
)?
/
);
return
"
number
"
;
}
else
if
(
ch
==
"
?
"
)
{
while
(
stream
.
match
(
/^
\\[
CM
]
-/
))
{}
if
(
stream
.
eat
(
"
\\
"
))
stream
.
eatWhile
(
/
\w
/
);
else
stream
.
next
();
return
"
string
"
;
}
else
if
(
ch
==
"
:
"
)
{
if
(
stream
.
eat
(
"
'
"
))
return
chain
(
readQuoted
(
"
'
"
,
"
atom
"
,
false
),
stream
,
state
);
if
(
stream
.
eat
(
'
"
'
))
return
chain
(
readQuoted
(
'
"
'
,
"
atom
"
,
true
),
stream
,
state
);
// :> :>> :< :<< are valid symbols
if
(
stream
.
eat
(
/
[\<\>]
/
))
{
stream
.
eat
(
/
[\<\>]
/
);
return
"
atom
"
;
}
// :+ :- :/ :* :| :& :! are valid symbols
if
(
stream
.
eat
(
/
[\+\-\*\/\&\|\:\!]
/
))
{
return
"
atom
"
;
}
// Symbols can't start by a digit
if
(
stream
.
eat
(
/
[
a-zA-Z$@_
\x
a1-
\u
ffff
]
/
))
{
stream
.
eatWhile
(
/
[\w
$
\x
a1-
\u
ffff
]
/
);
// Only one ? ! = is allowed and only as the last character
stream
.
eat
(
/
[\?\!\=]
/
);
return
"
atom
"
;
}
return
"
operator
"
;
}
else
if
(
ch
==
"
@
"
&&
stream
.
match
(
/^@
?[
a-zA-Z_
\x
a1-
\u
ffff
]
/
))
{
stream
.
eat
(
"
@
"
);
stream
.
eatWhile
(
/
[\w\x
a1-
\u
ffff
]
/
);
return
"
variable-2
"
;
}
else
if
(
ch
==
"
$
"
)
{
if
(
stream
.
eat
(
/
[
a-zA-Z_
]
/
))
{
stream
.
eatWhile
(
/
[\w]
/
);
}
else
if
(
stream
.
eat
(
/
\d
/
))
{
stream
.
eat
(
/
\d
/
);
}
else
{
stream
.
next
();
// Must be a special global like $: or $!
}
return
"
variable-3
"
;
}
else
if
(
/
[
a-zA-Z_
\x
a1-
\u
ffff
]
/
.
test
(
ch
))
{
stream
.
eatWhile
(
/
[\w\x
a1-
\u
ffff
]
/
);
stream
.
eat
(
/
[\?\!]
/
);
if
(
stream
.
eat
(
"
:
"
))
return
"
atom
"
;
return
"
ident
"
;
}
else
if
(
ch
==
"
|
"
&&
(
state
.
varList
||
state
.
lastTok
==
"
{
"
||
state
.
lastTok
==
"
do
"
))
{
curPunc
=
"
|
"
;
return
null
;
}
else
if
(
/
[\(\)\[\]
{}
\\
;
]
/
.
test
(
ch
))
{
curPunc
=
ch
;
return
null
;
}
else
if
(
ch
==
"
-
"
&&
stream
.
eat
(
"
>
"
))
{
return
"
arrow
"
;
}
else
if
(
/
[
=+
\-\/
*:
\.
^%<>~|
]
/
.
test
(
ch
))
{
var
more
=
stream
.
eatWhile
(
/
[
=+
\-\/
*:
\.
^%<>~|
]
/
);
if
(
ch
==
"
.
"
&&
!
more
)
curPunc
=
"
.
"
;
return
"
operator
"
;
}
else
{
return
null
;
}
}
function
regexpAhead
(
stream
)
{
var
start
=
stream
.
pos
,
depth
=
0
,
next
,
found
=
false
,
escaped
=
false
while
((
next
=
stream
.
next
())
!=
null
)
{
if
(
!
escaped
)
{
if
(
"
[{(
"
.
indexOf
(
next
)
>
-
1
)
{
depth
++
}
else
if
(
"
]})
"
.
indexOf
(
next
)
>
-
1
)
{
depth
--
if
(
depth
<
0
)
break
}
else
if
(
next
==
"
/
"
&&
depth
==
0
)
{
found
=
true
break
}
escaped
=
next
==
"
\\
"
}
else
{
escaped
=
false
}
}
stream
.
backUp
(
stream
.
pos
-
start
)
return
found
}
function
tokenBaseUntilBrace
(
depth
)
{
if
(
!
depth
)
depth
=
1
;
return
function
(
stream
,
state
)
{
if
(
stream
.
peek
()
==
"
}
"
)
{
if
(
depth
==
1
)
{
state
.
tokenize
.
pop
();
return
state
.
tokenize
[
state
.
tokenize
.
length
-
1
](
stream
,
state
);
}
else
{
state
.
tokenize
[
state
.
tokenize
.
length
-
1
]
=
tokenBaseUntilBrace
(
depth
-
1
);
}
}
else
if
(
stream
.
peek
()
==
"
{
"
)
{
state
.
tokenize
[
state
.
tokenize
.
length
-
1
]
=
tokenBaseUntilBrace
(
depth
+
1
);
}
return
tokenBase
(
stream
,
state
);
};
}
function
tokenBaseOnce
()
{
var
alreadyCalled
=
false
;
return
function
(
stream
,
state
)
{
if
(
alreadyCalled
)
{
state
.
tokenize
.
pop
();
return
state
.
tokenize
[
state
.
tokenize
.
length
-
1
](
stream
,
state
);
}
alreadyCalled
=
true
;
return
tokenBase
(
stream
,
state
);
};
}
function
readQuoted
(
quote
,
style
,
embed
,
unescaped
)
{
return
function
(
stream
,
state
)
{
var
escaped
=
false
,
ch
;
if
(
state
.
context
.
type
===
'
read-quoted-paused
'
)
{
state
.
context
=
state
.
context
.
prev
;
stream
.
eat
(
"
}
"
);
}
while
((
ch
=
stream
.
next
())
!=
null
)
{
if
(
ch
==
quote
&&
(
unescaped
||
!
escaped
))
{
state
.
tokenize
.
pop
();
break
;
}
if
(
embed
&&
ch
==
"
#
"
&&
!
escaped
)
{
if
(
stream
.
eat
(
"
{
"
))
{
if
(
quote
==
"
}
"
)
{
state
.
context
=
{
prev
:
state
.
context
,
type
:
'
read-quoted-paused
'
};
}
state
.
tokenize
.
push
(
tokenBaseUntilBrace
());
break
;
}
else
if
(
/
[
@
\$]
/
.
test
(
stream
.
peek
()))
{
state
.
tokenize
.
push
(
tokenBaseOnce
());
break
;
}
}
escaped
=
!
escaped
&&
ch
==
"
\\
"
;
}
return
style
;
};
}
function
readHereDoc
(
phrase
,
mayIndent
)
{
return
function
(
stream
,
state
)
{
if
(
mayIndent
)
stream
.
eatSpace
()
if
(
stream
.
match
(
phrase
))
state
.
tokenize
.
pop
();
else
stream
.
skipToEnd
();
return
"
string
"
;
};
}
function
readBlockComment
(
stream
,
state
)
{
if
(
stream
.
sol
()
&&
stream
.
match
(
"
=end
"
)
&&
stream
.
eol
())
state
.
tokenize
.
pop
();
stream
.
skipToEnd
();
return
"
comment
"
;
}
return
{
startState
:
function
()
{
return
{
tokenize
:
[
tokenBase
],
indented
:
0
,
context
:
{
type
:
"
top
"
,
indented
:
-
config
.
indentUnit
},
continuedLine
:
false
,
lastTok
:
null
,
varList
:
false
};
},
token
:
function
(
stream
,
state
)
{
curPunc
=
null
;
if
(
stream
.
sol
())
state
.
indented
=
stream
.
indentation
();
var
style
=
state
.
tokenize
[
state
.
tokenize
.
length
-
1
](
stream
,
state
),
kwtype
;
var
thisTok
=
curPunc
;
if
(
style
==
"
ident
"
)
{
var
word
=
stream
.
current
();
style
=
state
.
lastTok
==
"
.
"
?
"
property
"
:
keywords
.
propertyIsEnumerable
(
stream
.
current
())
?
"
keyword
"
:
/^
[
A-Z
]
/
.
test
(
word
)
?
"
tag
"
:
(
state
.
lastTok
==
"
def
"
||
state
.
lastTok
==
"
class
"
||
state
.
varList
)
?
"
def
"
:
"
variable
"
;
if
(
style
==
"
keyword
"
)
{
thisTok
=
word
;
if
(
indentWords
.
propertyIsEnumerable
(
word
))
kwtype
=
"
indent
"
;
else
if
(
dedentWords
.
propertyIsEnumerable
(
word
))
kwtype
=
"
dedent
"
;
else
if
((
word
==
"
if
"
||
word
==
"
unless
"
)
&&
stream
.
column
()
==
stream
.
indentation
())
kwtype
=
"
indent
"
;
else
if
(
word
==
"
do
"
&&
state
.
context
.
indented
<
state
.
indented
)
kwtype
=
"
indent
"
;
}
}
if
(
curPunc
||
(
style
&&
style
!=
"
comment
"
))
state
.
lastTok
=
thisTok
;
if
(
curPunc
==
"
|
"
)
state
.
varList
=
!
state
.
varList
;
if
(
kwtype
==
"
indent
"
||
/
[\(\[\{]
/
.
test
(
curPunc
))
state
.
context
=
{
prev
:
state
.
context
,
type
:
curPunc
||
style
,
indented
:
state
.
indented
};
else
if
((
kwtype
==
"
dedent
"
||
/
[\)\]\}]
/
.
test
(
curPunc
))
&&
state
.
context
.
prev
)
state
.
context
=
state
.
context
.
prev
;
if
(
stream
.
eol
())
state
.
continuedLine
=
(
curPunc
==
"
\\
"
||
style
==
"
operator
"
);
return
style
;
},
indent
:
function
(
state
,
textAfter
)
{
if
(
state
.
tokenize
[
state
.
tokenize
.
length
-
1
]
!=
tokenBase
)
return
CodeMirror
.
Pass
;
var
firstChar
=
textAfter
&&
textAfter
.
charAt
(
0
);
var
ct
=
state
.
context
;
var
closed
=
ct
.
type
==
closing
[
firstChar
]
||
ct
.
type
==
"
keyword
"
&&
/^
(?:
end|until|else|elsif|when|rescue
)\b
/
.
test
(
textAfter
);
return
ct
.
indented
+
(
closed
?
0
:
config
.
indentUnit
)
+
(
state
.
continuedLine
?
config
.
indentUnit
:
0
);
},
electricInput
:
/^
\s
*
(?:
end|rescue|elsif|else|
\})
$/
,
lineComment
:
"
#
"
,
fold
:
"
indent
"
};
});
CodeMirror
.
defineMIME
(
"
text/x-ruby
"
,
"
ruby
"
);
});
src/main/webapp/static/plugins/codemirror/5.48.4/mode/ruby/test.js
0 → 100644
View file @
53f587bc
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: https://codemirror.net/LICENSE
(
function
()
{
var
mode
=
CodeMirror
.
getMode
({
indentUnit
:
2
},
"
ruby
"
);
function
MT
(
name
)
{
test
.
mode
(
name
,
mode
,
Array
.
prototype
.
slice
.
call
(
arguments
,
1
));
}
MT
(
"
divide_equal_operator
"
,
"
[variable bar] [operator /=] [variable foo]
"
);
MT
(
"
divide_equal_operator_no_spacing
"
,
"
[variable foo][operator /=][number 42]
"
);
MT
(
"
complex_regexp
"
,
"
[keyword if] [variable cr] [operator =~] [string-2 /(?:
\\
( #{][tag RE_NOT][string-2 }
\\
( | #{][tag RE_NOT_PAR_OR][string-2 }* #{][tag RE_OPA_OR][string-2 } )/][variable x]
"
)
MT
(
"
indented_heredoc
"
,
"
[keyword def] [def x]
"
,
"
[variable y] [operator =] [string <<-FOO]
"
,
"
[string bar]
"
,
"
[string FOO]
"
,
"
[keyword end]
"
)
})();
src/main/webapp/static/plugins/codemirror/5.48.4/mode/rust/index.html
0 → 100644
View file @
53f587bc
<!doctype html>
<title>
CodeMirror: Rust mode
</title>
<meta
charset=
"utf-8"
/>
<link
rel=
stylesheet
href=
"../../doc/docs.css"
>
<link
rel=
"stylesheet"
href=
"../../lib/codemirror.css"
>
<script
src=
"../../lib/codemirror.js"
></script>
<script
src=
"../../addon/mode/simple.js"
></script>
<script
src=
"rust.js"
></script>
<style>
.CodeMirror
{
border-top
:
1px
solid
black
;
border-bottom
:
1px
solid
black
;}
</style>
<div
id=
nav
>
<a
href=
"https://codemirror.net"
><h1>
CodeMirror
</h1><img
id=
logo
src=
"../../doc/logo.png"
></a>
<ul>
<li><a
href=
"../../index.html"
>
Home
</a>
<li><a
href=
"../../doc/manual.html"
>
Manual
</a>
<li><a
href=
"https://github.com/codemirror/codemirror"
>
Code
</a>
</ul>
<ul>
<li><a
href=
"../index.html"
>
Language modes
</a>
<li><a
class=
active
href=
"#"
>
Rust
</a>
</ul>
</div>
<article>
<h2>
Rust mode
</h2>
<div><textarea
id=
"code"
name=
"code"
>
// Demo code.
type foo
<T>
= int;
enum bar {
some(int, foo
<float>
),
none
}
fn check_crate(x: int) {
let v = 10;
match foo {
1 ... 3 {
print_foo();
if x {
blah().to_string();
}
}
(x, y) { "bye" }
_ { "hi" }
}
}
</textarea></div>
<script>
var
editor
=
CodeMirror
.
fromTextArea
(
document
.
getElementById
(
"
code
"
),
{
lineNumbers
:
true
,
lineWrapping
:
true
,
indentUnit
:
4
,
mode
:
"
rust
"
});
</script>
<p><strong>
MIME types defined:
</strong>
<code>
text/x-rustsrc
</code>
.
</p>
</article>
src/main/webapp/static/plugins/codemirror/5.48.4/mode/rust/rust.js
0 → 100644
View file @
53f587bc
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: https://codemirror.net/LICENSE
(
function
(
mod
)
{
if
(
typeof
exports
==
"
object
"
&&
typeof
module
==
"
object
"
)
// CommonJS
mod
(
require
(
"
../../lib/codemirror
"
),
require
(
"
../../addon/mode/simple
"
));
else
if
(
typeof
define
==
"
function
"
&&
define
.
amd
)
// AMD
define
([
"
../../lib/codemirror
"
,
"
../../addon/mode/simple
"
],
mod
);
else
// Plain browser env
mod
(
CodeMirror
);
})(
function
(
CodeMirror
)
{
"
use strict
"
;
CodeMirror
.
defineSimpleMode
(
"
rust
"
,{
start
:
[
// string and byte string
{
regex
:
/b
?
"/
,
token
:
"
string
"
,
next
:
"
string
"
},
// raw string and raw byte string
{
regex
:
/b
?
r"/
,
token
:
"
string
"
,
next
:
"
string_raw
"
},
{
regex
:
/b
?
r#+"/
,
token
:
"
string
"
,
next
:
"
string_raw_hash
"
},
// character
{
regex
:
/'
(?:[^
'
\\]
|
\\(?:[
nrt0'"
]
|x
[\d
a-fA-F
]{2}
|u
\{[\d
a-fA-F
]{6}\}))
'/
,
token
:
"
string-2
"
},
// byte
{
regex
:
/b'
(?:[^
'
]
|
\\(?:[
'
\\
nrt0
]
|x
[\d
a-fA-F
]{2}))
'/
,
token
:
"
string-2
"
},
{
regex
:
/
(?:(?:[
0-9
][
0-9_
]
*
)(?:(?:[
Ee
][
+-
]?[
0-9_
]
+
)
|
\.[
0-9_
]
+
(?:[
Ee
][
+-
]?[
0-9_
]
+
)?)(?:
f32|f64
)?)
|
(?:
0
(?:
b
[
01_
]
+|
(?:
o
[
0-7_
]
+
)
|
(?:
x
[
0-9a-fA-F_
]
+
))
|
(?:[
0-9
][
0-9_
]
*
))(?:
u8|u16|u32|u64|i8|i16|i32|i64|isize|usize
)?
/
,
token
:
"
number
"
},
{
regex
:
/
(
let
(?:\s
+mut
)?
|fn|enum|mod|struct|type
)(\s
+
)([
a-zA-Z_
][
a-zA-Z0-9_
]
*
)
/
,
token
:
[
"
keyword
"
,
null
,
"
def
"
]},
{
regex
:
/
(?:
abstract|alignof|as|box|break|continue|const|crate|do|else|enum|extern|fn|for|final|if|impl|in|loop|macro|match|mod|move|offsetof|override|priv|proc|pub|pure|ref|return|self|sizeof|static|struct|super|trait|type|typeof|unsafe|unsized|use|virtual|where|while|yield
)\b
/
,
token
:
"
keyword
"
},
{
regex
:
/
\b(?:
Self|isize|usize|char|bool|u8|u16|u32|u64|f16|f32|f64|i8|i16|i32|i64|str|Option
)\b
/
,
token
:
"
atom
"
},
{
regex
:
/
\b(?:
true|false|Some|None|Ok|Err
)\b
/
,
token
:
"
builtin
"
},
{
regex
:
/
\b(
fn
)(\s
+
)([
a-zA-Z_
][
a-zA-Z0-9_
]
*
)
/
,
token
:
[
"
keyword
"
,
null
,
"
def
"
]},
{
regex
:
/#!
?\[
.*
\]
/
,
token
:
"
meta
"
},
{
regex
:
/
\/\/
.*/
,
token
:
"
comment
"
},
{
regex
:
/
\/\*
/
,
token
:
"
comment
"
,
next
:
"
comment
"
},
{
regex
:
/
[
-+
\/
*=<>!
]
+/
,
token
:
"
operator
"
},
{
regex
:
/
[
a-zA-Z_
]\w
*!/
,
token
:
"
variable-3
"
},
{
regex
:
/
[
a-zA-Z_
]\w
*/
,
token
:
"
variable
"
},
{
regex
:
/
[\{\[\(]
/
,
indent
:
true
},
{
regex
:
/
[\}\]\)]
/
,
dedent
:
true
}
],
string
:
[
{
regex
:
/"/
,
token
:
"
string
"
,
next
:
"
start
"
},
{
regex
:
/
(?:[^\\
"
]
|
\\(?:
.|$
))
*/
,
token
:
"
string
"
}
],
string_raw
:
[
{
regex
:
/"/
,
token
:
"
string
"
,
next
:
"
start
"
},
{
regex
:
/
[^
"
]
*/
,
token
:
"
string
"
}
],
string_raw_hash
:
[
{
regex
:
/"#+/
,
token
:
"
string
"
,
next
:
"
start
"
},
{
regex
:
/
(?:[^
"
]
|"
(?!
#
))
*/
,
token
:
"
string
"
}
],
comment
:
[
{
regex
:
/.*
?\*\/
/
,
token
:
"
comment
"
,
next
:
"
start
"
},
{
regex
:
/.*/
,
token
:
"
comment
"
}
],
meta
:
{
dontIndentStates
:
[
"
comment
"
],
electricInput
:
/^
\s
*
\}
$/
,
blockCommentStart
:
"
/*
"
,
blockCommentEnd
:
"
*/
"
,
lineComment
:
"
//
"
,
fold
:
"
brace
"
}
});
CodeMirror
.
defineMIME
(
"
text/x-rustsrc
"
,
"
rust
"
);
CodeMirror
.
defineMIME
(
"
text/rust
"
,
"
rust
"
);
});
src/main/webapp/static/plugins/codemirror/5.48.4/mode/rust/test.js
0 → 100644
View file @
53f587bc
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: https://codemirror.net/LICENSE
(
function
()
{
var
mode
=
CodeMirror
.
getMode
({
indentUnit
:
4
},
"
rust
"
);
function
MT
(
name
)
{
test
.
mode
(
name
,
mode
,
Array
.
prototype
.
slice
.
call
(
arguments
,
1
));}
MT
(
'
integer_test
'
,
'
[number 123i32]
'
,
'
[number 123u32]
'
,
'
[number 123_u32]
'
,
'
[number 0xff_u8]
'
,
'
[number 0o70_i16]
'
,
'
[number 0b1111_1111_1001_0000_i32]
'
,
'
[number 0usize]
'
);
MT
(
'
float_test
'
,
'
[number 123.0f64]
'
,
'
[number 0.1f64]
'
,
'
[number 0.1f32]
'
,
'
[number 12E+99_f64]
'
);
MT
(
'
string-literals-test
'
,
'
[string "foo"]
'
,
'
[string r"foo"]
'
,
'
[string "
\\
"foo
\\
""]
'
,
'
[string r#""foo""#]
'
,
'
[string "foo #
\\
"# bar"]
'
,
'
[string b"foo"]
'
,
'
[string br"foo"]
'
,
'
[string b"
\\
"foo
\\
""]
'
,
'
[string br#""foo""#]
'
,
'
[string br##"foo #" bar"##]
'
,
"
[string-2 'h']
"
,
"
[string-2 b'h']
"
);
})();
src/main/webapp/static/plugins/codemirror/5.48.4/mode/sas/index.html
0 → 100644
View file @
53f587bc
<!doctype html>
<title>
CodeMirror: SAS mode
</title>
<meta
charset=
"utf-8"
/>
<link
rel=
stylesheet
href=
"../../doc/docs.css"
>
<link
rel=
"stylesheet"
href=
"../../lib/codemirror.css"
>
<script
src=
"../../lib/codemirror.js"
></script>
<script
src=
"../xml/xml.js"
></script>
<script
src=
"sas.js"
></script>
<style>
.CodeMirror
{
border-top
:
1px
solid
black
;
border-bottom
:
1px
solid
black
;}
.cm-s-default
.cm-trailing-space-a
:before
,
.cm-s-default
.cm-trailing-space-b
:before
{
position
:
absolute
;
content
:
"\00B7"
;
color
:
#777
;}
.cm-s-default
.cm-trailing-space-new-line
:before
{
position
:
absolute
;
content
:
"\21B5"
;
color
:
#777
;}
</style>
<div
id=
nav
>
<a
href=
"https://codemirror.net"
><h1>
CodeMirror
</h1><img
id=
logo
src=
"../../doc/logo.png"
></a>
<ul>
<li><a
href=
"../../index.html"
>
Home
</a>
<li><a
href=
"../../doc/manual.html"
>
Manual
</a>
<li><a
href=
"https://github.com/codemirror/codemirror"
>
Code
</a>
</ul>
<ul>
<li><a
href=
"../index.html"
>
Language modes
</a>
<li><a
class=
active
href=
"#"
>
SAS
</a>
</ul>
</div>
<article>
<h2>
SAS mode
</h2>
<form><textarea
id=
"code"
name=
"code"
>
libname foo "/tmp/foobar";
%let count=1;
/* Multi line
Comment
*/
data _null_;
x=ranuni();
* single comment;
x2=x**2;
sx=sqrt(x);
if x=x2 then put "x must be 1";
else do;
put x=;
end;
run;
/* embedded comment
* comment;
*/
proc glm data=sashelp.class;
class sex;
model weight = height sex;
run;
proc sql;
select count(*)
from sashelp.class;
create table foo as
select * from sashelp.class;
select *
from foo;
quit;
</textarea></form>
<script>
var
editor
=
CodeMirror
.
fromTextArea
(
document
.
getElementById
(
"
code
"
),
{
mode
:
'
sas
'
,
lineNumbers
:
true
});
</script>
<p><strong>
MIME types defined:
</strong>
<code>
text/x-sas
</code>
.
</p>
</article>
src/main/webapp/static/plugins/codemirror/5.48.4/mode/sas/sas.js
0 → 100644
View file @
53f587bc
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: https://codemirror.net/LICENSE
// SAS mode copyright (c) 2016 Jared Dean, SAS Institute
// Created by Jared Dean
// TODO
// indent and de-indent
// identify macro variables
//Definitions
// comment -- text within * ; or /* */
// keyword -- SAS language variable
// variable -- macro variables starts with '&' or variable formats
// variable-2 -- DATA Step, proc, or macro names
// string -- text within ' ' or " "
// operator -- numeric operator + / - * ** le eq ge ... and so on
// builtin -- proc %macro data run mend
// atom
// def
(
function
(
mod
)
{
if
(
typeof
exports
==
"
object
"
&&
typeof
module
==
"
object
"
)
// CommonJS
mod
(
require
(
"
../../lib/codemirror
"
));
else
if
(
typeof
define
==
"
function
"
&&
define
.
amd
)
// AMD
define
([
"
../../lib/codemirror
"
],
mod
);
else
// Plain browser env
mod
(
CodeMirror
);
})(
function
(
CodeMirror
)
{
"
use strict
"
;
CodeMirror
.
defineMode
(
"
sas
"
,
function
()
{
var
words
=
{};
var
isDoubleOperatorSym
=
{
eq
:
'
operator
'
,
lt
:
'
operator
'
,
le
:
'
operator
'
,
gt
:
'
operator
'
,
ge
:
'
operator
'
,
"
in
"
:
'
operator
'
,
ne
:
'
operator
'
,
or
:
'
operator
'
};
var
isDoubleOperatorChar
=
/
(
<=|>=|!=|<>
)
/
;
var
isSingleOperatorChar
=
/
[
=
\(
:
\)
,{}.*<>+
\-\/
^
\[\]]
/
;
// Takes a string of words separated by spaces and adds them as
// keys with the value of the first argument 'style'
function
define
(
style
,
string
,
context
)
{
if
(
context
)
{
var
split
=
string
.
split
(
'
'
);
for
(
var
i
=
0
;
i
<
split
.
length
;
i
++
)
{
words
[
split
[
i
]]
=
{
style
:
style
,
state
:
context
};
}
}
}
//datastep
define
(
'
def
'
,
'
stack pgm view source debug nesting nolist
'
,
[
'
inDataStep
'
]);
define
(
'
def
'
,
'
if while until for do do; end end; then else cancel
'
,
[
'
inDataStep
'
]);
define
(
'
def
'
,
'
label format _n_ _error_
'
,
[
'
inDataStep
'
]);
define
(
'
def
'
,
'
ALTER BUFNO BUFSIZE CNTLLEV COMPRESS DLDMGACTION ENCRYPT ENCRYPTKEY EXTENDOBSCOUNTER GENMAX GENNUM INDEX LABEL OBSBUF OUTREP PW PWREQ READ REPEMPTY REPLACE REUSE ROLE SORTEDBY SPILL TOBSNO TYPE WRITE FILECLOSE FIRSTOBS IN OBS POINTOBS WHERE WHEREUP IDXNAME IDXWHERE DROP KEEP RENAME
'
,
[
'
inDataStep
'
]);
define
(
'
def
'
,
'
filevar finfo finv fipname fipnamel fipstate first firstobs floor
'
,
[
'
inDataStep
'
]);
define
(
'
def
'
,
'
varfmt varinfmt varlabel varlen varname varnum varray varrayx vartype verify vformat vformatd vformatdx vformatn vformatnx vformatw vformatwx vformatx vinarray vinarrayx vinformat vinformatd vinformatdx vinformatn vinformatnx vinformatw vinformatwx vinformatx vlabel vlabelx vlength vlengthx vname vnamex vnferr vtype vtypex weekday
'
,
[
'
inDataStep
'
]);
define
(
'
def
'
,
'
zipfips zipname zipnamel zipstate
'
,
[
'
inDataStep
'
]);
define
(
'
def
'
,
'
put putc putn
'
,
[
'
inDataStep
'
]);
define
(
'
builtin
'
,
'
data run
'
,
[
'
inDataStep
'
]);
//proc
define
(
'
def
'
,
'
data
'
,
[
'
inProc
'
]);
// flow control for macros
define
(
'
def
'
,
'
%if %end %end; %else %else; %do %do; %then
'
,
[
'
inMacro
'
]);
//everywhere
define
(
'
builtin
'
,
'
proc run; quit; libname filename %macro %mend option options
'
,
[
'
ALL
'
]);
define
(
'
def
'
,
'
footnote title libname ods
'
,
[
'
ALL
'
]);
define
(
'
def
'
,
'
%let %put %global %sysfunc %eval
'
,
[
'
ALL
'
]);
// automatic macro variables http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/viewer.htm#a003167023.htm
define
(
'
variable
'
,
'
&sysbuffr &syscc &syscharwidth &syscmd &sysdate &sysdate9 &sysday &sysdevic &sysdmg &sysdsn &sysencoding &sysenv &syserr &syserrortext &sysfilrc &syshostname &sysindex &sysinfo &sysjobid &syslast &syslckrc &syslibrc &syslogapplname &sysmacroname &sysmenv &sysmsg &sysncpu &sysodspath &sysparm &syspbuff &sysprocessid &sysprocessname &sysprocname &sysrc &sysscp &sysscpl &sysscpl &syssite &sysstartid &sysstartname &systcpiphostname &systime &sysuserid &sysver &sysvlong &sysvlong4 &syswarningtext
'
,
[
'
ALL
'
]);
//footnote[1-9]? title[1-9]?
//options statement
define
(
'
def
'
,
'
source2 nosource2 page pageno pagesize
'
,
[
'
ALL
'
]);
//proc and datastep
define
(
'
def
'
,
'
_all_ _character_ _cmd_ _freq_ _i_ _infile_ _last_ _msg_ _null_ _numeric_ _temporary_ _type_ abort abs addr adjrsq airy alpha alter altlog altprint and arcos array arsin as atan attrc attrib attrn authserver autoexec awscontrol awsdef awsmenu awsmenumerge awstitle backward band base betainv between blocksize blshift bnot bor brshift bufno bufsize bxor by byerr byline byte calculated call cards cards4 catcache cbufno cdf ceil center cexist change chisq cinv class cleanup close cnonct cntllev coalesce codegen col collate collin column comamid comaux1 comaux2 comdef compbl compound compress config continue convert cos cosh cpuid create cross crosstab css curobs cv daccdb daccdbsl daccsl daccsyd dacctab dairy datalines datalines4 datejul datepart datetime day dbcslang dbcstype dclose ddm delete delimiter depdb depdbsl depsl depsyd deptab dequote descending descript design= device dflang dhms dif digamma dim dinfo display distinct dkricond dkrocond dlm dnum do dopen doptname doptnum dread drop dropnote dsname dsnferr echo else emaildlg emailid emailpw emailserver emailsys encrypt end endsas engine eof eov erf erfc error errorcheck errors exist exp fappend fclose fcol fdelete feedback fetch fetchobs fexist fget file fileclose fileexist filefmt filename fileref fmterr fmtsearch fnonct fnote font fontalias fopen foptname foptnum force formatted formchar formdelim formdlim forward fpoint fpos fput fread frewind frlen from fsep fuzz fwrite gaminv gamma getoption getvarc getvarn go goto group gwindow hbar hbound helpenv helploc hms honorappearance hosthelp hostprint hour hpct html hvar ibessel ibr id if index indexc indexw initcmd initstmt inner input inputc inputn inr insert int intck intnx into intrr invaliddata irr is jbessel join juldate keep kentb kurtosis label lag last lbound leave left length levels lgamma lib library libref line linesize link list log log10 log2 logpdf logpmf logsdf lostcard lowcase lrecl ls macro macrogen maps mautosource max maxdec maxr mdy mean measures median memtype merge merror min minute missing missover mlogic mod mode model modify month mopen mort mprint mrecall msglevel msymtabmax mvarsize myy n nest netpv new news nmiss no nobatch nobs nocaps nocardimage nocenter nocharcode nocmdmac nocol nocum nodate nodbcs nodetails nodmr nodms nodmsbatch nodup nodupkey noduplicates noechoauto noequals noerrorabend noexitwindows nofullstimer noicon noimplmac noint nolist noloadlist nomiss nomlogic nomprint nomrecall nomsgcase nomstored nomultenvappl nonotes nonumber noobs noovp nopad nopercent noprint noprintinit normal norow norsasuser nosetinit nosplash nosymbolgen note notes notitle notitles notsorted noverbose noxsync noxwait npv null number numkeys nummousekeys nway obs on open order ordinal otherwise out outer outp= output over ovp p(1 5 10 25 50 75 90 95 99) pad pad2 paired parm parmcards path pathdll pathname pdf peek peekc pfkey pmf point poisson poke position printer probbeta probbnml probchi probf probgam probhypr probit probnegb probnorm probsig probt procleave prt ps pw pwreq qtr quote r ranbin rancau ranexp rangam range ranks rannor ranpoi rantbl rantri ranuni read recfm register regr remote remove rename repeat replace resolve retain return reuse reverse rewind right round rsquare rtf rtrace rtraceloc s s2 samploc sasautos sascontrol sasfrscr sasmsg sasmstore sasscript sasuser saving scan sdf second select selection separated seq serror set setcomm setot sign simple sin sinh siteinfo skewness skip sle sls sortedby sortpgm sortseq sortsize soundex spedis splashlocation split spool sqrt start std stderr stdin stfips stimer stname stnamel stop stopover subgroup subpopn substr sum sumwgt symbol symbolgen symget symput sysget sysin sysleave sysmsg sysparm sysprint sysprintfont sysprod sysrc system t table tables tan tanh tapeclose tbufsize terminal test then timepart tinv tnonct to today tol tooldef totper transformout translate trantab tranwrd trigamma trim trimn trunc truncover type unformatted uniform union until upcase update user usericon uss validate value var weight when where while wincharset window work workinit workterm write wsum xsync xwait yearcutoff yes yyq min max
'
,
[
'
inDataStep
'
,
'
inProc
'
]);
define
(
'
operator
'
,
'
and not
'
,
[
'
inDataStep
'
,
'
inProc
'
]);
// Main function
function
tokenize
(
stream
,
state
)
{
// Finally advance the stream
var
ch
=
stream
.
next
();
// BLOCKCOMMENT
if
(
ch
===
'
/
'
&&
stream
.
eat
(
'
*
'
))
{
state
.
continueComment
=
true
;
return
"
comment
"
;
}
else
if
(
state
.
continueComment
===
true
)
{
// in comment block
//comment ends at the beginning of the line
if
(
ch
===
'
*
'
&&
stream
.
peek
()
===
'
/
'
)
{
stream
.
next
();
state
.
continueComment
=
false
;
}
else
if
(
stream
.
skipTo
(
'
*
'
))
{
//comment is potentially later in line
stream
.
skipTo
(
'
*
'
);
stream
.
next
();
if
(
stream
.
eat
(
'
/
'
))
state
.
continueComment
=
false
;
}
else
{
stream
.
skipToEnd
();
}
return
"
comment
"
;
}
if
(
ch
==
"
*
"
&&
stream
.
column
()
==
stream
.
indentation
())
{
stream
.
skipToEnd
()
return
"
comment
"
}
// DoubleOperator match
var
doubleOperator
=
ch
+
stream
.
peek
();
if
((
ch
===
'
"
'
||
ch
===
"
'
"
)
&&
!
state
.
continueString
)
{
state
.
continueString
=
ch
return
"
string
"
}
else
if
(
state
.
continueString
)
{
if
(
state
.
continueString
==
ch
)
{
state
.
continueString
=
null
;
}
else
if
(
stream
.
skipTo
(
state
.
continueString
))
{
// quote found on this line
stream
.
next
();
state
.
continueString
=
null
;
}
else
{
stream
.
skipToEnd
();
}
return
"
string
"
;
}
else
if
(
state
.
continueString
!==
null
&&
stream
.
eol
())
{
stream
.
skipTo
(
state
.
continueString
)
||
stream
.
skipToEnd
();
return
"
string
"
;
}
else
if
(
/
[\d\.]
/
.
test
(
ch
))
{
//find numbers
if
(
ch
===
"
.
"
)
stream
.
match
(
/^
[
0-9
]
+
([
eE
][\-
+
]?[
0-9
]
+
)?
/
);
else
if
(
ch
===
"
0
"
)
stream
.
match
(
/^
[
xX
][
0-9a-fA-F
]
+/
)
||
stream
.
match
(
/^0
[
0-7
]
+/
);
else
stream
.
match
(
/^
[
0-9
]
*
\.?[
0-9
]
*
([
eE
][\-
+
]?[
0-9
]
+
)?
/
);
return
"
number
"
;
}
else
if
(
isDoubleOperatorChar
.
test
(
ch
+
stream
.
peek
()))
{
// TWO SYMBOL TOKENS
stream
.
next
();
return
"
operator
"
;
}
else
if
(
isDoubleOperatorSym
.
hasOwnProperty
(
doubleOperator
))
{
stream
.
next
();
if
(
stream
.
peek
()
===
'
'
)
return
isDoubleOperatorSym
[
doubleOperator
.
toLowerCase
()];
}
else
if
(
isSingleOperatorChar
.
test
(
ch
))
{
// SINGLE SYMBOL TOKENS
return
"
operator
"
;
}
// Matches one whole word -- even if the word is a character
var
word
;
if
(
stream
.
match
(
/
[
%&;
\w]
+/
,
false
)
!=
null
)
{
word
=
ch
+
stream
.
match
(
/
[
%&;
\w]
+/
,
true
);
if
(
/&/
.
test
(
word
))
return
'
variable
'
}
else
{
word
=
ch
;
}
// the word after DATA PROC or MACRO
if
(
state
.
nextword
)
{
stream
.
match
(
/
[\w]
+/
);
// match memname.libname
if
(
stream
.
peek
()
===
'
.
'
)
stream
.
skipTo
(
'
'
);
state
.
nextword
=
false
;
return
'
variable-2
'
;
}
word
=
word
.
toLowerCase
()
// Are we in a DATA Step?
if
(
state
.
inDataStep
)
{
if
(
word
===
'
run;
'
||
stream
.
match
(
/run
\s
;/
))
{
state
.
inDataStep
=
false
;
return
'
builtin
'
;
}
// variable formats
if
((
word
)
&&
stream
.
next
()
===
'
.
'
)
{
//either a format or libname.memname
if
(
/
\w
/
.
test
(
stream
.
peek
()))
return
'
variable-2
'
;
else
return
'
variable
'
;
}
// do we have a DATA Step keyword
if
(
word
&&
words
.
hasOwnProperty
(
word
)
&&
(
words
[
word
].
state
.
indexOf
(
"
inDataStep
"
)
!==
-
1
||
words
[
word
].
state
.
indexOf
(
"
ALL
"
)
!==
-
1
))
{
//backup to the start of the word
if
(
stream
.
start
<
stream
.
pos
)
stream
.
backUp
(
stream
.
pos
-
stream
.
start
);
//advance the length of the word and return
for
(
var
i
=
0
;
i
<
word
.
length
;
++
i
)
stream
.
next
();
return
words
[
word
].
style
;
}
}
// Are we in an Proc statement?
if
(
state
.
inProc
)
{
if
(
word
===
'
run;
'
||
word
===
'
quit;
'
)
{
state
.
inProc
=
false
;
return
'
builtin
'
;
}
// do we have a proc keyword
if
(
word
&&
words
.
hasOwnProperty
(
word
)
&&
(
words
[
word
].
state
.
indexOf
(
"
inProc
"
)
!==
-
1
||
words
[
word
].
state
.
indexOf
(
"
ALL
"
)
!==
-
1
))
{
stream
.
match
(
/
[\w]
+/
);
return
words
[
word
].
style
;
}
}
// Are we in a Macro statement?
if
(
state
.
inMacro
)
{
if
(
word
===
'
%mend
'
)
{
if
(
stream
.
peek
()
===
'
;
'
)
stream
.
next
();
state
.
inMacro
=
false
;
return
'
builtin
'
;
}
if
(
word
&&
words
.
hasOwnProperty
(
word
)
&&
(
words
[
word
].
state
.
indexOf
(
"
inMacro
"
)
!==
-
1
||
words
[
word
].
state
.
indexOf
(
"
ALL
"
)
!==
-
1
))
{
stream
.
match
(
/
[\w]
+/
);
return
words
[
word
].
style
;
}
return
'
atom
'
;
}
// Do we have Keywords specific words?
if
(
word
&&
words
.
hasOwnProperty
(
word
))
{
// Negates the initial next()
stream
.
backUp
(
1
);
// Actually move the stream
stream
.
match
(
/
[\w]
+/
);
if
(
word
===
'
data
'
&&
/=/
.
test
(
stream
.
peek
())
===
false
)
{
state
.
inDataStep
=
true
;
state
.
nextword
=
true
;
return
'
builtin
'
;
}
if
(
word
===
'
proc
'
)
{
state
.
inProc
=
true
;
state
.
nextword
=
true
;
return
'
builtin
'
;
}
if
(
word
===
'
%macro
'
)
{
state
.
inMacro
=
true
;
state
.
nextword
=
true
;
return
'
builtin
'
;
}
if
(
/title
[
1-9
]
/
.
test
(
word
))
return
'
def
'
;
if
(
word
===
'
footnote
'
)
{
stream
.
eat
(
/
[
1-9
]
/
);
return
'
def
'
;
}
// Returns their value as state in the prior define methods
if
(
state
.
inDataStep
===
true
&&
words
[
word
].
state
.
indexOf
(
"
inDataStep
"
)
!==
-
1
)
return
words
[
word
].
style
;
if
(
state
.
inProc
===
true
&&
words
[
word
].
state
.
indexOf
(
"
inProc
"
)
!==
-
1
)
return
words
[
word
].
style
;
if
(
state
.
inMacro
===
true
&&
words
[
word
].
state
.
indexOf
(
"
inMacro
"
)
!==
-
1
)
return
words
[
word
].
style
;
if
(
words
[
word
].
state
.
indexOf
(
"
ALL
"
)
!==
-
1
)
return
words
[
word
].
style
;
return
null
;
}
// Unrecognized syntax
return
null
;
}
return
{
startState
:
function
()
{
return
{
inDataStep
:
false
,
inProc
:
false
,
inMacro
:
false
,
nextword
:
false
,
continueString
:
null
,
continueComment
:
false
};
},
token
:
function
(
stream
,
state
)
{
// Strip the spaces, but regex will account for them either way
if
(
stream
.
eatSpace
())
return
null
;
// Go through the main process
return
tokenize
(
stream
,
state
);
},
blockCommentStart
:
"
/*
"
,
blockCommentEnd
:
"
*/
"
};
});
CodeMirror
.
defineMIME
(
"
text/x-sas
"
,
"
sas
"
);
});
src/main/webapp/static/plugins/codemirror/5.48.4/mode/sass/index.html
0 → 100644
View file @
53f587bc
<!doctype html>
<title>
CodeMirror: Sass mode
</title>
<meta
charset=
"utf-8"
/>
<link
rel=
stylesheet
href=
"../../doc/docs.css"
>
<link
rel=
"stylesheet"
href=
"../../lib/codemirror.css"
>
<script
src=
"../../lib/codemirror.js"
></script>
<script
src=
"../../addon/edit/matchbrackets.js"
></script>
<script
src=
"../css/css.js"
></script>
<script
src=
"sass.js"
></script>
<style>
.CodeMirror
{
border
:
1px
solid
#ddd
;
font-size
:
12px
;
height
:
400px
}
</style>
<div
id=
nav
>
<a
href=
"https://codemirror.net"
><h1>
CodeMirror
</h1><img
id=
logo
src=
"../../doc/logo.png"
></a>
<ul>
<li><a
href=
"../../index.html"
>
Home
</a>
<li><a
href=
"../../doc/manual.html"
>
Manual
</a>
<li><a
href=
"https://github.com/codemirror/codemirror"
>
Code
</a>
</ul>
<ul>
<li><a
href=
"../index.html"
>
Language modes
</a>
<li><a
class=
active
href=
"#"
>
Sass
</a>
</ul>
</div>
<article>
<h2>
Sass mode
</h2>
<form><textarea
id=
"code"
name=
"code"
>
// Variable Definitions
$page-width: 800px
$sidebar-width: 200px
$primary-color: #eeeeee
// Global Attributes
body
font:
family: sans-serif
size: 30em
weight: bold
// Scoped Styles
#contents
width: $page-width
#sidebar
float: right
width: $sidebar-width
#main
width: $page-width - $sidebar-width
background: $primary-color
h2
color: blue
#footer
height: 200px
</textarea></form>
<script>
var
editor
=
CodeMirror
.
fromTextArea
(
document
.
getElementById
(
"
code
"
),
{
lineNumbers
:
true
,
matchBrackets
:
true
,
mode
:
"
sass
"
});
</script>
<p><strong>
MIME types defined:
</strong>
<code>
text/x-sass
</code>
.
</p>
</article>
src/main/webapp/static/plugins/codemirror/5.48.4/mode/sass/sass.js
0 → 100644
View file @
53f587bc
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: https://codemirror.net/LICENSE
(
function
(
mod
)
{
if
(
typeof
exports
==
"
object
"
&&
typeof
module
==
"
object
"
)
// CommonJS
mod
(
require
(
"
../../lib/codemirror
"
),
require
(
"
../css/css
"
));
else
if
(
typeof
define
==
"
function
"
&&
define
.
amd
)
// AMD
define
([
"
../../lib/codemirror
"
,
"
../css/css
"
],
mod
);
else
// Plain browser env
mod
(
CodeMirror
);
})(
function
(
CodeMirror
)
{
"
use strict
"
;
CodeMirror
.
defineMode
(
"
sass
"
,
function
(
config
)
{
var
cssMode
=
CodeMirror
.
mimeModes
[
"
text/css
"
];
var
propertyKeywords
=
cssMode
.
propertyKeywords
||
{},
colorKeywords
=
cssMode
.
colorKeywords
||
{},
valueKeywords
=
cssMode
.
valueKeywords
||
{},
fontProperties
=
cssMode
.
fontProperties
||
{};
function
tokenRegexp
(
words
)
{
return
new
RegExp
(
"
^
"
+
words
.
join
(
"
|
"
));
}
var
keywords
=
[
"
true
"
,
"
false
"
,
"
null
"
,
"
auto
"
];
var
keywordsRegexp
=
new
RegExp
(
"
^
"
+
keywords
.
join
(
"
|
"
));
var
operators
=
[
"
\\
(
"
,
"
\\
)
"
,
"
=
"
,
"
>
"
,
"
<
"
,
"
==
"
,
"
>=
"
,
"
<=
"
,
"
\\
+
"
,
"
-
"
,
"
\\
!=
"
,
"
/
"
,
"
\\
*
"
,
"
%
"
,
"
and
"
,
"
or
"
,
"
not
"
,
"
;
"
,
"
\\
{
"
,
"
\\
}
"
,
"
:
"
];
var
opRegexp
=
tokenRegexp
(
operators
);
var
pseudoElementsRegexp
=
/^::
?[
a-zA-Z_
][\w\-]
*/
;
var
word
;
function
isEndLine
(
stream
)
{
return
!
stream
.
peek
()
||
stream
.
match
(
/
\s
+$/
,
false
);
}
function
urlTokens
(
stream
,
state
)
{
var
ch
=
stream
.
peek
();
if
(
ch
===
"
)
"
)
{
stream
.
next
();
state
.
tokenizer
=
tokenBase
;
return
"
operator
"
;
}
else
if
(
ch
===
"
(
"
)
{
stream
.
next
();
stream
.
eatSpace
();
return
"
operator
"
;
}
else
if
(
ch
===
"
'
"
||
ch
===
'
"
'
)
{
state
.
tokenizer
=
buildStringTokenizer
(
stream
.
next
());
return
"
string
"
;
}
else
{
state
.
tokenizer
=
buildStringTokenizer
(
"
)
"
,
false
);
return
"
string
"
;
}
}
function
comment
(
indentation
,
multiLine
)
{
return
function
(
stream
,
state
)
{
if
(
stream
.
sol
()
&&
stream
.
indentation
()
<=
indentation
)
{
state
.
tokenizer
=
tokenBase
;
return
tokenBase
(
stream
,
state
);
}
if
(
multiLine
&&
stream
.
skipTo
(
"
*/
"
))
{
stream
.
next
();
stream
.
next
();
state
.
tokenizer
=
tokenBase
;
}
else
{
stream
.
skipToEnd
();
}
return
"
comment
"
;
};
}
function
buildStringTokenizer
(
quote
,
greedy
)
{
if
(
greedy
==
null
)
{
greedy
=
true
;
}
function
stringTokenizer
(
stream
,
state
)
{
var
nextChar
=
stream
.
next
();
var
peekChar
=
stream
.
peek
();
var
previousChar
=
stream
.
string
.
charAt
(
stream
.
pos
-
2
);
var
endingString
=
((
nextChar
!==
"
\\
"
&&
peekChar
===
quote
)
||
(
nextChar
===
quote
&&
previousChar
!==
"
\\
"
));
if
(
endingString
)
{
if
(
nextChar
!==
quote
&&
greedy
)
{
stream
.
next
();
}
if
(
isEndLine
(
stream
))
{
state
.
cursorHalf
=
0
;
}
state
.
tokenizer
=
tokenBase
;
return
"
string
"
;
}
else
if
(
nextChar
===
"
#
"
&&
peekChar
===
"
{
"
)
{
state
.
tokenizer
=
buildInterpolationTokenizer
(
stringTokenizer
);
stream
.
next
();
return
"
operator
"
;
}
else
{
return
"
string
"
;
}
}
return
stringTokenizer
;
}
function
buildInterpolationTokenizer
(
currentTokenizer
)
{
return
function
(
stream
,
state
)
{
if
(
stream
.
peek
()
===
"
}
"
)
{
stream
.
next
();
state
.
tokenizer
=
currentTokenizer
;
return
"
operator
"
;
}
else
{
return
tokenBase
(
stream
,
state
);
}
};
}
function
indent
(
state
)
{
if
(
state
.
indentCount
==
0
)
{
state
.
indentCount
++
;
var
lastScopeOffset
=
state
.
scopes
[
0
].
offset
;
var
currentOffset
=
lastScopeOffset
+
config
.
indentUnit
;
state
.
scopes
.
unshift
({
offset
:
currentOffset
});
}
}
function
dedent
(
state
)
{
if
(
state
.
scopes
.
length
==
1
)
return
;
state
.
scopes
.
shift
();
}
function
tokenBase
(
stream
,
state
)
{
var
ch
=
stream
.
peek
();
// Comment
if
(
stream
.
match
(
"
/*
"
))
{
state
.
tokenizer
=
comment
(
stream
.
indentation
(),
true
);
return
state
.
tokenizer
(
stream
,
state
);
}
if
(
stream
.
match
(
"
//
"
))
{
state
.
tokenizer
=
comment
(
stream
.
indentation
(),
false
);
return
state
.
tokenizer
(
stream
,
state
);
}
// Interpolation
if
(
stream
.
match
(
"
#{
"
))
{
state
.
tokenizer
=
buildInterpolationTokenizer
(
tokenBase
);
return
"
operator
"
;
}
// Strings
if
(
ch
===
'
"
'
||
ch
===
"
'
"
)
{
stream
.
next
();
state
.
tokenizer
=
buildStringTokenizer
(
ch
);
return
"
string
"
;
}
if
(
!
state
.
cursorHalf
){
// state.cursorHalf === 0
// first half i.e. before : for key-value pairs
// including selectors
if
(
ch
===
"
-
"
)
{
if
(
stream
.
match
(
/^-
\w
+-/
))
{
return
"
meta
"
;
}
}
if
(
ch
===
"
.
"
)
{
stream
.
next
();
if
(
stream
.
match
(
/^
[\w
-
]
+/
))
{
indent
(
state
);
return
"
qualifier
"
;
}
else
if
(
stream
.
peek
()
===
"
#
"
)
{
indent
(
state
);
return
"
tag
"
;
}
}
if
(
ch
===
"
#
"
)
{
stream
.
next
();
// ID selectors
if
(
stream
.
match
(
/^
[\w
-
]
+/
))
{
indent
(
state
);
return
"
builtin
"
;
}
if
(
stream
.
peek
()
===
"
#
"
)
{
indent
(
state
);
return
"
tag
"
;
}
}
// Variables
if
(
ch
===
"
$
"
)
{
stream
.
next
();
stream
.
eatWhile
(
/
[\w
-
]
/
);
return
"
variable-2
"
;
}
// Numbers
if
(
stream
.
match
(
/^-
?[
0-9
\.]
+/
))
return
"
number
"
;
// Units
if
(
stream
.
match
(
/^
(
px|em|in
)\b
/
))
return
"
unit
"
;
if
(
stream
.
match
(
keywordsRegexp
))
return
"
keyword
"
;
if
(
stream
.
match
(
/^url/
)
&&
stream
.
peek
()
===
"
(
"
)
{
state
.
tokenizer
=
urlTokens
;
return
"
atom
"
;
}
if
(
ch
===
"
=
"
)
{
// Match shortcut mixin definition
if
(
stream
.
match
(
/^=
[\w
-
]
+/
))
{
indent
(
state
);
return
"
meta
"
;
}
}
if
(
ch
===
"
+
"
)
{
// Match shortcut mixin definition
if
(
stream
.
match
(
/^
\+[\w
-
]
+/
)){
return
"
variable-3
"
;
}
}
if
(
ch
===
"
@
"
){
if
(
stream
.
match
(
/@extend/
)){
if
(
!
stream
.
match
(
/
\s
*
[\w]
/
))
dedent
(
state
);
}
}
// Indent Directives
if
(
stream
.
match
(
/^@
(
else if|if|media|else|for|each|while|mixin|function
)
/
))
{
indent
(
state
);
return
"
def
"
;
}
// Other Directives
if
(
ch
===
"
@
"
)
{
stream
.
next
();
stream
.
eatWhile
(
/
[\w
-
]
/
);
return
"
def
"
;
}
if
(
stream
.
eatWhile
(
/
[\w
-
]
/
)){
if
(
stream
.
match
(
/ *: *
[\w
-
\+\$
#!
\(
"'
]
/
,
false
)){
word
=
stream
.
current
().
toLowerCase
();
var
prop
=
state
.
prevProp
+
"
-
"
+
word
;
if
(
propertyKeywords
.
hasOwnProperty
(
prop
))
{
return
"
property
"
;
}
else
if
(
propertyKeywords
.
hasOwnProperty
(
word
))
{
state
.
prevProp
=
word
;
return
"
property
"
;
}
else
if
(
fontProperties
.
hasOwnProperty
(
word
))
{
return
"
property
"
;
}
return
"
tag
"
;
}
else
if
(
stream
.
match
(
/ *:/
,
false
)){
indent
(
state
);
state
.
cursorHalf
=
1
;
state
.
prevProp
=
stream
.
current
().
toLowerCase
();
return
"
property
"
;
}
else
if
(
stream
.
match
(
/ *,/
,
false
)){
return
"
tag
"
;
}
else
{
indent
(
state
);
return
"
tag
"
;
}
}
if
(
ch
===
"
:
"
){
if
(
stream
.
match
(
pseudoElementsRegexp
)){
// could be a pseudo-element
return
"
variable-3
"
;
}
stream
.
next
();
state
.
cursorHalf
=
1
;
return
"
operator
"
;
}
}
// cursorHalf===0 ends here
else
{
if
(
ch
===
"
#
"
)
{
stream
.
next
();
// Hex numbers
if
(
stream
.
match
(
/
[
0-9a-fA-F
]{6}
|
[
0-9a-fA-F
]{3}
/
)){
if
(
isEndLine
(
stream
))
{
state
.
cursorHalf
=
0
;
}
return
"
number
"
;
}
}
// Numbers
if
(
stream
.
match
(
/^-
?[
0-9
\.]
+/
)){
if
(
isEndLine
(
stream
))
{
state
.
cursorHalf
=
0
;
}
return
"
number
"
;
}
// Units
if
(
stream
.
match
(
/^
(
px|em|in
)\b
/
)){
if
(
isEndLine
(
stream
))
{
state
.
cursorHalf
=
0
;
}
return
"
unit
"
;
}
if
(
stream
.
match
(
keywordsRegexp
)){
if
(
isEndLine
(
stream
))
{
state
.
cursorHalf
=
0
;
}
return
"
keyword
"
;
}
if
(
stream
.
match
(
/^url/
)
&&
stream
.
peek
()
===
"
(
"
)
{
state
.
tokenizer
=
urlTokens
;
if
(
isEndLine
(
stream
))
{
state
.
cursorHalf
=
0
;
}
return
"
atom
"
;
}
// Variables
if
(
ch
===
"
$
"
)
{
stream
.
next
();
stream
.
eatWhile
(
/
[\w
-
]
/
);
if
(
isEndLine
(
stream
))
{
state
.
cursorHalf
=
0
;
}
return
"
variable-2
"
;
}
// bang character for !important, !default, etc.
if
(
ch
===
"
!
"
)
{
stream
.
next
();
state
.
cursorHalf
=
0
;
return
stream
.
match
(
/^
[\w]
+/
)
?
"
keyword
"
:
"
operator
"
;
}
if
(
stream
.
match
(
opRegexp
)){
if
(
isEndLine
(
stream
))
{
state
.
cursorHalf
=
0
;
}
return
"
operator
"
;
}
// attributes
if
(
stream
.
eatWhile
(
/
[\w
-
]
/
))
{
if
(
isEndLine
(
stream
))
{
state
.
cursorHalf
=
0
;
}
word
=
stream
.
current
().
toLowerCase
();
if
(
valueKeywords
.
hasOwnProperty
(
word
))
{
return
"
atom
"
;
}
else
if
(
colorKeywords
.
hasOwnProperty
(
word
))
{
return
"
keyword
"
;
}
else
if
(
propertyKeywords
.
hasOwnProperty
(
word
))
{
state
.
prevProp
=
stream
.
current
().
toLowerCase
();
return
"
property
"
;
}
else
{
return
"
tag
"
;
}
}
//stream.eatSpace();
if
(
isEndLine
(
stream
))
{
state
.
cursorHalf
=
0
;
return
null
;
}
}
// else ends here
if
(
stream
.
match
(
opRegexp
))
return
"
operator
"
;
// If we haven't returned by now, we move 1 character
// and return an error
stream
.
next
();
return
null
;
}
function
tokenLexer
(
stream
,
state
)
{
if
(
stream
.
sol
())
state
.
indentCount
=
0
;
var
style
=
state
.
tokenizer
(
stream
,
state
);
var
current
=
stream
.
current
();
if
(
current
===
"
@return
"
||
current
===
"
}
"
){
dedent
(
state
);
}
if
(
style
!==
null
)
{
var
startOfToken
=
stream
.
pos
-
current
.
length
;
var
withCurrentIndent
=
startOfToken
+
(
config
.
indentUnit
*
state
.
indentCount
);
var
newScopes
=
[];
for
(
var
i
=
0
;
i
<
state
.
scopes
.
length
;
i
++
)
{
var
scope
=
state
.
scopes
[
i
];
if
(
scope
.
offset
<=
withCurrentIndent
)
newScopes
.
push
(
scope
);
}
state
.
scopes
=
newScopes
;
}
return
style
;
}
return
{
startState
:
function
()
{
return
{
tokenizer
:
tokenBase
,
scopes
:
[{
offset
:
0
,
type
:
"
sass
"
}],
indentCount
:
0
,
cursorHalf
:
0
,
// cursor half tells us if cursor lies after (1)
// or before (0) colon (well... more or less)
definedVars
:
[],
definedMixins
:
[]
};
},
token
:
function
(
stream
,
state
)
{
var
style
=
tokenLexer
(
stream
,
state
);
state
.
lastToken
=
{
style
:
style
,
content
:
stream
.
current
()
};
return
style
;
},
indent
:
function
(
state
)
{
return
state
.
scopes
[
0
].
offset
;
}
};
},
"
css
"
);
CodeMirror
.
defineMIME
(
"
text/x-sass
"
,
"
sass
"
);
});
src/main/webapp/static/plugins/codemirror/5.48.4/mode/sass/test.js
0 → 100644
View file @
53f587bc
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: https://codemirror.net/LICENSE
(
function
()
{
var
mode
=
CodeMirror
.
getMode
({
indentUnit
:
2
},
"
sass
"
);
// Since Sass has an indent-based syntax, is almost impossible to test correctly the indentation in all cases.
// So disable it for tests.
mode
.
indent
=
undefined
;
function
MT
(
name
)
{
test
.
mode
(
name
,
mode
,
Array
.
prototype
.
slice
.
call
(
arguments
,
1
));
}
MT
(
"
comment
"
,
"
[comment // this is a comment]
"
,
"
[comment also this is a comment]
"
)
MT
(
"
comment_multiline
"
,
"
[comment /* this is a comment]
"
,
"
[comment also this is a comment]
"
)
MT
(
"
variable
"
,
"
[variable-2 $page-width][operator :] [number 800][unit px]
"
)
MT
(
"
global_attributes
"
,
"
[tag body]
"
,
"
[property font][operator :]
"
,
"
[property family][operator :] [atom sans-serif]
"
,
"
[property size][operator :] [number 30][unit em]
"
,
"
[property weight][operator :] [atom bold]
"
)
MT
(
"
scoped_styles
"
,
"
[builtin #contents]
"
,
"
[property width][operator :] [variable-2 $page-width]
"
,
"
[builtin #sidebar]
"
,
"
[property float][operator :] [atom right]
"
,
"
[property width][operator :] [variable-2 $sidebar-width]
"
,
"
[builtin #main]
"
,
"
[property width][operator :] [variable-2 $page-width] [operator -] [variable-2 $sidebar-width]
"
,
"
[property background][operator :] [variable-2 $primary-color]
"
,
"
[tag h2]
"
,
"
[property color][operator :] [keyword blue]
"
)
// Sass allows to write the colon as first char instead of a "separator".
// :color red
// Not supported
// MT("property_syntax",
// "[qualifier .foo]",
// " [operator :][property color] [keyword red]")
MT
(
"
import
"
,
"
[def @import] [string
\"
sass/variables
\"
]
"
,
// Probably it should parsed as above: as a string even without the " or '
// "[def @import] [string sass/baz]"
"
[def @import] [tag sass][operator /][tag baz]
"
)
MT
(
"
def
"
,
"
[def @if] [variable-2 $foo] [def @else]
"
)
MT
(
"
tag_on_more_lines
"
,
"
[tag td],
"
,
"
[tag th]
"
,
"
[property font-family][operator :] [string
\"
Arial
\"
], [atom serif]
"
)
MT
(
"
important
"
,
"
[qualifier .foo]
"
,
"
[property text-decoration][operator :] [atom none] [keyword !important]
"
,
"
[tag h1]
"
,
"
[property font-size][operator :] [number 2.5][unit em]
"
)
MT
(
"
selector
"
,
// SCSS doesn't highlight the :
// "[tag h1]:[variable-3 before],",
// "[tag h2]:[variable-3 before]",
"
[tag h1][variable-3 :before],
"
,
"
[tag h2][variable-3 :before]
"
,
"
[property content][operator :] [string
\"
::
\"
]
"
)
MT
(
"
definition_mixin_equal
"
,
"
[variable-2 $defined-bs-type][operator :] [atom border-box] [keyword !default]
"
,
"
[meta =bs][operator (][variable-2 $bs-type][operator :] [variable-2 $defined-bs-type][operator )]
"
,
"
[meta -webkit-][property box-sizing][operator :] [variable-2 $bs-type]
"
,
"
[property box-sizing][operator :] [variable-2 $bs-type]
"
)
MT
(
"
definition_mixin_with_space
"
,
"
[variable-2 $defined-bs-type][operator :] [atom border-box] [keyword !default]
"
,
"
[def @mixin] [tag bs][operator (][variable-2 $bs-type][operator :] [variable-2 $defined-bs-type][operator )]
"
,
"
[meta -moz-][property box-sizing][operator :] [variable-2 $bs-type]
"
,
"
[property box-sizing][operator :] [variable-2 $bs-type]
"
)
MT
(
"
numbers_start_dot_include_plus
"
,
// The % is not highlighted correctly
// "[meta =button-links][operator (][variable-2 $button-base][operator :] [atom darken][operator (][variable-2 $color11], [number 10][unit %][operator )][operator )]",
"
[meta =button-links][operator (][variable-2 $button-base][operator :] [atom darken][operator (][variable-2 $color11], [number 10][operator %))]
"
,
"
[property padding][operator :] [number .3][unit em] [number .6][unit em]
"
,
"
[variable-3 +border-radius][operator (][number 8][unit px][operator )]
"
,
"
[property background-color][operator :] [variable-2 $button-base]
"
)
MT
(
"
include
"
,
"
[qualifier .bar]
"
,
"
[def @include] [tag border-radius][operator (][number 8][unit px][operator )]
"
)
MT
(
"
reference_parent
"
,
"
[qualifier .col]
"
,
"
[property clear][operator :] [atom both]
"
,
// SCSS doesn't highlight the :
// " &:[variable-3 after]",
"
&[variable-3 :after]
"
,
"
[property content][operator :] [string '']
"
,
"
[property clear][operator :] [atom both]
"
)
MT
(
"
reference_parent_with_spaces
"
,
"
[tag section]
"
,
"
[property border-left][operator :] [number 20][unit px] [atom transparent] [atom solid]
"
,
"
&[qualifier .section3]
"
,
"
[qualifier .title]
"
,
"
[property color][operator :] [keyword white]
"
,
"
[qualifier .vermas]
"
,
"
[property display][operator :] [atom none]
"
)
MT
(
"
font_face
"
,
"
[def @font-face]
"
,
"
[property font-family][operator :] [string 'icomoon']
"
,
"
[property src][operator :] [atom url][operator (][string fonts/icomoon.ttf][operator )]
"
)
})();
src/main/webapp/static/plugins/codemirror/5.48.4/mode/scheme/index.html
0 → 100644
View file @
53f587bc
<!doctype html>
<title>
CodeMirror: Scheme mode
</title>
<meta
charset=
"utf-8"
/>
<link
rel=
stylesheet
href=
"../../doc/docs.css"
>
<link
rel=
"stylesheet"
href=
"../../lib/codemirror.css"
>
<script
src=
"../../lib/codemirror.js"
></script>
<script
src=
"scheme.js"
></script>
<style>
.CodeMirror
{
background
:
#f8f8f8
;}
</style>
<div
id=
nav
>
<a
href=
"https://codemirror.net"
><h1>
CodeMirror
</h1><img
id=
logo
src=
"../../doc/logo.png"
></a>
<ul>
<li><a
href=
"../../index.html"
>
Home
</a>
<li><a
href=
"../../doc/manual.html"
>
Manual
</a>
<li><a
href=
"https://github.com/codemirror/codemirror"
>
Code
</a>
</ul>
<ul>
<li><a
href=
"../index.html"
>
Language modes
</a>
<li><a
class=
active
href=
"#"
>
Scheme
</a>
</ul>
</div>
<article>
<h2>
Scheme mode
</h2>
<form><textarea
id=
"code"
name=
"code"
>
; See if the input starts with a given symbol.
(define (match-symbol input pattern)
(cond ((null? (remain input)) #f)
((eqv? (car (remain input)) pattern) (r-cdr input))
(else #f)))
; Allow the input to start with one of a list of patterns.
(define (match-or input pattern)
(cond ((null? pattern) #f)
((match-pattern input (car pattern)))
(else (match-or input (cdr pattern)))))
; Allow a sequence of patterns.
(define (match-seq input pattern)
(if (null? pattern)
input
(let ((match (match-pattern input (car pattern))))
(if match (match-seq match (cdr pattern)) #f))))
; Match with the pattern but no problem if it does not match.
(define (match-opt input pattern)
(let ((match (match-pattern input (car pattern))))
(if match match input)))
; Match anything (other than '()), until pattern is found. The rather
; clumsy form of requiring an ending pattern is needed to decide where
; the end of the match is. If none is given, this will match the rest
; of the sentence.
(define (match-any input pattern)
(cond ((null? (remain input)) #f)
((null? pattern) (f-cons (remain input) (clear-remain input)))
(else
(let ((accum-any (collector)))
(define (match-pattern-any input pattern)
(cond ((null? (remain input)) #f)
(else (accum-any (car (remain input)))
(cond ((match-pattern (r-cdr input) pattern))
(else (match-pattern-any (r-cdr input) pattern))))))
(let ((retval (match-pattern-any input (car pattern))))
(if retval
(f-cons (accum-any) retval)
#f))))))
</textarea></form>
<script>
var
editor
=
CodeMirror
.
fromTextArea
(
document
.
getElementById
(
"
code
"
),
{});
</script>
<p><strong>
MIME types defined:
</strong>
<code>
text/x-scheme
</code>
.
</p>
</article>
src/main/webapp/static/plugins/codemirror/5.48.4/mode/scheme/scheme.js
0 → 100644
View file @
53f587bc
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: https://codemirror.net/LICENSE
/**
* Author: Koh Zi Han, based on implementation by Koh Zi Chun
*/
(
function
(
mod
)
{
if
(
typeof
exports
==
"
object
"
&&
typeof
module
==
"
object
"
)
// CommonJS
mod
(
require
(
"
../../lib/codemirror
"
));
else
if
(
typeof
define
==
"
function
"
&&
define
.
amd
)
// AMD
define
([
"
../../lib/codemirror
"
],
mod
);
else
// Plain browser env
mod
(
CodeMirror
);
})(
function
(
CodeMirror
)
{
"
use strict
"
;
CodeMirror
.
defineMode
(
"
scheme
"
,
function
()
{
var
BUILTIN
=
"
builtin
"
,
COMMENT
=
"
comment
"
,
STRING
=
"
string
"
,
ATOM
=
"
atom
"
,
NUMBER
=
"
number
"
,
BRACKET
=
"
bracket
"
;
var
INDENT_WORD_SKIP
=
2
;
function
makeKeywords
(
str
)
{
var
obj
=
{},
words
=
str
.
split
(
"
"
);
for
(
var
i
=
0
;
i
<
words
.
length
;
++
i
)
obj
[
words
[
i
]]
=
true
;
return
obj
;
}
var
keywords
=
makeKeywords
(
"
λ case-lambda call/cc class define-class exit-handler field import inherit init-field interface let*-values let-values let/ec mixin opt-lambda override protect provide public rename require require-for-syntax syntax syntax-case syntax-error unit/sig unless when with-syntax and begin call-with-current-continuation call-with-input-file call-with-output-file case cond define define-syntax delay do dynamic-wind else for-each if lambda let let* let-syntax letrec letrec-syntax map or syntax-rules abs acos angle append apply asin assoc assq assv atan boolean? caar cadr call-with-input-file call-with-output-file call-with-values car cdddar cddddr cdr ceiling char->integer char-alphabetic? char-ci<=? char-ci<? char-ci=? char-ci>=? char-ci>? char-downcase char-lower-case? char-numeric? char-ready? char-upcase char-upper-case? char-whitespace? char<=? char<? char=? char>=? char>? char? close-input-port close-output-port complex? cons cos current-input-port current-output-port denominator display eof-object? eq? equal? eqv? eval even? exact->inexact exact? exp expt #f floor force gcd imag-part inexact->exact inexact? input-port? integer->char integer? interaction-environment lcm length list list->string list->vector list-ref list-tail list? load log magnitude make-polar make-rectangular make-string make-vector max member memq memv min modulo negative? newline not null-environment null? number->string number? numerator odd? open-input-file open-output-file output-port? pair? peek-char port? positive? procedure? quasiquote quote quotient rational? rationalize read read-char real-part real? remainder reverse round scheme-report-environment set! set-car! set-cdr! sin sqrt string string->list string->number string->symbol string-append string-ci<=? string-ci<? string-ci=? string-ci>=? string-ci>? string-copy string-fill! string-length string-ref string-set! string<=? string<? string=? string>=? string>? string? substring symbol->string symbol? #t tan transcript-off transcript-on truncate values vector vector->list vector-fill! vector-length vector-ref vector-set! with-input-from-file with-output-to-file write write-char zero?
"
);
var
indentKeys
=
makeKeywords
(
"
define let letrec let* lambda
"
);
function
stateStack
(
indent
,
type
,
prev
)
{
// represents a state stack object
this
.
indent
=
indent
;
this
.
type
=
type
;
this
.
prev
=
prev
;
}
function
pushStack
(
state
,
indent
,
type
)
{
state
.
indentStack
=
new
stateStack
(
indent
,
type
,
state
.
indentStack
);
}
function
popStack
(
state
)
{
state
.
indentStack
=
state
.
indentStack
.
prev
;
}
var
binaryMatcher
=
new
RegExp
(
/^
(?:[
-+
]
i|
[
-+
][
01
]
+#*
(?:\/[
01
]
+#*
)?
i|
[
-+
]?[
01
]
+#*
(?:\/[
01
]
+#*
)?
@
[
-+
]?[
01
]
+#*
(?:\/[
01
]
+#*
)?
|
[
-+
]?[
01
]
+#*
(?:\/[
01
]
+#*
)?[
-+
](?:[
01
]
+#*
(?:\/[
01
]
+#*
)?)?
i|
[
-+
]?[
01
]
+#*
(?:\/[
01
]
+#*
)?)(?=[
()
\s
;"
]
|$
)
/i
);
var
octalMatcher
=
new
RegExp
(
/^
(?:[
-+
]
i|
[
-+
][
0-7
]
+#*
(?:\/[
0-7
]
+#*
)?
i|
[
-+
]?[
0-7
]
+#*
(?:\/[
0-7
]
+#*
)?
@
[
-+
]?[
0-7
]
+#*
(?:\/[
0-7
]
+#*
)?
|
[
-+
]?[
0-7
]
+#*
(?:\/[
0-7
]
+#*
)?[
-+
](?:[
0-7
]
+#*
(?:\/[
0-7
]
+#*
)?)?
i|
[
-+
]?[
0-7
]
+#*
(?:\/[
0-7
]
+#*
)?)(?=[
()
\s
;"
]
|$
)
/i
);
var
hexMatcher
=
new
RegExp
(
/^
(?:[
-+
]
i|
[
-+
][\d
a-f
]
+#*
(?:\/[\d
a-f
]
+#*
)?
i|
[
-+
]?[\d
a-f
]
+#*
(?:\/[\d
a-f
]
+#*
)?
@
[
-+
]?[\d
a-f
]
+#*
(?:\/[\d
a-f
]
+#*
)?
|
[
-+
]?[\d
a-f
]
+#*
(?:\/[\d
a-f
]
+#*
)?[
-+
](?:[\d
a-f
]
+#*
(?:\/[\d
a-f
]
+#*
)?)?
i|
[
-+
]?[\d
a-f
]
+#*
(?:\/[\d
a-f
]
+#*
)?)(?=[
()
\s
;"
]
|$
)
/i
);
var
decimalMatcher
=
new
RegExp
(
/^
(?:[
-+
]
i|
[
-+
](?:(?:(?:\d
+#+
\.?
#*|
\d
+
\.\d
*#*|
\.\d
+#*|
\d
+
)(?:[
esfdl
][
-+
]?\d
+
)?)
|
\d
+#*
\/\d
+#*
)
i|
[
-+
]?(?:(?:(?:\d
+#+
\.?
#*|
\d
+
\.\d
*#*|
\.\d
+#*|
\d
+
)(?:[
esfdl
][
-+
]?\d
+
)?)
|
\d
+#*
\/\d
+#*
)
@
[
-+
]?(?:(?:(?:\d
+#+
\.?
#*|
\d
+
\.\d
*#*|
\.\d
+#*|
\d
+
)(?:[
esfdl
][
-+
]?\d
+
)?)
|
\d
+#*
\/\d
+#*
)
|
[
-+
]?(?:(?:(?:\d
+#+
\.?
#*|
\d
+
\.\d
*#*|
\.\d
+#*|
\d
+
)(?:[
esfdl
][
-+
]?\d
+
)?)
|
\d
+#*
\/\d
+#*
)[
-+
](?:(?:(?:\d
+#+
\.?
#*|
\d
+
\.\d
*#*|
\.\d
+#*|
\d
+
)(?:[
esfdl
][
-+
]?\d
+
)?)
|
\d
+#*
\/\d
+#*
)?
i|
(?:(?:(?:\d
+#+
\.?
#*|
\d
+
\.\d
*#*|
\.\d
+#*|
\d
+
)(?:[
esfdl
][
-+
]?\d
+
)?)
|
\d
+#*
\/\d
+#*
))(?=[
()
\s
;"
]
|$
)
/i
);
function
isBinaryNumber
(
stream
)
{
return
stream
.
match
(
binaryMatcher
);
}
function
isOctalNumber
(
stream
)
{
return
stream
.
match
(
octalMatcher
);
}
function
isDecimalNumber
(
stream
,
backup
)
{
if
(
backup
===
true
)
{
stream
.
backUp
(
1
);
}
return
stream
.
match
(
decimalMatcher
);
}
function
isHexNumber
(
stream
)
{
return
stream
.
match
(
hexMatcher
);
}
return
{
startState
:
function
()
{
return
{
indentStack
:
null
,
indentation
:
0
,
mode
:
false
,
sExprComment
:
false
,
sExprQuote
:
false
};
},
token
:
function
(
stream
,
state
)
{
if
(
state
.
indentStack
==
null
&&
stream
.
sol
())
{
// update indentation, but only if indentStack is empty
state
.
indentation
=
stream
.
indentation
();
}
// skip spaces
if
(
stream
.
eatSpace
())
{
return
null
;
}
var
returnType
=
null
;
switch
(
state
.
mode
){
case
"
string
"
:
// multi-line string parsing mode
var
next
,
escaped
=
false
;
while
((
next
=
stream
.
next
())
!=
null
)
{
if
(
next
==
"
\"
"
&&
!
escaped
)
{
state
.
mode
=
false
;
break
;
}
escaped
=
!
escaped
&&
next
==
"
\\
"
;
}
returnType
=
STRING
;
// continue on in scheme-string mode
break
;
case
"
comment
"
:
// comment parsing mode
var
next
,
maybeEnd
=
false
;
while
((
next
=
stream
.
next
())
!=
null
)
{
if
(
next
==
"
#
"
&&
maybeEnd
)
{
state
.
mode
=
false
;
break
;
}
maybeEnd
=
(
next
==
"
|
"
);
}
returnType
=
COMMENT
;
break
;
case
"
s-expr-comment
"
:
// s-expr commenting mode
state
.
mode
=
false
;
if
(
stream
.
peek
()
==
"
(
"
||
stream
.
peek
()
==
"
[
"
){
// actually start scheme s-expr commenting mode
state
.
sExprComment
=
0
;
}
else
{
// if not we just comment the entire of the next token
stream
.
eatWhile
(
/
[^\s\(\)\[\]]
/
);
// eat symbol atom
returnType
=
COMMENT
;
break
;
}
default
:
// default parsing mode
var
ch
=
stream
.
next
();
if
(
ch
==
"
\"
"
)
{
state
.
mode
=
"
string
"
;
returnType
=
STRING
;
}
else
if
(
ch
==
"
'
"
)
{
if
(
stream
.
peek
()
==
"
(
"
||
stream
.
peek
()
==
"
[
"
){
if
(
typeof
state
.
sExprQuote
!=
"
number
"
)
{
state
.
sExprQuote
=
0
;
}
// else already in a quoted expression
returnType
=
ATOM
;
}
else
{
stream
.
eatWhile
(
/
[\w
_
\-
!$%&*+
\.\/
:<=>?@
\^
~
]
/
);
returnType
=
ATOM
;
}
}
else
if
(
ch
==
'
#
'
)
{
if
(
stream
.
eat
(
"
|
"
))
{
// Multi-line comment
state
.
mode
=
"
comment
"
;
// toggle to comment mode
returnType
=
COMMENT
;
}
else
if
(
stream
.
eat
(
/
[
tf
]
/i
))
{
// #t/#f (atom)
returnType
=
ATOM
;
}
else
if
(
stream
.
eat
(
'
;
'
))
{
// S-Expr comment
state
.
mode
=
"
s-expr-comment
"
;
returnType
=
COMMENT
;
}
else
{
var
numTest
=
null
,
hasExactness
=
false
,
hasRadix
=
true
;
if
(
stream
.
eat
(
/
[
ei
]
/i
))
{
hasExactness
=
true
;
}
else
{
stream
.
backUp
(
1
);
// must be radix specifier
}
if
(
stream
.
match
(
/^#b/i
))
{
numTest
=
isBinaryNumber
;
}
else
if
(
stream
.
match
(
/^#o/i
))
{
numTest
=
isOctalNumber
;
}
else
if
(
stream
.
match
(
/^#x/i
))
{
numTest
=
isHexNumber
;
}
else
if
(
stream
.
match
(
/^#d/i
))
{
numTest
=
isDecimalNumber
;
}
else
if
(
stream
.
match
(
/^
[
-+0-9.
]
/
,
false
))
{
hasRadix
=
false
;
numTest
=
isDecimalNumber
;
// re-consume the intial # if all matches failed
}
else
if
(
!
hasExactness
)
{
stream
.
eat
(
'
#
'
);
}
if
(
numTest
!=
null
)
{
if
(
hasRadix
&&
!
hasExactness
)
{
// consume optional exactness after radix
stream
.
match
(
/^#
[
ei
]
/i
);
}
if
(
numTest
(
stream
))
returnType
=
NUMBER
;
}
}
}
else
if
(
/^
[
-+0-9.
]
/
.
test
(
ch
)
&&
isDecimalNumber
(
stream
,
true
))
{
// match non-prefixed number, must be decimal
returnType
=
NUMBER
;
}
else
if
(
ch
==
"
;
"
)
{
// comment
stream
.
skipToEnd
();
// rest of the line is a comment
returnType
=
COMMENT
;
}
else
if
(
ch
==
"
(
"
||
ch
==
"
[
"
)
{
var
keyWord
=
''
;
var
indentTemp
=
stream
.
column
(),
letter
;
/**
Either
(indent-word ..
(non-indent-word ..
(;something else, bracket, etc.
*/
while
((
letter
=
stream
.
eat
(
/
[^\s\(\[\;\)\]]
/
))
!=
null
)
{
keyWord
+=
letter
;
}
if
(
keyWord
.
length
>
0
&&
indentKeys
.
propertyIsEnumerable
(
keyWord
))
{
// indent-word
pushStack
(
state
,
indentTemp
+
INDENT_WORD_SKIP
,
ch
);
}
else
{
// non-indent word
// we continue eating the spaces
stream
.
eatSpace
();
if
(
stream
.
eol
()
||
stream
.
peek
()
==
"
;
"
)
{
// nothing significant after
// we restart indentation 1 space after
pushStack
(
state
,
indentTemp
+
1
,
ch
);
}
else
{
pushStack
(
state
,
indentTemp
+
stream
.
current
().
length
,
ch
);
// else we match
}
}
stream
.
backUp
(
stream
.
current
().
length
-
1
);
// undo all the eating
if
(
typeof
state
.
sExprComment
==
"
number
"
)
state
.
sExprComment
++
;
if
(
typeof
state
.
sExprQuote
==
"
number
"
)
state
.
sExprQuote
++
;
returnType
=
BRACKET
;
}
else
if
(
ch
==
"
)
"
||
ch
==
"
]
"
)
{
returnType
=
BRACKET
;
if
(
state
.
indentStack
!=
null
&&
state
.
indentStack
.
type
==
(
ch
==
"
)
"
?
"
(
"
:
"
[
"
))
{
popStack
(
state
);
if
(
typeof
state
.
sExprComment
==
"
number
"
){
if
(
--
state
.
sExprComment
==
0
){
returnType
=
COMMENT
;
// final closing bracket
state
.
sExprComment
=
false
;
// turn off s-expr commenting mode
}
}
if
(
typeof
state
.
sExprQuote
==
"
number
"
){
if
(
--
state
.
sExprQuote
==
0
){
returnType
=
ATOM
;
// final closing bracket
state
.
sExprQuote
=
false
;
// turn off s-expr quote mode
}
}
}
}
else
{
stream
.
eatWhile
(
/
[\w
_
\-
!$%&*+
\.\/
:<=>?@
\^
~
]
/
);
if
(
keywords
&&
keywords
.
propertyIsEnumerable
(
stream
.
current
()))
{
returnType
=
BUILTIN
;
}
else
returnType
=
"
variable
"
;
}
}
return
(
typeof
state
.
sExprComment
==
"
number
"
)
?
COMMENT
:
((
typeof
state
.
sExprQuote
==
"
number
"
)
?
ATOM
:
returnType
);
},
indent
:
function
(
state
)
{
if
(
state
.
indentStack
==
null
)
return
state
.
indentation
;
return
state
.
indentStack
.
indent
;
},
closeBrackets
:
{
pairs
:
"
()[]{}
\"\"
"
},
lineComment
:
"
;;
"
};
});
CodeMirror
.
defineMIME
(
"
text/x-scheme
"
,
"
scheme
"
);
});
src/main/webapp/static/plugins/codemirror/5.48.4/mode/shell/index.html
0 → 100644
View file @
53f587bc
<!doctype html>
<title>
CodeMirror: Shell mode
</title>
<meta
charset=
"utf-8"
/>
<link
rel=
stylesheet
href=
"../../doc/docs.css"
>
<link
rel=
stylesheet
href=
../../lib/codemirror.css
>
<script
src=
../../lib/codemirror.js
></script>
<script
src=
"../../addon/edit/matchbrackets.js"
></script>
<script
src=
shell.js
></script>
<style
type=
text/css
>
.CodeMirror
{
border-top
:
1px
solid
black
;
border-bottom
:
1px
solid
black
;}
</style>
<div
id=
nav
>
<a
href=
"https://codemirror.net"
><h1>
CodeMirror
</h1><img
id=
logo
src=
"../../doc/logo.png"
></a>
<ul>
<li><a
href=
"../../index.html"
>
Home
</a>
<li><a
href=
"../../doc/manual.html"
>
Manual
</a>
<li><a
href=
"https://github.com/codemirror/codemirror"
>
Code
</a>
</ul>
<ul>
<li><a
href=
"../index.html"
>
Language modes
</a>
<li><a
class=
active
href=
"#"
>
Shell
</a>
</ul>
</div>
<article>
<h2>
Shell mode
</h2>
<textarea
id=
code
>
#!/bin/bash
# clone the repository
git clone http://github.com/garden/tree
# generate HTTPS credentials
cd tree
openssl genrsa -aes256 -out https.key 1024
openssl req -new -nodes -key https.key -out https.csr
openssl x509 -req -days 365 -in https.csr -signkey https.key -out https.crt
cp https.key{,.orig}
openssl rsa -in https.key.orig -out https.key
# start the server in HTTPS mode
cd web
sudo node ../server.js 443 'yes'
>>
../node.log
&
# here is how to stop the server
for pid in `ps aux | grep 'node ../server.js' | awk '{print $2}'` ; do
sudo kill -9 $pid 2
>
/dev/null
done
exit 0
</textarea>
<script>
var
editor
=
CodeMirror
.
fromTextArea
(
document
.
getElementById
(
'
code
'
),
{
mode
:
'
shell
'
,
lineNumbers
:
true
,
matchBrackets
:
true
});
</script>
<p><strong>
MIME types defined:
</strong>
<code>
text/x-sh
</code>
,
<code>
application/x-sh
</code>
.
</p>
</article>
src/main/webapp/static/plugins/codemirror/5.48.4/mode/shell/shell.js
0 → 100644
View file @
53f587bc
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: https://codemirror.net/LICENSE
(
function
(
mod
)
{
if
(
typeof
exports
==
"
object
"
&&
typeof
module
==
"
object
"
)
// CommonJS
mod
(
require
(
"
../../lib/codemirror
"
));
else
if
(
typeof
define
==
"
function
"
&&
define
.
amd
)
// AMD
define
([
"
../../lib/codemirror
"
],
mod
);
else
// Plain browser env
mod
(
CodeMirror
);
})(
function
(
CodeMirror
)
{
"
use strict
"
;
CodeMirror
.
defineMode
(
'
shell
'
,
function
()
{
var
words
=
{};
function
define
(
style
,
dict
)
{
for
(
var
i
=
0
;
i
<
dict
.
length
;
i
++
)
{
words
[
dict
[
i
]]
=
style
;
}
};
var
commonAtoms
=
[
"
true
"
,
"
false
"
];
var
commonKeywords
=
[
"
if
"
,
"
then
"
,
"
do
"
,
"
else
"
,
"
elif
"
,
"
while
"
,
"
until
"
,
"
for
"
,
"
in
"
,
"
esac
"
,
"
fi
"
,
"
fin
"
,
"
fil
"
,
"
done
"
,
"
exit
"
,
"
set
"
,
"
unset
"
,
"
export
"
,
"
function
"
];
var
commonCommands
=
[
"
ab
"
,
"
awk
"
,
"
bash
"
,
"
beep
"
,
"
cat
"
,
"
cc
"
,
"
cd
"
,
"
chown
"
,
"
chmod
"
,
"
chroot
"
,
"
clear
"
,
"
cp
"
,
"
curl
"
,
"
cut
"
,
"
diff
"
,
"
echo
"
,
"
find
"
,
"
gawk
"
,
"
gcc
"
,
"
get
"
,
"
git
"
,
"
grep
"
,
"
hg
"
,
"
kill
"
,
"
killall
"
,
"
ln
"
,
"
ls
"
,
"
make
"
,
"
mkdir
"
,
"
openssl
"
,
"
mv
"
,
"
nc
"
,
"
nl
"
,
"
node
"
,
"
npm
"
,
"
ping
"
,
"
ps
"
,
"
restart
"
,
"
rm
"
,
"
rmdir
"
,
"
sed
"
,
"
service
"
,
"
sh
"
,
"
shopt
"
,
"
shred
"
,
"
source
"
,
"
sort
"
,
"
sleep
"
,
"
ssh
"
,
"
start
"
,
"
stop
"
,
"
su
"
,
"
sudo
"
,
"
svn
"
,
"
tee
"
,
"
telnet
"
,
"
top
"
,
"
touch
"
,
"
vi
"
,
"
vim
"
,
"
wall
"
,
"
wc
"
,
"
wget
"
,
"
who
"
,
"
write
"
,
"
yes
"
,
"
zsh
"
];
CodeMirror
.
registerHelper
(
"
hintWords
"
,
"
shell
"
,
commonAtoms
.
concat
(
commonKeywords
,
commonCommands
));
define
(
'
atom
'
,
commonAtoms
);
define
(
'
keyword
'
,
commonKeywords
);
define
(
'
builtin
'
,
commonCommands
);
function
tokenBase
(
stream
,
state
)
{
if
(
stream
.
eatSpace
())
return
null
;
var
sol
=
stream
.
sol
();
var
ch
=
stream
.
next
();
if
(
ch
===
'
\\
'
)
{
stream
.
next
();
return
null
;
}
if
(
ch
===
'
\'
'
||
ch
===
'
"
'
||
ch
===
'
`
'
)
{
state
.
tokens
.
unshift
(
tokenString
(
ch
,
ch
===
"
`
"
?
"
quote
"
:
"
string
"
));
return
tokenize
(
stream
,
state
);
}
if
(
ch
===
'
#
'
)
{
if
(
sol
&&
stream
.
eat
(
'
!
'
))
{
stream
.
skipToEnd
();
return
'
meta
'
;
// 'comment'?
}
stream
.
skipToEnd
();
return
'
comment
'
;
}
if
(
ch
===
'
$
'
)
{
state
.
tokens
.
unshift
(
tokenDollar
);
return
tokenize
(
stream
,
state
);
}
if
(
ch
===
'
+
'
||
ch
===
'
=
'
)
{
return
'
operator
'
;
}
if
(
ch
===
'
-
'
)
{
stream
.
eat
(
'
-
'
);
stream
.
eatWhile
(
/
\w
/
);
return
'
attribute
'
;
}
if
(
/
\d
/
.
test
(
ch
))
{
stream
.
eatWhile
(
/
\d
/
);
if
(
stream
.
eol
()
||
!
/
\w
/
.
test
(
stream
.
peek
()))
{
return
'
number
'
;
}
}
stream
.
eatWhile
(
/
[\w
-
]
/
);
var
cur
=
stream
.
current
();
if
(
stream
.
peek
()
===
'
=
'
&&
/
\w
+/
.
test
(
cur
))
return
'
def
'
;
return
words
.
hasOwnProperty
(
cur
)
?
words
[
cur
]
:
null
;
}
function
tokenString
(
quote
,
style
)
{
var
close
=
quote
==
"
(
"
?
"
)
"
:
quote
==
"
{
"
?
"
}
"
:
quote
return
function
(
stream
,
state
)
{
var
next
,
escaped
=
false
;
while
((
next
=
stream
.
next
())
!=
null
)
{
if
(
next
===
close
&&
!
escaped
)
{
state
.
tokens
.
shift
();
break
;
}
else
if
(
next
===
'
$
'
&&
!
escaped
&&
quote
!==
"
'
"
&&
stream
.
peek
()
!=
close
)
{
escaped
=
true
;
stream
.
backUp
(
1
);
state
.
tokens
.
unshift
(
tokenDollar
);
break
;
}
else
if
(
!
escaped
&&
quote
!==
close
&&
next
===
quote
)
{
state
.
tokens
.
unshift
(
tokenString
(
quote
,
style
))
return
tokenize
(
stream
,
state
)
}
else
if
(
!
escaped
&&
/
[
'"
]
/
.
test
(
next
)
&&
!
/
[
'"
]
/
.
test
(
quote
))
{
state
.
tokens
.
unshift
(
tokenStringStart
(
next
,
"
string
"
));
stream
.
backUp
(
1
);
break
;
}
escaped
=
!
escaped
&&
next
===
'
\\
'
;
}
return
style
;
};
};
function
tokenStringStart
(
quote
,
style
)
{
return
function
(
stream
,
state
)
{
state
.
tokens
[
0
]
=
tokenString
(
quote
,
style
)
stream
.
next
()
return
tokenize
(
stream
,
state
)
}
}
var
tokenDollar
=
function
(
stream
,
state
)
{
if
(
state
.
tokens
.
length
>
1
)
stream
.
eat
(
'
$
'
);
var
ch
=
stream
.
next
()
if
(
/
[
'"({
]
/
.
test
(
ch
))
{
state
.
tokens
[
0
]
=
tokenString
(
ch
,
ch
==
"
(
"
?
"
quote
"
:
ch
==
"
{
"
?
"
def
"
:
"
string
"
);
return
tokenize
(
stream
,
state
);
}
if
(
!
/
\d
/
.
test
(
ch
))
stream
.
eatWhile
(
/
\w
/
);
state
.
tokens
.
shift
();
return
'
def
'
;
};
function
tokenize
(
stream
,
state
)
{
return
(
state
.
tokens
[
0
]
||
tokenBase
)
(
stream
,
state
);
};
return
{
startState
:
function
()
{
return
{
tokens
:[]};},
token
:
function
(
stream
,
state
)
{
return
tokenize
(
stream
,
state
);
},
closeBrackets
:
"
()[]{}''
\"\"
``
"
,
lineComment
:
'
#
'
,
fold
:
"
brace
"
};
});
CodeMirror
.
defineMIME
(
'
text/x-sh
'
,
'
shell
'
);
// Apache uses a slightly different Media Type for Shell scripts
// http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types
CodeMirror
.
defineMIME
(
'
application/x-sh
'
,
'
shell
'
);
});
src/main/webapp/static/plugins/codemirror/5.48.4/mode/shell/test.js
0 → 100644
View file @
53f587bc
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: https://codemirror.net/LICENSE
(
function
()
{
var
mode
=
CodeMirror
.
getMode
({},
"
shell
"
);
function
MT
(
name
)
{
test
.
mode
(
name
,
mode
,
Array
.
prototype
.
slice
.
call
(
arguments
,
1
));
}
MT
(
"
var
"
,
"
text [def $var] text
"
);
MT
(
"
varBraces
"
,
"
text[def ${var}]text
"
);
MT
(
"
varVar
"
,
"
text [def $a$b] text
"
);
MT
(
"
varBracesVarBraces
"
,
"
text[def ${a}${b}]text
"
);
MT
(
"
singleQuotedVar
"
,
"
[string 'text $var text']
"
);
MT
(
"
singleQuotedVarBraces
"
,
"
[string 'text ${var} text']
"
);
MT
(
"
doubleQuotedVar
"
,
'
[string "text ][def $var][string text"]
'
);
MT
(
"
doubleQuotedVarBraces
"
,
'
[string "text][def ${var}][string text"]
'
);
MT
(
"
doubleQuotedVarPunct
"
,
'
[string "text ][def $@][string text"]
'
);
MT
(
"
doubleQuotedVarVar
"
,
'
[string "][def $a$b][string "]
'
);
MT
(
"
doubleQuotedVarBracesVarBraces
"
,
'
[string "][def ${a}${b}][string "]
'
);
MT
(
"
notAString
"
,
"
text
\\
'text
"
);
MT
(
"
escapes
"
,
"
outside
\\
'
\\\"\\
`
\\\\
[string
\"
inside
\\
`
\\
'
\\\"\\\\
`
\\
$notAVar
\"
]outside
\\
$
\\
(notASubShell
\\
)
"
);
MT
(
"
subshell
"
,
"
[builtin echo] [quote $(whoami)] s log, stardate [quote `date`].
"
);
MT
(
"
doubleQuotedSubshell
"
,
"
[builtin echo] [string
\"
][quote $(whoami)][string 's log, stardate `date`.
\"
]
"
);
MT
(
"
hashbang
"
,
"
[meta #!/bin/bash]
"
);
MT
(
"
comment
"
,
"
text [comment # Blurb]
"
);
MT
(
"
numbers
"
,
"
[number 0] [number 1] [number 2]
"
);
MT
(
"
keywords
"
,
"
[keyword while] [atom true]; [keyword do]
"
,
"
[builtin sleep] [number 3]
"
,
"
[keyword done]
"
);
MT
(
"
options
"
,
"
[builtin ls] [attribute -l] [attribute --human-readable]
"
);
MT
(
"
operator
"
,
"
[def var][operator =]value
"
);
MT
(
"
doubleParens
"
,
"
foo [quote $((bar))]
"
)
MT
(
"
nested braces
"
,
"
[builtin echo] [def ${A[${B}]]}]
"
)
MT
(
"
strings in parens
"
,
"
[def FOO][operator =]([quote $(<][string
\"
][def $MYDIR][string
\"
][quote /myfile grep ][string 'hello$'][quote )])
"
)
MT
(
"
string ending in dollar
"
,
'
[def a][operator =][string "xyz$"]; [def b][operator =][string "y"]
'
)
MT
(
"
quote ending in dollar
"
,
"
[quote $(echo a$)]
"
)
})();
src/main/webapp/static/plugins/codemirror/5.48.4/mode/sieve/index.html
0 → 100644
View file @
53f587bc
<!doctype html>
<title>
CodeMirror: Sieve (RFC5228) mode
</title>
<meta
charset=
"utf-8"
/>
<link
rel=
stylesheet
href=
"../../doc/docs.css"
>
<link
rel=
"stylesheet"
href=
"../../lib/codemirror.css"
>
<script
src=
"../../lib/codemirror.js"
></script>
<script
src=
"sieve.js"
></script>
<style>
.CodeMirror
{
background
:
#f8f8f8
;}
</style>
<div
id=
nav
>
<a
href=
"https://codemirror.net"
><h1>
CodeMirror
</h1><img
id=
logo
src=
"../../doc/logo.png"
></a>
<ul>
<li><a
href=
"../../index.html"
>
Home
</a>
<li><a
href=
"../../doc/manual.html"
>
Manual
</a>
<li><a
href=
"https://github.com/codemirror/codemirror"
>
Code
</a>
</ul>
<ul>
<li><a
href=
"../index.html"
>
Language modes
</a>
<li><a
class=
active
href=
"#"
>
Sieve (RFC5228)
</a>
</ul>
</div>
<article>
<h2>
Sieve (RFC5228) mode
</h2>
<form><textarea
id=
"code"
name=
"code"
>
#
# Example Sieve Filter
# Declare any optional features or extension used by the script
#
require ["fileinto", "reject"];
#
# Reject any large messages (note that the four leading dots get
# "stuffed" to three)
#
if size :over 1M
{
reject text:
Please do not send me large attachments.
Put your file on a server and send me the URL.
Thank you.
.... Fred
.
;
stop;
}
#
# Handle messages from known mailing lists
# Move messages from IETF filter discussion list to filter folder
#
if header :is "Sender" "owner-ietf-mta-filters@imc.org"
{
fileinto "filter"; # move to "filter" folder
}
#
# Keep all messages to or from people in my company
#
elsif address :domain :is ["From", "To"] "example.com"
{
keep; # keep in "In" folder
}
#
# Try and catch unsolicited email. If a message is not to me,
# or it contains a subject known to be spam, file it away.
#
elsif anyof (not address :all :contains
["To", "Cc", "Bcc"] "me@example.com",
header :matches "subject"
["*make*money*fast*", "*university*dipl*mas*"])
{
# If message header does not contain my address,
# it's from a list.
fileinto "spam"; # move to "spam" folder
}
else
{
# Move all other (non-company) mail to "personal"
# folder.
fileinto "personal";
}
</textarea></form>
<script>
var
editor
=
CodeMirror
.
fromTextArea
(
document
.
getElementById
(
"
code
"
),
{});
</script>
<p><strong>
MIME types defined:
</strong>
<code>
application/sieve
</code>
.
</p>
</article>
src/main/webapp/static/plugins/codemirror/5.48.4/mode/sieve/sieve.js
0 → 100644
View file @
53f587bc
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: https://codemirror.net/LICENSE
(
function
(
mod
)
{
if
(
typeof
exports
==
"
object
"
&&
typeof
module
==
"
object
"
)
// CommonJS
mod
(
require
(
"
../../lib/codemirror
"
));
else
if
(
typeof
define
==
"
function
"
&&
define
.
amd
)
// AMD
define
([
"
../../lib/codemirror
"
],
mod
);
else
// Plain browser env
mod
(
CodeMirror
);
})(
function
(
CodeMirror
)
{
"
use strict
"
;
CodeMirror
.
defineMode
(
"
sieve
"
,
function
(
config
)
{
function
words
(
str
)
{
var
obj
=
{},
words
=
str
.
split
(
"
"
);
for
(
var
i
=
0
;
i
<
words
.
length
;
++
i
)
obj
[
words
[
i
]]
=
true
;
return
obj
;
}
var
keywords
=
words
(
"
if elsif else stop require
"
);
var
atoms
=
words
(
"
true false not
"
);
var
indentUnit
=
config
.
indentUnit
;
function
tokenBase
(
stream
,
state
)
{
var
ch
=
stream
.
next
();
if
(
ch
==
"
/
"
&&
stream
.
eat
(
"
*
"
))
{
state
.
tokenize
=
tokenCComment
;
return
tokenCComment
(
stream
,
state
);
}
if
(
ch
===
'
#
'
)
{
stream
.
skipToEnd
();
return
"
comment
"
;
}
if
(
ch
==
"
\"
"
)
{
state
.
tokenize
=
tokenString
(
ch
);
return
state
.
tokenize
(
stream
,
state
);
}
if
(
ch
==
"
(
"
)
{
state
.
_indent
.
push
(
"
(
"
);
// add virtual angel wings so that editor behaves...
// ...more sane incase of broken brackets
state
.
_indent
.
push
(
"
{
"
);
return
null
;
}
if
(
ch
===
"
{
"
)
{
state
.
_indent
.
push
(
"
{
"
);
return
null
;
}
if
(
ch
==
"
)
"
)
{
state
.
_indent
.
pop
();
state
.
_indent
.
pop
();
}
if
(
ch
===
"
}
"
)
{
state
.
_indent
.
pop
();
return
null
;
}
if
(
ch
==
"
,
"
)
return
null
;
if
(
ch
==
"
;
"
)
return
null
;
if
(
/
[
{}
\(\)
,;
]
/
.
test
(
ch
))
return
null
;
// 1*DIGIT "K" / "M" / "G"
if
(
/
\d
/
.
test
(
ch
))
{
stream
.
eatWhile
(
/
[\d]
/
);
stream
.
eat
(
/
[
KkMmGg
]
/
);
return
"
number
"
;
}
// ":" (ALPHA / "_") *(ALPHA / DIGIT / "_")
if
(
ch
==
"
:
"
)
{
stream
.
eatWhile
(
/
[
a-zA-Z_
]
/
);
stream
.
eatWhile
(
/
[
a-zA-Z0-9_
]
/
);
return
"
operator
"
;
}
stream
.
eatWhile
(
/
\w
/
);
var
cur
=
stream
.
current
();
// "text:" *(SP / HTAB) (hash-comment / CRLF)
// *(multiline-literal / multiline-dotstart)
// "." CRLF
if
((
cur
==
"
text
"
)
&&
stream
.
eat
(
"
:
"
))
{
state
.
tokenize
=
tokenMultiLineString
;
return
"
string
"
;
}
if
(
keywords
.
propertyIsEnumerable
(
cur
))
return
"
keyword
"
;
if
(
atoms
.
propertyIsEnumerable
(
cur
))
return
"
atom
"
;
return
null
;
}
function
tokenMultiLineString
(
stream
,
state
)
{
state
.
_multiLineString
=
true
;
// the first line is special it may contain a comment
if
(
!
stream
.
sol
())
{
stream
.
eatSpace
();
if
(
stream
.
peek
()
==
"
#
"
)
{
stream
.
skipToEnd
();
return
"
comment
"
;
}
stream
.
skipToEnd
();
return
"
string
"
;
}
if
((
stream
.
next
()
==
"
.
"
)
&&
(
stream
.
eol
()))
{
state
.
_multiLineString
=
false
;
state
.
tokenize
=
tokenBase
;
}
return
"
string
"
;
}
function
tokenCComment
(
stream
,
state
)
{
var
maybeEnd
=
false
,
ch
;
while
((
ch
=
stream
.
next
())
!=
null
)
{
if
(
maybeEnd
&&
ch
==
"
/
"
)
{
state
.
tokenize
=
tokenBase
;
break
;
}
maybeEnd
=
(
ch
==
"
*
"
);
}
return
"
comment
"
;
}
function
tokenString
(
quote
)
{
return
function
(
stream
,
state
)
{
var
escaped
=
false
,
ch
;
while
((
ch
=
stream
.
next
())
!=
null
)
{
if
(
ch
==
quote
&&
!
escaped
)
break
;
escaped
=
!
escaped
&&
ch
==
"
\\
"
;
}
if
(
!
escaped
)
state
.
tokenize
=
tokenBase
;
return
"
string
"
;
};
}
return
{
startState
:
function
(
base
)
{
return
{
tokenize
:
tokenBase
,
baseIndent
:
base
||
0
,
_indent
:
[]};
},
token
:
function
(
stream
,
state
)
{
if
(
stream
.
eatSpace
())
return
null
;
return
(
state
.
tokenize
||
tokenBase
)(
stream
,
state
);
},
indent
:
function
(
state
,
_textAfter
)
{
var
length
=
state
.
_indent
.
length
;
if
(
_textAfter
&&
(
_textAfter
[
0
]
==
"
}
"
))
length
--
;
if
(
length
<
0
)
length
=
0
;
return
length
*
indentUnit
;
},
electricChars
:
"
}
"
};
});
CodeMirror
.
defineMIME
(
"
application/sieve
"
,
"
sieve
"
);
});
src/main/webapp/static/plugins/codemirror/5.48.4/mode/slim/index.html
0 → 100644
View file @
53f587bc
<!doctype html>
<title>
CodeMirror: SLIM mode
</title>
<meta
charset=
"utf-8"
/>
<link
rel=
stylesheet
href=
"../../doc/docs.css"
>
<link
rel=
"stylesheet"
href=
"../../lib/codemirror.css"
>
<link
rel=
"stylesheet"
href=
"../../theme/ambiance.css"
>
<script
src=
"https://code.jquery.com/jquery-1.11.1.min.js"
></script>
<script
src=
"https://code.jquery.com/ui/1.11.0/jquery-ui.min.js"
></script>
<link
rel=
"stylesheet"
href=
"https://code.jquery.com/ui/1.11.0/themes/smoothness/jquery-ui.css"
>
<script
src=
"../../lib/codemirror.js"
></script>
<script
src=
"../xml/xml.js"
></script>
<script
src=
"../htmlembedded/htmlembedded.js"
></script>
<script
src=
"../htmlmixed/htmlmixed.js"
></script>
<script
src=
"../coffeescript/coffeescript.js"
></script>
<script
src=
"../javascript/javascript.js"
></script>
<script
src=
"../ruby/ruby.js"
></script>
<script
src=
"../markdown/markdown.js"
></script>
<script
src=
"slim.js"
></script>
<style>
.CodeMirror
{
background
:
#f8f8f8
;}
</style>
<div
id=
nav
>
<a
href=
"https://codemirror.net"
><h1>
CodeMirror
</h1><img
id=
logo
src=
"../../doc/logo.png"
></a>
<ul>
<li><a
href=
"../../index.html"
>
Home
</a>
<li><a
href=
"../../doc/manual.html"
>
Manual
</a>
<li><a
href=
"https://github.com/codemirror/codemirror"
>
Code
</a>
</ul>
<ul>
<li><a
href=
"../index.html"
>
Language modes
</a>
<li><a
class=
active
href=
"#"
>
SLIM
</a>
</ul>
</div>
<article>
<h2>
SLIM mode
</h2>
<form><textarea
id=
"code"
name=
"code"
>
body
table
- for user in users
td id="user_#{user.id}" class=user.role
a href=user_action(user, :edit) Edit #{user.name}
a href=(path_to_user user) = user.name
body
h1(id="logo") = page_logo
h2[id="tagline" class="small tagline"] = page_tagline
h2[id="tagline"
class="small tagline"] = page_tagline
h1 id = "logo" = page_logo
h2 [ id = "tagline" ] = page_tagline
/ comment
second line
/! html comment
second line
<!-- html comment -->
<a
href=
"#{'hello' if set}"
>
link
</a>
a.slim href="work" disabled=false running==:atom Text
<b>
bold
</b>
.clazz data-id="test" == 'hello' unless quark
| Text mode #{12}
Second line
= x ||= :ruby_atom
#menu.left
- @env.each do |x|
li: a = x
*@dyntag attr="val"
.first *{:class => [:second, :third]} Text
.second class=["text","more"]
.third class=:text,:symbol
</textarea></form>
<script>
var
editor
=
CodeMirror
.
fromTextArea
(
document
.
getElementById
(
"
code
"
),
{
lineNumbers
:
true
,
theme
:
"
ambiance
"
,
mode
:
"
application/x-slim
"
});
$
(
'
.CodeMirror
'
).
resizable
({
resize
:
function
()
{
editor
.
setSize
(
$
(
this
).
width
(),
$
(
this
).
height
());
//editor.refresh();
}
});
</script>
<p><strong>
MIME types defined:
</strong>
<code>
application/x-slim
</code>
.
</p>
<p>
<strong>
Parsing/Highlighting Tests:
</strong>
<a
href=
"../../test/index.html#slim_*"
>
normal
</a>
,
<a
href=
"../../test/index.html#verbose,slim_*"
>
verbose
</a>
.
</p>
</article>
Prev
1
…
10
11
12
13
14
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment