Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
CodeMirror
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Moritz Aurel Pascal Schubotz
CodeMirror
Commits
63e0effd
Commit
63e0effd
authored
10 years ago
by
Robert Plummer
Committed by
Marijn Haverbeke
10 years ago
Browse files
Options
Downloads
Patches
Plain Diff
[spreadsheet mode] Add
parent
c983dc1c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
mode/index.html
+4
-3
4 additions, 3 deletions
mode/index.html
mode/spreadsheet/index.html
+42
-0
42 additions, 0 deletions
mode/spreadsheet/index.html
mode/spreadsheet/spreadsheet.js
+121
-0
121 additions, 0 deletions
mode/spreadsheet/spreadsheet.js
with
167 additions
and
3 deletions
mode/index.html
+
4
−
3
View file @
63e0effd
...
...
@@ -19,16 +19,16 @@
<article>
<h2>
Language modes
</h2>
<h2>
Language modes
</h2>
<p>
This is a list of every mode in the distribution. Each mode lives
<p>
This is a list of every mode in the distribution. Each mode lives
in a subdirectory of the
<code>
mode/
</code>
directory, and typically
defines a single JavaScript file that implements the mode. Loading
such file will make the language available to CodeMirror, through
the
<a
href=
"../doc/manual.html#option_mode"
><code>
mode
</code></a>
option.
</p>
<div
style=
"-webkit-columns: 100px 2; -moz-columns: 100px 2; columns: 100px 2;"
>
<div
style=
"-webkit-columns: 100px 2; -moz-columns: 100px 2; columns: 100px 2;"
>
<ul
style=
"margin-top: 0"
>
<li><a
href=
"apl/index.html"
>
APL
</a></li>
<li><a
href=
"asterisk/index.html"
>
Asterisk dialplan
</a></li>
...
...
@@ -96,6 +96,7 @@ option.</p>
<li><a
href=
"ruby/index.html"
>
Ruby
</a></li>
<li><a
href=
"rust/index.html"
>
Rust
</a></li>
<li><a
href=
"sass/index.html"
>
Sass
</a></li>
<li><a
href=
"spreadsheet/index.html"
>
Spreadsheet
</a></li>
<li><a
href=
"clike/scala.html"
>
Scala
</a></li>
<li><a
href=
"scheme/index.html"
>
Scheme
</a></li>
<li><a
href=
"css/scss.html"
>
SCSS
</a></li>
...
...
This diff is collapsed.
Click to expand it.
mode/spreadsheet/index.html
0 → 100644
+
42
−
0
View file @
63e0effd
<!doctype html>
<title>
CodeMirror: Spreadsheet 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=
"spreadsheet.js"
></script>
<style
type=
"text/css"
>
.CodeMirror
{
border-top
:
1px
solid
black
;
border-bottom
:
1px
solid
black
;}
</style>
<div
id=
nav
>
<a
href=
"http://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=
"#"
>
Spreadsheet
</a>
</ul>
</div>
<article>
<h2>
Spreadsheet mode
</h2>
<form><textarea
id=
"code"
name=
"code"
>
=IF(A1:B2, TRUE, FALSE) / 100
</textarea></form>
<script>
var
editor
=
CodeMirror
.
fromTextArea
(
document
.
getElementById
(
"
code
"
),
{
lineNumbers
:
true
,
matchBrackets
:
true
,
extraKeys
:
{
"
Tab
"
:
"
indentAuto
"
}
});
</script>
<p><strong>
MIME types defined:
</strong>
<code>
text/x-spreadsheet
</code>
.
</p>
<h3>
The Spreadsheet Mode
</h3>
<p>
Created by
<a
href=
"https://github.com/robertleeplummerjr"
>
Robert Plummer
</a></p>
</article>
This diff is collapsed.
Click to expand it.
mode/spreadsheet/spreadsheet.js
0 → 100644
+
121
−
0
View file @
63e0effd
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://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
(
"
spreadsheet
"
,
function
()
{
var
stateType
=
{
string
:
'
string
'
,
characterClass
:
'
characterClass
'
};
return
{
startState
:
function
()
{
return
{
stringType
:
null
,
stack
:
[]
};
},
token
:
function
(
stream
,
state
)
{
if
(
!
stream
)
return
;
//check for state changes
if
(
state
.
stack
.
length
===
0
)
{
//strings
if
((
stream
.
peek
()
==
'
"
'
)
||
(
stream
.
peek
()
==
"
'
"
))
{
state
.
stringType
=
stream
.
peek
();
stream
.
next
();
// Skip quote
state
.
stack
.
unshift
(
stateType
.
string
);
}
}
//return state
//stack has
switch
(
state
.
stack
[
0
])
{
case
stateType
.
string
:
while
(
state
.
stack
[
0
]
===
stateType
.
string
&&
!
stream
.
eol
())
{
if
(
stream
.
peek
()
===
state
.
stringType
)
{
stream
.
next
();
// Skip quote
state
.
stack
.
shift
();
// Clear flag
}
else
if
(
stream
.
peek
()
===
"
\\
"
)
{
stream
.
next
();
stream
.
next
();
}
else
{
stream
.
match
(
/^.
[^\\\"\']
*/
);
}
}
return
"
string
"
;
case
stateType
.
characterClass
:
while
(
state
.
stack
[
0
]
===
stateType
.
characterClass
&&
!
stream
.
eol
())
{
if
(
!
(
stream
.
match
(
/^
[^\]\\]
+/
)
||
stream
.
match
(
/^
\\
./
)))
{
state
.
stack
.
shift
();
}
}
return
"
operator
"
;
}
var
peek
=
stream
.
peek
();
//no stack
switch
(
peek
)
{
case
"
[
"
:
stream
.
next
();
state
.
stack
.
unshift
(
stateType
.
characterClass
);
return
"
bracket
"
;
case
"
:
"
:
stream
.
next
();
return
"
operator
"
;
case
"
\\
"
:
if
(
stream
.
match
(
/
[\]
[a-z
]
+/
))
{
return
"
string-2
"
;
}
case
"
.
"
:
case
"
,
"
:
case
"
;
"
:
case
"
*
"
:
case
"
-
"
:
case
"
+
"
:
case
"
^
"
:
case
"
<
"
:
case
"
/
"
:
case
"
=
"
:
stream
.
next
();
return
"
atom
"
;
case
"
$
"
:
stream
.
next
();
return
"
builtin
"
;
}
if
(
stream
.
match
(
/
[
0-9
]
+/
))
{
if
(
stream
.
match
(
/^
[
a-zA-Z_
][
a-zA-Z0-9_
]
*/
))
{
return
"
error
"
;
}
return
"
number
"
;
}
else
if
(
stream
.
match
(
/^
[
a-zA-Z_
][
a-zA-Z0-9_
]
*/
))
{
if
(
stream
.
match
(
/
(?=[\(
.
])
/
,
false
))
{
return
"
keyword
"
;
}
return
"
variable-2
"
;
}
else
if
([
"
[
"
,
"
]
"
,
"
(
"
,
"
)
"
,
"
{
"
,
"
}
"
].
indexOf
(
peek
)
!=
-
1
)
{
stream
.
next
();
return
"
bracket
"
;
}
else
if
(
!
stream
.
eatSpace
())
{
stream
.
next
();
}
return
null
;
}
};
});
CodeMirror
.
defineMIME
(
"
text/x-spreadsheet
"
,
"
spreadsheet
"
);
});
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment