i386 theme - just copied, not optimized yet

This commit is contained in:
Claude 2015-09-02 12:38:10 +02:00
parent a9c5fee0c6
commit 2f3c3a6b87
289 changed files with 41621 additions and 0 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

5893
htdocs/themes/i386/css/bootstrap.css vendored Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,211 @@
.CodeMirror {
line-height: 1em;
font-family: monospace;
margin: 10px 0px;
/* Necessary so the scrollbar can be absolutely positioned within the wrapper on Lion. */
position: relative;
/* This prevents unwanted scrollbars from showing up on the body and wrapper in IE. */
overflow: hidden;
background-color: white;
border: 1px solid #CCC;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
-moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
-webkit-transition: border linear 0.2s, box-shadow linear 0.2s;
-moz-transition: border linear 0.2s, box-shadow linear 0.2s;
-ms-transition: border linear 0.2s, box-shadow linear 0.2s;
-o-transition: border linear 0.2s, box-shadow linear 0.2s;
transition: border linear 0.2s, box-shadow linear 0.2s;
}
.CodeMirror-scroll {
overflow-x: auto;
overflow-y: hidden;
height: 300px;
/* This is needed to prevent an IE[67] bug where the scrolled content
is visible outside of the scrolling box. */
position: relative;
outline: none;
}
/* Vertical scrollbar */
.CodeMirror-scrollbar {
float: right;
overflow-x: hidden;
overflow-y: scroll;
/* This corrects for the 1px gap introduced to the left of the scrollbar
by the rule for .CodeMirror-scrollbar-inner. */
margin-left: -1px;
}
.CodeMirror-scrollbar-inner {
/* This needs to have a nonzero width in order for the scrollbar to appear
in Firefox and IE9. */
width: 1px;
}
.CodeMirror-scrollbar.cm-sb-overlap {
/* Ensure that the scrollbar appears in Lion, and that it overlaps the content
rather than sitting to the right of it. */
position: absolute;
z-index: 1;
float: none;
right: 0;
min-width: 12px;
}
.CodeMirror-scrollbar.cm-sb-nonoverlap {
min-width: 12px;
}
.CodeMirror-scrollbar.cm-sb-ie7 {
min-width: 18px;
}
.CodeMirror-gutter {
position: absolute; left: 0; top: 0;
z-index: 10;
background-color: #F7F7F9;
border-right: 1px solid #eee;
min-width: 2em;
height: 100%;
-webkit-border-top-left-radius: 3px;
-webkit-border-bottom-left-radius: 3px;
-moz-border-radius-topleft: 3px;
-moz-border-radius-bottomleft: 3px;
border-top-left-radius: 3px;
border-bottom-left-radius: 3px;
-webkit-box-shadow: inset 1px 0 1px 1px rgba(0, 0, 0, 0.075);
-moz-box-shadow: inset 1px 0 1px rgba(0, 0, 0, 0.075);
box-shadow: inset 1px 0 1px 1px rgba(0, 0, 0, 0.075);
}
blockquote.CodeMirror {
background-color: #F7F7F9;
border-right: 1px solid #eee;
min-width: 2em;
height: 100%;
-webkit-border-top-left-radius: 3px;
-webkit-border-bottom-left-radius: 3px;
-moz-border-radius-topleft: 3px;
-moz-border-radius-bottomleft: 3px;
border-top-left-radius: 3px;
border-bottom-left-radius: 3px;
-webkit-box-shadow: inset 1px 0 1px 1px rgba(0, 0, 0, 0.075);
-moz-box-shadow: inset 1px 0 1px rgba(0, 0, 0, 0.075);
box-shadow: inset 1px 0 1px 1px rgba(0, 0, 0, 0.075);
}
blockquote.CodeMirror ol {
z-index: 10;
border: none;
background-color: #fff;
margin-bottom: 0;
}
.CodeMirror-gutter-text {
color: #aaa;
text-align: right;
padding: .4em .2em .4em .4em;
white-space: pre !important;
}
.CodeMirror-lines {
padding: .4em;
white-space: pre;
cursor: text;
}
.CodeMirror-lines * {
/* Necessary for throw-scrolling to decelerate properly on Safari. */
pointer-events: none;
}
.CodeMirror pre {
-moz-border-radius: 0;
-webkit-border-radius: 0;
-o-border-radius: 0;
border-radius: 0;
border-width: 0; margin: 0; padding: 0; background: transparent;
font-family: inherit;
font-size: inherit;
padding: 0; margin: 0;
white-space: pre;
word-wrap: normal;
line-height: inherit;
color: inherit;
}
.CodeMirror-wrap pre {
word-wrap: break-word;
white-space: pre-wrap;
word-break: normal;
}
.CodeMirror-wrap .CodeMirror-scroll {
overflow-x: hidden;
}
.CodeMirror textarea {
outline: none !important;
}
.CodeMirror pre.CodeMirror-cursor {
z-index: 10;
position: absolute;
visibility: hidden;
border-left: 1px solid black;
border-right: none;
width: 0;
}
.cm-keymap-fat-cursor pre.CodeMirror-cursor {
width: auto;
border: 0;
background: transparent;
background: rgba(0, 200, 0, .4);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#6600c800, endColorstr=#4c00c800);
}
/* Kludge to turn off filter in ie9+, which also accepts rgba */
.cm-keymap-fat-cursor pre.CodeMirror-cursor:not(#nonsense_id) {
filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
}
.CodeMirror pre.CodeMirror-cursor.CodeMirror-overwrite {}
.CodeMirror-focused pre.CodeMirror-cursor {
visibility: visible;
}
div.CodeMirror-selected { background: #d9d9d9; }
.CodeMirror-focused div.CodeMirror-selected { background: #d7d4f0; }
.CodeMirror-searching {
background: #ffa;
background: rgba(255, 255, 0, .4);
}
/* Default theme */
.cm-s-default span.cm-keyword {color: #708;}
.cm-s-default span.cm-atom {color: #219;}
.cm-s-default span.cm-number {color: #164;}
.cm-s-default span.cm-def {color: #00f;}
.cm-s-default span.cm-variable {color: black;}
.cm-s-default span.cm-variable-2 {color: #05a;}
.cm-s-default span.cm-variable-3 {color: #085;}
.cm-s-default span.cm-property {color: black;}
.cm-s-default span.cm-operator {color: black;}
.cm-s-default span.cm-comment {color: #a50;}
.cm-s-default span.cm-string {color: #a11;}
.cm-s-default span.cm-string-2 {color: #f50;}
.cm-s-default span.cm-meta {color: #555;}
.cm-s-default span.cm-error {color: #f00;}
.cm-s-default span.cm-qualifier {color: #555;}
.cm-s-default span.cm-builtin {color: #30a;}
.cm-s-default span.cm-bracket {color: #cc7;}
.cm-s-default span.cm-tag {color: #170;}
.cm-s-default span.cm-attribute {color: #00c;}
.cm-s-default span.cm-header {color: blue;}
.cm-s-default span.cm-quote {color: #090;}
.cm-s-default span.cm-hr {color: #999;}
.cm-s-default span.cm-link {color: #00c;}
span.cm-header, span.cm-strong {font-weight: bold;}
span.cm-em {font-style: italic;}
span.cm-emstrong {font-style: italic; font-weight: bold;}
span.cm-link {text-decoration: underline;}
div.CodeMirror span.CodeMirror-matchingbracket {color: #0f0;}
div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}

View File

@ -0,0 +1,25 @@
body {
}
.paste {
margin: 0 auto;
width: auto;
}
.paste .text_formatted {
width: 100%;
margin: 0;
border: 0;
}
.paste p {
clear: both;
background: #ccc;
padding: 3px 6px;
}
.paste .right {
float: right;
}

View File

@ -0,0 +1,130 @@
/*
iphone.css
stikked
Created by Ben McRedmond on 2008-03-19.
Copyright 2008 Stikked. Some rights reserved.
*/
* {
margin: 0;
}
body {
font-family: "Helvetica";
font-size: 20px;
font-weight: bold;
}
.container {
padding: 5px;
}
.pagetitle {
font-size: 25px;
}
/* Header */
.header {
background-color: #74972A;
border-bottom: 2px solid #607C21;
color: #fff;
height: 40px;
}
.logo{
float: left;
font-size: 25px;
}
.toolbar {
margin-top: 3px;
color: #aaa;
float: right;
font-weight: normal;
}
.toolbar ul li{
display: inline;
padding-left: 15px;
}
.toolbar ul li.active{
color: #fff;
}
.toolbar ul li a {
color: inherit;
text-decoration: none;
}
/* List */
tr {
height: 30px;
}
.recent {
list-style: none;
padding: 0;
}
.recent a {
color: inherit;
text-decoration: none;
}
.recent li {
padding: 5px;
border-bottom: 1px solid #eee;
}
.recent li span.author {
font-weight: normal;
}
.pages {
margin-top: 10px;
font-size: 25px;
font-weight: normal;
margin-right: 5px;
text-align: right;
}
.pages .current {
font-weight: bold;;
}
/* Create */
.data {
border: 0;
}
textarea {
width: 90%;
margin-left: 6px;
}
.submit {
margin-left: 2px;
margin-bottom: 5px;
}
/* View */
.info {
margin-left: 2px;
}
.meta{
font-weight: normal;
font-size: 15px;
margin-bottom: 5px;
color: #333;
}
.text_formatted {
font-size: 10px;
border-top: 1px solid #aaa;
padding-top: 5px;
overflow: auto;
}

View File

@ -0,0 +1,24 @@
/*
raw.css
Stikked
Created by Ben McRedmond on 2008-03-20.
Copyright 2008 Stikked. Some rights reserved.
*/
body {
font-family: "Lucida Grande", "Lucida Sans", "Lucida Sans Unicode", Verdana, "Helvetica Neue", Helvetica, sans-serif;
font-size: 14px;
}
#container {
width: 95%;
margin: 20px auto;
}
pre {
background-color: #eee;
padding: 5px;
font-family: monospace;
overflow: auto;
}

View File

@ -0,0 +1,125 @@
@media (min-width: 980px) {
body {
position: relative;
padding-top: 40px;
}
}
.hidden {
display: none;
}
/* Footer
-------------------------------------------------- */
.footer {
margin-top: 35px;
padding: 15px 0 10px;
border-top: 1px solid #e5e5e5;
}
.footer p {
margin-bottom: 0;
color: #555;
}
section {
margin-bottom: 25px;
}
/* Table Sorter
---------------------------------------------------*/
div.dataTables_length label {
float: left;
text-align: left;
}
div.dataTables_filter label {
float: right;
}
div.dataTables_info {
padding-top: 8px;
}
div.dataTables_paginate {
float: right;
margin: 0;
}
table {
margin-bottom: 6px !important;
clear: both;
}
table.table thead .sorting,
table.table thead .sorting_asc,
table.table thead .sorting_desc,
table.table thead .sorting_asc_disabled,
table.table thead .sorting_desc_disabled {
cursor: pointer;
*cursor: hand;
}
table.table thead .sorting { background: url('../images/sort_both.png') no-repeat center right; }
table.table thead .sorting_asc { background: url('../images/sort_asc.png') no-repeat center right; }
table.table thead .sorting_desc { background: url('../images/sort_desc.png') no-repeat center right; }
table.table thead .sorting_asc_disabled { background: url('../images/sort_asc_disabled.png') no-repeat center right; }
table.table thead .sorting_desc_disabled { background: url('../images/sort_desc_disabled.png') no-repeat center right; }
/* Diff style
-------------------------------------------------- */
.text ins {
color: green;
background: #dfd;
text-decoration: none;
}
.text del {
color: red;
background: #fdd;
}
/* Messages
-------------------------------------------------- */
.message {
width: 100%;
font-size: 85%;
margin-top: 15px;
color: #fff;
}
.message.success {
background-color: green;
}
.message.status {
background: #DB9330;
}
.message.error {
background: red;
}
.message .container {
padding: 5px;
}
/* Search */
.page-header {
position: relative;
}
.searchgroup {
position: absolute;
top: 10px;
right: 0;
}
/* line nums > 1000 are hidden */
.CodeMirror ol {
margin-left: 40px;
}

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,835 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
<svg>
<metadata>
Created by FontForge 20090914 at Tue Jul 30 19:37:37 2013
By www-data
GPL, see http://www.gnu.org/licenses/gpl.txt
</metadata>
<defs>
<font id="FixedsysTTF" horiz-adv-x="550" >
<font-face
font-family="FixedsysTTF"
font-weight="600"
font-stretch="normal"
units-per-em="1000"
panose-1="2 0 0 9 0 0 0 0 0 0"
ascent="800"
descent="-200"
x-height="465"
cap-height="610"
bbox="-1 -288 550 813"
underline-thickness="50"
underline-position="-75"
unicode-range="U+0001-U+20AC"
/>
<missing-glyph
/>
<glyph glyph-name=".notdef"
/>
<glyph glyph-name="uni0001"
d="M67 600h400v-600h-400v600z" />
<glyph glyph-name="uni0001"
d="M67 600h400v-600h-400v600z" />
<glyph glyph-name="uni0001"
d="M67 600h400v-600h-400v600z" />
<glyph glyph-name="uni0001"
d="M67 600h400v-600h-400v600z" />
<glyph glyph-name="uni0001"
d="M67 600h400v-600h-400v600z" />
<glyph glyph-name="uni0001"
d="M67 600h400v-600h-400v600z" />
<glyph glyph-name="uni0001"
d="M67 600h400v-600h-400v600z" />
<glyph glyph-name="uni0001"
d="M67 600h400v-600h-400v600z" />
<glyph glyph-name="uni0001"
d="M67 600h400v-600h-400v600z" />
<glyph glyph-name="uni0001"
d="M67 600h400v-600h-400v600z" />
<glyph glyph-name="uni0001"
d="M67 600h400v-600h-400v600z" />
<glyph glyph-name="uni0001"
d="M67 600h400v-600h-400v600z" />
<glyph glyph-name="uni0001"
d="M67 600h400v-600h-400v600z" />
<glyph glyph-name="uni0001"
d="M67 600h400v-600h-400v600z" />
<glyph glyph-name="uni0001"
d="M67 600h400v-600h-400v600z" />
<glyph glyph-name="uni0001"
d="M67 600h400v-600h-400v600z" />
<glyph glyph-name="uni0001"
d="M67 600h400v-600h-400v600z" />
<glyph glyph-name="uni0001"
d="M67 600h400v-600h-400v600z" />
<glyph glyph-name="uni0001"
d="M67 600h400v-600h-400v600z" />
<glyph glyph-name="uni0001"
d="M67 600h400v-600h-400v600z" />
<glyph glyph-name="uni0001"
d="M67 600h400v-600h-400v600z" />
<glyph glyph-name="uni0001"
d="M67 600h400v-600h-400v600z" />
<glyph glyph-name="uni0001"
d="M67 600h400v-600h-400v600z" />
<glyph glyph-name="uni0001"
d="M67 600h400v-600h-400v600z" />
<glyph glyph-name="uni0001" unicode="&#x85;"
d="M67 600h400v-600h-400v600z" />
<glyph glyph-name="uni0001"
d="M67 600h400v-600h-400v600z" />
<glyph glyph-name="uni0001"
d="M67 600h400v-600h-400v600z" />
<glyph glyph-name="uni0001"
d="M67 600h400v-600h-400v600z" />
<glyph glyph-name="uni0001"
d="M67 600h400v-600h-400v600z" />
<glyph glyph-name="uni0001"
d="M67 600h400v-600h-400v600z" />
<glyph glyph-name="uni0001"
d="M67 600h400v-600h-400v600z" />
<glyph glyph-name="uni0001"
d="M67 600h400v-600h-400v600z" />
<glyph glyph-name="uni0001"
d="M67 600h400v-600h-400v600z" />
<glyph glyph-name="uni0001"
d="M67 600h400v-600h-400v600z" />
<glyph glyph-name="uni0001"
d="M67 600h400v-600h-400v600z" />
<glyph glyph-name="uni0001"
d="M67 600h400v-600h-400v600z" />
<glyph glyph-name="uni0001"
d="M67 600h400v-600h-400v600z" />
<glyph glyph-name="uni0001"
d="M67 600h400v-600h-400v600z" />
<glyph glyph-name="uni0001"
d="M67 600h400v-600h-400v600z" />
<glyph glyph-name="uni0001"
d="M67 600h400v-600h-400v600z" />
<glyph glyph-name="uni0001"
d="M67 600h400v-600h-400v600z" />
<glyph glyph-name="uni0001"
d="M67 600h400v-600h-400v600z" />
<glyph glyph-name="uni0001"
d="M67 600h400v-600h-400v600z" />
<glyph glyph-name="uni0001"
d="M67 600h400v-600h-400v600z" />
<glyph glyph-name="uni0001"
d="M67 600h400v-600h-400v600z" />
<glyph glyph-name="uni0001"
d="M67 600h400v-600h-400v600z" />
<glyph glyph-name="uni0001"
d="M67 600h400v-600h-400v600z" />
<glyph glyph-name="uni0001"
d="M67 600h400v-600h-400v600z" />
<glyph glyph-name="uni0001"
d="M67 600h400v-600h-400v600z" />
<glyph glyph-name="uni0001"
d="M67 600h400v-600h-400v600z" />
<glyph glyph-name="uni0001"
d="M67 600h400v-600h-400v600z" />
<glyph glyph-name="uni0001" unicode="&#xa;"
d="M67 600h400v-600h-400v600z" />
<glyph glyph-name="uni0001"
d="M67 600h400v-600h-400v600z" />
<glyph glyph-name="uni0001"
d="M67 600h400v-600h-400v600z" />
<glyph glyph-name="uni0001"
d="M67 600h400v-600h-400v600z" />
<glyph glyph-name="uni0001"
d="M67 600h400v-600h-400v600z" />
<glyph glyph-name="uni0001"
d="M67 600h400v-600h-400v600z" />
<glyph glyph-name="uni0001"
d="M67 600h400v-600h-400v600z" />
<glyph glyph-name="uni0001"
d="M67 600h400v-600h-400v600z" />
<glyph glyph-name="space" unicode=" "
/>
<glyph glyph-name="space" unicode="&#xa0;"
/>
<glyph glyph-name="exclam" unicode="!"
d="M226 130v-130h120v130h-120zM221 335l0.00195312 -125h130v125h65v205c-2.66699 -1.33301 -6.83398 -1.83301 -12.501 -1.5s-11.667 1 -18 2s-12.333 2.33301 -18 4s-9.5 3.5 -11.5 5.5s-3.83301 5.83301 -5.5 11.5s-3 11.667 -4 18s-1.66699 12.333 -2 18
s0.166992 9.83398 1.5 12.501h-120c1.33301 -2.66699 1.83301 -6.83398 1.5 -12.501s-1 -11.667 -2 -18s-2.33301 -12.333 -4 -18s-3.5 -9.5 -5.5 -11.5s-5.83301 -3.83301 -11.5 -5.5s-11.667 -3 -18 -4s-12.333 -1.66699 -18 -2s-9.83398 0.166992 -12.501 1.5v-205h65z
" />
<glyph glyph-name="quotedbl" unicode="&#x22;"
d="M54 602v-200h130v200h-130v0zM324 602v-200h130v200h-130v0z" />
<glyph glyph-name="numbersign" unicode="#"
d="M119 135v-135h123v130h90v-130h127v135h69v70h-68v200h68v70h-69v135h-127v-130h-85v130h-128v-135h-69v-70h64v-200h-64v-70h69v0zM247 400h80v-190h-80v190v0z" />
<glyph glyph-name="dollar" unicode="$"
d="M187 1v-134h128v136h70v69l69 2v138h-68v69h-71v61h-69l-1 70h-59v141h129v-70h140v70h-69l-1 69h-70v139h-129v-139h-70v-71h-69v-138h70v-69h69v-61h60v-70l68 1v-142h-128v69h-141v-67h69c0 -12.667 0.166992 -24.5 0.5 -35.5s0.5 -22.833 0.5 -35.5
c2 -0.666992 6.33301 -1 13 -1h22h22c7.33301 0 12.333 -0.333008 15 -1z" />
<glyph glyph-name="percent" unicode="%"
d="M266 10v-65.002h205c-1.33301 2.66699 -1.83301 6.83398 -1.5 12.501s1 11.667 2 18s2.33301 12.333 4 18s3.5 9.5 5.5 11.5s5.83301 3.83301 11.5 5.5s11.667 3 18 4s12.333 1.66699 18 2s9.83398 -0.166992 12.501 -1.5v130
c-2.66699 -1.33301 -6.83398 -1.83301 -12.501 -1.5s-11.667 1 -18 2s-12.333 2.33301 -18 4s-9.5 3.5 -11.5 5.5s-3.83301 5.83301 -5.5 11.5s-3 11.667 -4 18s-1.66699 12.333 -2 18s0.166992 9.83398 1.5 12.501h-205v-65h-55v-140h55zM341 144.998h60v-130h-60v130z
M71 214.998l0.00195312 -129.999h60c-1.33301 2.66699 -1.83301 6.83398 -1.5 12.501s1 11.667 2 18s2.33301 12.333 4 18s3.5 9.5 5.5 11.5c0.666992 0.666992 4 1.5 10 2.5s12.5 1.83301 19.5 2.5s13.5 1.33398 19.5 2.00098s9.66699 1.66699 11 3c2 2 3.83301 6 5.5 12
s3 12.5 4 19.5s1.66699 13.667 2 20s-0.166992 10.833 -1.5 13.5h50c-1.33301 2.66699 -2 7 -2 13c0 6.66699 0.5 13.5 1.5 20.5s2.5 13.5 4.5 19.5s4 10 6 12s6 4 12 6s12.5 3.5 19.5 4.5s13.5 1.5 19.5 1.5c6.66699 0 11.334 -0.666992 14.001 -2v50
c2.66699 -1.33301 7.16699 -1.83301 13.5 -1.5s13 1 20 2s13.5 2.33301 19.5 4s10 3.5 12 5.5c0.666992 0.666992 1.5 4 2.5 10s1.83301 12.5 2.5 19.5s1.33398 13.5 2.00098 19.5s1.66699 9.66699 3 11c2 2 5.83301 3.83301 11.5 5.5s11.667 3 18 4s12.333 1.66699 18 2
s9.83398 -0.166992 12.501 -1.5v130h-60c1.33301 -2.66699 1.83301 -6.83398 1.5 -12.501s-1 -11.667 -2 -18s-2.33301 -12.333 -4 -18s-3.5 -9.5 -5.5 -11.5c-1.33301 -1.33301 -5 -2.33301 -11 -3s-12.5 -1.33398 -19.5 -2.00098s-13.5 -1.5 -19.5 -2.5
s-9.33301 -1.83301 -10 -2.5c-1.33301 -1.33301 -2.33301 -5 -3 -11s-1.33398 -12.5 -2.00098 -19.5s-1.5 -13.5 -2.5 -19.5s-1.83301 -9.33301 -2.5 -10c-1.33301 -1.33301 -5 -2.33301 -11 -3s-12.5 -1.33398 -19.5 -2.00098s-13.5 -1.5 -19.5 -2.5
s-9.33301 -1.83301 -10 -2.5c-2 -2 -3.83301 -5.83301 -5.5 -11.5s-3 -11.667 -4 -18s-1.66699 -12.333 -2 -18s0.166992 -9.83398 1.5 -12.501c-2 0.666992 -5.5 0.833984 -10.5 0.500977s-10.167 -1 -15.5 -2s-10.333 -2.16699 -15 -3.5s-7.66699 -3 -9 -5
s-2.83301 -5.33301 -4.5 -10s-3 -9.66699 -4 -15s-1.83301 -10.333 -2.5 -15s-0.333984 -8 0.999023 -10c-2.66699 1.33301 -6.83398 1.83301 -12.501 1.5s-11.667 -1 -18 -2s-12.333 -2.33301 -18 -4s-9.5 -3.5 -11.5 -5.5c-1.33301 -1.33301 -2.33301 -5 -3 -11
s-1.33398 -12.5 -2.00098 -19.5s-1.5 -13.5 -2.5 -19.5s-1.83301 -9.33301 -2.5 -10c-2 -2 -5.83301 -3.83301 -11.5 -5.5s-11.667 -3 -18 -4s-12.333 -1.66699 -18 -2s-9.83398 0.166992 -12.501 1.5zM1.00195 494.999c2.66699 1.33301 6.83398 1.83301 12.501 1.5
s11.667 -1 18 -2s12.333 -2.33301 18 -4s9.5 -3.5 11.5 -5.5s3.83301 -5.83301 5.5 -11.5s3 -11.667 4 -18s1.66699 -12.333 2 -18s-0.166992 -9.83398 -1.5 -12.501h190c-1.33301 2.66699 -1.83301 6.83398 -1.5 12.501s1 11.667 2 18s2.33301 12.333 4 18
s3.5 9.5 5.5 11.5s5.83301 3.83301 11.5 5.5s11.667 3 18 4s12.333 1.66699 18 2s9.83398 -0.166992 12.501 -1.5v130c-2.66699 -1.33301 -6.83398 -1.83301 -12.501 -1.5s-11.667 1 -18 2s-12.333 2.33301 -18 4s-9.5 3.5 -11.5 5.5s-3.83301 5.83301 -5.5 11.5
s-3 11.667 -4 18s-1.66699 12.333 -2 18s0.166992 9.83398 1.5 12.501h-190c1.33301 -2.66699 1.83301 -6.83398 1.5 -12.501s-1 -11.667 -2 -18s-2.33301 -12.333 -4 -18s-3.5 -9.5 -5.5 -11.5s-5.83301 -3.83301 -11.5 -5.5s-11.667 -3 -18 -4s-12.333 -1.66699 -18 -2
s-9.83398 0.166992 -12.501 1.5v-130zM141.002 624.999h60v-130h-60v130z" />
<glyph glyph-name="ampersand" unicode="&#x26;"
d="M56 70c2.66699 1.33301 6.83398 1.83398 12.501 1.50098s11.667 -1 18 -2s12.333 -2.33301 18 -4s9.5 -3.5 11.5 -5.5s3.83301 -5.83301 5.5 -11.5s3 -11.667 4 -18s1.66699 -12.333 2 -18s-0.166992 -9.83398 -1.5 -12.501h195v60h70v-60h135v65h-60v140h60v65h-270v-65
h60v-135h-120v265h120c-1.33301 2.66699 -1.83301 7.16699 -1.5 13.5s1 13 2 20s2.33301 13.5 4 19.5s3.5 10 5.5 12s5.83301 3.83301 11.5 5.5s11.667 3 18 4s12.333 1.66699 18 2s9.83398 -0.166992 12.501 -1.5v130c-2.66699 -1.33301 -6.83398 -1.83301 -12.501 -1.5
s-11.667 1 -18 2s-12.333 2.33301 -18 4s-9.5 3.5 -11.5 5.5s-3.83301 5.83301 -5.5 11.5s-3 11.667 -4 18s-1.66699 12.333 -2 18s0.166992 9.83398 1.5 12.501h-190c1.33301 -2.66699 1.83301 -6.83398 1.5 -12.501s-1 -11.667 -2 -18s-2.33301 -12.333 -4 -18
s-3.5 -9.5 -5.5 -11.5s-5.83301 -3.83301 -11.5 -5.5s-11.667 -3 -18 -4s-12.333 -1.66699 -18 -2s-9.83398 0.166992 -12.501 1.5v-135h60v-70h-60v-265zM196 540.001h50v-130h-50v130z" />
<glyph glyph-name="quotesingle" unicode="'"
d="M178 604v-200h120v200h-120v0z" />
<glyph glyph-name="parenleft" unicode="("
d="M282 -66v-65h135v65h-65v140h-65v340h65v140h65v65h-135v-65h-60v-140h-65v-340h65v-140h60v0z" />
<glyph glyph-name="parenright" unicode=")"
d="M165 -61l1 -68h121v65h75v140h65v340h-65v137h-70v68h-126l-1 -72h66l1 -133h55v-340h-55l-1 -137h-66z" />
<glyph glyph-name="asterisk" unicode="*"
d="M109 216v-65h125v60h70v-60h135v65h-60v70h130v60h-130v70h60v65h-135v-60h-70v60h-125v-65h60v-70h-130v-60h130v-70h-60v0z" />
<glyph glyph-name="plus" unicode="+"
d="M194 252v-135h130v135h135v60h-135v135h-130v-135h-135v-60h135v0z" />
<glyph glyph-name="comma" unicode=","
d="M200 -63l-0.000976562 -65.001h120c-1.33301 2.66699 -1.83301 6.83398 -1.5 12.501s1 11.667 2 18s2.33301 12.333 4 18s3.5 9.5 5.5 11.5s5.83301 3.83301 11.5 5.5s11.667 3 18 4s12.333 1.66699 18 2s9.83398 -0.166992 12.501 -1.5v200h-190v-135h50v-70h-50z" />
<glyph glyph-name="minus" unicode="-"
d="M56 303v-50h400v50h-400z" />
<glyph glyph-name="period" unicode="."
d="M198 130v-130h190v130h-190v0z" />
<glyph glyph-name="slash" unicode="/"
d="M87 -64h99l301 631v49h-108l-292 -584v-96z" />
<glyph glyph-name="zero" unicode="0"
d="M82 71c2.66699 1.33301 6.83398 1.83301 12.501 1.5s11.667 -1 18 -2s12.333 -2.33301 18 -4s9.5 -3.5 11.5 -5.5s3.83301 -5.83301 5.5 -11.5s3 -11.667 4 -18s1.66699 -12.333 2 -18s-0.166992 -9.83398 -1.5 -12.501h260
c-1.33301 2.66699 -1.83301 6.83398 -1.5 12.501s1 11.667 2 18s2.33301 12.333 4 18s3.5 9.5 5.5 11.5s5.83301 3.83301 11.5 5.5s11.667 3 18 4s12.333 1.66699 18 2s9.83398 -0.166992 12.501 -1.5v470c-2.66699 -1.33301 -6.83398 -1.83301 -12.501 -1.5
s-11.667 1 -18 2s-12.333 2.33301 -18 4s-9.5 3.5 -11.5 5.5s-3.83301 5.83301 -5.5 11.5s-3 11.667 -4 18s-1.66699 12.333 -2 18s0.166992 9.83398 1.5 12.501h-260c1.33301 -2.66699 1.83301 -6.83398 1.5 -12.501s-1 -11.667 -2 -18s-2.33301 -12.333 -4 -18
s-3.5 -9.5 -5.5 -11.5s-5.83301 -3.83301 -11.5 -5.5s-11.667 -3 -18 -4s-12.333 -1.66699 -18 -2s-9.83398 0.166992 -12.501 1.5v-470zM218 134h60v140h-60v265h130v-65h-60v-140h60v-265h-130v65z" />
<glyph glyph-name="one" unicode="1"
d="M249 406v-405h135v610h-135v-65h-60v-70h-135v-70h195v0z" />
<glyph glyph-name="two" unicode="2"
d="M98 0h400.001v65h-260v70h58c-1.33301 2.66699 -2.33301 7.16699 -3 13.5s-1 12.833 -1 19.5c0 7.33301 0.5 14 1.5 20s2.5 10 4.5 12c0.666992 0.666992 4 1.5 10 2.5s12.5 1.83301 19.5 2.5s13.5 1.33398 19.5 2.00098s9.66699 1.66699 11 3
c0.666992 0.666992 1.5 4 2.5 10s1.83301 12.5 2.5 19.5s1.33398 13.5 2.00098 19.5s1.66699 9.66699 3 11c2 2 6 3.83301 12 5.5s12.5 3 19.5 4s13.667 1.66699 20 2s10.833 -0.166992 13.5 -1.5v55h65v205c-2.66699 -1.33301 -6.83398 -1.83301 -12.501 -1.5
s-11.667 1 -18 2s-12.333 2.33301 -18 4s-9.5 3.5 -11.5 5.5s-3.83301 5.83301 -5.5 11.5s-3 11.667 -4 18s-1.66699 12.333 -2 18s0.166992 9.83398 1.5 12.501h-260c1.33301 -2.66699 1.83301 -6.83398 1.5 -12.501s-1 -11.667 -2 -18s-2.33301 -12.333 -4 -18
s-3.5 -9.5 -5.5 -11.5s-5.83301 -3.83301 -11.5 -5.5s-11.667 -3 -18 -4s-12.333 -1.66699 -18 -2s-9.83398 0.166992 -12.501 1.5v-130h135v130h125v-205h-60c0.666992 -2 1 -5.66699 1 -11s-0.5 -11 -1.5 -17s-2.33301 -11.5 -4 -16.5s-3.5 -8.5 -5.5 -10.5
c-1.33301 -2 -4.5 -3.5 -9.5 -4.5s-10.5 -1.83301 -16.5 -2.5s-12 -1 -18 -1c-5.33301 0 -9 0.666992 -11 2c1.33301 -2.66699 2.5 -7.33398 3.5 -14.001s1.5 -14 1.5 -22c0 -7.33301 -0.333008 -14.333 -1 -21s-2 -11 -4 -13c-1.33301 -1.33301 -5.33301 -1.83301 -12 -1.5
s-14.167 0.833008 -22.5 1.5s-16.166 1 -23.499 1c-6.66699 0 -10.334 -0.333008 -11.001 -1c-1.33301 -1.33301 -2 -5.33301 -2 -12s0.166992 -14.167 0.5 -22.5s0.333008 -16 0 -23s-0.833008 -10.833 -1.5 -11.5c-2 -2 -6 -3.33301 -12 -4s-12.333 -1 -19 -1
s-13 0.5 -19 1.5s-10.333 2.16699 -13 3.5v-135z" />
<glyph glyph-name="three" unicode="3"
d="M95 70c2.66699 1.33301 6.83398 1.83301 12.501 1.5s11.667 -1 18 -2s12.333 -2.33301 18 -4s9.5 -3.5 11.5 -5.5s3.83301 -5.83301 5.5 -11.5s3 -11.667 4 -18s1.66699 -12.333 2 -18s-0.166992 -9.83398 -1.5 -12.501h260
c-1.33301 2.66699 -1.83301 6.83398 -1.5 12.501s1 11.667 2 18s2.33301 12.333 4 18s3.5 9.5 5.5 11.5s5.83301 3.83301 11.5 5.5s11.667 3 18 4s12.333 1.66699 18 2s9.83398 -0.166992 12.501 -1.5v205h-60v60h60v205c-2.66699 -1.33301 -6.83398 -1.83301 -12.501 -1.5
s-11.667 1 -18 2s-12.333 2.33301 -18 4s-9.5 3.5 -11.5 5.5s-3.83301 5.83301 -5.5 11.5s-3 11.667 -4 18s-1.66699 12.333 -2 18s0.166992 9.83398 1.5 12.501h-260c1.33301 -2.66699 1.83301 -6.83398 1.5 -12.501s-1 -11.667 -2 -18s-2.33301 -12.333 -4 -18
s-3.5 -9.5 -5.5 -11.5s-5.83301 -3.83301 -11.5 -5.5s-11.667 -3 -18 -4s-12.333 -1.66699 -18 -2s-9.83398 0.166992 -12.501 1.5v-130h135v130h125v-205h-120v-60h120v-205h-125v130h-135v-130z" />
<glyph glyph-name="four" unicode="4"
d="M319 135v-135h140v135h65v70h-65v265h-140v-260h-125v65h50v335h-125v-335h-65v-140h265v0z" />
<glyph glyph-name="five" unicode="5"
d="M44 65l-0.000976562 -65.002h313c-1.33301 2.66699 -1.83301 6.83398 -1.5 12.501s1 11.667 2 18s2.33301 12.333 4 18s3.5 9.5 5.5 11.5c0.666992 0.666992 4 1.5 10 2.5s12.5 1.83301 19.5 2.5s13.5 1.33398 19.5 2.00098s9.66699 1.66699 11 3
c0.666992 0.666992 1.5 4 2.5 10s1.83301 12.5 2.5 19.5s1.33398 13.5 2.00098 19.5s1.66699 9.66699 3 11c2 2 5.83301 3.83301 11.5 5.5s11.667 3 18 4s12.333 1.66699 18 2s9.83398 -0.166992 12.501 -1.5v135h-65v60h-248v210h313v65h-453v-335h313v-135
c-2.66699 1.33301 -6.83398 1.83301 -12.501 1.5s-11.667 -1 -18 -2s-12.333 -2.33301 -18 -4s-9.5 -3.5 -11.5 -5.5s-3.83301 -6 -5.5 -12s-3 -12.5 -4 -19.5s-1.66699 -13.667 -2 -20s0.166992 -10.833 1.5 -13.5h-243z" />
<glyph glyph-name="six" unicode="6"
d="M95 70c2.66699 1.33301 6.83203 1.83301 12.499 1.5s11.667 -1 18 -2s12.333 -2.33301 18 -4s9.5 -3.5 11.5 -5.5s3.83301 -5.83301 5.5 -11.5s3 -11.667 4 -18s1.66699 -12.333 2 -18s-0.166992 -9.83398 -1.5 -12.501h260
c-1.33301 2.66699 -1.83301 6.83398 -1.5 12.501s1 11.667 2 18s2.33301 12.333 4 18s3.5 9.5 5.5 11.5s5.83301 3.83301 11.5 5.5s11.667 3 18 4s12.333 1.66699 18 2s9.83398 -0.166992 12.501 -1.5v260c-2.66699 -1.33301 -6.83398 -1.83301 -12.501 -1.5
s-11.667 1 -18 2s-12.333 2.33301 -18 4s-9.5 3.5 -11.5 5.5s-3.83301 6 -5.5 12s-3 12.5 -4 19.5s-1.66699 13.667 -2 20s0.166992 10.833 1.5 13.5h-130v65c2.66699 -1.33301 6.83398 -1.83301 12.501 -1.5s11.667 1 18 2s12.333 2.33301 18 4s9.5 3.5 11.5 5.5
c0.666992 0.666992 1.5 4 2.5 10s1.83301 12.5 2.5 19.5s1.33398 13.5 2.00098 19.5s1.66699 9.66699 3 11c2 2 5.83301 3.83301 11.5 5.5s11.667 3 18 4s12.333 1.66699 18 2s9.83398 -0.166992 12.501 -1.5v60h-195v-130c-2.66699 1.33301 -7.16699 1.83301 -13.5 1.5
s-13 -1 -20 -2s-13.5 -2.33301 -19.5 -4s-10 -3.5 -12 -5.5c-1.33301 -1.33301 -2.33301 -5 -3 -11s-1.33398 -12.5 -2.00098 -19.5s-1.5 -13.5 -2.5 -19.5s-1.83301 -9.33301 -2.5 -10c-2 -2 -5.83301 -3.83301 -11.5 -5.5s-11.667 -3 -18 -4s-12.333 -1.66699 -18 -2
s-9.83398 0.166992 -12.501 1.5v-330zM234.998 330h120v-260h-120v260z" />
<glyph glyph-name="seven" unicode="7"
d="M157 205v-205h125v205h70v130h70v140h65v135h-400v-65h260v-70h-65v-140h-60v-130h-65v0z" />
<glyph glyph-name="eight" unicode="8"
d="M87 70c2.66699 1.33301 6.83398 1.83301 12.501 1.5s11.667 -1 18 -2s12.333 -2.33301 18 -4s9.5 -3.5 11.5 -5.5s3.83301 -5.83301 5.5 -11.5s3 -11.667 4 -18s1.66699 -12.333 2 -18s-0.166992 -9.83398 -1.5 -12.501h260
c-1.33301 2.66699 -1.83301 6.83398 -1.5 12.501s1 11.667 2 18s2.33301 12.333 4 18s3.5 9.5 5.5 11.5s5.83301 3.83301 11.5 5.5s11.667 3 18 4s12.333 1.66699 18 2s9.83398 -0.166992 12.501 -1.5v205h-60v60h60v205c-2.66699 -1.33301 -6.83398 -1.83301 -12.501 -1.5
s-11.667 1 -18 2s-12.333 2.33301 -18 4s-9.5 3.5 -11.5 5.5s-3.83301 5.83301 -5.5 11.5s-3 11.667 -4 18s-1.66699 12.333 -2 18s0.166992 9.83398 1.5 12.501h-260c1.33301 -2.66699 1.83301 -6.83398 1.5 -12.501s-1 -11.667 -2 -18s-2.33301 -12.333 -4 -18
s-3.5 -9.5 -5.5 -11.5s-5.83301 -3.83301 -11.5 -5.5s-11.667 -3 -18 -4s-12.333 -1.66699 -18 -2s-9.83398 0.166992 -12.501 1.5v-205h60v-60h-60v-205zM227 270l49.999 0.000976562c-1.33301 -2.66699 -1.83301 -6.83398 -1.5 -12.501s1 -11.667 2 -18
s2.33301 -12.333 4 -18s3.5 -9.5 5.5 -11.5s5.83301 -3.83301 11.5 -5.5s11.667 -3 18 -4s12.333 -1.66699 18 -2s9.83398 0.166992 12.501 1.5v-130h-120v200zM281.999 405.001h-55v135h120v-200h-65v65z" />
<glyph glyph-name="nine" unicode="9"
d="M156 60v-60h195v130c2.66699 -1.33301 7.16699 -1.83301 13.5 -1.5s13 1 20 2s13.5 2.33301 19.5 4s10 3.5 12 5.5c0.666992 0.666992 1.5 4 2.5 10s1.83301 12.5 2.5 19.5s1.33398 13.5 2.00098 19.5s1.66699 9.66699 3 11c2 2 5.83301 3.83301 11.5 5.5s11.667 3 18 4
s12.333 1.66699 18 2s9.83398 -0.166992 12.501 -1.5v330c-2.66699 -1.33301 -6.83398 -1.83301 -12.501 -1.5s-11.667 1 -18 2s-12.333 2.33301 -18 4s-9.5 3.5 -11.5 5.5s-3.83301 5.83301 -5.5 11.5s-3 11.667 -4 18s-1.66699 12.333 -2 18s0.166992 9.83398 1.5 12.501
h-260c1.33301 -2.66699 1.83301 -6.83398 1.5 -12.501s-1 -11.667 -2 -18s-2.33301 -12.333 -4 -18s-3.5 -9.5 -5.5 -11.5s-5.83301 -3.83301 -11.5 -5.5s-11.667 -3 -18 -4s-12.333 -1.66699 -18 -2s-9.83398 0.166992 -12.501 1.5v-260
c2.66699 1.33301 6.83398 1.83301 12.501 1.5s11.667 -1 18 -2s12.333 -2.33301 18 -4s9.5 -3.5 11.5 -5.5s3.83301 -6 5.5 -12s3 -12.5 4 -19.5s1.66699 -13.667 2 -20s-0.166992 -10.833 -1.5 -13.5h120v-70h-50c1.33301 -2.66699 1.83301 -7.16699 1.5 -13.5
s-1 -13 -2 -20s-2.33301 -13.5 -4 -19.5s-3.5 -10 -5.5 -12s-5.83301 -3.83301 -11.5 -5.5s-11.667 -3 -18 -4s-12.333 -1.66699 -18 -2s-9.83398 0.166992 -12.501 1.5zM226 540h120v-260h-120v260z" />
<glyph glyph-name="colon" unicode=":"
d="M193 139v-130h190v130h-190v0zM193 479v-130h190v130h-190v0z" />
<glyph glyph-name="semicolon" unicode=";"
d="M198 -66l-0.000976562 -65.001h120c-1.33301 2.66699 -1.83301 6.83398 -1.5 12.501s1 11.667 2 18s2.33301 12.333 4 18s3.5 9.5 5.5 11.5s5.83301 3.83301 11.5 5.5s11.667 3 18 4s12.333 1.66699 18 2s9.83398 -0.166992 12.501 -1.5v200h-190v-135h50v-70h-50z
M197.999 478.999v-130h190v130h-190z" />
<glyph glyph-name="less" unicode="&#x3c;"
d="M494 0h-102l-301 300l301 310h102v-42l-267 -269l267 -262v-37z" />
<glyph glyph-name="equal" unicode="="
d="M99 283v-60h401v60h-401v0zM99 422v-60h401v60h-401v0z" />
<glyph glyph-name="greater" unicode="&#x3e;"
d="M92 0h102l301 300l-301 310h-102v-42l259 -261l-259 -265v-42z" />
<glyph glyph-name="question" unicode="?"
d="M211 130v-130h120v130h-120zM211 335l0.000976562 -125h125v120c2.66699 -1.33301 7.16699 -1.83301 13.5 -1.5s13 1 20 2s13.5 2.33301 19.5 4s10 3.5 12 5.5c0.666992 0.666992 1.5 4 2.5 10s1.83301 12.5 2.5 19.5s1.33398 13.5 2.00098 19.5s1.66699 9.66699 3 11
c2 2 5.83301 3.83301 11.5 5.5s11.667 3 18 4s12.333 1.66699 18 2s9.83398 -0.166992 12.501 -1.5v130c-2.66699 -1.33301 -6.83398 -1.83301 -12.501 -1.5s-11.667 1 -18 2s-12.333 2.33301 -18 4s-9.5 3.5 -11.5 5.5s-3.83301 5.83301 -5.5 11.5s-3 11.667 -4 18
s-1.66699 12.333 -2 18s0.166992 9.83398 1.5 12.501h-260c1.33301 -2.66699 1.83301 -6.83398 1.5 -12.501s-1 -11.667 -2 -18s-2.33301 -12.333 -4 -18s-3.5 -9.5 -5.5 -11.5s-5.83301 -3.83301 -11.5 -5.5s-11.667 -3 -18 -4s-12.333 -1.66699 -18 -2
s-9.83398 0.166992 -12.501 1.5v-130h135v130h125v-130c-2.66699 1.33301 -6.83398 1.83301 -12.501 1.5s-11.667 -1 -18 -2s-12.333 -2.33301 -18 -4s-9.5 -3.5 -11.5 -5.5s-3.83301 -6 -5.5 -12s-3 -12.5 -4 -19.5s-1.66699 -13.667 -2 -20s0.166992 -10.833 1.5 -13.5
h-50z" />
<glyph glyph-name="at" unicode="@"
d="M7 71c2.66699 1.33301 6.83301 1.83398 12.5 1.50098s11.667 -1 18 -2s12.333 -2.33301 18 -4s9.5 -3.5 11.5 -5.5s3.83301 -5.83301 5.5 -11.5s3 -11.667 4 -18s1.66699 -12.333 2 -18s-0.166992 -9.83398 -1.5 -12.501h470v65h-400v481h265v-141h-140v-70h-55v-130h55
v-65h275v404h-66l-4 66h-406v-65l-64 -1v-474zM358.999 335.001h72v-130h-72v130z" />
<glyph glyph-name="A" unicode="A"
d="M59 470l0.00390625 -470h135v200h130v-200h135v470c-2.66699 -1.33301 -6.83398 -1.83301 -12.501 -1.5s-11.667 1 -18 2s-12.333 2.33301 -18 4s-9.5 3.5 -11.5 5.5c-1.33301 0.666992 -2.33301 4 -3 10s-1.33398 12.5 -2.00098 19.5s-1.5 13.5 -2.5 19.5
s-1.83301 9.66699 -2.5 11c-1.33301 0.666992 -5 1.5 -11 2.5s-12.5 1.83301 -19.5 2.5s-13.5 1.33398 -19.5 2.00098s-9.33301 1.66699 -10 3c-2 2 -3.83301 5.83301 -5.5 11.5s-3 11.667 -4 18s-1.66699 12.333 -2 18s0.166992 9.83398 1.5 12.501h-120
c1.33301 -2.66699 1.83301 -6.83398 1.5 -12.501s-1 -11.667 -2 -18s-2.33301 -12.333 -4 -18s-3.5 -9.5 -5.5 -11.5c-1.33301 -1.33301 -5 -2.33301 -11 -3s-12.5 -1.33398 -19.5 -2.00098s-13.5 -1.5 -19.5 -2.5s-9.33301 -1.83301 -10 -2.5
c-1.33301 -1.33301 -2.33301 -5 -3 -11s-1.33398 -12.5 -2.00098 -19.5s-1.5 -13.5 -2.5 -19.5s-1.83301 -9.33301 -2.5 -10c-2 -2 -5.83301 -3.83301 -11.5 -5.5s-11.667 -3 -18 -4s-12.333 -1.66699 -18 -2s-9.83398 0.166992 -12.501 1.5zM199.004 470h120v-190h-120v190
z" />
<glyph glyph-name="B" unicode="B"
d="M62 610v-610.002h330c-1.33301 2.66699 -1.83301 6.83398 -1.5 12.501s1 11.667 2 18s2.33301 12.333 4 18s3.5 9.5 5.5 11.5s5.83301 3.83301 11.5 5.5s11.667 3 18 4s12.333 1.66699 18 2s9.83398 -0.166992 12.501 -1.5v205h-60v60h60v205
c-2.66699 -1.33301 -6.83398 -1.83301 -12.501 -1.5s-11.667 1 -18 2s-12.333 2.33301 -18 4s-9.5 3.5 -11.5 5.5s-3.83301 5.83301 -5.5 11.5s-3 11.667 -4 18s-1.66699 12.333 -2 18s0.166992 9.83398 1.5 12.501h-330zM202 269.998h120v-200h-120v200zM202 539.998h120
v-200h-120v200z" />
<glyph glyph-name="C" unicode="C"
d="M59 70c2.66699 1.33301 6.83398 1.83301 12.501 1.5s11.667 -1 18 -2s12.333 -2.33301 18 -4s9.5 -3.5 11.5 -5.5s3.83301 -5.83301 5.5 -11.5s3 -11.667 4 -18s1.66699 -12.333 2 -18s-0.166992 -9.83398 -1.5 -12.501h260
c-1.33301 2.66699 -1.83301 6.83398 -1.5 12.501s1 11.667 2 18s2.33301 12.333 4 18s3.5 9.5 5.5 11.5s5.83301 3.83301 11.5 5.5s11.667 3 18 4s12.333 1.66699 18 2s9.83398 -0.166992 12.501 -1.5v130h-135v-130h-125v470h125v-130h135v130
c-2.66699 -1.33301 -6.83398 -1.83301 -12.501 -1.5s-11.667 1 -18 2s-12.333 2.33301 -18 4s-9.5 3.5 -11.5 5.5s-3.83301 5.83301 -5.5 11.5s-3 11.667 -4 18s-1.66699 12.333 -2 18s0.166992 9.83398 1.5 12.501h-260c1.33301 -2.66699 1.83301 -6.83398 1.5 -12.501
s-1 -11.667 -2 -18s-2.33301 -12.333 -4 -18s-3.5 -9.5 -5.5 -11.5s-5.83301 -3.83301 -11.5 -5.5s-11.667 -3 -18 -4s-12.333 -1.66699 -18 -2s-9.83398 0.166992 -12.501 1.5v-470z" />
<glyph glyph-name="D" unicode="D"
d="M54 610v-610.004h260c-1.33301 2.66699 -1.83301 6.83398 -1.5 12.501s1 11.667 2 18s2.33301 12.333 4 18s3.5 9.5 5.5 11.5c0.666992 0.666992 4 1.5 10 2.5s12.5 1.83301 19.5 2.5s13.5 1.33398 19.5 2.00098s9.66699 1.66699 11 3c0.666992 0.666992 1.5 4 2.5 10
s1.83301 12.5 2.5 19.5s1.33398 13.5 2.00098 19.5s1.66699 9.66699 3 11c2 2 5.83301 3.83301 11.5 5.5s11.667 3 18 4s12.333 1.66699 18 2s9.83398 -0.166992 12.501 -1.5v330c-2.66699 -1.33301 -6.83398 -1.83301 -12.501 -1.5s-11.667 1 -18 2s-12.333 2.33301 -18 4
s-9.5 3.5 -11.5 5.5c-1.33301 0.666992 -2.33301 4 -3 10s-1.33398 12.5 -2.00098 19.5s-1.5 13.5 -2.5 19.5s-1.83301 9.66699 -2.5 11c-1.33301 0.666992 -5 1.5 -11 2.5s-12.5 1.83301 -19.5 2.5s-13.5 1.33398 -19.5 2.00098s-9.33301 1.66699 -10 3
c-2 2 -3.83301 5.83301 -5.5 11.5s-3 11.667 -4 18s-1.66699 12.333 -2 18s0.166992 9.83398 1.5 12.501h-260zM194 539.996l50 0.00195312c-1.33301 -2.66699 -1.83301 -6.83398 -1.5 -12.501s1 -11.667 2 -18s2.33301 -12.333 4 -18s3.5 -9.5 5.5 -11.5
s5.83301 -3.83301 11.5 -5.5s11.667 -3 18 -4s12.333 -1.66699 18 -2s9.83398 0.166992 12.501 1.5v-330c-2.66699 1.33301 -6.83398 1.83301 -12.501 1.5s-11.667 -1 -18 -2s-12.333 -2.33301 -18 -4s-9.5 -3.5 -11.5 -5.5s-3.83301 -5.83301 -5.5 -11.5s-3 -11.667 -4 -18
s-1.66699 -12.333 -2 -18s0.166992 -9.83398 1.5 -12.501h-50v470z" />
<glyph glyph-name="E" unicode="E"
d="M59 610v-610h400v65h-260v210h190v60h-190v210h260v65h-400v0z" />
<glyph glyph-name="F" unicode="F"
d="M59 610v-610h135v275h195v60h-190v210h260v65h-400v0z" />
<glyph glyph-name="G" unicode="G"
d="M59 70c2.66699 1.33301 6.83496 1.83398 12.502 1.50098s11.667 -1 18 -2s12.333 -2.33301 18 -4s9.5 -3.5 11.5 -5.5s3.83301 -5.83301 5.5 -11.5s3 -11.667 4 -18s1.66699 -12.333 2 -18s-0.166992 -9.83398 -1.5 -12.501h330v270h-200v-65h60v-135h-120v470h125v-130
h135v130c-2.66699 -1.33301 -6.83398 -1.83301 -12.501 -1.5s-11.667 1 -18 2s-12.333 2.33301 -18 4s-9.5 3.5 -11.5 5.5s-3.83301 5.83301 -5.5 11.5s-3 11.667 -4 18s-1.66699 12.333 -2 18s0.166992 9.83398 1.5 12.501h-260
c1.33301 -2.66699 1.83301 -6.83398 1.5 -12.501s-1 -11.667 -2 -18s-2.33301 -12.333 -4 -18s-3.5 -9.5 -5.5 -11.5s-5.83301 -3.83301 -11.5 -5.5s-11.667 -3 -18 -4s-12.333 -1.66699 -18 -2s-9.83398 0.166992 -12.501 1.5v-470z" />
<glyph glyph-name="H" unicode="H"
d="M59 610v-610h135v270h130v-270h135v610h-135v-270h-130v270h-135v0z" />
<glyph glyph-name="I" unicode="I"
d="M124 65v-65h260v65h-60v480h60v65h-260v-65h60v-480h-60v0z" />
<glyph glyph-name="J" unicode="J"
d="M59 70c2.66699 1.33301 6.83203 1.83301 12.499 1.5s11.667 -1 18 -2s12.333 -2.33301 18 -4s9.5 -3.5 11.5 -5.5s3.83301 -5.83301 5.5 -11.5s3 -11.667 4 -18s1.66699 -12.333 2 -18s-0.166992 -9.83398 -1.5 -12.501h260
c-1.33301 2.66699 -1.83301 6.83398 -1.5 12.501s1 11.667 2 18s2.33301 12.333 4 18s3.5 9.5 5.5 11.5s5.83301 3.83301 11.5 5.5s11.667 3 18 4s12.333 1.66699 18 2s9.83398 -0.166992 12.501 -1.5v540h-135v-540h-130v130h-135v-130z" />
<glyph glyph-name="K" unicode="K"
d="M56 610v-610h135v270h60v-135h70v-135h135v135h-65v140h-65v60h65v140h65v135h-135v-135h-70v-135h-60v270h-135v0z" />
<glyph glyph-name="L" unicode="L"
d="M59 610v-610h400v65h-265v545h-135v0z" />
<glyph glyph-name="M" unicode="M"
d="M44 610v-610h135v405h55v70h-55v135h-135zM379 400l0.00195312 -400h135v610h-135v-130c-2.66699 1.33301 -7.16699 1.83301 -13.5 1.5s-13 -1 -20 -2s-13.5 -2.33301 -19.5 -4s-10 -3.5 -12 -5.5c-1.33301 -1.33301 -2.33301 -5 -3 -11s-1.33398 -12.5 -2.00098 -19.5
s-1.5 -13.5 -2.5 -19.5s-1.83301 -9.33301 -2.5 -10c-2 -2 -5.83301 -3.83301 -11.5 -5.5s-11.667 -3 -18 -4s-12.333 -1.66699 -18 -2s-9.83398 0.166992 -12.501 1.5v-190h65v190h70z" />
<glyph glyph-name="N" unicode="N"
d="M56 610v-610h135v350l200 -176v-174h135v610h-135v-301l-200 191v110h-135z" />
<glyph glyph-name="O" unicode="O"
d="M75 69c2.66699 1.33301 6.83398 1.83301 12.501 1.5s11.667 -1 18 -2s12.333 -2.33301 18 -4s9.5 -3.5 11.5 -5.5s3.83301 -5.83301 5.5 -11.5s3 -11.667 4 -18s1.66699 -12.333 2 -18s-0.166992 -9.83398 -1.5 -12.501h260
c-1.33301 2.66699 -1.83301 6.83398 -1.5 12.501s1 11.667 2 18s2.33301 12.333 4 18s3.5 9.5 5.5 11.5s5.83301 3.83301 11.5 5.5s11.667 3 18 4s12.333 1.66699 18 2s9.83398 -0.166992 12.501 -1.5v470c-2.66699 -1.33301 -6.83398 -1.83301 -12.501 -1.5
s-11.667 1 -18 2s-12.333 2.33301 -18 4s-9.5 3.5 -11.5 5.5s-3.83301 5.83301 -5.5 11.5s-3 11.667 -4 18s-1.66699 12.333 -2 18s0.166992 9.83398 1.5 12.501h-260c1.33301 -2.66699 1.83301 -6.83398 1.5 -12.501s-1 -11.667 -2 -18s-2.33301 -12.333 -4 -18
s-3.5 -9.5 -5.5 -11.5s-5.83301 -3.83301 -11.5 -5.5s-11.667 -3 -18 -4s-12.333 -1.66699 -18 -2s-9.83398 0.166992 -12.501 1.5v-470zM215 539h120v-470h-120v470z" />
<glyph glyph-name="P" unicode="P"
d="M57 615v-615h139v275h200v60h65v209l-65 1v70h-339v0zM196 544h129v-209h-129v209v0z" />
<glyph glyph-name="Q" unicode="Q"
d="M247 0c-1.33301 -2.66699 -1.83203 -7.16504 -1.49902 -13.498s1 -13 2 -20s2.33301 -13.5 4 -19.5s3.5 -10 5.5 -12c0.666992 -1.33301 4 -2.33301 10 -3s12.5 -1.33398 19.5 -2.00098s13.5 -1.5 19.5 -2.5s9.66699 -1.83301 11 -2.5c2 -2 3.83301 -5.83301 5.5 -11.5
s3 -11.667 4 -18s1.66699 -12.333 2 -18s-0.166992 -9.83398 -1.5 -12.501h130v65h-60v140h60v475c-2.66699 -1.33301 -6.83398 -1.83301 -12.501 -1.5s-11.667 1 -18 2s-12.333 2.33301 -18 4s-9.5 3.5 -11.5 5.5s-3.83301 5.83301 -5.5 11.5s-3 11.667 -4 18
s-1.66699 12.333 -2 18s0.166992 9.83398 1.5 12.501h-260c1.33301 -2.66699 1.83301 -6.83398 1.5 -12.501s-1 -11.667 -2 -18s-2.33301 -12.333 -4 -18s-3.5 -9.5 -5.5 -11.5s-5.83301 -3.83301 -11.5 -5.5s-11.667 -3 -18 -4s-12.333 -1.66699 -18 -2
s-9.83398 0.166992 -12.501 1.5v-470c2.66699 1.33301 6.83398 1.83301 12.501 1.5s11.667 -1 18 -2s12.333 -2.33301 18 -4s9.5 -3.5 11.5 -5.5s3.83301 -6 5.5 -12s3 -12.5 4 -19.5s1.66699 -13.667 2 -20s-0.166992 -10.833 -1.5 -13.5h120zM197.001 545.002h120v-470
h-120v470z" />
<glyph glyph-name="R" unicode="R"
d="M79 610l0.000976562 -610h135v270h55c-1.33301 -2.66699 -1.83301 -6.83398 -1.5 -12.501s1 -11.667 2 -18s2.33301 -12.333 4 -18s3.5 -9.5 5.5 -11.5s6 -3.83301 12 -5.5s12.5 -3 19.5 -4s13.667 -1.66699 20 -2s10.833 0.166992 13.5 1.5v-200h135v205h-60v130h60v205
c-2.66699 -1.33301 -6.83398 -1.83301 -12.501 -1.5s-11.667 1 -18 2s-12.333 2.33301 -18 4s-9.5 3.5 -11.5 5.5s-3.83301 5.83301 -5.5 11.5s-3 11.667 -4 18s-1.66699 12.333 -2 18s0.166992 9.83398 1.5 12.501h-330zM219.001 540h120v-200h-120v200z" />
<glyph glyph-name="S" unicode="S"
d="M51 70c2.66699 1.33301 6.83203 1.83398 12.499 1.50098s11.667 -1 18 -2s12.333 -2.33301 18 -4s9.5 -3.5 11.5 -5.5s3.83301 -5.83301 5.5 -11.5s3 -11.667 4 -18s1.66699 -12.333 2 -18s-0.166992 -9.83398 -1.5 -12.501h260
c-1.33301 2.66699 -1.83301 6.83398 -1.5 12.501s1 11.667 2 18s2.33301 12.333 4 18s3.5 9.5 5.5 11.5s5.83301 3.83301 11.5 5.5s11.667 3 18 4s12.333 1.66699 18 2s9.83398 -0.166992 12.501 -1.5v130c-2.66699 -1.33301 -6.83398 -1.83301 -12.501 -1.5
s-11.667 1 -18 2s-12.333 2.33301 -18 4s-9.5 3.5 -11.5 5.5c-1.33301 0.666992 -2.33301 4 -3 10s-1.33398 12.5 -2.00098 19.5s-1.5 13.5 -2.5 19.5s-1.83301 9.66699 -2.5 11c-2 2 -6 3.83301 -12 5.5s-12.5 3 -19.5 4s-13.667 1.66699 -20 2
s-10.833 -0.166992 -13.5 -1.5v50c-2.66699 -1.33301 -7.33398 -2 -14.001 -2c-6 0 -12.5 0.5 -19.5 1.5s-13.5 2.5 -19.5 4.5s-10 4 -12 6s-4 6 -6 12s-3.5 12.5 -4.5 19.5s-1.5 13.5 -1.5 19.5c0 6.66699 0.666992 11.334 2 14.001h-50v135h125v-60h135v60
c-2.66699 -1.33301 -6.83398 -1.83301 -12.501 -1.5s-11.667 1 -18 2s-12.333 2.33301 -18 4s-9.5 3.5 -11.5 5.5s-3.83301 5.83301 -5.5 11.5s-3 11.667 -4 18s-1.66699 12.333 -2 18s0.166992 9.83398 1.5 12.501h-260c1.33301 -2.66699 1.83301 -6.83398 1.5 -12.501
s-1 -11.667 -2 -18s-2.33301 -12.333 -4 -18s-3.5 -9.5 -5.5 -11.5s-5.83301 -3.83301 -11.5 -5.5s-11.667 -3 -18 -4s-12.333 -1.66699 -18 -2s-9.83398 0.166992 -12.501 1.5v-130c2.66699 1.33301 6.83398 1.83301 12.501 1.5s11.667 -1 18 -2s12.333 -2.33301 18 -4
s9.5 -3.5 11.5 -5.5c0.666992 -1.33301 1.5 -5 2.5 -11s1.83301 -12.5 2.5 -19.5s1.33398 -13.5 2.00098 -19.5s1.66699 -9.33301 3 -10c2 -2 5.83301 -3.83301 11.5 -5.5s11.667 -3 18 -4s12.333 -1.66699 18 -2s9.83398 0.166992 12.501 1.5
c-1.33301 -2 -1.66602 -5.5 -0.999023 -10.5s1.5 -10.167 2.5 -15.5s2.33301 -10.333 4 -15s3.16699 -7.66699 4.5 -9s4.33301 -2.83301 9 -4.5s9.66699 -3 15 -4s10.5 -1.83301 15.5 -2.5s8.5 -0.333984 10.5 0.999023c-1.33301 -2.66699 -1.83301 -6.83398 -1.5 -12.501
s1 -11.667 2 -18s2.33301 -12.333 4 -18s3.5 -9.5 5.5 -11.5s5.83301 -3.83301 11.5 -5.5s11.667 -3 18 -4s12.333 -1.66699 18 -2s9.83398 0.166992 12.501 1.5v-130h-125v60h-135v-60z" />
<glyph glyph-name="T" unicode="T"
d="M194 545v-545h130v545h135v65h-400v-65h135v0z" />
<glyph glyph-name="U" unicode="U"
d="M56 70c2.66699 1.33301 6.83203 1.83301 12.499 1.5s11.667 -1 18 -2s12.333 -2.33301 18 -4s9.5 -3.5 11.5 -5.5s3.83301 -5.83301 5.5 -11.5s3 -11.667 4 -18s1.66699 -12.333 2 -18s-0.166992 -9.83398 -1.5 -12.501h260
c-1.33301 2.66699 -1.83301 6.83398 -1.5 12.501s1 11.667 2 18s2.33301 12.333 4 18s3.5 9.5 5.5 11.5s5.83301 3.83301 11.5 5.5s11.667 3 18 4s12.333 1.66699 18 2s9.83398 -0.166992 12.501 -1.5v540h-135v-540h-130v540h-135v-540z" />
<glyph glyph-name="V" unicode="V"
d="M54 140c2.66699 1.33301 6.83008 1.83301 12.4971 1.5s11.667 -1 18 -2s12.333 -2.33301 18 -4s9.5 -3.5 11.5 -5.5c0.666992 -1.33301 1.5 -5 2.5 -11s1.83301 -12.5 2.5 -19.5s1.33398 -13.5 2.00098 -19.5s1.66699 -9.33301 3 -10c0.666992 -1.33301 4 -2.33301 10 -3
s12.5 -1.33398 19.5 -2.00098s13.5 -1.5 19.5 -2.5s9.66699 -1.83301 11 -2.5c2 -2 3.83301 -5.83301 5.5 -11.5s3 -11.667 4 -18s1.66699 -12.333 2 -18s-0.166992 -9.83398 -1.5 -12.501h120c-1.33301 2.66699 -1.83301 6.83398 -1.5 12.501s1 11.667 2 18
s2.33301 12.333 4 18s3.5 9.5 5.5 11.5c0.666992 0.666992 4 1.5 10 2.5s12.5 1.83301 19.5 2.5s13.5 1.33398 19.5 2.00098s9.66699 1.66699 11 3c0.666992 0.666992 1.5 4 2.5 10s1.83301 12.5 2.5 19.5s1.33398 13.5 2.00098 19.5s1.66699 9.66699 3 11
c2 2 5.83301 3.83301 11.5 5.5s11.667 3 18 4s12.333 1.66699 18 2s9.83398 -0.166992 12.501 -1.5v470h-135v-470h-130v470h-135v-470z" />
<glyph glyph-name="W" unicode="W"
d="M119 205v-205h130v205h65v195h-65v-190h-60v400h-135v-405h65v0zM324 205v-205h135v205h65v405h-135v-405h-65v0z" />
<glyph glyph-name="X" unicode="X"
d="M56 200v-199.999h135v270h55c-1.33301 -2.66699 -1.83301 -6.83398 -1.5 -12.501s1 -11.667 2 -18s2.33301 -12.333 4 -18s3.5 -9.5 5.5 -11.5s6 -3.83301 12 -5.5s12.5 -3 19.5 -4s13.667 -1.66699 20 -2s10.833 0.166992 13.5 1.5v-200h135v200
c-2.66699 -1.33301 -6.83398 -1.83301 -12.501 -1.5s-11.667 1 -18 2s-12.333 2.33301 -18 4s-9.5 3.5 -11.5 5.5c-1.33301 0.666992 -2.33301 4 -3 10s-1.33398 12.5 -2.00098 19.5s-1.5 13.5 -2.5 19.5s-1.83301 9.66699 -2.5 11c-2 2 -5.83301 3.83301 -11.5 5.5
s-11.667 3 -18 4s-12.333 1.66699 -18 2s-9.83398 -0.166992 -12.501 -1.5v120c2.66699 -1.33301 6.83398 -1.83301 12.501 -1.5s11.667 1 18 2s12.333 2.33301 18 4s9.5 3.5 11.5 5.5c0.666992 0.666992 1.5 4 2.5 10s1.83301 12.5 2.5 19.5s1.33398 13.5 2.00098 19.5
s1.66699 9.66699 3 11c2 2 5.83301 3.83301 11.5 5.5s11.667 3 18 4s12.333 1.66699 18 2s9.83398 -0.166992 12.501 -1.5v130h-135v-200h-70v65h-60v135h-135v-130c2.66699 1.33301 6.83398 1.83301 12.501 1.5s11.667 -1 18 -2s12.333 -2.33301 18 -4s9.5 -3.5 11.5 -5.5
c0.666992 -1.33301 1.5 -5 2.5 -11s1.83301 -12.5 2.5 -19.5s1.33398 -13.5 2.00098 -19.5s1.66699 -9.33301 3 -10c2 -2 5.83301 -3.83301 11.5 -5.5s11.667 -3 18 -4s12.333 -1.66699 18 -2s9.83398 0.166992 12.501 1.5v-120
c-2.66699 1.33301 -6.83398 1.83301 -12.501 1.5s-11.667 -1 -18 -2s-12.333 -2.33301 -18 -4s-9.5 -3.5 -11.5 -5.5c-1.33301 -1.33301 -2.33301 -5 -3 -11s-1.33398 -12.5 -2.00098 -19.5s-1.5 -13.5 -2.5 -19.5s-1.83301 -9.33301 -2.5 -10
c-2 -2 -5.83301 -3.83301 -11.5 -5.5s-11.667 -3 -18 -4s-12.333 -1.66699 -18 -2s-9.83398 0.166992 -12.501 1.5z" />
<glyph glyph-name="Y" unicode="Y"
d="M189 275v-275h130v275h70v60h65v275h-135v-270h-130v270h-135v-275h65v-60h70v0z" />
<glyph glyph-name="Z" unicode="Z"
d="M56 200l0.00195312 -200.001h400v65h-260v140h50c-1.33301 2.66699 -2 7 -2 13c0 6.66699 0.5 13.5 1.5 20.5s2.5 13.5 4.5 19.5s4 10 6 12s6 4 12 6s12.5 3.5 19.5 4.5s13.5 1.5 19.5 1.5c6.66699 0 11.334 -0.666992 14.001 -2v50
c2.66699 -1.33301 7.16699 -1.83301 13.5 -1.5s13 1 20 2s13.5 2.33301 19.5 4s10 3.5 12 5.5c0.666992 0.666992 1.5 4 2.5 10s1.83301 12.5 2.5 19.5s1.33398 13.5 2.00098 19.5s1.66699 9.66699 3 11c2 2 5.83301 3.83301 11.5 5.5s11.667 3 18 4s12.333 1.66699 18 2
s9.83398 -0.166992 12.501 -1.5v200h-400v-65h260v-135c-2.66699 1.33301 -6.83398 1.83301 -12.501 1.5s-11.667 -1 -18 -2s-12.333 -2.33301 -18 -4s-9.5 -3.5 -11.5 -5.5s-3.83301 -5.83301 -5.5 -11.5s-3 -11.667 -4 -18s-1.66699 -12.333 -2 -18
s0.166992 -9.83398 1.5 -12.501c-2 0.666992 -5.5 0.833984 -10.5 0.500977s-10.167 -1 -15.5 -2s-10.333 -2.16699 -15 -3.5s-7.66699 -3 -9 -5s-2.83301 -5.16699 -4.5 -9.5s-3 -9.16602 -4 -14.499s-1.83301 -10.5 -2.5 -15.5s-0.333984 -8.5 0.999023 -10.5
c-2.66699 1.33301 -6.83398 1.83301 -12.501 1.5s-11.667 -1 -18 -2s-12.333 -2.33301 -18 -4s-9.5 -3.5 -11.5 -5.5c-1.33301 -1.33301 -2.33301 -5 -3 -11s-1.33398 -12.5 -2.00098 -19.5s-1.5 -13.5 -2.5 -19.5s-1.83301 -9.33301 -2.5 -10
c-2 -2 -5.83301 -3.83301 -11.5 -5.5s-11.667 -3 -18 -4s-12.333 -1.66699 -18 -2s-9.83398 0.166992 -12.501 1.5z" />
<glyph glyph-name="bracketleft" unicode="["
d="M121 623v-798h269v55h-130v678h130v65h-269v0z" />
<glyph glyph-name="backslash" unicode="\"
d="M372 -60l110 -3l-2 53l-314 625l-84 2v-99z" />
<glyph glyph-name="bracketright" unicode="]"
d="M166 -132v-55h260v810h-260v-65h120v-690h-120v0z" />
<glyph glyph-name="asciicircum" unicode="^"
d="M208 717v-60v0h-60v0v-60v0h-60v0v-60v0h120v0v60h120v0v-60v0h108v0v60v0h-48v0v60v0h-60v0v60v0h-120v0z" />
<glyph glyph-name="underscore" unicode="_"
d="M0 -158v-50h550v50h-550z" />
<glyph glyph-name="grave" unicode="`"
d="M282 589v-69h140v69h-70v140h-199v-70h70v-70h59z" />
<glyph glyph-name="a" unicode="a"
d="M59 70c2.66699 1.33301 6.83496 1.83301 12.502 1.5s11.667 -1 18 -2s12.333 -2.33301 18 -4s9.5 -3.5 11.5 -5.5s3.83301 -5.83301 5.5 -11.5s3 -11.667 4 -18s1.66699 -12.333 2 -18s-0.166992 -9.83398 -1.5 -12.501h330v400
c-2.66699 -1.33301 -6.83398 -1.83301 -12.501 -1.5s-11.667 1 -18 2s-12.333 2.33301 -18 4s-9.5 3.5 -11.5 5.5s-3.83301 5.83301 -5.5 11.5s-3 11.667 -4 18s-1.66699 12.333 -2 18s0.166992 9.83398 1.5 12.501h-260v-65h190v-130h-190
c1.33301 -2.66699 1.83301 -7.16699 1.5 -13.5s-1 -13 -2 -20s-2.33301 -13.5 -4 -19.5s-3.5 -10 -5.5 -12s-5.83301 -3.83301 -11.5 -5.5s-11.667 -3 -18 -4s-12.333 -1.66699 -18 -2s-9.83398 0.166992 -12.501 1.5v-130zM199.001 200h120v-130h-120v130z" />
<glyph glyph-name="b" unicode="b"
d="M97 610l-0.000976562 -610.001h330c-1.33301 2.66699 -1.83301 6.83398 -1.5 12.501s1 11.667 2 18s2.33301 12.333 4 18s3.5 9.5 5.5 11.5s5.83301 3.83301 11.5 5.5s11.667 3 18 4s12.333 1.66699 18 2s9.83398 -0.166992 12.501 -1.5v330h-66v75h-199v135h-135z
M236.999 399.999h120v-330h-120v330z" />
<glyph glyph-name="c" unicode="c"
d="M56 70c2.66699 1.33301 6.83398 1.83301 12.501 1.5s11.667 -1 18 -2s12.333 -2.33301 18 -4s9.5 -3.5 11.5 -5.5s3.83301 -5.83301 5.5 -11.5s3 -11.667 4 -18s1.66699 -12.333 2 -18s-0.166992 -9.83398 -1.5 -12.501h260
c-1.33301 2.66699 -1.83301 6.83398 -1.5 12.501s1 11.667 2 18s2.33301 12.333 4 18s3.5 9.5 5.5 11.5s5.83301 3.83301 11.5 5.5s11.667 3 18 4s12.333 1.66699 18 2s9.83398 -0.166992 12.501 -1.5v60h-135v-60h-125v330h125v-60h135v60
c-2.66699 -1.33301 -6.83398 -1.83301 -12.501 -1.5s-11.667 1 -18 2s-12.333 2.33301 -18 4s-9.5 3.5 -11.5 5.5s-3.83301 5.83301 -5.5 11.5s-3 11.667 -4 18s-1.66699 12.333 -2 18s0.166992 9.83398 1.5 12.501h-260c1.33301 -2.66699 1.83301 -6.83398 1.5 -12.501
s-1 -11.667 -2 -18s-2.33301 -12.333 -4 -18s-3.5 -9.5 -5.5 -11.5s-5.83301 -3.83301 -11.5 -5.5s-11.667 -3 -18 -4s-12.333 -1.66699 -18 -2s-9.83398 0.166992 -12.501 1.5v-330z" />
<glyph glyph-name="d" unicode="d"
d="M59 70c2.66699 1.33301 6.83398 1.83398 12.501 1.50098s11.667 -1 18 -2s12.333 -2.33301 18 -4s9.5 -3.5 11.5 -5.5s3.83301 -5.83301 5.5 -11.5s3 -11.667 4 -18s1.66699 -12.333 2 -18s-0.166992 -9.83398 -1.5 -12.501h330v610h-135v-135h-195
c1.33301 -2.66699 1.83301 -7.16699 1.5 -13.5s-1 -13 -2 -20s-2.33301 -13.5 -4 -19.5s-3.5 -10 -5.5 -12s-5.83301 -3.83301 -11.5 -5.5s-11.667 -3 -18 -4s-12.333 -1.66699 -18 -2s-9.83398 0.166992 -12.501 1.5v-330zM199 400.001h120v-330h-120v330z" />
<glyph glyph-name="e" unicode="e"
d="M51 70c2.66699 1.33301 6.83496 1.83398 12.502 1.50098s11.667 -1 18 -2s12.333 -2.33301 18 -4s9.5 -3.5 11.5 -5.5s3.83301 -5.83301 5.5 -11.5s3 -11.667 4 -18s1.66699 -12.333 2 -18s-0.166992 -9.83398 -1.5 -12.501h260v65h-190v140h260v195
c-2.66699 -1.33301 -6.83398 -1.83301 -12.501 -1.5s-11.667 1 -18 2s-12.333 2.33301 -18 4s-9.5 3.5 -11.5 5.5s-3.83301 5.83301 -5.5 11.5s-3 11.667 -4 18s-1.66699 12.333 -2 18s0.166992 9.83398 1.5 12.501h-260c1.33301 -2.66699 1.83301 -6.83398 1.5 -12.501
s-1 -11.667 -2 -18s-2.33301 -12.333 -4 -18s-3.5 -9.5 -5.5 -11.5s-5.83301 -3.83301 -11.5 -5.5s-11.667 -3 -18 -4s-12.333 -1.66699 -18 -2s-9.83398 0.166992 -12.501 1.5v-330zM191.001 400.001h120v-120h-120v120z" />
<glyph glyph-name="f" unicode="f"
d="M124 275v-275h130v275h209v61h-208v211h208v67h-267v-68h-72v-211h-70v-60h70v0z" />
<glyph glyph-name="g" unicode="g"
d="M62 -140v-54.999h335v55h65v615h-330c1.33301 -2.66699 1.83301 -6.83398 1.5 -12.501s-1 -11.667 -2 -18s-2.33301 -12.333 -4 -18s-3.5 -9.5 -5.5 -11.5s-5.83301 -3.83301 -11.5 -5.5s-11.667 -3 -18 -4s-12.333 -1.66699 -18 -2s-9.83398 0.166992 -12.501 1.5v-330
c2.66699 1.33301 6.83398 1.83301 12.501 1.5s11.667 -1 18 -2s12.333 -2.33301 18 -4s9.5 -3.5 11.5 -5.5s3.83301 -6 5.5 -12s3 -12.5 4 -19.5s1.66699 -13.667 2 -20s-0.166992 -10.833 -1.5 -13.5h190v-140h-260zM202 405.001h120v-330h-120v330z" />
<glyph glyph-name="h" unicode="h"
d="M62 610l0.000976562 -610h135v400h130v-400h135v400c-2.66699 -1.33301 -6.83398 -1.83301 -12.501 -1.5s-11.667 1 -18 2s-12.333 2.33301 -18 4s-9.5 3.5 -11.5 5.5s-3.83301 6 -5.5 12s-3 12.5 -4 19.5s-1.66699 13.667 -2 20s0.166992 10.833 1.5 13.5h-195v135h-135
z" />
<glyph glyph-name="i" unicode="i"
d="M59 65v-65h400v65h-135v405h-265v-65h130v-340h-130v0zM199 660v-110h120v110h-120v0z" />
<glyph glyph-name="j" unicode="j"
d="M59 -155v-55h265v55h65v615h-260v-65h120v-550h-190v0zM259 650v-110h130v110h-130v0z" />
<glyph glyph-name="k" unicode="k"
d="M62 610l0.00292969 -609.999h135v200h55c-1.33301 -2.66699 -1.83301 -6.83398 -1.5 -12.501s1 -11.667 2 -18s2.33301 -12.333 4 -18s3.5 -9.5 5.5 -11.5s6 -3.83301 12 -5.5s12.5 -3 19.5 -4s13.667 -1.66699 20 -2s10.833 0.166992 13.5 1.5v-130h135v130
c-2.66699 -1.33301 -6.83398 -1.83301 -12.501 -1.5s-11.667 1 -18 2s-12.333 2.33301 -18 4s-9.5 3.5 -11.5 5.5c-1.33301 0.666992 -2.33301 4 -3 10s-1.33398 12.5 -2.00098 19.5s-1.5 13.5 -2.5 19.5s-1.83301 9.66699 -2.5 11c-2 2 -5.83301 3.83301 -11.5 5.5
s-11.667 3 -18 4s-12.333 1.66699 -18 2s-9.83398 -0.166992 -12.501 -1.5v65h65v60h65v135h-135v-135h-65c1.33301 -2 1.83301 -5.66699 1.5 -11s-1 -11 -2 -17s-2.33301 -11.5 -4 -16.5s-3.5 -8.5 -5.5 -10.5s-5.66699 -2 -11 0s-10.833 4.5 -16.5 7.5l-16.5 8.5
c-5.33301 2.66699 -9 4 -11 4v310h-135z" />
<glyph glyph-name="l" unicode="l"
d="M59 65v-65h400v65h-135v545h-265v-65h130v-480h-130v0z" />
<glyph glyph-name="m" unicode="m"
d="M59 470v-470h135v400h60v-330h70v330h70v-400h135v400h-65v70h-405v0z" />
<glyph glyph-name="n" unicode="n"
d="M59 470v-470h135v400h130v-400h135v400l-65 7v63h-335v0z" />
<glyph glyph-name="o" unicode="o"
d="M59 70c2.66699 1.33301 6.83398 1.83301 12.501 1.5s11.667 -1 18 -2s12.333 -2.33301 18 -4s9.5 -3.5 11.5 -5.5s3.83301 -5.83301 5.5 -11.5s3 -11.667 4 -18s1.66699 -12.333 2 -18s-0.166992 -9.83398 -1.5 -12.501h260
c-1.33301 2.66699 -1.83301 6.83398 -1.5 12.501s1 11.667 2 18s2.33301 12.333 4 18s3.5 9.5 5.5 11.5s5.83301 3.83301 11.5 5.5s11.667 3 18 4s12.333 1.66699 18 2s9.83398 -0.166992 12.501 -1.5v330c-2.66699 -1.33301 -6.83398 -1.83301 -12.501 -1.5
s-11.667 1 -18 2s-12.333 2.33301 -18 4s-9.5 3.5 -11.5 5.5s-3.83301 5.83301 -5.5 11.5s-3 11.667 -4 18s-1.66699 12.333 -2 18s0.166992 9.83398 1.5 12.501h-260c1.33301 -2.66699 1.83301 -6.83398 1.5 -12.501s-1 -11.667 -2 -18s-2.33301 -12.333 -4 -18
s-3.5 -9.5 -5.5 -11.5s-5.83301 -3.83301 -11.5 -5.5s-11.667 -3 -18 -4s-12.333 -1.66699 -18 -2s-9.83398 0.166992 -12.501 1.5v-330zM199 400h120v-330h-120v330z" />
<glyph glyph-name="p" unicode="p"
d="M56 470l0.00195312 -664.001h134v193h193c-1.33301 2.66699 -1.83301 7.16699 -1.5 13.5s1 12.833 2 19.5s2.33301 13 4 19s3.5 10.333 5.5 13c2 2 5.66699 3.83301 11 5.5s11.166 3 17.499 4s12.166 1.5 17.499 1.5c6 0 10.333 -0.333008 13 -1v326
c-2.66699 -1.33301 -6.83398 -1.83301 -12.501 -1.5s-11.667 1 -18 2s-12.166 2.33301 -17.499 4s-9 3.5 -11 5.5s-3.83301 5.83301 -5.5 11.5s-3 11.667 -4 18s-1.66699 12.333 -2 18s0.166992 9.83398 1.5 12.501h-327zM195.002 399.999h118v-326h-118v326z" />
<glyph glyph-name="q" unicode="q"
d="M324 1l-0.00390625 -194.002h135v664h-327c0.666992 -2.66699 1.33398 -7.66699 2.00098 -15s1 -15 1 -23s-0.333008 -15.167 -1 -21.5s-2 -9.5 -4 -9.5c-2.66699 0 -7.16699 -0.166992 -13.5 -0.5s-13 -0.666016 -20 -0.999023s-13.833 -0.5 -20.5 -0.5
c-6 0 -10.333 0.666992 -13 2v-327c2.66699 1.33301 7.33398 2.33301 14.001 3s13.834 0.833984 21.501 0.500977s14.834 -0.833008 21.501 -1.5s11 -2 13 -4s3.33301 -6.5 4 -13.5s0.666992 -14.333 0 -22s-1.5 -15 -2.5 -22s-1.83301 -11.833 -2.5 -14.5h192z
M200.996 401.998h119v-327h-119v327z" />
<glyph glyph-name="r" unicode="r"
d="M62 470v-470h135v276l60 1l1 58h204v135h-135l1 -63h-70l-2 -72h-59v135h-135z" />
<glyph glyph-name="s" unicode="s"
d="M62 65v-65h330c-1.33301 2.66699 -1.83301 6.83398 -1.5 12.501s1 11.667 2 18s2.33301 12.333 4 18s3.5 9.5 5.5 11.5s5.83301 3.83301 11.5 5.5s11.667 3 18 4s12.333 1.66699 18 2s9.83398 -0.166992 12.501 -1.5v130
c-2.66699 -1.33301 -6.83398 -1.83301 -12.501 -1.5s-11.667 1 -18 2s-12.333 2.33301 -18 4s-9.5 3.5 -11.5 5.5s-3.83301 6 -5.5 12s-3 12.5 -4 19.5s-1.66699 13.667 -2 20s0.166992 10.833 1.5 13.5h-190v130h260v65h-330
c1.33301 -2.66699 1.83301 -6.83398 1.5 -12.501s-1 -11.667 -2 -18s-2.33301 -12.333 -4 -18s-3.5 -9.5 -5.5 -11.5s-5.83301 -3.83301 -11.5 -5.5s-11.667 -3 -18 -4s-12.333 -1.66699 -18 -2s-9.83398 0.166992 -12.501 1.5v-120
c2.66699 1.33301 6.83398 1.83301 12.501 1.5s11.667 -1 18 -2s12.333 -2.33301 18 -4s9.5 -3.5 11.5 -5.5s3.83301 -6 5.5 -12s3 -12.5 4 -19.5s1.66699 -13.667 2 -20s-0.166992 -10.833 -1.5 -13.5h190v-140h-260z" />
<glyph glyph-name="t" unicode="t"
d="M124 70c2.66699 1.33301 7.16699 1.83398 13.5 1.50098s13 -1 20 -2s13.5 -2.33301 19.5 -4s10 -3.5 12 -5.5s3.83301 -5.83301 5.5 -11.5s3 -11.667 4 -18s1.66699 -12.333 2 -18s-0.166992 -9.83398 -1.5 -12.501h260v65h-200v340h200v70h-205v135h-130v-135h-65v-70
h65v-335z" />
<glyph glyph-name="u" unicode="u"
d="M59 70c2.66699 1.33301 6.83301 1.83398 12.5 1.50098s11.667 -1 18 -2s12.333 -2.33301 18 -4s9.5 -3.5 11.5 -5.5s3.83301 -5.83301 5.5 -11.5s3 -11.667 4 -18s1.66699 -12.333 2 -18s-0.166992 -9.83398 -1.5 -12.501h330v470h-135v-400h-130v400h-135v-400z" />
<glyph glyph-name="v" unicode="v"
d="M59 140c2.66699 1.33301 6.83008 1.83301 12.4971 1.5s11.667 -1 18 -2s12.333 -2.33301 18 -4s9.5 -3.5 11.5 -5.5c0.666992 -1.33301 1.5 -5 2.5 -11s1.83301 -12.5 2.5 -19.5s1.33398 -13.5 2.00098 -19.5s1.66699 -9.33301 3 -10c0.666992 -1.33301 4 -2.33301 10 -3
s12.5 -1.33398 19.5 -2.00098s13.5 -1.5 19.5 -2.5s9.66699 -1.83301 11 -2.5c2 -2 3.83301 -5.83301 5.5 -11.5s3 -11.667 4 -18s1.66699 -12.333 2 -18s-0.166992 -9.83398 -1.5 -12.501h120c-1.33301 2.66699 -1.83301 6.83398 -1.5 12.501s1 11.667 2 18
s2.33301 12.333 4 18s3.5 9.5 5.5 11.5c0.666992 0.666992 4 1.5 10 2.5s12.5 1.83301 19.5 2.5s13.5 1.33398 19.5 2.00098s9.66699 1.66699 11 3c0.666992 0.666992 1.5 4 2.5 10s1.83301 12.5 2.5 19.5s1.33398 13.5 2.00098 19.5s1.66699 9.66699 3 11
c2 2 5.83301 3.83301 11.5 5.5s11.667 3 18 4s12.333 1.66699 18 2s9.83398 -0.166992 12.501 -1.5v330h-135v-330h-130v330h-135v-330z" />
<glyph glyph-name="w" unicode="w"
d="M113 133v-133h129v133h64v263h-64v-257h-59v326h-135v-332h65v0zM316 133v-133h134v133h64v332h-133v-332h-65v0z" />
<glyph glyph-name="x" unicode="x"
d="M59 130l0.00585938 -130h135v130h130v-130h135v130c-2.66699 -1.33301 -6.83398 -1.83301 -12.501 -1.5s-11.667 1 -18 2s-12.333 2.33301 -18 4s-9.5 3.5 -11.5 5.5c-1.33301 0.666992 -2.33301 4 -3 10s-1.33398 12.5 -2.00098 19.5s-1.5 13.5 -2.5 19.5
s-1.83301 9.66699 -2.5 11c-2 2 -5.83301 3.83301 -11.5 5.5s-11.667 3 -18 4s-12.333 1.66699 -18 2s-9.83398 -0.166992 -12.501 -1.5v65h65v60h65v135h-135v-130h-130v130h-135v-135h65v-60h65v-65c-2.66699 1.33301 -6.83398 1.83301 -12.501 1.5s-11.667 -1 -18 -2
s-12.333 -2.33301 -18 -4s-9.5 -3.5 -11.5 -5.5c-1.33301 -1.33301 -2.33301 -5 -3 -11s-1.33398 -12.5 -2.00098 -19.5s-1.5 -13.5 -2.5 -19.5s-1.83301 -9.33301 -2.5 -10c-2 -2 -5.83301 -3.83301 -11.5 -5.5s-11.667 -3 -18 -4s-12.333 -1.66699 -18 -2
s-9.83398 0.166992 -12.501 1.5z" />
<glyph glyph-name="y" unicode="y"
d="M22 -141l-0.00195312 -55h265v50c2.66699 -1.33301 7.16699 -1.83301 13.5 -1.5s13 1 20 2s13.5 2.33301 19.5 4s10 3.5 12 5.5c0.666992 0.666992 1.5 4 2.5 10s1.83301 12.5 2.5 19.5s1.33398 13.5 2.00098 19.5s1.66699 9.66699 3 11c2 2 6 3.83301 12 5.5
s12.5 3 19.5 4s13.667 1.66699 20 2s10.833 -0.166992 13.5 -1.5v135h65v405h-135v-400h-130v400h-135v-400c2.66699 1.33301 6.83398 1.83301 12.501 1.5s11.667 -1 18 -2s12.333 -2.33301 18 -4s9.5 -3.5 11.5 -5.5s3.83301 -6 5.5 -12s3 -12.5 4 -19.5
s1.66699 -13.667 2 -20s-0.166992 -10.833 -1.5 -13.5h120v-70h-55v-70h-205z" />
<glyph glyph-name="z" unicode="z"
d="M59 130l0.000976562 -129.999h400v65h-260v70h50c-1.33301 2.66699 -1.83301 7.16699 -1.5 13.5s1 13 2 20s2.33301 13.5 4 19.5s3.5 10 5.5 12c0.666992 0.666992 4 1.5 10 2.5s12.5 1.83301 19.5 2.5s13.5 1.33398 19.5 2.00098s9.66699 1.66699 11 3
c0.666992 0.666992 1.5 4 2.5 10s1.83301 12.5 2.5 19.5s1.33398 13.5 2.00098 19.5s1.66699 9.66699 3 11c2 2 6 3.83301 12 5.5s12.5 3 19.5 4s13.667 1.66699 20 2s10.833 -0.166992 13.5 -1.5v55h65v135h-400v-65h260v-70h-60c0.666992 -2 1 -5.66699 1 -11
s-0.5 -11 -1.5 -17s-2.33301 -11.5 -4 -16.5s-3.5 -8.5 -5.5 -10.5c-1.33301 -2 -4.33301 -3.83301 -9 -5.5s-9.66699 -3 -15 -4s-10.5 -1.66699 -15.5 -2s-8.5 0.166992 -10.5 1.5c1.33301 -2.66699 1.83301 -6.83398 1.5 -12.501s-1 -11.667 -2 -18
s-2.33301 -12.333 -4 -18s-3.5 -9.5 -5.5 -11.5c-1.33301 -1.33301 -5 -2.33301 -11 -3s-12.5 -1.33398 -19.5 -2.00098s-13.5 -1.5 -19.5 -2.5s-9.33301 -1.83301 -10 -2.5c-1.33301 -1.33301 -2.33301 -5 -3 -11s-1.33398 -12.5 -2.00098 -19.5s-1.5 -13.5 -2.5 -19.5
s-1.83301 -9.33301 -2.5 -10c-2 -2 -5.83301 -3.83301 -11.5 -5.5s-11.667 -3 -18 -4s-12.333 -1.66699 -18 -2s-9.83398 0.166992 -12.501 1.5z" />
<glyph glyph-name="braceleft" unicode="{"
d="M240 -47v-65h135v65h-65v205h-68v75h-57v65h60v65h65v199h65v65h-135v-65h-60v-199h-70v-65h-65v-65h66v-75h69v-205h60z" />
<glyph glyph-name="bar" unicode="|"
d="M228 611v-810h120v810h-120v0z" />
<glyph glyph-name="braceright" unicode="}"
d="M101 -61v-65h139v70h75v200h72v80h63v65h-65v76h-70v200h-77v65h-139v-65h71v-200h78l2 -76h60v-65h-59v-75h-79v-210h-71z" />
<glyph glyph-name="asciitilde" unicode="~"
d="M1 557v-134h61v65h67v68h77v-68h60v-65h216v65h59v135h-60v-63h-80v-67h-60v68h-80v71h-195v-75h-65z" />
<glyph glyph-name="uni0091"
d="M266 600h132v-66h-68v-68h68v-133h-200v201h68v66z" />
<glyph glyph-name="uni0092"
d="M200 600h200v-199h-67v-68h-133v68h66v67h-66v132z" />
<glyph glyph-name="exclamdown" unicode="&#xa1;"
d="M200 400h133v-133h-133v133zM200 200h132v-133h68v-200h-67v-67h-133v67h-67v200h67v133z" />
<glyph glyph-name="cent" unicode="&#xa2;"
d="M200 600h133v-133h66v-67h67v-67h-133v67h-133v-267h132v67h133v-66h-65v-66h-67v-135h-133v135h-67v65h-66v267h65v68h68v132z" />
<glyph glyph-name="sterling" unicode="&#xa3;"
d="M0 133h67v135h-67v65h67v200h66v67h267v-66h66v-67h-133v66h-133v-200h200v-65h-201v-134h-66v-67h334v-67h-467v133z" />
<glyph glyph-name="currency" unicode="&#xa4;"
d="M200 400v-133h133v133h-133zM67 533h132v-66h134v66h134v-66h-67v-67h66v-133h-67v-66h68v-68h-134v68h-133v-68h-133v67h66v67h-66v133h66v67h-66v66z" />
<glyph glyph-name="yen" unicode="&#xa5;"
d="M67 600h132v-199h134v199h133v-199h-66v-68h66v-66h-133v-67h132v-67h-132v-133h-133v133h-133v67h133v67h-133v66h65v68h-65v199z" />
<glyph glyph-name="brokenbar" unicode="&#xa6;"
d="M200 133h133v-333h-133v333zM200 600h133v-333h-133v333z" />
<glyph glyph-name="section" unicode="&#xa7;"
d="M148 578v-60v0h-60v0v-120v0h60v-120v0h-60v0v-120v0h60v0v-60v0h60v0v-66v0h120v-136h-120v0v68v0h-120v0v-68v0h60v0v-66v0h240v0v66v0h60v0v136v0h-60v126v0h60v0v120v0h-60v0v60v0h-60v0v60v0h-120v120v0h120v0v-60v0h120v0v60v0h-60v0v60v0h-240v0zM328 278v-120
h-120v120h120z" />
<glyph glyph-name="dieresis" unicode="&#xa8;"
d="M67 667h133v-134h-133v134zM333 667h134v-134h-134v134z" />
<glyph glyph-name="copyright" unicode="&#xa9;"
d="M200 467h132v-67h68v-67h-67v68h-133v-201h-67v200h67v67zM67 468v-334h66v-66h267v66h67v335h-67v65h-268v-66h-65zM0 533h66v67h399v-67h68v-466h-67v-67h-399v67h-67v466zM200 200h133v67h67v-66h-68v-67h-132v66z" />
<glyph glyph-name="ordfeminine" unicode="&#xaa;"
d="M200 400v-67h133v67h-133zM467 200v-67h-400v67h400zM134 601h266v-68h67v-266h-335v66h-65v67h65v67h201v66h-199v68z" />
<glyph glyph-name="guillemotleft" unicode="&#xab;"
d="M266 334v-66h-68v-66h-66v-68h66v-67h68v-66h-133v67h-67v66h-67v66h67v67h66v67h134zM400 334h133v-65h-67v-67h-66v-68h64v-66h69v-68h-133v67h-68v67h-65v66h66v66h67v68z" />
<glyph glyph-name="logicalnot" unicode="&#xac;"
d="M467 333v-200h-135v134h-265v66h400z" />
<glyph glyph-name="uni00AD" unicode="&#xad;"
d="M466 268h-400v65h400v-65z" />
<glyph glyph-name="registered" unicode="&#xae;"
d="M67 467v-333h66v-66h267v66h66v333h-66v66h-267v-66h-66zM132 133v334h200v-67h68v-133h-67v133h-133v-132h132v-68h67v-66h-67v67h-133v-68h-67zM0 533h67v67h398v-67h68v-466h-67v-67h-400v67h-66v466z" />
<glyph glyph-name="macron" unicode="&#xaf;"
d="M0 800h532v-66h-532v66z" />
<glyph glyph-name="degree" unicode="&#xb0;"
d="M146 649v-63v0h-67v0v-127v0h67v0v-63v0h271v0v63v0h63v0v127v0h-63v0v63v0h-271v0zM354 586v-127h-139v127h139z" />
<glyph glyph-name="plusminus" unicode="&#xb1;"
d="M466 68v-68h-399v68h399zM200 467h133v-134h133v-66h-133v-134h-133v134h-133v66h133v134z" />
<glyph glyph-name="uni00B2" unicode="&#xb2;"
d="M133 600h200v-67h67v-66h-68v-66h-65v-68h133v-66h-267v133h67v67h67v66h-134v67z" />
<glyph glyph-name="uni00B3" unicode="&#xb3;"
d="M133 600h200v-67h67v-65h-67v-67h66v-67h-66v-67h-200v66h134v68h-67v66h67v66h-134v67z" />
<glyph glyph-name="acute" unicode="&#xb4;"
d="M292 589v-69h-140v69h70v140h199v-70h-70v-70h-59z" />
<glyph glyph-name="uni00B5" unicode="&#xb5;"
d="M199 467v-400h134v400h132v-400h68v-67h-133v68h-67v-68h-133v-132h-67v-68h-133v67h67v600h132z" />
<glyph glyph-name="paragraph" unicode="&#xb6;"
d="M533 600v-67h-67v-733h-133v333h-133v67h-67v67h-66v200h66v66h67v67h333z" />
<glyph glyph-name="periodcentered" unicode="&#xb7;"
d="M200 400h200v-133h-200v133z" />
<glyph glyph-name="cedilla" unicode="&#xb8;"
d="M200 0h132v-67h68v-65h-67v-68h-200v67h134v66h-67v67z" />
<glyph glyph-name="uni00B9" unicode="&#xb9;"
d="M200 600h133v-333h-133v200h-67v67h67v66z" />
<glyph glyph-name="ordmasculine" unicode="&#xba;"
d="M135 600v-66h-66v-201h65v-66h268v66h66v200h-66v67h-267zM466 200v-67h-399v67h399zM200 333v200h133v-200h-133z" />
<glyph glyph-name="guillemotright" unicode="&#xbb;"
d="M266 334v-66h68v-66h66v-68h-66v-67h-68v-66h133v67h67v66h67v66h-67v67h-66v67h-134zM132 334h-133v-65h67v-67h66v-68h-64v-66h-69v-68h133v67h68v67h65v66h-66v66h-67v68z" />
<glyph glyph-name="onequarter" unicode="&#xbc;"
d="M67 667h132v-334h68v68h66v66h66v66h134v-65h-68v-67h-66v-67h-66v-67h200v-334h-133v67h-200v133h-68v-66h-132v66h66v67h67v67h67v66h-134v200h-66v68h67v66zM333 67h67v66h-67v-66zM267 200h66v67h-66v-67zM200 133h67v67h-67v-67z" />
<glyph glyph-name="onehalf" unicode="&#xbd;"
d="M67 667h132v-334h68v68h66v66h66v66h134v-65h-68v-67h-66v-67h-66v-67h132v-66h67v-67h-67v-66h-65v-68h133v-67h-267v135h66v66h67v67h-199v-68h-68v-66h-132v66h66v67h67v67h67v66h-134v200h-66v68h67v66z" />
<glyph glyph-name="threequarters" unicode="&#xbe;"
d="M0 667h199v-67h67v-66h-67v-67h67v-66h-67v-68h68v68h66v66h66v66h134v-65h-68v-67h-66v-67h-66v-67h199v-334h-132v66h-200v135h67v66h66v67h-67v-66h-66v-68h-68v-66h-132v66h66v67h67v67h67v66h-200v68h132v67h-66v65h67v68h-133v66zM333 67h67v66h-67v-66z" />
<glyph glyph-name="questiondown" unicode="&#xbf;"
d="M328 270v130h-120v-130h120zM329 72l-0.000976562 125h-125v-120c-2.66699 1.33301 -7.16699 1.83301 -13.5 1.5s-13 -1 -20 -2s-13.5 -2.33301 -19.5 -4s-10 -3.5 -12 -5.5c-0.666992 -0.666992 -1.5 -4 -2.5 -10s-1.83301 -12.5 -2.5 -19.5
s-1.33398 -13.5 -2.00098 -19.5s-1.66699 -9.66699 -3 -11c-2 -2 -5.83301 -3.83301 -11.5 -5.5s-11.667 -3 -18 -4s-12.333 -1.66699 -18 -2s-9.83398 0.166992 -12.501 1.5v-130c2.66699 1.33301 6.83398 1.83301 12.501 1.5s11.667 -1 18 -2s12.333 -2.33301 18 -4
s9.5 -3.5 11.5 -5.5s3.83301 -5.83301 5.5 -11.5s3 -11.667 4 -18s1.66699 -12.333 2 -18s-0.166992 -9.83398 -1.5 -12.501h260c-1.33301 2.66699 -1.83301 6.83398 -1.5 12.501s1 11.667 2 18s2.33301 12.333 4 18s3.5 9.5 5.5 11.5s5.83301 3.83301 11.5 5.5
s11.667 3 18 4s12.333 1.66699 18 2s9.83398 -0.166992 12.501 -1.5v130h-135v-130h-125v130c2.66699 -1.33301 6.83398 -1.83301 12.501 -1.5s11.667 1 18 2s12.333 2.33301 18 4s9.5 3.5 11.5 5.5s3.83301 6 5.5 12s3 12.5 4 19.5s1.66699 13.667 2 20
s-0.166992 10.833 -1.5 13.5h50z" />
<glyph glyph-name="Agrave" unicode="&#xc0;"
d="M59 470l0.00390625 -470h135v200h130v-200h135v470c-2.66699 -1.33301 -6.83398 -1.83301 -12.501 -1.5s-11.667 1 -18 2s-12.333 2.33301 -18 4s-9.5 3.5 -11.5 5.5c-1.33301 0.666992 -2.33301 4 -3 10s-1.33398 12.5 -2.00098 19.5s-1.5 13.5 -2.5 19.5
s-1.83301 9.66699 -2.5 11c-1.33301 0.666992 -5 1.5 -11 2.5s-12.5 1.83301 -19.5 2.5s-13.5 1.33398 -19.5 2.00098s-9.33301 1.66699 -10 3c-2 2 -3.83301 5.83301 -5.5 11.5s-3 11.667 -4 18s-1.66699 12.333 -2 18s0.166992 9.83398 1.5 12.501h-120
c1.33301 -2.66699 1.83301 -6.83398 1.5 -12.501s-1 -11.667 -2 -18s-2.33301 -12.333 -4 -18s-3.5 -9.5 -5.5 -11.5c-1.33301 -1.33301 -5 -2.33301 -11 -3s-12.5 -1.33398 -19.5 -2.00098s-13.5 -1.5 -19.5 -2.5s-9.33301 -1.83301 -10 -2.5
c-1.33301 -1.33301 -2.33301 -5 -3 -11s-1.33398 -12.5 -2.00098 -19.5s-1.5 -13.5 -2.5 -19.5s-1.83301 -9.33301 -2.5 -10c-2 -2 -5.83301 -3.83301 -11.5 -5.5s-11.667 -3 -18 -4s-12.333 -1.66699 -18 -2s-9.83398 0.166992 -12.501 1.5zM199.004 470h120v-190h-120v190
zM129.004 803h133v-67h66v-67h-133v67h-66v67z" />
<glyph glyph-name="Aacute" unicode="&#xc1;"
d="M59 470l0.00390625 -470h135v200h130v-200h135v470c-2.66699 -1.33301 -6.83398 -1.83301 -12.501 -1.5s-11.667 1 -18 2s-12.333 2.33301 -18 4s-9.5 3.5 -11.5 5.5c-1.33301 0.666992 -2.33301 4 -3 10s-1.33398 12.5 -2.00098 19.5s-1.5 13.5 -2.5 19.5
s-1.83301 9.66699 -2.5 11c-1.33301 0.666992 -5 1.5 -11 2.5s-12.5 1.83301 -19.5 2.5s-13.5 1.33398 -19.5 2.00098s-9.33301 1.66699 -10 3c-2 2 -3.83301 5.83301 -5.5 11.5s-3 11.667 -4 18s-1.66699 12.333 -2 18s0.166992 9.83398 1.5 12.501h-120
c1.33301 -2.66699 1.83301 -6.83398 1.5 -12.501s-1 -11.667 -2 -18s-2.33301 -12.333 -4 -18s-3.5 -9.5 -5.5 -11.5c-1.33301 -1.33301 -5 -2.33301 -11 -3s-12.5 -1.33398 -19.5 -2.00098s-13.5 -1.5 -19.5 -2.5s-9.33301 -1.83301 -10 -2.5
c-1.33301 -1.33301 -2.33301 -5 -3 -11s-1.33398 -12.5 -2.00098 -19.5s-1.5 -13.5 -2.5 -19.5s-1.83301 -9.33301 -2.5 -10c-2 -2 -5.83301 -3.83301 -11.5 -5.5s-11.667 -3 -18 -4s-12.333 -1.66699 -18 -2s-9.83398 0.166992 -12.501 1.5zM199.004 470h120v-190h-120v190
zM263.004 737v66h134v-65h-68v-68h-131v67h65z" />
<glyph glyph-name="Acircumflex" unicode="&#xc2;"
d="M59 470l0.00390625 -470h135v200h130v-200h135v470c-2.66699 -1.33301 -6.83398 -1.83301 -12.501 -1.5s-11.667 1 -18 2s-12.333 2.33301 -18 4s-9.5 3.5 -11.5 5.5c-1.33301 0.666992 -2.33301 4 -3 10s-1.33398 12.5 -2.00098 19.5s-1.5 13.5 -2.5 19.5
s-1.83301 9.66699 -2.5 11c-1.33301 0.666992 -5 1.5 -11 2.5s-12.5 1.83301 -19.5 2.5s-13.5 1.33398 -19.5 2.00098s-9.33301 1.66699 -10 3c-2 2 -3.83301 5.83301 -5.5 11.5s-3 11.667 -4 18s-1.66699 12.333 -2 18s0.166992 9.83398 1.5 12.501h-120
c1.33301 -2.66699 1.83301 -6.83398 1.5 -12.501s-1 -11.667 -2 -18s-2.33301 -12.333 -4 -18s-3.5 -9.5 -5.5 -11.5c-1.33301 -1.33301 -5 -2.33301 -11 -3s-12.5 -1.33398 -19.5 -2.00098s-13.5 -1.5 -19.5 -2.5s-9.33301 -1.83301 -10 -2.5
c-1.33301 -1.33301 -2.33301 -5 -3 -11s-1.33398 -12.5 -2.00098 -19.5s-1.5 -13.5 -2.5 -19.5s-1.83301 -9.33301 -2.5 -10c-2 -2 -5.83301 -3.83301 -11.5 -5.5s-11.667 -3 -18 -4s-12.333 -1.66699 -18 -2s-9.83398 0.166992 -12.501 1.5zM199.004 470h120v-190h-120v190
zM130.004 803h267v-66h67v-68h-134v67h-133v-66h-133v66h66v67z" />
<glyph glyph-name="Atilde" unicode="&#xc3;"
d="M59 470l0.00390625 -470h135v200h130v-200h135v470c-2.66699 -1.33301 -6.83398 -1.83301 -12.501 -1.5s-11.667 1 -18 2s-12.333 2.33301 -18 4s-9.5 3.5 -11.5 5.5c-1.33301 0.666992 -2.33301 4 -3 10s-1.33398 12.5 -2.00098 19.5s-1.5 13.5 -2.5 19.5
s-1.83301 9.66699 -2.5 11c-1.33301 0.666992 -5 1.5 -11 2.5s-12.5 1.83301 -19.5 2.5s-13.5 1.33398 -19.5 2.00098s-9.33301 1.66699 -10 3c-2 2 -3.83301 5.83301 -5.5 11.5s-3 11.667 -4 18s-1.66699 12.333 -2 18s0.166992 9.83398 1.5 12.501h-120
c1.33301 -2.66699 1.83301 -6.83398 1.5 -12.501s-1 -11.667 -2 -18s-2.33301 -12.333 -4 -18s-3.5 -9.5 -5.5 -11.5c-1.33301 -1.33301 -5 -2.33301 -11 -3s-12.5 -1.33398 -19.5 -2.00098s-13.5 -1.5 -19.5 -2.5s-9.33301 -1.83301 -10 -2.5
c-1.33301 -1.33301 -2.33301 -5 -3 -11s-1.33398 -12.5 -2.00098 -19.5s-1.5 -13.5 -2.5 -19.5s-1.83301 -9.33301 -2.5 -10c-2 -2 -5.83301 -3.83301 -11.5 -5.5s-11.667 -3 -18 -4s-12.333 -1.66699 -18 -2s-9.83398 0.166992 -12.501 1.5zM199.004 470h120v-190h-120v190
zM129.004 803h200v-66h67v66h132v-67h-67v-65h-198v65h-67v-65h-133v65h66v67z" />
<glyph glyph-name="Adieresis" unicode="&#xc4;"
d="M57 770v-129v0h134v0v129v0h-134v0zM330 770v-129v0h134v0v129v0h-134v0zM198 576v-66v0h-68v0v-69v0h-66v0v-442v0h134v0v180h139v-180v0h134v0v442v0h-66v0v69v0h-68v0v66v0h-139v0zM337 441v-202h-139v0v202h139z" />
<glyph glyph-name="Aring" unicode="&#xc5;"
d="M59 470l0.00292969 -470.001h135v200h130v-200h135v470c-2.66699 -1.33301 -6.83398 -1.83301 -12.501 -1.5s-11.667 1 -18 2s-12.333 2.33301 -18 4s-9.5 3.5 -11.5 5.5c-1.33301 0.666992 -2.33301 4 -3 10s-1.33398 12.5 -2.00098 19.5s-1.5 13.5 -2.5 19.5
s-1.83301 9.66699 -2.5 11c-1.33301 0.666992 -5 1.5 -11 2.5s-12.5 1.83301 -19.5 2.5s-13.5 1.33398 -19.5 2.00098s-9.33301 1.66699 -10 3c-2 2 -3.83301 5.83301 -5.5 11.5s-3 11.667 -4 18s-1.66699 12.333 -2 18s24.834 7.83398 75.501 6.50098v71h66v63h-65v66h-265
v-65h-68v-64h65v-69c50 0 74.833 -2.83301 74.5 -8.5s-1 -11.667 -2 -18s-2.33301 -12.333 -4 -18s-3.5 -9.5 -5.5 -11.5c-1.33301 -1.33301 -5 -2.33301 -11 -3s-12.5 -1.33398 -19.5 -2.00098s-13.5 -1.5 -19.5 -2.5s-9.33301 -1.83301 -10 -2.5
c-1.33301 -1.33301 -2.33301 -5 -3 -11s-1.33398 -12.5 -2.00098 -19.5s-1.5 -13.5 -2.5 -19.5s-1.83301 -9.33301 -2.5 -10c-2 -2 -5.83301 -3.83301 -11.5 -5.5s-11.667 -3 -18 -4s-12.333 -1.66699 -18 -2s-9.83398 0.166992 -12.501 1.5zM199.003 469.999h120v-190h-120
v190zM194.003 738.999h133v-66h-133v66z" />
<glyph glyph-name="AE" unicode="&#xc6;"
d="M267 600h266v-67h-133v-199h132v-66h-132v-201h132v-67h-265v201h-68v-201h-132v400h65v67h67v66h68v67zM200 267h67v133h-67v-133z" />
<glyph glyph-name="Ccedilla" unicode="&#xc7;"
d="M59 70c2.66699 1.33301 6.83398 1.83301 12.501 1.5s11.667 -1 18 -2s12.333 -2.33301 18 -4s9.5 -3.5 11.5 -5.5s3.83301 -5.83301 5.5 -11.5s3 -11.667 4 -18s1.66699 -12.333 2 -18s-0.166992 -9.83398 -1.5 -12.501h64v-66h72v-65h-137v-68h204v68h66v64h-67v67h58
c-1.33301 2.66699 -1.83301 6.83398 -1.5 12.501s1 11.667 2 18s2.33301 12.333 4 18s3.5 9.5 5.5 11.5s5.83301 3.83301 11.5 5.5s11.667 3 18 4s12.333 1.66699 18 2s9.83398 -0.166992 12.501 -1.5v130h-135v-130h-125v470h125v-130h135v130
c-2.66699 -1.33301 -6.83398 -1.83301 -12.501 -1.5s-11.667 1 -18 2s-12.333 2.33301 -18 4s-9.5 3.5 -11.5 5.5s-3.83301 5.83301 -5.5 11.5s-3 11.667 -4 18s-1.66699 12.333 -2 18s0.166992 9.83398 1.5 12.501h-260c1.33301 -2.66699 1.83301 -6.83398 1.5 -12.501
s-1 -11.667 -2 -18s-2.33301 -12.333 -4 -18s-3.5 -9.5 -5.5 -11.5s-5.83301 -3.83301 -11.5 -5.5s-11.667 -3 -18 -4s-12.333 -1.66699 -18 -2s-9.83398 0.166992 -12.501 1.5v-470z" />
<glyph glyph-name="Egrave" unicode="&#xc8;"
d="M59 610v-610h400v65h-260v210h190v60h-190v210h260v65h-400v0zM127 805h131v-64h67v-63h-134v62h-64v65z" />
<glyph glyph-name="Eacute" unicode="&#xc9;"
d="M59 610v-610h400v65h-260v210h190v60h-190v210h260v65h-400v0zM260 803h132v-66h-66v-66h-133v66h67v66z" />
<glyph glyph-name="Ecircumflex" unicode="&#xca;"
d="M59 610v-610h400v65h-260v210h190v60h-190v210h260v65h-400v0zM129 806h265v-66h67v-66h-132v65h-134v-66h-133v67h67v66z" />
<glyph glyph-name="Edieresis" unicode="&#xcb;"
d="M59 610v-610h400v65h-260v210h190v60h-190v210h260v65h-400v0zM62 807h132v-133h-132v133zM326 806h132v-133h-132v133z" />
<glyph glyph-name="Igrave" unicode="&#xcc;"
d="M124 65v-65h260v65h-60v480h60v65h-260v-65h60v-480h-60v0zM127 806h133v-67h66v-65h-133v66h-66v66z" />
<glyph glyph-name="Iacute" unicode="&#xcd;"
d="M124 65v-65h260v65h-60v480h60v65h-260v-65h60v-480h-60v0zM261 805h132v-67h-66v-66h-133v65h67v68z" />
<glyph glyph-name="Icircumflex" unicode="&#xce;"
d="M124 65v-65h260v65h-60v480h60v65h-260v-65h60v-480h-60v0zM124 809h266v-66h67v-66h-133v66h-134v-66h-132v65h66v67z" />
<glyph glyph-name="Idieresis" unicode="&#xcf;"
d="M124 65v-65h260v65h-60v480h60v65h-260v-65h60v-480h-60v0zM55 813h133v-131h-133v131zM322 812h132v-132h-132v132z" />
<glyph glyph-name="Eth" unicode="&#xd0;"
d="M55 611v-271.004h-55v-64h54v-276h260c-1.33301 2.66699 -1.83301 6.83398 -1.5 12.501s1 11.667 2 18s2.33301 12.333 4 18s3.5 9.5 5.5 11.5c0.666992 0.666992 4 1.5 10 2.5s12.5 1.83301 19.5 2.5s13.5 1.33398 19.5 2.00098s9.66699 1.66699 11 3
c0.666992 0.666992 1.5 4 2.5 10s1.83301 12.5 2.5 19.5s1.33398 13.5 2.00098 19.5s1.66699 9.66699 3 11c2 2 5.83301 3.83301 11.5 5.5s11.667 3 18 4s12.333 1.66699 18 2s9.83398 -0.166992 12.501 -1.5v330c-2.66699 -1.33301 -6.83398 -1.83301 -12.501 -1.5
s-11.667 1 -18 2s-12.333 2.33301 -18 4s-9.5 3.5 -11.5 5.5c-1.33301 0.666992 -2.33301 4 -3 10s-1.33398 12.5 -2.00098 19.5s-1.5 13.5 -2.5 19.5s-1.83301 9.66699 -2.5 11c-1.33301 0.666992 -5 1.5 -11 2.5s-12.5 1.83301 -19.5 2.5s-13.5 1.33398 -19.5 2.00098
s-9.33301 1.66699 -10 3c-2 2 -3.83301 5.83301 -5.5 11.5s-3 11.667 -4 18s-1.66699 12.333 -2 18s0.166992 9.83398 1.5 12.501zM194 539.996l50 0.00195312c-1.33301 -2.66699 -1.83301 -6.83398 -1.5 -12.501s1 -11.667 2 -18s2.33301 -12.333 4 -18s3.5 -9.5 5.5 -11.5
s5.83301 -3.83301 11.5 -5.5s11.667 -3 18 -4s12.333 -1.66699 18 -2s9.83398 0.166992 12.501 1.5v-330c-2.66699 1.33301 -6.83398 1.83301 -12.501 1.5s-11.667 -1 -18 -2s-12.333 -2.33301 -18 -4s-9.5 -3.5 -11.5 -5.5s-3.83301 -5.83301 -5.5 -11.5s-3 -11.667 -4 -18
s-1.66699 -12.333 -2 -18s0.166992 -9.83398 1.5 -12.501h-50v205h67v65h-67v200z" />
<glyph glyph-name="Ntilde" unicode="&#xd1;"
d="M63 610l-0.00195312 -610.004h135v311c2 0 5.66699 1.33301 11 4l16.5 8c5.66699 2.66699 11.167 4.83398 16.5 6.50098s9 1.83398 11 0.500977s3.83301 -4.33301 5.5 -9s3 -9.66699 4 -15s1.66699 -10.5 2 -15.5s-0.166992 -8.5 -1.5 -10.5
c2.66699 1.33301 6.83398 1.83301 12.501 1.5s11.667 -1 18 -2s12.333 -2.33301 18 -4s9.5 -3.5 11.5 -5.5c0.666992 -1.33301 1.5 -5 2.5 -11s1.83301 -12.5 2.5 -19.5s1.33398 -13.5 2.00098 -19.5s1.66699 -9.33301 3 -10c2 -2 6 -3.83301 12 -5.5s12.5 -3 19.5 -4
s13.667 -1.66699 20 -2s10.833 0.166992 13.5 1.5v-200h135v610h-135v-270h-65c1.33301 2.66699 1.83301 6.83398 1.5 12.501s-1 11.667 -2 18s-2.33301 12.333 -4 18s-3.5 9.5 -5.5 11.5c-1.33301 0.666992 -5 1.5 -11 2.5s-12.5 1.83301 -19.5 2.5
s-13.5 1.33398 -19.5 2.00098s-9.33301 1.66699 -10 3c-2 2 -3.83301 6 -5.5 12s-3 12.5 -4 19.5s-1.66699 13.667 -2 20s0.166992 10.833 1.5 13.5h-55v135h-135zM131.998 799.996h201v-66h66l1 66h132v-66h-66v-66h-199v66h-68v-66h-134v66h67v66z" />
<glyph glyph-name="Ograve" unicode="&#xd2;"
d="M75 69c2.66699 1.33301 6.83398 1.83301 12.501 1.5s11.667 -1 18 -2s12.333 -2.33301 18 -4s9.5 -3.5 11.5 -5.5s3.83301 -5.83301 5.5 -11.5s3 -11.667 4 -18s1.66699 -12.333 2 -18s-0.166992 -9.83398 -1.5 -12.501h260
c-1.33301 2.66699 -1.83301 6.83398 -1.5 12.501s1 11.667 2 18s2.33301 12.333 4 18s3.5 9.5 5.5 11.5s5.83301 3.83301 11.5 5.5s11.667 3 18 4s12.333 1.66699 18 2s9.83398 -0.166992 12.501 -1.5v470c-2.66699 -1.33301 -6.83398 -1.83301 -12.501 -1.5
s-11.667 1 -18 2s-12.333 2.33301 -18 4s-9.5 3.5 -11.5 5.5s-3.83301 5.83301 -5.5 11.5s-3 11.667 -4 18s-1.66699 12.333 -2 18s0.166992 9.83398 1.5 12.501h-260c1.33301 -2.66699 1.83301 -6.83398 1.5 -12.501s-1 -11.667 -2 -18s-2.33301 -12.333 -4 -18
s-3.5 -9.5 -5.5 -11.5s-5.83301 -3.83301 -11.5 -5.5s-11.667 -3 -18 -4s-12.333 -1.66699 -18 -2s-9.83398 0.166992 -12.501 1.5v-470zM215 539h120v-470h-120v470zM142 808h133v-66h67v-68h-133v68h-67v66z" />
<glyph glyph-name="Oacute" unicode="&#xd3;"
d="M75 69c2.66699 1.33301 6.83398 1.83301 12.501 1.5s11.667 -1 18 -2s12.333 -2.33301 18 -4s9.5 -3.5 11.5 -5.5s3.83301 -5.83301 5.5 -11.5s3 -11.667 4 -18s1.66699 -12.333 2 -18s-0.166992 -9.83398 -1.5 -12.501h260
c-1.33301 2.66699 -1.83301 6.83398 -1.5 12.501s1 11.667 2 18s2.33301 12.333 4 18s3.5 9.5 5.5 11.5s5.83301 3.83301 11.5 5.5s11.667 3 18 4s12.333 1.66699 18 2s9.83398 -0.166992 12.501 -1.5v470c-2.66699 -1.33301 -6.83398 -1.83301 -12.501 -1.5
s-11.667 1 -18 2s-12.333 2.33301 -18 4s-9.5 3.5 -11.5 5.5s-3.83301 5.83301 -5.5 11.5s-3 11.667 -4 18s-1.66699 12.333 -2 18s0.166992 9.83398 1.5 12.501h-260c1.33301 -2.66699 1.83301 -6.83398 1.5 -12.501s-1 -11.667 -2 -18s-2.33301 -12.333 -4 -18
s-3.5 -9.5 -5.5 -11.5s-5.83301 -3.83301 -11.5 -5.5s-11.667 -3 -18 -4s-12.333 -1.66699 -18 -2s-9.83398 0.166992 -12.501 1.5v-470zM215 539h120v-470h-120v470zM276 806h132v-66h-66v-66h-133v65h67v67z" />
<glyph glyph-name="Ocircumflex" unicode="&#xd4;"
d="M75 69c2.66699 1.33301 6.83398 1.83301 12.501 1.5s11.667 -1 18 -2s12.333 -2.33301 18 -4s9.5 -3.5 11.5 -5.5s3.83301 -5.83301 5.5 -11.5s3 -11.667 4 -18s1.66699 -12.333 2 -18s-0.166992 -9.83398 -1.5 -12.501h260
c-1.33301 2.66699 -1.83301 6.83398 -1.5 12.501s1 11.667 2 18s2.33301 12.333 4 18s3.5 9.5 5.5 11.5s5.83301 3.83301 11.5 5.5s11.667 3 18 4s12.333 1.66699 18 2s9.83398 -0.166992 12.501 -1.5v470c-2.66699 -1.33301 -6.83398 -1.83301 -12.501 -1.5
s-11.667 1 -18 2s-12.333 2.33301 -18 4s-9.5 3.5 -11.5 5.5s-3.83301 5.83301 -5.5 11.5s-3 11.667 -4 18s-1.66699 12.333 -2 18s0.166992 9.83398 1.5 12.501h-260c1.33301 -2.66699 1.83301 -6.83398 1.5 -12.501s-1 -11.667 -2 -18s-2.33301 -12.333 -4 -18
s-3.5 -9.5 -5.5 -11.5s-5.83301 -3.83301 -11.5 -5.5s-11.667 -3 -18 -4s-12.333 -1.66699 -18 -2s-9.83398 0.166992 -12.501 1.5v-470zM215 539h120v-470h-120v470zM141 808h266v-68h66v-65h-132v67h-133v-66h-133v65h66v67z" />
<glyph glyph-name="Otilde" unicode="&#xd5;"
d="M75 69c2.66699 1.33301 6.83398 1.83301 12.501 1.5s11.667 -1 18 -2s12.333 -2.33301 18 -4s9.5 -3.5 11.5 -5.5s3.83301 -5.83301 5.5 -11.5s3 -11.667 4 -18s1.66699 -12.333 2 -18s-0.166992 -9.83398 -1.5 -12.501h260
c-1.33301 2.66699 -1.83301 6.83398 -1.5 12.501s1 11.667 2 18s2.33301 12.333 4 18s3.5 9.5 5.5 11.5s5.83301 3.83301 11.5 5.5s11.667 3 18 4s12.333 1.66699 18 2s9.83398 -0.166992 12.501 -1.5v470c-2.66699 -1.33301 -6.83398 -1.83301 -12.501 -1.5
s-11.667 1 -18 2s-12.333 2.33301 -18 4s-9.5 3.5 -11.5 5.5s-3.83301 5.83301 -5.5 11.5s-3 11.667 -4 18s-1.66699 12.333 -2 18s0.166992 9.83398 1.5 12.501h-260c1.33301 -2.66699 1.83301 -6.83398 1.5 -12.501s-1 -11.667 -2 -18s-2.33301 -12.333 -4 -18
s-3.5 -9.5 -5.5 -11.5s-5.83301 -3.83301 -11.5 -5.5s-11.667 -3 -18 -4s-12.333 -1.66699 -18 -2s-9.83398 0.166992 -12.501 1.5v-470zM215 539h120v-470h-120v470zM138 807h200v-66h67v66h132v-66h-66v-66h-199v65h-67v-65h-133v65h66v67z" />
<glyph glyph-name="Odieresis" unicode="&#xd6;"
d="M119 580v-70v0h-60v0v-447v0h60v0v-60v0h279v0v60v0h60v0v447v0h-60v0v70v0h-279v0zM338 510v-447h-143v0v447h143zM57 770v-129v0h134v0v129v0h-134v0zM330 770v-129v0h134v0v129v0h-134v0z" />
<glyph glyph-name="multiply" unicode="&#xd7;"
d="M67 200v-132h65v65h68v68h133v-67h66v-66h66v132h-66v67h-67v67h68v66h66v134h-66v-67h-67v-67h-134v68h-67v66h-65v-133h66v-67h66v-67h-67v-67h-65z" />
<glyph glyph-name="Oslash" unicode="&#xd8;"
d="M200 133v-66h133v201h-66v-135h-67zM199 533v-200h67v134h66v66h-133zM133 600l333 1v-534h-66v-67h-333v534h66v66z" />
<glyph glyph-name="Ugrave" unicode="&#xd9;"
d="M56 70c2.66699 1.33301 6.83203 1.83301 12.499 1.5s11.667 -1 18 -2s12.333 -2.33301 18 -4s9.5 -3.5 11.5 -5.5s3.83301 -5.83301 5.5 -11.5s3 -11.667 4 -18s1.66699 -12.333 2 -18s-0.166992 -9.83398 -1.5 -12.501h260
c-1.33301 2.66699 -1.83301 6.83398 -1.5 12.501s1 11.667 2 18s2.33301 12.333 4 18s3.5 9.5 5.5 11.5s5.83301 3.83301 11.5 5.5s11.667 3 18 4s12.333 1.66699 18 2s9.83398 -0.166992 12.501 -1.5v540h-135v-540h-130v540h-135v-540zM123.998 809h133v-65h65v-67h-131
v67h-67v65z" />
<glyph glyph-name="Uacute" unicode="&#xda;"
d="M56 70c2.66699 1.33301 6.83203 1.83301 12.499 1.5s11.667 -1 18 -2s12.333 -2.33301 18 -4s9.5 -3.5 11.5 -5.5s3.83301 -5.83301 5.5 -11.5s3 -11.667 4 -18s1.66699 -12.333 2 -18s-0.166992 -9.83398 -1.5 -12.501h260
c-1.33301 2.66699 -1.83301 6.83398 -1.5 12.501s1 11.667 2 18s2.33301 12.333 4 18s3.5 9.5 5.5 11.5s5.83301 3.83301 11.5 5.5s11.667 3 18 4s12.333 1.66699 18 2s9.83398 -0.166992 12.501 -1.5v540h-135v-540h-130v540h-135v-540zM258.998 809h133v-66h-68v-66h-132
v66h67v66z" />
<glyph glyph-name="Ucircumflex" unicode="&#xdb;"
d="M56 70c2.66699 1.33301 6.83203 1.83301 12.499 1.5s11.667 -1 18 -2s12.333 -2.33301 18 -4s9.5 -3.5 11.5 -5.5s3.83301 -5.83301 5.5 -11.5s3 -11.667 4 -18s1.66699 -12.333 2 -18s-0.166992 -9.83398 -1.5 -12.501h260
c-1.33301 2.66699 -1.83301 6.83398 -1.5 12.501s1 11.667 2 18s2.33301 12.333 4 18s3.5 9.5 5.5 11.5s5.83301 3.83301 11.5 5.5s11.667 3 18 4s12.333 1.66699 18 2s9.83398 -0.166992 12.501 -1.5v540h-135v-540h-130v540h-135v-540zM123.998 809h268v-66h65v-65h-132
v65h-132v-66h-134v66h65v66z" />
<glyph glyph-name="Udieresis" unicode="&#xdc;"
d="M59 572v-513v0h60v0v-60v0h281v0v60v0h60v0v513v0h-120v0v-513h-149v0v513v0h-132v0zM57 770v-129v0h134v0v129v0h-134v0zM330 770v-129v0h134v0v129v0h-134v0z" />
<glyph glyph-name="Yacute" unicode="&#xdd;"
d="M189 275v-275h130v275h70v60h65v275h-135v-270h-130v270h-135v-275h65v-60h70v0zM189 743h68v67h132v-66h-66v-66h-134v65z" />
<glyph glyph-name="Thorn" unicode="&#xde;"
d="M200 200h133v200h-133v-200zM67 600h133v-132h199v-68h66v-199h-66v-67h-199v-134h-133v600z" />
<glyph glyph-name="germandbls" unicode="&#xdf;"
d="M138 576v-60v0h-60v0v-517v0h120v0v517v0h60v-204v0h60v0v-253v0h-60v0v-60v0h120v0v60v0h60v0v253v0h-60v0v204v0h-60v0v60v0h-180v0z" />
<glyph glyph-name="agrave" unicode="&#xe0;"
d="M59 70c2.66699 1.33301 6.83496 1.83301 12.502 1.5s11.667 -1 18 -2s12.333 -2.33301 18 -4s9.5 -3.5 11.5 -5.5s3.83301 -5.83301 5.5 -11.5s3 -11.667 4 -18s1.66699 -12.333 2 -18s-0.166992 -9.83398 -1.5 -12.501h330v400
c-2.66699 -1.33301 -6.83398 -1.83301 -12.501 -1.5s-11.667 1 -18 2s-12.333 2.33301 -18 4s-9.5 3.5 -11.5 5.5s-3.83301 5.83301 -5.5 11.5s-3 11.667 -4 18s-1.66699 12.333 -2 18s0.166992 9.83398 1.5 12.501h-260v-65h190v-130h-190
c1.33301 -2.66699 1.83301 -7.16699 1.5 -13.5s-1 -13 -2 -20s-2.33301 -13.5 -4 -19.5s-3.5 -10 -5.5 -12s-5.83301 -3.83301 -11.5 -5.5s-11.667 -3 -18 -4s-12.333 -1.66699 -18 -2s-9.83398 0.166992 -12.501 1.5v-130zM199.001 200h120v-130h-120v130zM63.001 737h198
v-133h66v-67h-133v67h-66v68h-65v65z" />
<glyph glyph-name="aacute" unicode="&#xe1;"
d="M59 70c2.66699 1.33301 6.83496 1.83301 12.502 1.5s11.667 -1 18 -2s12.333 -2.33301 18 -4s9.5 -3.5 11.5 -5.5s3.83301 -5.83301 5.5 -11.5s3 -11.667 4 -18s1.66699 -12.333 2 -18s-0.166992 -9.83398 -1.5 -12.501h330v400
c-2.66699 -1.33301 -6.83398 -1.83301 -12.501 -1.5s-11.667 1 -18 2s-12.333 2.33301 -18 4s-9.5 3.5 -11.5 5.5s-3.83301 5.83301 -5.5 11.5s-3 11.667 -4 18s-1.66699 12.333 -2 18s0.166992 9.83398 1.5 12.501h-260v-65h190v-130h-190
c1.33301 -2.66699 1.83301 -7.16699 1.5 -13.5s-1 -13 -2 -20s-2.33301 -13.5 -4 -19.5s-3.5 -10 -5.5 -12s-5.83301 -3.83301 -11.5 -5.5s-11.667 -3 -18 -4s-12.333 -1.66699 -18 -2s-9.83398 0.166992 -12.501 1.5v-130zM199.001 200h120v-130h-120v130zM459.001 739
l1 -65h-67v-67h-66v-68h-133v67h67v133h198z" />
<glyph glyph-name="acircumflex" unicode="&#xe2;"
d="M59 70c2.66699 1.33301 6.83496 1.83301 12.502 1.5s11.667 -1 18 -2s12.333 -2.33301 18 -4s9.5 -3.5 11.5 -5.5s3.83301 -5.83301 5.5 -11.5s3 -11.667 4 -18s1.66699 -12.333 2 -18s-0.166992 -9.83398 -1.5 -12.501h330v400
c-2.66699 -1.33301 -6.83398 -1.83301 -12.501 -1.5s-11.667 1 -18 2s-12.333 2.33301 -18 4s-9.5 3.5 -11.5 5.5s-3.83301 5.83301 -5.5 11.5s-3 11.667 -4 18s-1.66699 12.333 -2 18s0.166992 9.83398 1.5 12.501h-260v-65h190v-130h-190
c1.33301 -2.66699 1.83301 -7.16699 1.5 -13.5s-1 -13 -2 -20s-2.33301 -13.5 -4 -19.5s-3.5 -10 -5.5 -12s-5.83301 -3.83301 -11.5 -5.5s-11.667 -3 -18 -4s-12.333 -1.66699 -18 -2s-9.83398 0.166992 -12.501 1.5v-130zM199.001 200h120v-130h-120v130zM461.001 606v-68
h-133v68h-134v-67h-133v66h67v67h66v66h133v-66h67v-66h67z" />
<glyph glyph-name="atilde" unicode="&#xe3;"
d="M59 70c2.66699 1.33301 6.83496 1.83301 12.502 1.5s11.667 -1 18 -2s12.333 -2.33301 18 -4s9.5 -3.5 11.5 -5.5s3.83301 -5.83301 5.5 -11.5s3 -11.667 4 -18s1.66699 -12.333 2 -18s-0.166992 -9.83398 -1.5 -12.501h330v400
c-2.66699 -1.33301 -6.83398 -1.83301 -12.501 -1.5s-11.667 1 -18 2s-12.333 2.33301 -18 4s-9.5 3.5 -11.5 5.5s-3.83301 5.83301 -5.5 11.5s-3 11.667 -4 18s-1.66699 12.333 -2 18s0.166992 9.83398 1.5 12.501h-260v-65h190v-130h-190
c1.33301 -2.66699 1.83301 -7.16699 1.5 -13.5s-1 -13 -2 -20s-2.33301 -13.5 -4 -19.5s-3.5 -10 -5.5 -12s-5.83301 -3.83301 -11.5 -5.5s-11.667 -3 -18 -4s-12.333 -1.66699 -18 -2s-9.83398 0.166992 -12.501 1.5v-130zM199.001 200h120v-130h-120v130zM532.001 736
v-132h-67v-68h-198v67h-67v67h-68v-66h-66v-67h-66v133h67v67h200v-67h66v-67h66v67h66v66h67z" />
<glyph glyph-name="adieresis" unicode="&#xe4;"
d="M136 440v-60v0h202v-141v0h-202v0v-60v0h-60v0v-120v0h60v0v-60v0h322v0v381v0h-60v0v60v0h-262v0zM338 179v-120h-134v120h134zM81 641v-120v0h120v0v120v0h-120v0zM321 641v-120v0h120v0v120v0h-120v0z" />
<glyph glyph-name="aring" unicode="&#xe5;"
d="M59 70c2.66699 1.33301 6.83496 1.83301 12.502 1.5s11.667 -1 18 -2s12.333 -2.33301 18 -4s9.5 -3.5 11.5 -5.5s3.83301 -5.83301 5.5 -11.5s3 -11.667 4 -18s1.66699 -12.333 2 -18s-0.166992 -9.83398 -1.5 -12.501h330v400
c-2.66699 -1.33301 -6.83398 -1.83301 -12.501 -1.5s-11.667 1 -18 2s-12.333 2.33301 -18 4s-9.5 3.5 -11.5 5.5s-3.83301 5.83301 -5.5 11.5s-3 11.667 -4 18s-1.66699 12.333 -2 18s0.166992 9.83398 1.5 12.501h-260v-65h190v-130h-190
c1.33301 -2.66699 1.83301 -7.16699 1.5 -13.5s-1 -13 -2 -20s-2.33301 -13.5 -4 -19.5s-3.5 -10 -5.5 -12s-5.83301 -3.83301 -11.5 -5.5s-11.667 -3 -18 -4s-12.333 -1.66699 -18 -2s-9.83398 0.166992 -12.501 1.5v-130zM199.001 200h120v-130h-120v130zM459.001 674h-67
v66h-266v-66h-66v-67h65v-67h268v68h66v66zM194.001 672h133v-67h-132z" />
<glyph glyph-name="ae" unicode="&#xe6;"
d="M533 401v-200h-200v-133h199v-68h-199v68h-66v-68h-200v68h-67v133h66v67h134v133h-133v67h132v-67h67v67h199v-67h68zM333 267h67v133h-67v-133zM133 67h67v133h-67v-133z" />
<glyph glyph-name="ccedilla" unicode="&#xe7;"
d="M56 70c2.66699 1.33301 6.83496 1.83398 12.502 1.50098s11.667 -1 18 -2s12.333 -2.33301 18 -4s9.5 -3.5 11.5 -5.5s3.83301 -5.83301 5.5 -11.5s3 -11.667 4 -18s1.66699 -12.333 2 -18s-0.166992 -9.83398 -1.5 -12.501h67v-64h68v-63h-130v-69h198v69h66v62h-66v67
h56c-0.666992 1.33301 -0.833984 4.83301 -0.500977 10.5s1 11.667 2 18s2.33301 12.333 4 18s3.5 9.5 5.5 11.5s5.83301 3.83301 11.5 5.5s11.667 3 18 4s12.333 1.66699 18 2s9.83398 -0.166992 12.501 -1.5v60h-135v-60h-125v330h125v-60h135v60
c-2.66699 -1.33301 -6.83398 -1.83301 -12.501 -1.5s-11.667 1 -18 2s-12.333 2.33301 -18 4s-9.5 3.5 -11.5 5.5s-3.83301 5.83301 -5.5 11.5s-3 11.667 -4 18s-1.66699 12.333 -2 18s0.166992 9.83398 1.5 12.501h-260c1.33301 -2.66699 1.83301 -6.83398 1.5 -12.501
s-1 -11.667 -2 -18s-2.33301 -12.333 -4 -18s-3.5 -9.5 -5.5 -11.5s-5.83301 -3.83301 -11.5 -5.5s-11.667 -3 -18 -4s-12.333 -1.66699 -18 -2s-9.83398 0.166992 -12.501 1.5v-330z" />
<glyph glyph-name="egrave" unicode="&#xe8;"
d="M200 400v-133h133v133h-133zM333 600v-67h-134v67h-66v67h-66v67h199v-134h67zM133 467h267v-67h66v-200h-266v-133h199v-68h-266v68h-66v333h66v67z" />
<glyph glyph-name="eacute" unicode="&#xe9;"
d="M200 400v-133h133v133h-133zM133 467h267v-67h67v-200h-267v-133h199v-68h-266v68h-66v334h66v66zM267 733h198v-65h-65v-67h-67v-68h-133v67h67v133z" />
<glyph glyph-name="ecircumflex" unicode="&#xea;"
d="M200 400v-133h133v133h-133zM133 467h267v-67h67v-200h-267v-133h199v-66h-266v66h-66v334h66v66zM200 733h132v-66h68v-66h66v-67h-134v66h-132v-67h-133v68h66v66h67v66z" />
<glyph glyph-name="edieresis" unicode="&#xeb;"
d="M67 667h133v-134h-133v134zM200 400v-133h133v133h-133zM133 467h266v-67h68v-200h-267v-133h199v-66h-266v66h-66v334h66v66zM333 667h134v-134h-134v134z" />
<glyph glyph-name="igrave" unicode="&#xec;"
d="M59 65v-65h400v65h-135v405h-265v-65h130v-340h-130v0zM194 537h133v67h-67v133h-200v-65h67v-67h67v-68z" />
<glyph glyph-name="iacute" unicode="&#xed;"
d="M59 65v-65h400v65h-135v405h-265v-65h130v-340h-130v0zM257 606h-66v-67h132v67h67v67h67v65h-200v-132z" />
<glyph glyph-name="icircumflex" unicode="&#xee;"
d="M59 65v-65h400v65h-135v405h-265v-65h130v-340h-130v0zM192 737v-66h-67v-67h-66v-67h133v68h133v-67h134v66h-66v67h-67v66h-134v0z" />
<glyph glyph-name="idieresis" unicode="&#xef;"
d="M59 65v-65h400v65h-135v405h-265v-65h130v-340h-130v0zM323 672v-135h134v135h-134v0zM58 672v-135h134v135h-134v0z" />
<glyph glyph-name="eth" unicode="&#xf0;"
d="M200 334h133v-267h-133v267zM332 600v-67h-66v67h-133v-67h67v-66h-133v-67h133v-67h-133v-266h66v-67h267v68h65v333h-65v66h-68v67h133v66h-133zM200 400h67v67h-67v-67z" />
<glyph glyph-name="ntilde" unicode="&#xf1;"
d="M59 470v-470h135v400h130v-400h135v400l-65 7v63h-335v0zM533 736v-133h-67v-68h-199v67h-67v67h-68v-66h-66v-68h-67v134h67v67h200v-66h66v-67h68v66h66v67h67z" />
<glyph glyph-name="ograve" unicode="&#xf2;"
d="M59 70c2.66699 1.33301 6.83398 1.83301 12.501 1.5s11.667 -1 18 -2s12.333 -2.33301 18 -4s9.5 -3.5 11.5 -5.5s3.83301 -5.83301 5.5 -11.5s3 -11.667 4 -18s1.66699 -12.333 2 -18s-0.166992 -9.83398 -1.5 -12.501h260
c-1.33301 2.66699 -1.83301 6.83398 -1.5 12.501s1 11.667 2 18s2.33301 12.333 4 18s3.5 9.5 5.5 11.5s5.83301 3.83301 11.5 5.5s11.667 3 18 4s12.333 1.66699 18 2s9.83398 -0.166992 12.501 -1.5v330c-2.66699 -1.33301 -6.83398 -1.83301 -12.501 -1.5
s-11.667 1 -18 2s-12.333 2.33301 -18 4s-9.5 3.5 -11.5 5.5s-3.83301 5.83301 -5.5 11.5s-3 11.667 -4 18s-1.66699 12.333 -2 18s0.166992 9.83398 1.5 12.501h-260c1.33301 -2.66699 1.83301 -6.83398 1.5 -12.501s-1 -11.667 -2 -18s-2.33301 -12.333 -4 -18
s-3.5 -9.5 -5.5 -11.5s-5.83301 -3.83301 -11.5 -5.5s-11.667 -3 -18 -4s-12.333 -1.66699 -18 -2s-9.83398 0.166992 -12.501 1.5v-330zM199 400h120v-330h-120v330zM59 742h200v-133h66v-67h-132v67h-68v67h-66v66z" />
<glyph glyph-name="oacute" unicode="&#xf3;"
d="M59 70c2.66699 1.33301 6.83398 1.83301 12.501 1.5s11.667 -1 18 -2s12.333 -2.33301 18 -4s9.5 -3.5 11.5 -5.5s3.83301 -5.83301 5.5 -11.5s3 -11.667 4 -18s1.66699 -12.333 2 -18s-0.166992 -9.83398 -1.5 -12.501h260
c-1.33301 2.66699 -1.83301 6.83398 -1.5 12.501s1 11.667 2 18s2.33301 12.333 4 18s3.5 9.5 5.5 11.5s5.83301 3.83301 11.5 5.5s11.667 3 18 4s12.333 1.66699 18 2s9.83398 -0.166992 12.501 -1.5v330c-2.66699 -1.33301 -6.83398 -1.83301 -12.501 -1.5
s-11.667 1 -18 2s-12.333 2.33301 -18 4s-9.5 3.5 -11.5 5.5s-3.83301 5.83301 -5.5 11.5s-3 11.667 -4 18s-1.66699 12.333 -2 18s0.166992 9.83398 1.5 12.501h-260c1.33301 -2.66699 1.83301 -6.83398 1.5 -12.501s-1 -11.667 -2 -18s-2.33301 -12.333 -4 -18
s-3.5 -9.5 -5.5 -11.5s-5.83301 -3.83301 -11.5 -5.5s-11.667 -3 -18 -4s-12.333 -1.66699 -18 -2s-9.83398 0.166992 -12.501 1.5v-330zM199 400h120v-330h-120v330zM254 741h199v-66h-65v-67h-67v-67h-133v66h66v134z" />
<glyph glyph-name="ocircumflex" unicode="&#xf4;"
d="M59 70c2.66699 1.33301 6.83398 1.83301 12.501 1.5s11.667 -1 18 -2s12.333 -2.33301 18 -4s9.5 -3.5 11.5 -5.5s3.83301 -5.83301 5.5 -11.5s3 -11.667 4 -18s1.66699 -12.333 2 -18s-0.166992 -9.83398 -1.5 -12.501h260
c-1.33301 2.66699 -1.83301 6.83398 -1.5 12.501s1 11.667 2 18s2.33301 12.333 4 18s3.5 9.5 5.5 11.5s5.83301 3.83301 11.5 5.5s11.667 3 18 4s12.333 1.66699 18 2s9.83398 -0.166992 12.501 -1.5v330c-2.66699 -1.33301 -6.83398 -1.83301 -12.501 -1.5
s-11.667 1 -18 2s-12.333 2.33301 -18 4s-9.5 3.5 -11.5 5.5s-3.83301 5.83301 -5.5 11.5s-3 11.667 -4 18s-1.66699 12.333 -2 18s0.166992 9.83398 1.5 12.501h-260c1.33301 -2.66699 1.83301 -6.83398 1.5 -12.501s-1 -11.667 -2 -18s-2.33301 -12.333 -4 -18
s-3.5 -9.5 -5.5 -11.5s-5.83301 -3.83301 -11.5 -5.5s-11.667 -3 -18 -4s-12.333 -1.66699 -18 -2s-9.83398 0.166992 -12.501 1.5v-330zM199 400h120v-330h-120v330zM192 737h133v-66h67v-68h65v-66h-132v67h-134v-68h-132v67h65v67h68v67z" />
<glyph glyph-name="otilde" unicode="&#xf5;"
d="M59 70c2.66699 1.33301 6.83398 1.83301 12.501 1.5s11.667 -1 18 -2s12.333 -2.33301 18 -4s9.5 -3.5 11.5 -5.5s3.83301 -5.83301 5.5 -11.5s3 -11.667 4 -18s1.66699 -12.333 2 -18s-0.166992 -9.83398 -1.5 -12.501h260
c-1.33301 2.66699 -1.83301 6.83398 -1.5 12.501s1 11.667 2 18s2.33301 12.333 4 18s3.5 9.5 5.5 11.5s5.83301 3.83301 11.5 5.5s11.667 3 18 4s12.333 1.66699 18 2s9.83398 -0.166992 12.501 -1.5v330c-2.66699 -1.33301 -6.83398 -1.83301 -12.501 -1.5
s-11.667 1 -18 2s-12.333 2.33301 -18 4s-9.5 3.5 -11.5 5.5s-3.83301 5.83301 -5.5 11.5s-3 11.667 -4 18s-1.66699 12.333 -2 18s0.166992 9.83398 1.5 12.501h-260c1.33301 -2.66699 1.83301 -6.83398 1.5 -12.501s-1 -11.667 -2 -18s-2.33301 -12.333 -4 -18
s-3.5 -9.5 -5.5 -11.5s-5.83301 -3.83301 -11.5 -5.5s-11.667 -3 -18 -4s-12.333 -1.66699 -18 -2s-9.83398 0.166992 -12.501 1.5v-330zM199 400h120v-330h-120v330zM0 672h67v65h199v-66h66v-67h68v68h65v65h67v-132h-67l1 -67h-199v67h-67v67h-68v-68h-66v-66h-66v134z
" />
<glyph glyph-name="odieresis" unicode="&#xf6;"
d="M81 641v-120v0h120v0v120v0h-120v0zM321 641v-120v0h120v0v120v0h-120v0zM141 447v-60v0h-60v0v-327v0h60v0v-60v0h240v0v60v0h60v0v327v0h-60v0v60v0h-240v0zM321 387v-327h-120v0v327h120z" />
<glyph glyph-name="divide" unicode="&#xf7;"
d="M200 200h133v-133h-133v133zM200 533h133v-133h-133v133zM465 333v-66h-398v66h398z" />
<glyph glyph-name="oslash" unicode="&#xf8;"
d="M200 133v-66h133v133h-66v-67h-67zM200 400v-133h66v66h67v67h-133zM133 467h333v-400h-66v-67h-333v400h66v67z" />
<glyph glyph-name="ugrave" unicode="&#xf9;"
d="M59 70c2.66699 1.33301 6.83301 1.83398 12.5 1.50098s11.667 -1 18 -2s12.333 -2.33301 18 -4s9.5 -3.5 11.5 -5.5s3.83301 -5.83301 5.5 -11.5s3 -11.667 4 -18s1.66699 -12.333 2 -18s-0.166992 -9.83398 -1.5 -12.501h330v470h-135v-400h-130v400h-135v-400z
M57.999 738.001h199v-132h67v-68h-133v68h-67v67h-66v65z" />
<glyph glyph-name="uacute" unicode="&#xfa;"
d="M59 70c2.66699 1.33301 6.83301 1.83398 12.5 1.50098s11.667 -1 18 -2s12.333 -2.33301 18 -4s9.5 -3.5 11.5 -5.5s3.83301 -5.83301 5.5 -11.5s3 -11.667 4 -18s1.66699 -12.333 2 -18s-0.166992 -9.83398 -1.5 -12.501h330v470h-135v-400h-130v400h-135v-400z
M258.999 737.001h199v-66h-66v-66h-67v-67h-133v66h67v133z" />
<glyph glyph-name="ucircumflex" unicode="&#xfb;"
d="M59 70c2.66699 1.33301 6.83301 1.83398 12.5 1.50098s11.667 -1 18 -2s12.333 -2.33301 18 -4s9.5 -3.5 11.5 -5.5s3.83301 -5.83301 5.5 -11.5s3 -11.667 4 -18s1.66699 -12.333 2 -18s-0.166992 -9.83398 -1.5 -12.501h330v470h-135v-400h-130v400h-135v-400z
M192.999 736.001h132v-65h67v-67h66v-67h-133v67h-133v-68h-132v67h66v67h67v66z" />
<glyph glyph-name="udieresis" unicode="&#xfc;"
d="M83 435v-377v0h60v0v-60v0h300v0v437v0h-120v0v-377h-120v0v377v0h-120v0zM81 641v-120v0h120v0v120v0h-120v0zM321 641v-120v0h120v0v120v0h-120v0z" />
<glyph glyph-name="yacute" unicode="&#xfd;"
d="M6 -139l-0.00195312 -55h265v50c2.66699 -1.33301 7.16699 -1.83301 13.5 -1.5s13 1 20 2s13.5 2.33301 19.5 4s10 3.5 12 5.5c0.666992 0.666992 1.5 4 2.5 10s1.83301 12.5 2.5 19.5s1.33398 13.5 2.00098 19.5s1.66699 9.66699 3 11c2 2 6 3.83301 12 5.5
s12.5 3 19.5 4s13.667 1.66699 20 2s10.833 -0.166992 13.5 -1.5v135h65v405h-135v-400h-130v400h-135v-400c2.66699 1.33301 6.83398 1.83301 12.501 1.5s11.667 -1 18 -2s12.333 -2.33301 18 -4s9.5 -3.5 11.5 -5.5s3.83301 -6 5.5 -12s3 -12.5 4 -19.5
s1.66699 -13.667 2 -20s-0.166992 -10.833 -1.5 -13.5h120v-70h-55v-70h-205zM271.998 744h200v-66h-66v-67h-67v-68h-133v67h67z" />
<glyph glyph-name="thorn" unicode="&#xfe;"
d="M200 68h133v266h-133v-266zM67 600h133v-199h199v-68h66v-266h-65v-67h-200v-200h-133v800z" />
<glyph glyph-name="ydieresis" unicode="&#xff;"
d="M6 -139l-0.00195312 -55h265v50c2.66699 -1.33301 7.16699 -1.83301 13.5 -1.5s13 1 20 2s13.5 2.33301 19.5 4s10 3.5 12 5.5c0.666992 0.666992 1.5 4 2.5 10s1.83301 12.5 2.5 19.5s1.33398 13.5 2.00098 19.5s1.66699 9.66699 3 11c2 2 6 3.83301 12 5.5
s12.5 3 19.5 4s13.667 1.66699 20 2s10.833 -0.166992 13.5 -1.5v135h65v405h-135v-400h-130v400h-135v-400c2.66699 1.33301 6.83398 1.83301 12.501 1.5s11.667 -1 18 -2s12.333 -2.33301 18 -4s9.5 -3.5 11.5 -5.5s3.83301 -6 5.5 -12s3 -12.5 4 -19.5
s1.66699 -13.667 2 -20s-0.166992 -10.833 -1.5 -13.5h120v-70h-55v-70h-205zM206.998 674v-134h-133v134h133zM475.998 674v-134h-134v134h134z" />
<glyph glyph-name="tilde" unicode="&#x2dc;"
d="M1 557v-134h61v65h67v68h77v-68h60v-65h216v65h59v135h-60v-63h-80v-67h-60v68h-80v71h-195v-75h-65z" />
<glyph glyph-name="Euro" unicode="&#x20ac;"
d="M125 625h311v-61h63v-64h-124v63h-188v-162h188v-57l-189 -1v-63h126v-64h-126v-153h188v62h125v-61h-62v-64h-313v64h-61v154h-63v63h63v63h-63v56h62v163h63v62z" />
<glyph glyph-name=".null"
/>
<glyph glyph-name="nonmarkingreturn"
/>
<glyph glyph-name=".0015"
d="M10 70c2.66699 1.33301 6.83398 1.83301 12.501 1.5s11.667 -1 18 -2s12.333 -2.33301 18 -4s9.5 -3.5 11.5 -5.5s3.83301 -5.83301 5.5 -11.5s3 -11.667 4 -18s1.66699 -12.333 2 -18s-0.166992 -9.83398 -1.5 -12.501h260
c-1.33301 2.66699 -1.83301 6.83398 -1.5 12.501s1 11.667 2 18s2.33301 12.333 4 18s3.5 9.5 5.5 11.5s5.83301 3.83301 11.5 5.5s11.667 3 18 4s12.333 1.66699 18 2s9.83398 -0.166992 12.501 -1.5v130h-135v-130h-125v470h125v-130h135v130
c-2.66699 -1.33301 -6.83398 -1.83301 -12.501 -1.5s-11.667 1 -18 2s-12.333 2.33301 -18 4s-9.5 3.5 -11.5 5.5s-3.83301 5.83301 -5.5 11.5s-3 11.667 -4 18s-1.66699 12.333 -2 18s0.166992 9.83398 1.5 12.501h-260c1.33301 -2.66699 1.83301 -6.83398 1.5 -12.501
s-1 -11.667 -2 -18s-2.33301 -12.333 -4 -18s-3.5 -9.5 -5.5 -11.5s-5.83301 -3.83301 -11.5 -5.5s-11.667 -3 -18 -4s-12.333 -1.66699 -18 -2s-9.83398 0.166992 -12.501 1.5v-470z" />
<glyph glyph-name="sf256"
/>
<glyph glyph-name="sf260"
d="M0 479v-479.999h120v400h160v-400h152c0 54.667 0.5 104.667 1.5 150s0.166992 86.166 -2.5 122.499s-8.66699 67.833 -18 94.5s-24 49 -44 67s-46.833 31.5 -80.5 40.5s-76.5 13.5 -128.5 13.5c-6 0 -16.667 -0.5 -32 -1.5s-31.5 -2 -48.5 -3s-33 -1.83301 -48 -2.5
s-25.5 -1 -31.5 -1z" />
<glyph glyph-name="sf264"
d="M6 236c0 -41.333 2.16699 -76.666 6.5 -105.999s13.166 -53.5 26.499 -72.5s32.833 -32.833 58.5 -41.5s60.167 -13 103.5 -13s77.833 4.33301 103.5 13s45.334 22.5 59.001 41.5s22.5 43.167 26.5 72.5s6 64.666 6 105.999s-2 76.666 -6 105.999
s-12.833 53.333 -26.5 72s-33.334 32.334 -59.001 41.001s-60.167 13 -103.5 13s-77.833 -4.33301 -103.5 -13s-45.167 -22.334 -58.5 -41.001s-22.166 -42.667 -26.499 -72s-6.5 -64.666 -6.5 -105.999zM164 386h75v-300h-75v300z" />
<glyph glyph-name="sf265"
d="M8 417v-705c4 0 9.66699 0.833008 17 2.5s15 4 23 7s15.333 6.16699 22 9.5s11 7 13 11c4 4 9.33301 13.333 16 28l21.5 47l21.5 47c6.66699 14.667 12 24 16 28s13.333 9.66699 28 17l47 23l47 22c14.667 6.66699 24 11 28 13c5.33301 4 12.333 9.66699 21 17
s17 15 25 23s14.833 15.333 20.5 22s8.5 11 8.5 13s0.333008 9 1 21s1.5 26 2.5 42s1.83301 32.167 2.5 48.5s1 29.166 1 38.499s-0.333008 22 -1 38s-1.5 32 -2.5 48s-1.83301 30.167 -2.5 42.5s-1 19.5 -1 21.5c-2 5.33301 -6 11.833 -12 19.5
s-12.833 15.334 -20.5 23.001s-15.334 14.5 -23.001 20.5s-14.167 10 -19.5 12c-2 0 -9.16699 0.333008 -21.5 1s-26.5 1.5 -42.5 2.5s-32 1.83301 -48 2.5s-28.667 1 -38 1c-6 0 -16 -0.333008 -30 -1s-29 -1.5 -45 -2.5s-31.167 -1.83301 -45.5 -2.5
s-24.166 -1 -29.499 -1zM158 342h75v-300h-75v300z" />
<glyph glyph-name="sf259"
d="M69 448l0.000976562 -449.999h75l3 372l109 -297l150 300v-375h143c0 10 -0.5 25 -1.5 45s-2.5 42.333 -4.5 67l-6.5 78l-6.5 77.5c-2 24.333 -4 46.166 -6 65.499s-3.66699 33.333 -5 42c0 5.33301 -2.83301 12.333 -8.5 21s-12.5 17 -20.5 25s-16.333 14.833 -25 20.5
s-15.667 8.5 -21 8.5c-2 0 -10.5 0.333008 -25.5 1s-32.333 1.5 -52 2.5s-39.667 1.83301 -60 2.5s-37.166 1 -50.499 1c-7.33301 0 -19.833 -0.333008 -37.5 -1s-36.334 -1.5 -56.001 -2.5s-38.334 -1.83301 -56.001 -2.5s-30.167 -1 -37.5 -1z" />
<glyph glyph-name="sf261"
d="M10 610l-0.00195312 -610.004h135v311c2 0 5.66699 1.33301 11 4l16.5 8c5.66699 2.66699 11.167 4.83398 16.5 6.50098s9 1.83398 11 0.500977s3.83301 -4.33301 5.5 -9s3 -9.66699 4 -15s1.66699 -10.5 2 -15.5s-0.166992 -8.5 -1.5 -10.5
c2.66699 1.33301 6.83398 1.83301 12.501 1.5s11.667 -1 18 -2s12.333 -2.33301 18 -4s9.5 -3.5 11.5 -5.5c0.666992 -1.33301 1.5 -5 2.5 -11s1.83301 -12.5 2.5 -19.5s1.33398 -13.5 2.00098 -19.5s1.66699 -9.33301 3 -10c2 -2 6 -3.83301 12 -5.5s12.5 -3 19.5 -4
s13.667 -1.66699 20 -2s10.833 0.166992 13.5 1.5v-200h135v610h-135v-270h-65c1.33301 2.66699 1.83301 6.83398 1.5 12.501s-1 11.667 -2 18s-2.33301 12.333 -4 18s-3.5 9.5 -5.5 11.5c-1.33301 0.666992 -5 1.5 -11 2.5s-12.5 1.83301 -19.5 2.5
s-13.5 1.33398 -19.5 2.00098s-9.33301 1.66699 -10 3c-2 2 -3.83301 6 -5.5 12s-3 12.5 -4 19.5s-1.66699 13.667 -2 20s0.166992 10.833 1.5 13.5h-55v135h-135z" />
<glyph glyph-name="sf263"
d="M7 457l-0.000976562 -457.001h102v233c1.33301 0 4 1 8 3l12.5 6c4.33301 2 8.5 3.66699 12.5 5s6.66699 1.33301 8 0s2.66602 -3.5 3.99902 -6.5s2.33301 -6.5 3 -10.5s1 -8 1 -12c0 -3.33301 -0.333008 -6 -1 -8c2 0.666992 5 1 9 1
c4.66699 0 9.33398 -0.5 14.001 -1.5s9.16699 -2.16699 13.5 -3.5s7.16602 -2.66602 8.49902 -3.99902c0.666992 -0.666992 1.33398 -3.33398 2.00098 -8.00098l2 -14.5l2 -14.5c0.666992 -4.66699 1.33398 -7.33398 2.00098 -8.00098
c2 -1.33301 5.16699 -2.66602 9.5 -3.99902s9 -2.33301 14 -3s10 -1.16699 15 -1.5s8.5 0.166992 10.5 1.5v-150h101v457h-101v-202h-49c0.666992 2 1 5 1 9c0 4.66699 -0.5 9.33398 -1.5 14.001s-2.16699 9.16699 -3.5 13.5s-2.66602 7.16602 -3.99902 8.49902
c-0.666992 0.666992 -3.33398 1.33398 -8.00098 2.00098s-9.5 1.16699 -14.5 1.5s-9.83301 0.833008 -14.5 1.5s-7.33398 1.33398 -8.00098 2.00098c-1.33301 2 -2.66602 5.16699 -3.99902 9.5s-2.33301 9.16602 -3 14.499s-1.16699 10.333 -1.5 15s0.166992 8 1.5 10h-41
v101h-102z" />
<glyph glyph-name="sf262"
d="M7 457v-457h102v304h41v52h-41v101h-102zM259 300l0.000976562 -300h101v457h-101v-97c-2 0.666992 -5.66699 1 -11 1c-4.66699 0 -9.5 -0.5 -14.5 -1.5s-9.66699 -2.16699 -14 -3.5s-7.5 -2.66602 -9.5 -3.99902
c-0.666992 -0.666992 -1.33398 -3.33398 -2.00098 -8.00098l-2 -14.5l-2 -14.5c-0.666992 -4.66699 -1.33398 -7.33398 -2.00098 -8.00098c-1.33301 -1.33301 -4.16602 -2.66602 -8.49902 -3.99902s-8.83301 -2.33301 -13.5 -3s-9.16699 -1.16699 -13.5 -1.5
s-7.5 0.166992 -9.5 1.5v-143h49v143h53z" />
<glyph glyph-name="sf266"
d="M10 130l0.00585938 -130h135v130h130v-130h135v130c-2.66699 -1.33301 -6.83398 -1.83301 -12.501 -1.5s-11.667 1 -18 2s-12.333 2.33301 -18 4s-9.5 3.5 -11.5 5.5c-1.33301 0.666992 -2.33301 4 -3 10s-1.33398 12.5 -2.00098 19.5s-1.5 13.5 -2.5 19.5
s-1.83301 9.66699 -2.5 11c-2 2 -5.83301 3.83301 -11.5 5.5s-11.667 3 -18 4s-12.333 1.66699 -18 2s-9.83398 -0.166992 -12.501 -1.5v65h65v60h65v135h-135v-130h-130v130h-135v-135h65v-60h65v-65c-2.66699 1.33301 -6.83398 1.83301 -12.501 1.5s-11.667 -1 -18 -2
s-12.333 -2.33301 -18 -4s-9.5 -3.5 -11.5 -5.5c-1.33301 -1.33301 -2.33301 -5 -3 -11s-1.33398 -12.5 -2.00098 -19.5s-1.5 -13.5 -2.5 -19.5s-1.83301 -9.33301 -2.5 -10c-2 -2 -5.83301 -3.83301 -11.5 -5.5s-11.667 -3 -18 -4s-12.333 -1.66699 -18 -2
s-9.83398 0.166992 -12.501 1.5z" />
<glyph glyph-name="sf267"
d="M6 -139l-0.00195312 -55h265v50c2.66699 -1.33301 7.16699 -1.83301 13.5 -1.5s13 1 20 2s13.5 2.33301 19.5 4s10 3.5 12 5.5c0.666992 0.666992 1.5 4 2.5 10s1.83301 12.5 2.5 19.5s1.33398 13.5 2.00098 19.5s1.66699 9.66699 3 11c2 2 6 3.83301 12 5.5
s12.5 3 19.5 4s13.667 1.66699 20 2s10.833 -0.166992 13.5 -1.5v135h65v405h-135v-400h-130v400h-135v-400c2.66699 1.33301 6.83398 1.83301 12.501 1.5s11.667 -1 18 -2s12.333 -2.33301 18 -4s9.5 -3.5 11.5 -5.5s3.83301 -6 5.5 -12s3 -12.5 4 -19.5
s1.66699 -13.667 2 -20s-0.166992 -10.833 -1.5 -13.5h120v-70h-55v-70h-205z" />
<glyph glyph-name="sf268"
d="M145 4l-0.00195312 -130.001h130v130c2.66699 -1.33301 7.16699 -1.83301 13.5 -1.5s13 1 20 2s13.5 2.33301 19.5 4s10 3.5 12 5.5c0.666992 0.666992 1.5 4 2.5 10s1.83301 12.5 2.5 19.5s1.33398 13.5 2.00098 19.5s1.66699 9.66699 3 11
c2 2 5.83301 3.83301 11.5 5.5s11.667 3 18 4s12.333 1.66699 18 2s9.83398 -0.166992 12.501 -1.5v130c-2.66699 -1.33301 -6.83398 -1.83301 -12.501 -1.5s-11.667 1 -18 2s-12.333 2.33301 -18 4s-9.5 3.5 -11.5 5.5c-1.33301 0.666992 -2.33301 4 -3 10
s-1.33398 12.5 -2.00098 19.5s-1.5 13.5 -2.5 19.5s-1.83301 9.66699 -2.5 11c-2 2 -6 3.83301 -12 5.5s-12.5 3 -19.5 4s-13.667 1.66699 -20 2s-10.833 -0.166992 -13.5 -1.5v50c-2.66699 -1.33301 -7.33398 -2 -14.001 -2c-6 0 -12.5 0.5 -19.5 1.5s-13.5 2.5 -19.5 4.5
s-10 4 -12 6s-4 6 -6 12s-3.5 12.5 -4.5 19.5s-1.5 13.5 -1.5 19.5c0 6.66699 0.666992 11.334 2 14.001h-50v135h125v-60h135v60c-2.66699 -1.33301 -6.83398 -1.83301 -12.501 -1.5s-11.667 1 -18 2s-12.333 2.33301 -18 4s-9.5 3.5 -11.5 5.5
c-1.33301 0.666992 -2.33301 4 -3 10s-1.33398 12.5 -2.00098 19.5s-1.5 13.5 -2.5 19.5s-1.83301 9.66699 -2.5 11c-2 2 -6 3.83301 -12 5.5s-12.5 3 -19.5 4s-13.667 1.66699 -20 2s-10.833 -0.166992 -13.5 -1.5v90h-130v-90
c-2.66699 1.33301 -7.16699 1.83301 -13.5 1.5s-13 -1 -20 -2s-13.5 -2.33301 -19.5 -4s-10 -3.5 -12 -5.5c-1.33301 -1.33301 -2.33301 -5 -3 -11s-1.33398 -12.5 -2.00098 -19.5s-1.5 -13.5 -2.5 -19.5s-1.83301 -9.33301 -2.5 -10c-2 -2 -5.83301 -3.83301 -11.5 -5.5
s-11.667 -3 -18 -4s-12.333 -1.66699 -18 -2s-9.83398 0.166992 -12.501 1.5v-130c2.66699 1.33301 6.83398 1.83301 12.501 1.5s11.667 -1 18 -2s12.333 -2.33301 18 -4s9.5 -3.5 11.5 -5.5c0.666992 -1.33301 1.5 -5 2.5 -11s1.83301 -12.5 2.5 -19.5
s1.33398 -13.5 2.00098 -19.5s1.66699 -9.33301 3 -10c2 -2 5.83301 -3.83301 11.5 -5.5s11.667 -3 18 -4s12.333 -1.66699 18 -2s9.83398 0.166992 12.501 1.5c-1.33301 -2 -1.66602 -5.33301 -0.999023 -10s1.5 -9.66699 2.5 -15s2.33301 -10.333 4 -15
s3.16699 -8 4.5 -10s4.33301 -3.66699 9 -5s9.66699 -2.5 15 -3.5s10.5 -1.66699 15.5 -2s8.5 -0.166016 10.5 0.500977c-1.33301 -2.66699 -1.83301 -6.83398 -1.5 -12.501s1 -11.667 2 -18s2.33301 -12.333 4 -18s3.5 -9.5 5.5 -11.5s5.83301 -3.83301 11.5 -5.5
s11.667 -3 18 -4s12.333 -1.66699 18 -2s9.83398 0.166992 12.501 1.5v-130h-125v60h-135v-60c2.66699 1.33301 6.83398 1.83301 12.501 1.5s11.667 -1 18 -2s12.333 -2.33301 18 -4s9.5 -3.5 11.5 -5.5c0.666992 -1.33301 1.5 -5 2.5 -11s1.83301 -12.5 2.5 -19.5
s1.33398 -13.5 2.00098 -19.5s1.66699 -9.33301 3 -10c2 -2 6 -3.83301 12 -5.5s12.5 -3 19.5 -4s13.667 -1.66699 20 -2s10.833 0.166992 13.5 1.5z" />
<glyph glyph-name="sf269"
d="M10 810v-810h260v55h-130v690h130v65h-260v0z" />
<glyph glyph-name="sf270"
d="M56 603v-200h130v200h-130v0zM326 603v-200h130v200h-130v0z" />
<glyph glyph-name="glyph124"
d="M267 600h133v-267h-200z" />
</font>
</defs></svg>

After

Width:  |  Height:  |  Size: 97 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 207 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 282 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

2386
htdocs/themes/i386/js/bootstrap.js vendored Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,29 @@
// TODO number prefixes
(function() {
// Really primitive kill-ring implementation.
var killRing = [];
function addToRing(str) {
killRing.push(str);
if (killRing.length > 50) killRing.shift();
}
function getFromRing() { return killRing[killRing.length - 1] || ""; }
function popFromRing() { if (killRing.length > 1) killRing.pop(); return getFromRing(); }
CodeMirror.keyMap.emacs = {
"Ctrl-X": function(cm) {cm.setOption("keyMap", "emacs-Ctrl-X");},
"Ctrl-W": function(cm) {addToRing(cm.getSelection()); cm.replaceSelection("");},
"Ctrl-Alt-W": function(cm) {addToRing(cm.getSelection()); cm.replaceSelection("");},
"Alt-W": function(cm) {addToRing(cm.getSelection());},
"Ctrl-Y": function(cm) {cm.replaceSelection(getFromRing());},
"Alt-Y": function(cm) {cm.replaceSelection(popFromRing());},
"Ctrl-/": "undo", "Shift-Ctrl--": "undo", "Shift-Alt-,": "goDocStart", "Shift-Alt-.": "goDocEnd",
"Ctrl-S": "findNext", "Ctrl-R": "findPrev", "Ctrl-G": "clearSearch", "Shift-Alt-5": "replace",
"Ctrl-Z": "undo", "Cmd-Z": "undo", "Alt-/": "autocomplete",
fallthrough: ["basic", "emacsy"]
};
CodeMirror.keyMap["emacs-Ctrl-X"] = {
"Ctrl-S": "save", "Ctrl-W": "save", "S": "saveAll", "F": "open", "U": "undo", "K": "close",
auto: "emacs", nofallthrough: true
};
})();

View File

@ -0,0 +1,766 @@
// Supported keybindings:
//
// Cursor movement:
// h, j, k, l
// e, E, w, W, b, B
// Ctrl-f, Ctrl-b
// Ctrl-n, Ctrl-p
// $, ^, 0
// G
// ge, gE
// gg
// f<char>, F<char>, t<char>, T<char>
// Ctrl-o, Ctrl-i TODO (FIXME - Ctrl-O wont work in Chrome)
// /, ?, n, N TODO (does not work)
// #, * TODO
//
// Entering insert mode:
// i, I, a, A, o, O
// s
// ce, cb (without support for number of actions like c3e - TODO)
// cc
// S, C TODO
// cf<char>, cF<char>, ct<char>, cT<char>
//
// Deleting text:
// x, X
// J
// dd, D
// de, db (without support for number of actions like d3e - TODO)
// df<char>, dF<char>, dt<char>, dT<char>
//
// Yanking and pasting:
// yy, Y
// p, P
// p'<char> TODO - test
// y'<char> TODO - test
// m<char> TODO - test
//
// Changing text in place:
// ~
// r<char>
//
// Visual mode:
// v, V TODO
//
// Misc:
// . TODO
//
(function() {
var count = "";
var sdir = "f";
var buf = "";
var yank = 0;
var mark = [];
var reptTimes = 0;
function emptyBuffer() { buf = ""; }
function pushInBuffer(str) { buf += str; }
function pushCountDigit(digit) { return function(cm) {count += digit;}; }
function popCount() { var i = parseInt(count, 10); count = ""; return i || 1; }
function iterTimes(func) {
for (var i = 0, c = popCount(); i < c; ++i) func(i, i == c - 1);
}
function countTimes(func) {
if (typeof func == "string") func = CodeMirror.commands[func];
return function(cm) { iterTimes(function () { func(cm); }); };
}
function iterObj(o, f) {
for (var prop in o) if (o.hasOwnProperty(prop)) f(prop, o[prop]);
}
function iterList(l, f) {
for (var i in l) f(l[i]);
}
function toLetter(ch) {
// T -> t, Shift-T -> T, '*' -> *, "Space" -> " "
if (ch.slice(0, 6) == "Shift-") {
return ch.slice(0, 1);
} else {
if (ch == "Space") return " ";
if (ch.length == 3 && ch[0] == "'" && ch[2] == "'") return ch[1];
return ch.toLowerCase();
}
}
var SPECIAL_SYMBOLS = "~`!@#$%^&*()_-+=[{}]\\|/?.,<>:;\"\'1234567890";
function toCombo(ch) {
// t -> T, T -> Shift-T, * -> '*', " " -> "Space"
if (ch == " ") return "Space";
var specialIdx = SPECIAL_SYMBOLS.indexOf(ch);
if (specialIdx != -1) return "'" + ch + "'";
if (ch.toLowerCase() == ch) return ch.toUpperCase();
return "Shift-" + ch.toUpperCase();
}
var word = [/\w/, /[^\w\s]/], bigWord = [/\S/];
function findWord(line, pos, dir, regexps) {
var stop = 0, next = -1;
if (dir > 0) { stop = line.length; next = 0; }
var start = stop, end = stop;
// Find bounds of next one.
outer: for (; pos != stop; pos += dir) {
for (var i = 0; i < regexps.length; ++i) {
if (regexps[i].test(line.charAt(pos + next))) {
start = pos;
for (; pos != stop; pos += dir) {
if (!regexps[i].test(line.charAt(pos + next))) break;
}
end = pos;
break outer;
}
}
}
return {from: Math.min(start, end), to: Math.max(start, end)};
}
function moveToWord(cm, regexps, dir, times, where) {
var cur = cm.getCursor();
for (var i = 0; i < times; i++) {
var line = cm.getLine(cur.line), startCh = cur.ch, word;
while (true) {
// If we're at start/end of line, start on prev/next respectivly
if (cur.ch == line.length && dir > 0) {
cur.line++;
cur.ch = 0;
line = cm.getLine(cur.line);
} else if (cur.ch == 0 && dir < 0) {
cur.line--;
cur.ch = line.length;
line = cm.getLine(cur.line);
}
if (!line) break;
// On to the actual searching
word = findWord(line, cur.ch, dir, regexps);
cur.ch = word[where == "end" ? "to" : "from"];
if (startCh == cur.ch && word.from != word.to) cur.ch = word[dir < 0 ? "from" : "to"];
else break;
}
}
return cur;
}
function joinLineNext(cm) {
var cur = cm.getCursor(), ch = cur.ch, line = cm.getLine(cur.line);
CodeMirror.commands.goLineEnd(cm);
if (cur.line != cm.lineCount()) {
CodeMirror.commands.goLineEnd(cm);
cm.replaceSelection(" ", "end");
CodeMirror.commands.delCharRight(cm);
}
}
function delTillMark(cm, cHar) {
var i = mark[cHar];
if (i === undefined) {
// console.log("Mark not set"); // TODO - show in status bar
return;
}
var l = cm.getCursor().line, start = i > l ? l : i, end = i > l ? i : l;
cm.setCursor(start);
for (var c = start; c <= end; c++) {
pushInBuffer("\n"+cm.getLine(start));
cm.removeLine(start);
}
}
function yankTillMark(cm, cHar) {
var i = mark[cHar];
if (i === undefined) {
// console.log("Mark not set"); // TODO - show in status bar
return;
}
var l = cm.getCursor().line, start = i > l ? l : i, end = i > l ? i : l;
for (var c = start; c <= end; c++) {
pushInBuffer("\n"+cm.getLine(c));
}
cm.setCursor(start);
}
function goLineStartText(cm) {
// Go to the start of the line where the text begins, or the end for whitespace-only lines
var cur = cm.getCursor(), firstNonWS = cm.getLine(cur.line).search(/\S/);
cm.setCursor(cur.line, firstNonWS == -1 ? line.length : firstNonWS, true);
}
function charIdxInLine(cm, cHar, motion_options) {
// Search for cHar in line.
// motion_options: {forward, inclusive}
// If inclusive = true, include it too.
// If forward = true, search forward, else search backwards.
// If char is not found on this line, do nothing
var cur = cm.getCursor(), line = cm.getLine(cur.line), idx;
var ch = toLetter(cHar), mo = motion_options;
if (mo.forward) {
idx = line.indexOf(ch, cur.ch + 1);
if (idx != -1 && mo.inclusive) idx += 1;
} else {
idx = line.lastIndexOf(ch, cur.ch);
if (idx != -1 && !mo.inclusive) idx += 1;
}
return idx;
}
function moveTillChar(cm, cHar, motion_options) {
// Move to cHar in line, as found by charIdxInLine.
var idx = charIdxInLine(cm, cHar, motion_options), cur = cm.getCursor();
if (idx != -1) cm.setCursor({line: cur.line, ch: idx});
}
function delTillChar(cm, cHar, motion_options) {
// delete text in this line, untill cHar is met,
// as found by charIdxInLine.
// If char is not found on this line, do nothing
var idx = charIdxInLine(cm, cHar, motion_options);
var cur = cm.getCursor();
if (idx !== -1) {
if (motion_options.forward) {
cm.replaceRange("", {line: cur.line, ch: cur.ch}, {line: cur.line, ch: idx});
} else {
cm.replaceRange("", {line: cur.line, ch: idx}, {line: cur.line, ch: cur.ch});
}
}
}
function enterInsertMode(cm) {
// enter insert mode: switch mode and cursor
popCount();
cm.setOption("keyMap", "vim-insert");
}
// main keymap
var map = CodeMirror.keyMap.vim = {
// Pipe (|); TODO: should be *screen* chars, so need a util function to turn tabs into spaces?
"'|'": function(cm) {
cm.setCursor(cm.getCursor().line, popCount() - 1, true);
},
"A": function(cm) {
cm.setCursor(cm.getCursor().line, cm.getCursor().ch+1, true);
enterInsertMode(cm);
},
"Shift-A": function(cm) { CodeMirror.commands.goLineEnd(cm); enterInsertMode(cm);},
"I": function(cm) { enterInsertMode(cm);},
"Shift-I": function(cm) { goLineStartText(cm); enterInsertMode(cm);},
"O": function(cm) {
CodeMirror.commands.goLineEnd(cm);
CodeMirror.commands.newlineAndIndent(cm);
enterInsertMode(cm);
},
"Shift-O": function(cm) {
CodeMirror.commands.goLineStart(cm);
cm.replaceSelection("\n", "start");
cm.indentLine(cm.getCursor().line);
enterInsertMode(cm);
},
"G": function(cm) { cm.setOption("keyMap", "vim-prefix-g");},
"Shift-D": function(cm) {
// commented out verions works, but I left original, cause maybe
// I don't know vim enouth to see what it does
/* var cur = cm.getCursor();
var f = {line: cur.line, ch: cur.ch}, t = {line: cur.line};
pushInBuffer(cm.getRange(f, t));
*/
emptyBuffer();
mark["Shift-D"] = cm.getCursor(false).line;
cm.setCursor(cm.getCursor(true).line);
delTillMark(cm,"Shift-D"); mark = [];
},
"S": function (cm) {
countTimes(function (_cm) {
CodeMirror.commands.delCharRight(_cm);
})(cm);
enterInsertMode(cm);
},
"M": function(cm) {cm.setOption("keyMap", "vim-prefix-m"); mark = [];},
"Y": function(cm) {cm.setOption("keyMap", "vim-prefix-y"); emptyBuffer(); yank = 0;},
"Shift-Y": function(cm) {
emptyBuffer();
mark["Shift-D"] = cm.getCursor(false).line;
cm.setCursor(cm.getCursor(true).line);
yankTillMark(cm,"Shift-D"); mark = [];
},
"/": function(cm) {var f = CodeMirror.commands.find; f && f(cm); sdir = "f";},
"'?'": function(cm) {
var f = CodeMirror.commands.find;
if (f) { f(cm); CodeMirror.commands.findPrev(cm); sdir = "r"; }
},
"N": function(cm) {
var fn = CodeMirror.commands.findNext;
if (fn) sdir != "r" ? fn(cm) : CodeMirror.commands.findPrev(cm);
},
"Shift-N": function(cm) {
var fn = CodeMirror.commands.findNext;
if (fn) sdir != "r" ? CodeMirror.commands.findPrev(cm) : fn.findNext(cm);
},
"Shift-G": function(cm) {
count == "" ? cm.setCursor(cm.lineCount()) : cm.setCursor(parseInt(count, 10)-1);
popCount();
CodeMirror.commands.goLineStart(cm);
},
nofallthrough: true, style: "fat-cursor"
};
// standard mode switching
iterList(["d", "t", "T", "f", "F", "c", "r"],
function (ch) {
CodeMirror.keyMap.vim[toCombo(ch)] = function (cm) {
cm.setOption("keyMap", "vim-prefix-" + ch);
emptyBuffer();
};
});
function addCountBindings(keyMap) {
// Add bindings for number keys
keyMap["0"] = function(cm) {
count.length > 0 ? pushCountDigit("0")(cm) : CodeMirror.commands.goLineStart(cm);
};
for (var i = 1; i < 10; ++i) keyMap[i] = pushCountDigit(i);
}
addCountBindings(CodeMirror.keyMap.vim);
// main num keymap
// Add bindings that are influenced by number keys
iterObj({
"Left": "goColumnLeft", "Right": "goColumnRight",
"Down": "goLineDown", "Up": "goLineUp", "Backspace": "goCharLeft",
"Space": "goCharRight",
"X": function(cm) {CodeMirror.commands.delCharRight(cm);},
"P": function(cm) {
var cur = cm.getCursor().line;
if (buf!= "") {
if (buf[0] == "\n") CodeMirror.commands.goLineEnd(cm);
cm.replaceRange(buf, cm.getCursor());
}
},
"Shift-X": function(cm) {CodeMirror.commands.delCharLeft(cm);},
"Shift-J": function(cm) {joinLineNext(cm);},
"Shift-P": function(cm) {
var cur = cm.getCursor().line;
if (buf!= "") {
CodeMirror.commands.goLineUp(cm);
CodeMirror.commands.goLineEnd(cm);
cm.replaceSelection(buf, "end");
}
cm.setCursor(cur+1);
},
"'~'": function(cm) {
var cur = cm.getCursor(), cHar = cm.getRange({line: cur.line, ch: cur.ch}, {line: cur.line, ch: cur.ch+1});
cHar = cHar != cHar.toLowerCase() ? cHar.toLowerCase() : cHar.toUpperCase();
cm.replaceRange(cHar, {line: cur.line, ch: cur.ch}, {line: cur.line, ch: cur.ch+1});
cm.setCursor(cur.line, cur.ch+1);
},
"Ctrl-B": function(cm) {CodeMirror.commands.goPageUp(cm);},
"Ctrl-F": function(cm) {CodeMirror.commands.goPageDown(cm);},
"Ctrl-P": "goLineUp", "Ctrl-N": "goLineDown",
"U": "undo", "Ctrl-R": "redo"
}, function(key, cmd) { map[key] = countTimes(cmd); });
// empty key maps
iterList([
"vim-prefix-d'",
"vim-prefix-y'",
"vim-prefix-df",
"vim-prefix-dF",
"vim-prefix-dt",
"vim-prefix-dT",
"vim-prefix-c",
"vim-prefix-cf",
"vim-prefix-cF",
"vim-prefix-ct",
"vim-prefix-cT",
"vim-prefix-",
"vim-prefix-f",
"vim-prefix-F",
"vim-prefix-t",
"vim-prefix-T",
"vim-prefix-r",
"vim-prefix-m"
],
function (prefix) {
CodeMirror.keyMap[prefix] = {
auto: "vim",
nofallthrough: true,
style: "fat-cursor"
};
});
CodeMirror.keyMap["vim-prefix-g"] = {
"E": countTimes(function(cm) { cm.setCursor(moveToWord(cm, word, -1, 1, "start"));}),
"Shift-E": countTimes(function(cm) { cm.setCursor(moveToWord(cm, bigWord, -1, 1, "start"));}),
"G": function (cm) { cm.setCursor({line: 0, ch: cm.getCursor().ch});},
auto: "vim", nofallthrough: true, style: "fat-cursor"
};
CodeMirror.keyMap["vim-prefix-d"] = {
"D": countTimes(function(cm) {
pushInBuffer("\n"+cm.getLine(cm.getCursor().line));
cm.removeLine(cm.getCursor().line);
cm.setOption("keyMap", "vim");
}),
"'": function(cm) {
cm.setOption("keyMap", "vim-prefix-d'");
emptyBuffer();
},
"B": function(cm) {
var cur = cm.getCursor();
var line = cm.getLine(cur.line);
var index = line.lastIndexOf(" ", cur.ch);
pushInBuffer(line.substring(index, cur.ch));
cm.replaceRange("", {line: cur.line, ch: index}, cur);
cm.setOption("keyMap", "vim");
},
nofallthrough: true, style: "fat-cursor"
};
// FIXME - does not work for bindings like "d3e"
addCountBindings(CodeMirror.keyMap["vim-prefix-d"]);
CodeMirror.keyMap["vim-prefix-c"] = {
"B": function (cm) {
countTimes("delWordLeft")(cm);
enterInsertMode(cm);
},
"C": function (cm) {
iterTimes(function (i, last) {
CodeMirror.commands.deleteLine(cm);
if (i) {
CodeMirror.commands.delCharRight(cm);
if (last) CodeMirror.commands.deleteLine(cm);
}
});
enterInsertMode(cm);
},
nofallthrough: true, style: "fat-cursor"
};
iterList(["vim-prefix-d", "vim-prefix-c", "vim-prefix-"], function (prefix) {
iterList(["f", "F", "T", "t"],
function (ch) {
CodeMirror.keyMap[prefix][toCombo(ch)] = function (cm) {
cm.setOption("keyMap", prefix + ch);
emptyBuffer();
};
});
});
var MOTION_OPTIONS = {
"t": {inclusive: false, forward: true},
"f": {inclusive: true, forward: true},
"T": {inclusive: false, forward: false},
"F": {inclusive: true, forward: false}
};
function setupPrefixBindingForKey(m) {
CodeMirror.keyMap["vim-prefix-m"][m] = function(cm) {
mark[m] = cm.getCursor().line;
};
CodeMirror.keyMap["vim-prefix-d'"][m] = function(cm) {
delTillMark(cm,m);
};
CodeMirror.keyMap["vim-prefix-y'"][m] = function(cm) {
yankTillMark(cm,m);
};
CodeMirror.keyMap["vim-prefix-r"][m] = function (cm) {
var cur = cm.getCursor();
cm.replaceRange(toLetter(m),
{line: cur.line, ch: cur.ch},
{line: cur.line, ch: cur.ch + 1});
CodeMirror.commands.goColumnLeft(cm);
};
// all commands, related to motions till char in line
iterObj(MOTION_OPTIONS, function (ch, options) {
CodeMirror.keyMap["vim-prefix-" + ch][m] = function(cm) {
moveTillChar(cm, m, options);
};
CodeMirror.keyMap["vim-prefix-d" + ch][m] = function(cm) {
delTillChar(cm, m, options);
};
CodeMirror.keyMap["vim-prefix-c" + ch][m] = function(cm) {
delTillChar(cm, m, options);
enterInsertMode(cm);
};
});
}
for (var i = 65; i < 65 + 26; i++) { // uppercase alphabet char codes
var ch = String.fromCharCode(i);
setupPrefixBindingForKey(toCombo(ch));
setupPrefixBindingForKey(toCombo(ch.toLowerCase()));
}
iterList(SPECIAL_SYMBOLS, function (ch) {
setupPrefixBindingForKey(toCombo(ch));
});
setupPrefixBindingForKey("Space");
CodeMirror.keyMap["vim-prefix-y"] = {
"Y": countTimes(function(cm) { pushInBuffer("\n"+cm.getLine(cm.getCursor().line+yank)); yank++; }),
"'": function(cm) {cm.setOption("keyMap", "vim-prefix-y'"); emptyBuffer();},
nofallthrough: true, style: "fat-cursor"
};
CodeMirror.keyMap["vim-insert"] = {
// TODO: override navigation keys so that Esc will cancel automatic indentation from o, O, i_<CR>
"Esc": function(cm) {
cm.setCursor(cm.getCursor().line, cm.getCursor().ch-1, true);
cm.setOption("keyMap", "vim");
},
"Ctrl-N": "autocomplete",
"Ctrl-P": "autocomplete",
fallthrough: ["default"]
};
function findMatchedSymbol(cm, cur, symb) {
var line = cur.line;
var symb = symb ? symb : cm.getLine(line)[cur.ch];
// Are we at the opening or closing char
var forwards = ['(', '[', '{'].indexOf(symb) != -1;
var reverseSymb = (function(sym) {
switch (sym) {
case '(' : return ')';
case '[' : return ']';
case '{' : return '}';
case ')' : return '(';
case ']' : return '[';
case '}' : return '{';
default : return null;
}
})(symb);
// Couldn't find a matching symbol, abort
if (reverseSymb == null) return cur;
// Tracking our imbalance in open/closing symbols. An opening symbol wii be
// the first thing we pick up if moving forward, this isn't true moving backwards
var disBal = forwards ? 0 : 1;
while (true) {
if (line == cur.line) {
// First pass, do some special stuff
var currLine = forwards ? cm.getLine(line).substr(cur.ch).split('') : cm.getLine(line).substr(0,cur.ch).split('').reverse();
} else {
var currLine = forwards ? cm.getLine(line).split('') : cm.getLine(line).split('').reverse();
}
for (var index = 0; index < currLine.length; index++) {
if (currLine[index] == symb) disBal++;
else if (currLine[index] == reverseSymb) disBal--;
if (disBal == 0) {
if (forwards && cur.line == line) return {line: line, ch: index + cur.ch};
else if (forwards) return {line: line, ch: index};
else return {line: line, ch: currLine.length - index - 1 };
}
}
if (forwards) line++;
else line--;
}
}
function selectCompanionObject(cm, revSymb, inclusive) {
var cur = cm.getCursor();
var end = findMatchedSymbol(cm, cur, revSymb);
var start = findMatchedSymbol(cm, end);
start.ch += inclusive ? 1 : 0;
end.ch += inclusive ? 0 : 1;
return {start: start, end: end};
}
// These are our motion commands to be used for navigation and selection with
// certian other commands. All should return a cursor object.
var motionList = ['B', 'E', 'J', 'K', 'H', 'L', 'W', 'Shift-W', "'^'", "'$'", "'%'", 'Esc'];
motions = {
'B': function(cm, times) { return moveToWord(cm, word, -1, times); },
'Shift-B': function(cm, times) { return moveToWord(cm, bigWord, -1, times); },
'E': function(cm, times) { return moveToWord(cm, word, 1, times, 'end'); },
'Shift-E': function(cm, times) { return moveToWord(cm, bigWord, 1, times, 'end'); },
'J': function(cm, times) {
var cur = cm.getCursor();
return {line: cur.line+times, ch : cur.ch};
},
'K': function(cm, times) {
var cur = cm.getCursor();
return {line: cur.line-times, ch: cur.ch};
},
'H': function(cm, times) {
var cur = cm.getCursor();
return {line: cur.line, ch: cur.ch-times};
},
'L': function(cm, times) {
var cur = cm.getCursor();
return {line: cur.line, ch: cur.ch+times};
},
'W': function(cm, times) { return moveToWord(cm, word, 1, times); },
'Shift-W': function(cm, times) { return moveToWord(cm, bigWord, 1, times); },
"'^'": function(cm, times) {
var cur = cm.getCursor();
var line = cm.getLine(cur.line).split('');
// Empty line :o
if (line.length == 0) return cur;
for (var index = 0; index < line.length; index++) {
if (line[index].match(/[^\s]/)) return {line: cur.line, ch: index};
}
},
"'$'": function(cm) {
var cur = cm.getCursor();
var line = cm.getLine(cur.line);
return {line: cur.line, ch: line.length};
},
"'%'": function(cm) { return findMatchedSymbol(cm, cm.getCursor()); },
"Esc" : function(cm) {
cm.setOption('vim');
reptTimes = 0;
return cm.getCursor();
}
};
// Map our movement actions each operator and non-operational movement
motionList.forEach(function(key, index, array) {
CodeMirror.keyMap['vim-prefix-d'][key] = function(cm) {
// Get our selected range
var start = cm.getCursor();
var end = motions[key](cm, reptTimes ? reptTimes : 1);
// Set swap var if range is of negative length
if ((start.line > end.line) || (start.line == end.line && start.ch > end.ch)) var swap = true;
// Take action, switching start and end if swap var is set
pushInBuffer(cm.getRange(swap ? end : start, swap ? start : end));
cm.replaceRange("", swap ? end : start, swap ? start : end);
// And clean up
reptTimes = 0;
cm.setOption("keyMap", "vim");
};
CodeMirror.keyMap['vim-prefix-c'][key] = function(cm) {
var start = cm.getCursor();
var end = motions[key](cm, reptTimes ? reptTimes : 1);
if ((start.line > end.line) || (start.line == end.line && start.ch > end.ch)) var swap = true;
pushInBuffer(cm.getRange(swap ? end : start, swap ? start : end));
cm.replaceRange("", swap ? end : start, swap ? start : end);
reptTimes = 0;
cm.setOption('keyMap', 'vim-insert');
};
CodeMirror.keyMap['vim-prefix-y'][key] = function(cm) {
var start = cm.getCursor();
var end = motions[key](cm, reptTimes ? reptTimes : 1);
if ((start.line > end.line) || (start.line == end.line && start.ch > end.ch)) var swap = true;
pushInBuffer(cm.getRange(swap ? end : start, swap ? start : end));
reptTimes = 0;
cm.setOption("keyMap", "vim");
};
CodeMirror.keyMap['vim'][key] = function(cm) {
var cur = motions[key](cm, reptTimes ? reptTimes : 1);
cm.setCursor(cur.line, cur.ch);
reptTimes = 0;
};
});
var nums = [1,2,3,4,5,6,7,8,9];
nums.forEach(function(key, index, array) {
CodeMirror.keyMap['vim'][key] = function (cm) {
reptTimes = (reptTimes * 10) + key;
};
CodeMirror.keyMap['vim-prefix-d'][key] = function (cm) {
reptTimes = (reptTimes * 10) + key;
};
CodeMirror.keyMap['vim-prefix-y'][key] = function (cm) {
reptTimes = (reptTimes * 10) + key;
};
CodeMirror.keyMap['vim-prefix-c'][key] = function (cm) {
reptTimes = (reptTimes * 10) + key;
};
});
// Create our keymaps for each operator and make xa and xi where x is an operator
// change to the corrosponding keymap
var operators = ['d', 'y', 'c'];
operators.forEach(function(key, index, array) {
CodeMirror.keyMap['vim-prefix-'+key+'a'] = {
auto: 'vim', nofallthrough: true, style: "fat-cursor"
};
CodeMirror.keyMap['vim-prefix-'+key+'i'] = {
auto: 'vim', nofallthrough: true, style: "fat-cursor"
};
CodeMirror.keyMap['vim-prefix-'+key]['A'] = function(cm) {
reptTimes = 0;
cm.setOption('keyMap', 'vim-prefix-' + key + 'a');
};
CodeMirror.keyMap['vim-prefix-'+key]['I'] = function(cm) {
reptTimes = 0;
cm.setOption('keyMap', 'vim-prefix-' + key + 'i');
};
});
function regexLastIndexOf(string, pattern, startIndex) {
for (var i = startIndex == null ? string.length : startIndex; i >= 0; --i)
if (pattern.test(string.charAt(i))) return i;
return -1;
}
// Create our text object functions. They work similar to motions but they
// return a start cursor as well
var textObjectList = ['W', 'Shift-[', 'Shift-9', '['];
var textObjects = {
'W': function(cm, inclusive) {
var cur = cm.getCursor();
var line = cm.getLine(cur.line);
var line_to_char = new String(line.substring(0, cur.ch));
var start = regexLastIndexOf(line_to_char, /[^a-zA-Z0-9]/) + 1;
var end = motions["E"](cm, 1) ;
end.ch += inclusive ? 1 : 0 ;
return {start: {line: cur.line, ch: start}, end: end };
},
'Shift-[': function(cm, inclusive) { return selectCompanionObject(cm, '}', inclusive); },
'Shift-9': function(cm, inclusive) { return selectCompanionObject(cm, ')', inclusive); },
'[': function(cm, inclusive) { return selectCompanionObject(cm, ']', inclusive); }
};
// One function to handle all operation upon text objects. Kinda funky but it works
// better than rewriting this code six times
function textObjectManipulation(cm, object, remove, insert, inclusive) {
// Object is the text object, delete object if remove is true, enter insert
// mode if insert is true, inclusive is the difference between a and i
var tmp = textObjects[object](cm, inclusive);
var start = tmp.start;
var end = tmp.end;
if ((start.line > end.line) || (start.line == end.line && start.ch > end.ch)) var swap = true ;
pushInBuffer(cm.getRange(swap ? end : start, swap ? start : end));
if (remove) cm.replaceRange("", swap ? end : start, swap ? start : end);
if (insert) cm.setOption('keyMap', 'vim-insert');
}
// And finally build the keymaps up from the text objects
for (var i = 0; i < textObjectList.length; ++i) {
var object = textObjectList[i];
(function(object) {
CodeMirror.keyMap['vim-prefix-di'][object] = function(cm) { textObjectManipulation(cm, object, true, false, false); };
CodeMirror.keyMap['vim-prefix-da'][object] = function(cm) { textObjectManipulation(cm, object, true, false, true); };
CodeMirror.keyMap['vim-prefix-yi'][object] = function(cm) { textObjectManipulation(cm, object, false, false, false); };
CodeMirror.keyMap['vim-prefix-ya'][object] = function(cm) { textObjectManipulation(cm, object, false, false, true); };
CodeMirror.keyMap['vim-prefix-ci'][object] = function(cm) { textObjectManipulation(cm, object, true, true, false); };
CodeMirror.keyMap['vim-prefix-ca'][object] = function(cm) { textObjectManipulation(cm, object, true, true, true); };
})(object)
}
})();

View File

@ -0,0 +1,168 @@
.CodeMirror {
line-height: 1em;
font-family: monospace;
/* Necessary so the scrollbar can be absolutely positioned within the wrapper on Lion. */
position: relative;
/* This prevents unwanted scrollbars from showing up on the body and wrapper in IE. */
overflow: hidden;
}
.CodeMirror-scroll {
overflow-x: auto;
overflow-y: hidden;
height: 300px;
/* This is needed to prevent an IE[67] bug where the scrolled content
is visible outside of the scrolling box. */
position: relative;
outline: none;
}
/* Vertical scrollbar */
.CodeMirror-scrollbar {
float: right;
overflow-x: hidden;
overflow-y: scroll;
/* This corrects for the 1px gap introduced to the left of the scrollbar
by the rule for .CodeMirror-scrollbar-inner. */
margin-left: -1px;
}
.CodeMirror-scrollbar-inner {
/* This needs to have a nonzero width in order for the scrollbar to appear
in Firefox and IE9. */
width: 1px;
}
.CodeMirror-scrollbar.cm-sb-overlap {
/* Ensure that the scrollbar appears in Lion, and that it overlaps the content
rather than sitting to the right of it. */
position: absolute;
z-index: 1;
float: none;
right: 0;
min-width: 12px;
}
.CodeMirror-scrollbar.cm-sb-nonoverlap {
min-width: 12px;
}
.CodeMirror-scrollbar.cm-sb-ie7 {
min-width: 18px;
}
.CodeMirror-gutter {
position: absolute; left: 0; top: 0;
z-index: 10;
background-color: #f7f7f7;
border-right: 1px solid #eee;
min-width: 2em;
height: 100%;
}
.CodeMirror-gutter-text {
color: #aaa;
text-align: right;
padding: .4em .2em .4em .4em;
white-space: pre !important;
}
.CodeMirror-lines {
padding: .4em;
white-space: pre;
cursor: text;
}
.CodeMirror-lines * {
/* Necessary for throw-scrolling to decelerate properly on Safari. */
pointer-events: none;
}
.CodeMirror pre {
-moz-border-radius: 0;
-webkit-border-radius: 0;
-o-border-radius: 0;
border-radius: 0;
border-width: 0; margin: 0; padding: 0; background: transparent;
font-family: inherit;
font-size: inherit;
padding: 0; margin: 0;
white-space: pre;
word-wrap: normal;
line-height: inherit;
color: inherit;
}
.CodeMirror-wrap pre {
word-wrap: break-word;
white-space: pre-wrap;
word-break: normal;
}
.CodeMirror-wrap .CodeMirror-scroll {
overflow-x: hidden;
}
.CodeMirror textarea {
outline: none !important;
}
.CodeMirror pre.CodeMirror-cursor {
z-index: 10;
position: absolute;
visibility: hidden;
border-left: 1px solid black;
border-right: none;
width: 0;
}
.cm-keymap-fat-cursor pre.CodeMirror-cursor {
width: auto;
border: 0;
background: transparent;
background: rgba(0, 200, 0, .4);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#6600c800, endColorstr=#4c00c800);
}
/* Kludge to turn off filter in ie9+, which also accepts rgba */
.cm-keymap-fat-cursor pre.CodeMirror-cursor:not(#nonsense_id) {
filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
}
.CodeMirror pre.CodeMirror-cursor.CodeMirror-overwrite {}
.CodeMirror-focused pre.CodeMirror-cursor {
visibility: visible;
}
div.CodeMirror-selected { background: #d9d9d9; }
.CodeMirror-focused div.CodeMirror-selected { background: #d7d4f0; }
.CodeMirror-searching {
background: #ffa;
background: rgba(255, 255, 0, .4);
}
/* Default theme */
.cm-s-default span.cm-keyword {color: #708;}
.cm-s-default span.cm-atom {color: #219;}
.cm-s-default span.cm-number {color: #164;}
.cm-s-default span.cm-def {color: #00f;}
.cm-s-default span.cm-variable {color: black;}
.cm-s-default span.cm-variable-2 {color: #05a;}
.cm-s-default span.cm-variable-3 {color: #085;}
.cm-s-default span.cm-property {color: black;}
.cm-s-default span.cm-operator {color: black;}
.cm-s-default span.cm-comment {color: #a50;}
.cm-s-default span.cm-string {color: #a11;}
.cm-s-default span.cm-string-2 {color: #f50;}
.cm-s-default span.cm-meta {color: #555;}
.cm-s-default span.cm-error {color: #f00;}
.cm-s-default span.cm-qualifier {color: #555;}
.cm-s-default span.cm-builtin {color: #30a;}
.cm-s-default span.cm-bracket {color: #cc7;}
.cm-s-default span.cm-tag {color: #170;}
.cm-s-default span.cm-attribute {color: #00c;}
.cm-s-default span.cm-header {color: blue;}
.cm-s-default span.cm-quote {color: #090;}
.cm-s-default span.cm-hr {color: #999;}
.cm-s-default span.cm-link {color: #00c;}
span.cm-header, span.cm-strong {font-weight: bold;}
span.cm-em {font-style: italic;}
span.cm-emstrong {font-style: italic; font-weight: bold;}
span.cm-link {text-decoration: underline;}
div.CodeMirror span.CodeMirror-matchingbracket {color: #0f0;}
div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,146 @@
/**
* Tag-closer extension for CodeMirror.
*
* This extension adds a "closeTag" utility function that can be used with key bindings to
* insert a matching end tag after the ">" character of a start tag has been typed. It can
* also complete "</" if a matching start tag is found. It will correctly ignore signal
* characters for empty tags, comments, CDATA, etc.
*
* The function depends on internal parser state to identify tags. It is compatible with the
* following CodeMirror modes and will ignore all others:
* - htmlmixed
* - xml
*
* See demos/closetag.html for a usage example.
*
* @author Nathan Williams <nathan@nlwillia.net>
* Contributed under the same license terms as CodeMirror.
*/
(function() {
/** Option that allows tag closing behavior to be toggled. Default is true. */
CodeMirror.defaults['closeTagEnabled'] = true;
/** Array of tag names to add indentation after the start tag for. Default is the list of block-level html tags. */
CodeMirror.defaults['closeTagIndent'] = ['applet', 'blockquote', 'body', 'button', 'div', 'dl', 'fieldset', 'form', 'frameset', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'html', 'iframe', 'layer', 'legend', 'object', 'ol', 'p', 'select', 'table', 'ul'];
/**
* Call during key processing to close tags. Handles the key event if the tag is closed, otherwise throws CodeMirror.Pass.
* - cm: The editor instance.
* - ch: The character being processed.
* - indent: Optional. Omit or pass true to use the default indentation tag list defined in the 'closeTagIndent' option.
* Pass false to disable indentation. Pass an array to override the default list of tag names.
*/
CodeMirror.defineExtension("closeTag", function(cm, ch, indent) {
if (!cm.getOption('closeTagEnabled')) {
throw CodeMirror.Pass;
}
var mode = cm.getOption('mode');
if (mode == 'text/html') {
/*
* Relevant structure of token:
*
* htmlmixed
* className
* state
* htmlState
* type
* context
* tagName
* mode
*
* xml
* className
* state
* tagName
* type
*/
var pos = cm.getCursor();
var tok = cm.getTokenAt(pos);
var state = tok.state;
if (state.mode && state.mode != 'html') {
throw CodeMirror.Pass; // With htmlmixed, we only care about the html sub-mode.
}
if (ch == '>') {
var type = state.htmlState ? state.htmlState.type : state.type; // htmlmixed : xml
if (tok.className == 'tag' && type == 'closeTag') {
throw CodeMirror.Pass; // Don't process the '>' at the end of an end-tag.
}
cm.replaceSelection('>'); // Mode state won't update until we finish the tag.
pos = {line: pos.line, ch: pos.ch + 1};
cm.setCursor(pos);
tok = cm.getTokenAt(cm.getCursor());
state = tok.state;
type = state.htmlState ? state.htmlState.type : state.type; // htmlmixed : xml
if (tok.className == 'tag' && type != 'selfcloseTag') {
var tagName = state.htmlState ? state.htmlState.context.tagName : state.tagName; // htmlmixed : xml
if (tagName.length > 0) {
insertEndTag(cm, indent, pos, tagName);
}
return;
}
// Undo the '>' insert and allow cm to handle the key instead.
cm.setSelection({line: pos.line, ch: pos.ch - 1}, pos);
cm.replaceSelection("");
} else if (ch == '/') {
if (tok.className == 'tag' && tok.string == '<') {
var tagName = state.htmlState ? (state.htmlState.context ? state.htmlState.context.tagName : '') : state.context.tagName; // htmlmixed : xml # extra htmlmized check is for '</' edge case
if (tagName.length > 0) {
completeEndTag(cm, pos, tagName);
return;
}
}
}
}
throw CodeMirror.Pass; // Bubble if not handled
});
function insertEndTag(cm, indent, pos, tagName) {
if (shouldIndent(cm, indent, tagName)) {
cm.replaceSelection('\n\n</' + tagName + '>', 'end');
cm.indentLine(pos.line + 1);
cm.indentLine(pos.line + 2);
cm.setCursor({line: pos.line + 1, ch: cm.getLine(pos.line + 1).length});
} else {
cm.replaceSelection('</' + tagName + '>');
cm.setCursor(pos);
}
}
function shouldIndent(cm, indent, tagName) {
if (typeof indent == 'undefined' || indent == null || indent == true) {
indent = cm.getOption('closeTagIndent');
}
if (!indent) {
indent = [];
}
return indexOf(indent, tagName.toLowerCase()) != -1;
}
// C&P from codemirror.js...would be nice if this were visible to utilities.
function indexOf(collection, elt) {
if (collection.indexOf) return collection.indexOf(elt);
for (var i = 0, e = collection.length; i < e; ++i)
if (collection[i] == elt) return i;
return -1;
}
function completeEndTag(cm, pos, tagName) {
cm.replaceSelection('/' + tagName + '>');
cm.setCursor({line: pos.line, ch: pos.ch + tagName.length + 2 });
}
})();

View File

@ -0,0 +1,23 @@
.CodeMirror-dialog {
position: relative;
}
.CodeMirror-dialog > div {
position: absolute;
top: 0; left: 0; right: 0;
background: white;
border-bottom: 1px solid #eee;
z-index: 15;
padding: .1em .8em;
overflow: hidden;
color: #333;
}
.CodeMirror-dialog input {
border: none;
outline: none;
background: transparent;
width: 20em;
color: inherit;
font-family: monospace;
}

View File

@ -0,0 +1,63 @@
// Open simple dialogs on top of an editor. Relies on dialog.css.
(function() {
function dialogDiv(cm, template) {
var wrap = cm.getWrapperElement();
var dialog = wrap.insertBefore(document.createElement("div"), wrap.firstChild);
dialog.className = "CodeMirror-dialog";
dialog.innerHTML = '<div>' + template + '</div>';
return dialog;
}
CodeMirror.defineExtension("openDialog", function(template, callback) {
var dialog = dialogDiv(this, template);
var closed = false, me = this;
function close() {
if (closed) return;
closed = true;
dialog.parentNode.removeChild(dialog);
}
var inp = dialog.getElementsByTagName("input")[0];
if (inp) {
CodeMirror.connect(inp, "keydown", function(e) {
if (e.keyCode == 13 || e.keyCode == 27) {
CodeMirror.e_stop(e);
close();
me.focus();
if (e.keyCode == 13) callback(inp.value);
}
});
inp.focus();
CodeMirror.connect(inp, "blur", close);
}
return close;
});
CodeMirror.defineExtension("openConfirm", function(template, callbacks) {
var dialog = dialogDiv(this, template);
var buttons = dialog.getElementsByTagName("button");
var closed = false, me = this, blurring = 1;
function close() {
if (closed) return;
closed = true;
dialog.parentNode.removeChild(dialog);
me.focus();
}
buttons[0].focus();
for (var i = 0; i < buttons.length; ++i) {
var b = buttons[i];
(function(callback) {
CodeMirror.connect(b, "click", function(e) {
CodeMirror.e_preventDefault(e);
close();
if (callback) callback(me);
});
})(callbacks[i]);
CodeMirror.connect(b, "blur", function() {
--blurring;
setTimeout(function() { if (blurring <= 0) close(); }, 200);
});
CodeMirror.connect(b, "focus", function() { ++blurring; });
}
});
})();

View File

@ -0,0 +1,196 @@
// the tagRangeFinder function is
// Copyright (C) 2011 by Daniel Glazman <daniel@glazman.org>
// released under the MIT license (../../LICENSE) like the rest of CodeMirror
CodeMirror.tagRangeFinder = function(cm, line, hideEnd) {
var nameStartChar = "A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD";
var nameChar = nameStartChar + "\-\:\.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040";
var xmlNAMERegExp = new RegExp("^[" + nameStartChar + "][" + nameChar + "]*");
var lineText = cm.getLine(line);
var found = false;
var tag = null;
var pos = 0;
while (!found) {
pos = lineText.indexOf("<", pos);
if (-1 == pos) // no tag on line
return;
if (pos + 1 < lineText.length && lineText[pos + 1] == "/") { // closing tag
pos++;
continue;
}
// ok we weem to have a start tag
if (!lineText.substr(pos + 1).match(xmlNAMERegExp)) { // not a tag name...
pos++;
continue;
}
var gtPos = lineText.indexOf(">", pos + 1);
if (-1 == gtPos) { // end of start tag not in line
var l = line + 1;
var foundGt = false;
var lastLine = cm.lineCount();
while (l < lastLine && !foundGt) {
var lt = cm.getLine(l);
var gt = lt.indexOf(">");
if (-1 != gt) { // found a >
foundGt = true;
var slash = lt.lastIndexOf("/", gt);
if (-1 != slash && slash < gt) {
var str = lineText.substr(slash, gt - slash + 1);
if (!str.match( /\/\s*\>/ )) { // yep, that's the end of empty tag
if (hideEnd === true) l++;
return l;
}
}
}
l++;
}
found = true;
}
else {
var slashPos = lineText.lastIndexOf("/", gtPos);
if (-1 == slashPos) { // cannot be empty tag
found = true;
// don't continue
}
else { // empty tag?
// check if really empty tag
var str = lineText.substr(slashPos, gtPos - slashPos + 1);
if (!str.match( /\/\s*\>/ )) { // finally not empty
found = true;
// don't continue
}
}
}
if (found) {
var subLine = lineText.substr(pos + 1);
tag = subLine.match(xmlNAMERegExp);
if (tag) {
// we have an element name, wooohooo !
tag = tag[0];
// do we have the close tag on same line ???
if (-1 != lineText.indexOf("</" + tag + ">", pos)) // yep
{
found = false;
}
// we don't, so we have a candidate...
}
else
found = false;
}
if (!found)
pos++;
}
if (found) {
var startTag = "(\\<\\/" + tag + "\\>)|(\\<" + tag + "\\>)|(\\<" + tag + "\\s)|(\\<" + tag + "$)";
var startTagRegExp = new RegExp(startTag, "g");
var endTag = "</" + tag + ">";
var depth = 1;
var l = line + 1;
var lastLine = cm.lineCount();
while (l < lastLine) {
lineText = cm.getLine(l);
var match = lineText.match(startTagRegExp);
if (match) {
for (var i = 0; i < match.length; i++) {
if (match[i] == endTag)
depth--;
else
depth++;
if (!depth) {
if (hideEnd === true) l++;
return l;
}
}
}
l++;
}
return;
}
};
CodeMirror.braceRangeFinder = function(cm, line, hideEnd) {
var lineText = cm.getLine(line), at = lineText.length, startChar, tokenType;
for (;;) {
var found = lineText.lastIndexOf("{", at);
if (found < 0) break;
tokenType = cm.getTokenAt({line: line, ch: found}).className;
if (!/^(comment|string)/.test(tokenType)) { startChar = found; break; }
at = found - 1;
}
if (startChar == null || lineText.lastIndexOf("}") > startChar) return;
var count = 1, lastLine = cm.lineCount(), end;
outer: for (var i = line + 1; i < lastLine; ++i) {
var text = cm.getLine(i), pos = 0;
for (;;) {
var nextOpen = text.indexOf("{", pos), nextClose = text.indexOf("}", pos);
if (nextOpen < 0) nextOpen = text.length;
if (nextClose < 0) nextClose = text.length;
pos = Math.min(nextOpen, nextClose);
if (pos == text.length) break;
if (cm.getTokenAt({line: i, ch: pos + 1}).className == tokenType) {
if (pos == nextOpen) ++count;
else if (!--count) { end = i; break outer; }
}
++pos;
}
}
if (end == null || end == line + 1) return;
if (hideEnd === true) end++;
return end;
};
CodeMirror.indentRangeFinder = function(cm, line) {
var tabSize = cm.getOption("tabSize");
var myIndent = cm.getLineHandle(line).indentation(tabSize), last;
for (var i = line + 1, end = cm.lineCount(); i < end; ++i) {
var handle = cm.getLineHandle(i);
if (!/^\s*$/.test(handle.text)) {
if (handle.indentation(tabSize) <= myIndent) break;
last = i;
}
}
if (!last) return null;
return last + 1;
};
CodeMirror.newFoldFunction = function(rangeFinder, markText, hideEnd) {
var folded = [];
if (markText == null) markText = '<div style="position: absolute; left: 2px; color:#600">&#x25bc;</div>%N%';
function isFolded(cm, n) {
for (var i = 0; i < folded.length; ++i) {
var start = cm.lineInfo(folded[i].start);
if (!start) folded.splice(i--, 1);
else if (start.line == n) return {pos: i, region: folded[i]};
}
}
function expand(cm, region) {
cm.clearMarker(region.start);
for (var i = 0; i < region.hidden.length; ++i)
cm.showLine(region.hidden[i]);
}
return function(cm, line) {
cm.operation(function() {
var known = isFolded(cm, line);
if (known) {
folded.splice(known.pos, 1);
expand(cm, known.region);
} else {
var end = rangeFinder(cm, line, hideEnd);
if (end == null) return;
var hidden = [];
for (var i = line + 1; i < end; ++i) {
var handle = cm.hideLine(i);
if (handle) hidden.push(handle);
}
var first = cm.setMarker(line, markText);
var region = {start: first, hidden: hidden};
cm.onDeleteLine(first, function() { expand(cm, region); });
folded.push(region);
}
});
};
};

View File

@ -0,0 +1,297 @@
// ============== Formatting extensions ============================
// A common storage for all mode-specific formatting features
if (!CodeMirror.modeExtensions) CodeMirror.modeExtensions = {};
// Returns the extension of the editor's current mode
CodeMirror.defineExtension("getModeExt", function () {
var mname = CodeMirror.resolveMode(this.getOption("mode")).name;
var ext = CodeMirror.modeExtensions[mname];
if (!ext) throw new Error("No extensions found for mode " + mname);
return ext;
});
// If the current mode is 'htmlmixed', returns the extension of a mode located at
// the specified position (can be htmlmixed, css or javascript). Otherwise, simply
// returns the extension of the editor's current mode.
CodeMirror.defineExtension("getModeExtAtPos", function (pos) {
var token = this.getTokenAt(pos);
if (token && token.state && token.state.mode)
return CodeMirror.modeExtensions[token.state.mode == "html" ? "htmlmixed" : token.state.mode];
else
return this.getModeExt();
});
// Comment/uncomment the specified range
CodeMirror.defineExtension("commentRange", function (isComment, from, to) {
var curMode = this.getModeExtAtPos(this.getCursor());
if (isComment) { // Comment range
var commentedText = this.getRange(from, to);
this.replaceRange(curMode.commentStart + this.getRange(from, to) + curMode.commentEnd
, from, to);
if (from.line == to.line && from.ch == to.ch) { // An empty comment inserted - put cursor inside
this.setCursor(from.line, from.ch + curMode.commentStart.length);
}
}
else { // Uncomment range
var selText = this.getRange(from, to);
var startIndex = selText.indexOf(curMode.commentStart);
var endIndex = selText.lastIndexOf(curMode.commentEnd);
if (startIndex > -1 && endIndex > -1 && endIndex > startIndex) {
// Take string till comment start
selText = selText.substr(0, startIndex)
// From comment start till comment end
+ selText.substring(startIndex + curMode.commentStart.length, endIndex)
// From comment end till string end
+ selText.substr(endIndex + curMode.commentEnd.length);
}
this.replaceRange(selText, from, to);
}
});
// Applies automatic mode-aware indentation to the specified range
CodeMirror.defineExtension("autoIndentRange", function (from, to) {
var cmInstance = this;
this.operation(function () {
for (var i = from.line; i <= to.line; i++) {
cmInstance.indentLine(i, "smart");
}
});
});
// Applies automatic formatting to the specified range
CodeMirror.defineExtension("autoFormatRange", function (from, to) {
var absStart = this.indexFromPos(from);
var absEnd = this.indexFromPos(to);
// Insert additional line breaks where necessary according to the
// mode's syntax
var res = this.getModeExt().autoFormatLineBreaks(this.getValue(), absStart, absEnd);
var cmInstance = this;
// Replace and auto-indent the range
this.operation(function () {
cmInstance.replaceRange(res, from, to);
var startLine = cmInstance.posFromIndex(absStart).line;
var endLine = cmInstance.posFromIndex(absStart + res.length).line;
for (var i = startLine; i <= endLine; i++) {
cmInstance.indentLine(i, "smart");
}
});
});
// Define extensions for a few modes
CodeMirror.modeExtensions["css"] = {
commentStart: "/*",
commentEnd: "*/",
wordWrapChars: [";", "\\{", "\\}"],
autoFormatLineBreaks: function (text, startPos, endPos) {
text = text.substring(startPos, endPos);
return text.replace(new RegExp("(;|\\{|\\})([^\r\n])", "g"), "$1\n$2");
}
};
CodeMirror.modeExtensions["javascript"] = {
commentStart: "/*",
commentEnd: "*/",
wordWrapChars: [";", "\\{", "\\}"],
getNonBreakableBlocks: function (text) {
var nonBreakableRegexes = [
new RegExp("for\\s*?\\(([\\s\\S]*?)\\)"),
new RegExp("'([\\s\\S]*?)('|$)"),
new RegExp("\"([\\s\\S]*?)(\"|$)"),
new RegExp("//.*([\r\n]|$)")
];
var nonBreakableBlocks = new Array();
for (var i = 0; i < nonBreakableRegexes.length; i++) {
var curPos = 0;
while (curPos < text.length) {
var m = text.substr(curPos).match(nonBreakableRegexes[i]);
if (m != null) {
nonBreakableBlocks.push({
start: curPos + m.index,
end: curPos + m.index + m[0].length
});
curPos += m.index + Math.max(1, m[0].length);
}
else { // No more matches
break;
}
}
}
nonBreakableBlocks.sort(function (a, b) {
return a.start - b.start;
});
return nonBreakableBlocks;
},
autoFormatLineBreaks: function (text, startPos, endPos) {
text = text.substring(startPos, endPos);
var curPos = 0;
var reLinesSplitter = new RegExp("(;|\\{|\\})([^\r\n])", "g");
var nonBreakableBlocks = this.getNonBreakableBlocks(text);
if (nonBreakableBlocks != null) {
var res = "";
for (var i = 0; i < nonBreakableBlocks.length; i++) {
if (nonBreakableBlocks[i].start > curPos) { // Break lines till the block
res += text.substring(curPos, nonBreakableBlocks[i].start).replace(reLinesSplitter, "$1\n$2");
curPos = nonBreakableBlocks[i].start;
}
if (nonBreakableBlocks[i].start <= curPos
&& nonBreakableBlocks[i].end >= curPos) { // Skip non-breakable block
res += text.substring(curPos, nonBreakableBlocks[i].end);
curPos = nonBreakableBlocks[i].end;
}
}
if (curPos < text.length - 1) {
res += text.substr(curPos).replace(reLinesSplitter, "$1\n$2");
}
return res;
}
else {
return text.replace(reLinesSplitter, "$1\n$2");
}
}
};
CodeMirror.modeExtensions["xml"] = {
commentStart: "<!--",
commentEnd: "-->",
wordWrapChars: [">"],
autoFormatLineBreaks: function (text, startPos, endPos) {
text = text.substring(startPos, endPos);
var lines = text.split("\n");
var reProcessedPortion = new RegExp("(^\\s*?<|^[^<]*?)(.+)(>\\s*?$|[^>]*?$)");
var reOpenBrackets = new RegExp("<", "g");
var reCloseBrackets = new RegExp("(>)([^\r\n])", "g");
for (var i = 0; i < lines.length; i++) {
var mToProcess = lines[i].match(reProcessedPortion);
if (mToProcess != null && mToProcess.length > 3) { // The line starts with whitespaces and ends with whitespaces
lines[i] = mToProcess[1]
+ mToProcess[2].replace(reOpenBrackets, "\n$&").replace(reCloseBrackets, "$1\n$2")
+ mToProcess[3];
continue;
}
}
return lines.join("\n");
}
};
CodeMirror.modeExtensions["htmlmixed"] = {
commentStart: "<!--",
commentEnd: "-->",
wordWrapChars: [">", ";", "\\{", "\\}"],
getModeInfos: function (text, absPos) {
var modeInfos = new Array();
modeInfos[0] =
{
pos: 0,
modeExt: CodeMirror.modeExtensions["xml"],
modeName: "xml"
};
var modeMatchers = new Array();
modeMatchers[0] =
{
regex: new RegExp("<style[^>]*>([\\s\\S]*?)(</style[^>]*>|$)", "i"),
modeExt: CodeMirror.modeExtensions["css"],
modeName: "css"
};
modeMatchers[1] =
{
regex: new RegExp("<script[^>]*>([\\s\\S]*?)(</script[^>]*>|$)", "i"),
modeExt: CodeMirror.modeExtensions["javascript"],
modeName: "javascript"
};
var lastCharPos = (typeof (absPos) !== "undefined" ? absPos : text.length - 1);
// Detect modes for the entire text
for (var i = 0; i < modeMatchers.length; i++) {
var curPos = 0;
while (curPos <= lastCharPos) {
var m = text.substr(curPos).match(modeMatchers[i].regex);
if (m != null) {
if (m.length > 1 && m[1].length > 0) {
// Push block begin pos
var blockBegin = curPos + m.index + m[0].indexOf(m[1]);
modeInfos.push(
{
pos: blockBegin,
modeExt: modeMatchers[i].modeExt,
modeName: modeMatchers[i].modeName
});
// Push block end pos
modeInfos.push(
{
pos: blockBegin + m[1].length,
modeExt: modeInfos[0].modeExt,
modeName: modeInfos[0].modeName
});
curPos += m.index + m[0].length;
continue;
}
else {
curPos += m.index + Math.max(m[0].length, 1);
}
}
else { // No more matches
break;
}
}
}
// Sort mode infos
modeInfos.sort(function sortModeInfo(a, b) {
return a.pos - b.pos;
});
return modeInfos;
},
autoFormatLineBreaks: function (text, startPos, endPos) {
var modeInfos = this.getModeInfos(text);
var reBlockStartsWithNewline = new RegExp("^\\s*?\n");
var reBlockEndsWithNewline = new RegExp("\n\\s*?$");
var res = "";
// Use modes info to break lines correspondingly
if (modeInfos.length > 1) { // Deal with multi-mode text
for (var i = 1; i <= modeInfos.length; i++) {
var selStart = modeInfos[i - 1].pos;
var selEnd = (i < modeInfos.length ? modeInfos[i].pos : endPos);
if (selStart >= endPos) { // The block starts later than the needed fragment
break;
}
if (selStart < startPos) {
if (selEnd <= startPos) { // The block starts earlier than the needed fragment
continue;
}
selStart = startPos;
}
if (selEnd > endPos) {
selEnd = endPos;
}
var textPortion = text.substring(selStart, selEnd);
if (modeInfos[i - 1].modeName != "xml") { // Starting a CSS or JavaScript block
if (!reBlockStartsWithNewline.test(textPortion)
&& selStart > 0) { // The block does not start with a line break
textPortion = "\n" + textPortion;
}
if (!reBlockEndsWithNewline.test(textPortion)
&& selEnd < text.length - 1) { // The block does not end with a line break
textPortion += "\n";
}
}
res += modeInfos[i - 1].modeExt.autoFormatLineBreaks(textPortion);
}
}
else { // Single-mode text
res = modeInfos[0].modeExt.autoFormatLineBreaks(text.substring(startPos, endPos));
}
return res;
}
};

View File

@ -0,0 +1,134 @@
(function () {
function forEach(arr, f) {
for (var i = 0, e = arr.length; i < e; ++i) f(arr[i]);
}
function arrayContains(arr, item) {
if (!Array.prototype.indexOf) {
var i = arr.length;
while (i--) {
if (arr[i] === item) {
return true;
}
}
return false;
}
return arr.indexOf(item) != -1;
}
function scriptHint(editor, keywords, getToken) {
// Find the token at the cursor
var cur = editor.getCursor(), token = getToken(editor, cur), tprop = token;
// If it's not a 'word-style' token, ignore the token.
if (!/^[\w$_]*$/.test(token.string)) {
token = tprop = {start: cur.ch, end: cur.ch, string: "", state: token.state,
className: token.string == "." ? "property" : null};
}
// If it is a property, find out what it is a property of.
while (tprop.className == "property") {
tprop = getToken(editor, {line: cur.line, ch: tprop.start});
if (tprop.string != ".") return;
tprop = getToken(editor, {line: cur.line, ch: tprop.start});
if (tprop.string == ')') {
var level = 1;
do {
tprop = getToken(editor, {line: cur.line, ch: tprop.start});
switch (tprop.string) {
case ')': level++; break;
case '(': level--; break;
default: break;
}
} while (level > 0)
tprop = getToken(editor, {line: cur.line, ch: tprop.start});
if (tprop.className == 'variable')
tprop.className = 'function';
else return; // no clue
}
if (!context) var context = [];
context.push(tprop);
}
return {list: getCompletions(token, context, keywords),
from: {line: cur.line, ch: token.start},
to: {line: cur.line, ch: token.end}};
}
CodeMirror.javascriptHint = function(editor) {
return scriptHint(editor, javascriptKeywords,
function (e, cur) {return e.getTokenAt(cur);});
}
function getCoffeeScriptToken(editor, cur) {
// This getToken, it is for coffeescript, imitates the behavior of
// getTokenAt method in javascript.js, that is, returning "property"
// type and treat "." as indepenent token.
var token = editor.getTokenAt(cur);
if (cur.ch == token.start + 1 && token.string.charAt(0) == '.') {
token.end = token.start;
token.string = '.';
token.className = "property";
}
else if (/^\.[\w$_]*$/.test(token.string)) {
token.className = "property";
token.start++;
token.string = token.string.replace(/\./, '');
}
return token;
}
CodeMirror.coffeescriptHint = function(editor) {
return scriptHint(editor, coffeescriptKeywords, getCoffeeScriptToken);
}
var stringProps = ("charAt charCodeAt indexOf lastIndexOf substring substr slice trim trimLeft trimRight " +
"toUpperCase toLowerCase split concat match replace search").split(" ");
var arrayProps = ("length concat join splice push pop shift unshift slice reverse sort indexOf " +
"lastIndexOf every some filter forEach map reduce reduceRight ").split(" ");
var funcProps = "prototype apply call bind".split(" ");
var javascriptKeywords = ("break case catch continue debugger default delete do else false finally for function " +
"if in instanceof new null return switch throw true try typeof var void while with").split(" ");
var coffeescriptKeywords = ("and break catch class continue delete do else extends false finally for " +
"if in instanceof isnt new no not null of off on or return switch then throw true try typeof until void while with yes").split(" ");
function getCompletions(token, context, keywords) {
var found = [], start = token.string;
function maybeAdd(str) {
if (str.indexOf(start) == 0 && !arrayContains(found, str)) found.push(str);
}
function gatherCompletions(obj) {
if (typeof obj == "string") forEach(stringProps, maybeAdd);
else if (obj instanceof Array) forEach(arrayProps, maybeAdd);
else if (obj instanceof Function) forEach(funcProps, maybeAdd);
for (var name in obj) maybeAdd(name);
}
if (context) {
// If this is a property, see if it belongs to some object we can
// find in the current environment.
var obj = context.pop(), base;
if (obj.className == "variable")
base = window[obj.string];
else if (obj.className == "string")
base = "";
else if (obj.className == "atom")
base = 1;
else if (obj.className == "function") {
if (window.jQuery != null && (obj.string == '$' || obj.string == 'jQuery') &&
(typeof window.jQuery == 'function'))
base = window.jQuery();
else if (window._ != null && (obj.string == '_') && (typeof window._ == 'function'))
base = window._();
}
while (base != null && context.length)
base = base[context.pop().string];
if (base != null) gatherCompletions(base);
}
else {
// If not, just look in the window object and any local scope
// (reading into JS mode internals to get at the local variables)
for (var v = token.state.localVars; v; v = v.next) maybeAdd(v.name);
gatherCompletions(window);
forEach(keywords, maybeAdd);
}
return found;
}
})();

View File

@ -0,0 +1,51 @@
(function() {
if (!CodeMirror.modeURL) CodeMirror.modeURL = "../mode/%N/%N.js";
var loading = {};
function splitCallback(cont, n) {
var countDown = n;
return function() { if (--countDown == 0) cont(); }
}
function ensureDeps(mode, cont) {
var deps = CodeMirror.modes[mode].dependencies;
if (!deps) return cont();
var missing = [];
for (var i = 0; i < deps.length; ++i) {
if (!CodeMirror.modes.hasOwnProperty(deps[i]))
missing.push(deps[i]);
}
if (!missing.length) return cont();
var split = splitCallback(cont, missing.length);
for (var i = 0; i < missing.length; ++i)
CodeMirror.requireMode(missing[i], split);
}
CodeMirror.requireMode = function(mode, cont) {
if (typeof mode != "string") mode = mode.name;
if (CodeMirror.modes.hasOwnProperty(mode)) return ensureDeps(mode, cont);
if (loading.hasOwnProperty(mode)) return loading[mode].push(cont);
var script = document.createElement("script");
script.src = CodeMirror.modeURL.replace(/%N/g, mode);
var others = document.getElementsByTagName("script")[0];
others.parentNode.insertBefore(script, others);
var list = loading[mode] = [cont];
var count = 0, poll = setInterval(function() {
if (++count > 100) return clearInterval(poll);
if (CodeMirror.modes.hasOwnProperty(mode)) {
clearInterval(poll);
loading[mode] = null;
ensureDeps(mode, function() {
for (var i = 0; i < list.length; ++i) list[i]();
});
}
}, 200);
};
CodeMirror.autoLoadMode = function(instance, mode) {
if (!CodeMirror.modes.hasOwnProperty(mode))
CodeMirror.requireMode(mode, function() {
instance.setOption("mode", instance.getOption("mode"));
});
};
}());

View File

@ -0,0 +1,44 @@
// Define match-highlighter commands. Depends on searchcursor.js
// Use by attaching the following function call to the onCursorActivity event:
//myCodeMirror.matchHighlight(minChars);
// And including a special span.CodeMirror-matchhighlight css class (also optionally a separate one for .CodeMirror-focused -- see demo matchhighlighter.html)
(function() {
var DEFAULT_MIN_CHARS = 2;
function MatchHighlightState() {
this.marked = [];
}
function getMatchHighlightState(cm) {
return cm._matchHighlightState || (cm._matchHighlightState = new MatchHighlightState());
}
function clearMarks(cm) {
var state = getMatchHighlightState(cm);
for (var i = 0; i < state.marked.length; ++i)
state.marked[i].clear();
state.marked = [];
}
function markDocument(cm, className, minChars) {
clearMarks(cm);
minChars = (typeof minChars !== 'undefined' ? minChars : DEFAULT_MIN_CHARS);
if (cm.somethingSelected() && cm.getSelection().replace(/^\s+|\s+$/g, "").length >= minChars) {
var state = getMatchHighlightState(cm);
var query = cm.getSelection();
cm.operation(function() {
if (cm.lineCount() < 2000) { // This is too expensive on big documents.
for (var cursor = cm.getSearchCursor(query); cursor.findNext();) {
//Only apply matchhighlight to the matches other than the one actually selected
if (!(cursor.from().line === cm.getCursor(true).line && cursor.from().ch === cm.getCursor(true).ch))
state.marked.push(cm.markText(cursor.from(), cursor.to(), className));
}
}
});
}
}
CodeMirror.defineExtension("matchHighlight", function(className, minChars) {
markDocument(this, className, minChars);
});
})();

View File

@ -0,0 +1,72 @@
CodeMirror.multiplexingMode = function(outer /*, others */) {
// Others should be {open, close, mode [, delimStyle]} objects
var others = Array.prototype.slice.call(arguments, 1);
var n_others = others.length;
return {
startState: function() {
return {
outer: CodeMirror.startState(outer),
innerActive: null,
inner: null
};
},
copyState: function(state) {
return {
outer: CodeMirror.copyState(outer, state.outer),
innerActive: state.innerActive,
inner: state.innerActive && CodeMirror.copyState(state.innerActive.mode, state.inner)
};
},
token: function(stream, state) {
if (!state.innerActive) {
for (var i = 0; i < n_others; ++i) {
var other = others[i];
if (stream.match(other.open)) {
state.innerActive = other;
state.inner = CodeMirror.startState(other.mode);
return other.delimStyle;
}
}
var outerToken = outer.token(stream, state.outer);
var cur = stream.current();
for (var i = 0; i < n_others; ++i) {
var other = others[i], found = cur.indexOf(other.open);
if (found > -1) {
stream.backUp(cur.length - found);
cur = cur.slice(0, found);
}
}
return outerToken;
} else {
var curInner = state.innerActive;
if (stream.match(curInner.close)) {
state.innerActive = state.inner = null;
return curInner.delimStyle;
}
var innerToken = curInner.mode.token(stream, state.inner);
var cur = stream.current(), found = cur.indexOf(curInner.close);
if (found > -1) stream.backUp(cur.length - found);
return innerToken;
}
},
indent: function(state, textAfter) {
var mode = state.innerActive || outer;
if (!mode.indent) return CodeMirror.Pass;
return mode.indent(state.innerActive ? state.inner : state.outer, textAfter);
},
compareStates: function(a, b) {
if (a.innerActive != b.innerActive) return false;
var mode = a.innerActive || outer;
if (!mode.compareStates) return CodeMirror.Pass;
return mode.compareStates(a.innerActive ? a.inner : a.outer,
b.innerActive ? b.inner : b.outer);
},
electricChars: outer.electricChars
};
};

View File

@ -0,0 +1,52 @@
// Utility function that allows modes to be combined. The mode given
// as the base argument takes care of most of the normal mode
// functionality, but a second (typically simple) mode is used, which
// can override the style of text. Both modes get to parse all of the
// text, but when both assign a non-null style to a piece of code, the
// overlay wins, unless the combine argument was true, in which case
// the styles are combined.
// overlayParser is the old, deprecated name
CodeMirror.overlayMode = CodeMirror.overlayParser = function(base, overlay, combine) {
return {
startState: function() {
return {
base: CodeMirror.startState(base),
overlay: CodeMirror.startState(overlay),
basePos: 0, baseCur: null,
overlayPos: 0, overlayCur: null
};
},
copyState: function(state) {
return {
base: CodeMirror.copyState(base, state.base),
overlay: CodeMirror.copyState(overlay, state.overlay),
basePos: state.basePos, baseCur: null,
overlayPos: state.overlayPos, overlayCur: null
};
},
token: function(stream, state) {
if (stream.start == state.basePos) {
state.baseCur = base.token(stream, state.base);
state.basePos = stream.pos;
}
if (stream.start == state.overlayPos) {
stream.pos = stream.start;
state.overlayCur = overlay.token(stream, state.overlay);
state.overlayPos = stream.pos;
}
stream.pos = Math.min(state.basePos, state.overlayPos);
if (stream.eol()) state.basePos = state.overlayPos = 0;
if (state.overlayCur == null) return state.baseCur;
if (state.baseCur != null && combine) return state.baseCur + " " + state.overlayCur;
else return state.overlayCur;
},
indent: base.indent && function(state, textAfter) {
return base.indent(state.base, textAfter);
},
electricChars: base.electricChars
};
};

View File

@ -0,0 +1,123 @@
(function () {
function forEach(arr, f) {
for (var i = 0, e = arr.length; i < e; ++i) f(arr[i]);
}
function arrayContains(arr, item) {
if (!Array.prototype.indexOf) {
var i = arr.length;
while (i--) {
if (arr[i] === item) {
return true;
}
}
return false;
}
return arr.indexOf(item) != -1;
}
function scriptHint(editor, keywords, getToken) {
// Find the token at the cursor
var cur = editor.getCursor(), token = getToken(editor, cur), tprop = token;
// If it's not a 'word-style' token, ignore the token.
if (!/^[\w$_]*$/.test(token.string)) {
token = tprop = {start: cur.ch, end: cur.ch, string: "", state: token.state,
className: token.string == ":" ? "pig-type" : null};
}
if (!context) var context = [];
context.push(tprop);
completionList = getCompletions(token, context);
completionList = completionList.sort();
//prevent autocomplete for last word, instead show dropdown with one word
if(completionList.length == 1) {
completionList.push(" ");
}
return {list: completionList,
from: {line: cur.line, ch: token.start},
to: {line: cur.line, ch: token.end}};
}
CodeMirror.pigHint = function(editor) {
return scriptHint(editor, pigKeywordsU, function (e, cur) {return e.getTokenAt(cur);});
}
function toTitleCase(str) {
return str.replace(/(?:^|\s)\w/g, function(match) {
return match.toUpperCase();
});
}
var pigKeywords = "VOID IMPORT RETURNS DEFINE LOAD FILTER FOREACH ORDER CUBE DISTINCT COGROUP "
+ "JOIN CROSS UNION SPLIT INTO IF OTHERWISE ALL AS BY USING INNER OUTER ONSCHEMA PARALLEL "
+ "PARTITION GROUP AND OR NOT GENERATE FLATTEN ASC DESC IS STREAM THROUGH STORE MAPREDUCE "
+ "SHIP CACHE INPUT OUTPUT STDERROR STDIN STDOUT LIMIT SAMPLE LEFT RIGHT FULL EQ GT LT GTE LTE "
+ "NEQ MATCHES TRUE FALSE";
var pigKeywordsU = pigKeywords.split(" ");
var pigKeywordsL = pigKeywords.toLowerCase().split(" ");
var pigTypes = "BOOLEAN INT LONG FLOAT DOUBLE CHARARRAY BYTEARRAY BAG TUPLE MAP";
var pigTypesU = pigTypes.split(" ");
var pigTypesL = pigTypes.toLowerCase().split(" ");
var pigBuiltins = "ABS ACOS ARITY ASIN ATAN AVG BAGSIZE BINSTORAGE BLOOM BUILDBLOOM CBRT CEIL "
+ "CONCAT COR COS COSH COUNT COUNT_STAR COV CONSTANTSIZE CUBEDIMENSIONS DIFF DISTINCT DOUBLEABS "
+ "DOUBLEAVG DOUBLEBASE DOUBLEMAX DOUBLEMIN DOUBLEROUND DOUBLESUM EXP FLOOR FLOATABS FLOATAVG "
+ "FLOATMAX FLOATMIN FLOATROUND FLOATSUM GENERICINVOKER INDEXOF INTABS INTAVG INTMAX INTMIN "
+ "INTSUM INVOKEFORDOUBLE INVOKEFORFLOAT INVOKEFORINT INVOKEFORLONG INVOKEFORSTRING INVOKER "
+ "ISEMPTY JSONLOADER JSONMETADATA JSONSTORAGE LAST_INDEX_OF LCFIRST LOG LOG10 LOWER LONGABS "
+ "LONGAVG LONGMAX LONGMIN LONGSUM MAX MIN MAPSIZE MONITOREDUDF NONDETERMINISTIC OUTPUTSCHEMA "
+ "PIGSTORAGE PIGSTREAMING RANDOM REGEX_EXTRACT REGEX_EXTRACT_ALL REPLACE ROUND SIN SINH SIZE "
+ "SQRT STRSPLIT SUBSTRING SUM STRINGCONCAT STRINGMAX STRINGMIN STRINGSIZE TAN TANH TOBAG "
+ "TOKENIZE TOMAP TOP TOTUPLE TRIM TEXTLOADER TUPLESIZE UCFIRST UPPER UTF8STORAGECONVERTER";
var pigBuiltinsU = pigBuiltins.split(" ").join("() ").split(" ");
var pigBuiltinsL = pigBuiltins.toLowerCase().split(" ").join("() ").split(" ");
var pigBuiltinsC = ("BagSize BinStorage Bloom BuildBloom ConstantSize CubeDimensions DoubleAbs "
+ "DoubleAvg DoubleBase DoubleMax DoubleMin DoubleRound DoubleSum FloatAbs FloatAvg FloatMax "
+ "FloatMin FloatRound FloatSum GenericInvoker IntAbs IntAvg IntMax IntMin IntSum "
+ "InvokeForDouble InvokeForFloat InvokeForInt InvokeForLong InvokeForString Invoker "
+ "IsEmpty JsonLoader JsonMetadata JsonStorage LongAbs LongAvg LongMax LongMin LongSum MapSize "
+ "MonitoredUDF Nondeterministic OutputSchema PigStorage PigStreaming StringConcat StringMax "
+ "StringMin StringSize TextLoader TupleSize Utf8StorageConverter").split(" ").join("() ").split(" ");
function getCompletions(token, context) {
var found = [], start = token.string;
function maybeAdd(str) {
if (str.indexOf(start) == 0 && !arrayContains(found, str)) found.push(str);
}
function gatherCompletions(obj) {
if(obj == ":") {
forEach(pigTypesL, maybeAdd);
}
else {
forEach(pigBuiltinsU, maybeAdd);
forEach(pigBuiltinsL, maybeAdd);
forEach(pigBuiltinsC, maybeAdd);
forEach(pigTypesU, maybeAdd);
forEach(pigTypesL, maybeAdd);
forEach(pigKeywordsU, maybeAdd);
forEach(pigKeywordsL, maybeAdd);
}
}
if (context) {
// If this is a property, see if it belongs to some object we can
// find in the current environment.
var obj = context.pop(), base;
if (obj.className == "pig-word")
base = obj.string;
else if(obj.className == "pig-type")
base = ":" + obj.string;
while (base != null && context.length)
base = base[context.pop().string];
if (base != null) gatherCompletions(base);
}
return found;
}
})();

View File

@ -0,0 +1,49 @@
CodeMirror.runMode = function(string, modespec, callback, options) {
var mode = CodeMirror.getMode(CodeMirror.defaults, modespec);
var isNode = callback.nodeType == 1;
var tabSize = (options && options.tabSize) || CodeMirror.defaults.tabSize;
if (isNode) {
var node = callback, accum = [], col = 0;
callback = function(text, style) {
if (text == "\n") {
accum.push("<br>");
col = 0;
return;
}
var escaped = "";
// HTML-escape and replace tabs
for (var pos = 0;;) {
var idx = text.indexOf("\t", pos);
if (idx == -1) {
escaped += CodeMirror.htmlEscape(text.slice(pos));
col += text.length - pos;
break;
} else {
col += idx - pos;
escaped += CodeMirror.htmlEscape(text.slice(pos, idx));
var size = tabSize - col % tabSize;
col += size;
for (var i = 0; i < size; ++i) escaped += " ";
pos = idx + 1;
}
}
if (style)
accum.push("<span class=\"cm-" + CodeMirror.htmlEscape(style) + "\">" + escaped + "</span>");
else
accum.push(escaped);
}
}
var lines = CodeMirror.splitLines(string), state = CodeMirror.startState(mode);
for (var i = 0, e = lines.length; i < e; ++i) {
if (i) callback("\n");
var stream = new CodeMirror.StringStream(lines[i]);
while (!stream.eol()) {
var style = mode.token(stream, state);
callback(stream.current(), style, i, stream.start);
stream.start = stream.pos;
}
}
if (isNode)
node.innerHTML = accum.join("");
};

View File

@ -0,0 +1,118 @@
// Define search commands. Depends on dialog.js or another
// implementation of the openDialog method.
// Replace works a little oddly -- it will do the replace on the next
// Ctrl-G (or whatever is bound to findNext) press. You prevent a
// replace by making sure the match is no longer selected when hitting
// Ctrl-G.
(function() {
function SearchState() {
this.posFrom = this.posTo = this.query = null;
this.marked = [];
}
function getSearchState(cm) {
return cm._searchState || (cm._searchState = new SearchState());
}
function getSearchCursor(cm, query, pos) {
// Heuristic: if the query string is all lowercase, do a case insensitive search.
return cm.getSearchCursor(query, pos, typeof query == "string" && query == query.toLowerCase());
}
function dialog(cm, text, shortText, f) {
if (cm.openDialog) cm.openDialog(text, f);
else f(prompt(shortText, ""));
}
function confirmDialog(cm, text, shortText, fs) {
if (cm.openConfirm) cm.openConfirm(text, fs);
else if (confirm(shortText)) fs[0]();
}
function parseQuery(query) {
var isRE = query.match(/^\/(.*)\/([a-z]*)$/);
return isRE ? new RegExp(isRE[1], isRE[2].indexOf("i") == -1 ? "" : "i") : query;
}
var queryDialog =
'Search: <input type="text" style="width: 10em"/> <span style="color: #888">(Use /re/ syntax for regexp search)</span>';
function doSearch(cm, rev) {
var state = getSearchState(cm);
if (state.query) return findNext(cm, rev);
dialog(cm, queryDialog, "Search for:", function(query) {
cm.operation(function() {
if (!query || state.query) return;
state.query = parseQuery(query);
if (cm.lineCount() < 2000) { // This is too expensive on big documents.
for (var cursor = getSearchCursor(cm, query); cursor.findNext();)
state.marked.push(cm.markText(cursor.from(), cursor.to(), "CodeMirror-searching"));
}
state.posFrom = state.posTo = cm.getCursor();
findNext(cm, rev);
});
});
}
function findNext(cm, rev) {cm.operation(function() {
var state = getSearchState(cm);
var cursor = getSearchCursor(cm, state.query, rev ? state.posFrom : state.posTo);
if (!cursor.find(rev)) {
cursor = getSearchCursor(cm, state.query, rev ? {line: cm.lineCount() - 1} : {line: 0, ch: 0});
if (!cursor.find(rev)) return;
}
cm.setSelection(cursor.from(), cursor.to());
state.posFrom = cursor.from(); state.posTo = cursor.to();
})}
function clearSearch(cm) {cm.operation(function() {
var state = getSearchState(cm);
if (!state.query) return;
state.query = null;
for (var i = 0; i < state.marked.length; ++i) state.marked[i].clear();
state.marked.length = 0;
})}
var replaceQueryDialog =
'Replace: <input type="text" style="width: 10em"/> <span style="color: #888">(Use /re/ syntax for regexp search)</span>';
var replacementQueryDialog = 'With: <input type="text" style="width: 10em"/>';
var doReplaceConfirm = "Replace? <button>Yes</button> <button>No</button> <button>Stop</button>";
function replace(cm, all) {
dialog(cm, replaceQueryDialog, "Replace:", function(query) {
if (!query) return;
query = parseQuery(query);
dialog(cm, replacementQueryDialog, "Replace with:", function(text) {
if (all) {
cm.compoundChange(function() { cm.operation(function() {
for (var cursor = getSearchCursor(cm, query); cursor.findNext();) {
if (typeof query != "string") {
var match = cm.getRange(cursor.from(), cursor.to()).match(query);
cursor.replace(text.replace(/\$(\d)/, function(w, i) {return match[i];}));
} else cursor.replace(text);
}
})});
} else {
clearSearch(cm);
var cursor = getSearchCursor(cm, query, cm.getCursor());
function advance() {
var start = cursor.from(), match;
if (!(match = cursor.findNext())) {
cursor = getSearchCursor(cm, query);
if (!(match = cursor.findNext()) ||
(start && cursor.from().line == start.line && cursor.from().ch == start.ch)) return;
}
cm.setSelection(cursor.from(), cursor.to());
confirmDialog(cm, doReplaceConfirm, "Replace?",
[function() {doReplace(match);}, advance]);
}
function doReplace(match) {
cursor.replace(typeof query == "string" ? text :
text.replace(/\$(\d)/, function(w, i) {return match[i];}));
advance();
}
advance();
}
});
});
}
CodeMirror.commands.find = function(cm) {clearSearch(cm); doSearch(cm);};
CodeMirror.commands.findNext = doSearch;
CodeMirror.commands.findPrev = function(cm) {doSearch(cm, true);};
CodeMirror.commands.clearSearch = clearSearch;
CodeMirror.commands.replace = replace;
CodeMirror.commands.replaceAll = function(cm) {replace(cm, true);};
})();

View File

@ -0,0 +1,117 @@
(function(){
function SearchCursor(cm, query, pos, caseFold) {
this.atOccurrence = false; this.cm = cm;
if (caseFold == null && typeof query == "string") caseFold = false;
pos = pos ? cm.clipPos(pos) : {line: 0, ch: 0};
this.pos = {from: pos, to: pos};
// The matches method is filled in based on the type of query.
// It takes a position and a direction, and returns an object
// describing the next occurrence of the query, or null if no
// more matches were found.
if (typeof query != "string") // Regexp match
this.matches = function(reverse, pos) {
if (reverse) {
var line = cm.getLine(pos.line).slice(0, pos.ch), match = line.match(query), start = 0;
while (match) {
var ind = line.indexOf(match[0]);
start += ind;
line = line.slice(ind + 1);
var newmatch = line.match(query);
if (newmatch) match = newmatch;
else break;
start++;
}
}
else {
var line = cm.getLine(pos.line).slice(pos.ch), match = line.match(query),
start = match && pos.ch + line.indexOf(match[0]);
}
if (match)
return {from: {line: pos.line, ch: start},
to: {line: pos.line, ch: start + match[0].length},
match: match};
};
else { // String query
if (caseFold) query = query.toLowerCase();
var fold = caseFold ? function(str){return str.toLowerCase();} : function(str){return str;};
var target = query.split("\n");
// Different methods for single-line and multi-line queries
if (target.length == 1)
this.matches = function(reverse, pos) {
var line = fold(cm.getLine(pos.line)), len = query.length, match;
if (reverse ? (pos.ch >= len && (match = line.lastIndexOf(query, pos.ch - len)) != -1)
: (match = line.indexOf(query, pos.ch)) != -1)
return {from: {line: pos.line, ch: match},
to: {line: pos.line, ch: match + len}};
};
else
this.matches = function(reverse, pos) {
var ln = pos.line, idx = (reverse ? target.length - 1 : 0), match = target[idx], line = fold(cm.getLine(ln));
var offsetA = (reverse ? line.indexOf(match) + match.length : line.lastIndexOf(match));
if (reverse ? offsetA >= pos.ch || offsetA != match.length
: offsetA <= pos.ch || offsetA != line.length - match.length)
return;
for (;;) {
if (reverse ? !ln : ln == cm.lineCount() - 1) return;
line = fold(cm.getLine(ln += reverse ? -1 : 1));
match = target[reverse ? --idx : ++idx];
if (idx > 0 && idx < target.length - 1) {
if (line != match) return;
else continue;
}
var offsetB = (reverse ? line.lastIndexOf(match) : line.indexOf(match) + match.length);
if (reverse ? offsetB != line.length - match.length : offsetB != match.length)
return;
var start = {line: pos.line, ch: offsetA}, end = {line: ln, ch: offsetB};
return {from: reverse ? end : start, to: reverse ? start : end};
}
};
}
}
SearchCursor.prototype = {
findNext: function() {return this.find(false);},
findPrevious: function() {return this.find(true);},
find: function(reverse) {
var self = this, pos = this.cm.clipPos(reverse ? this.pos.from : this.pos.to);
function savePosAndFail(line) {
var pos = {line: line, ch: 0};
self.pos = {from: pos, to: pos};
self.atOccurrence = false;
return false;
}
for (;;) {
if (this.pos = this.matches(reverse, pos)) {
this.atOccurrence = true;
return this.pos.match || true;
}
if (reverse) {
if (!pos.line) return savePosAndFail(0);
pos = {line: pos.line-1, ch: this.cm.getLine(pos.line-1).length};
}
else {
var maxLine = this.cm.lineCount();
if (pos.line == maxLine - 1) return savePosAndFail(maxLine);
pos = {line: pos.line+1, ch: 0};
}
}
},
from: function() {if (this.atOccurrence) return this.pos.from;},
to: function() {if (this.atOccurrence) return this.pos.to;},
replace: function(newText) {
var self = this;
if (this.atOccurrence)
self.pos.to = this.cm.replaceRange(newText, self.pos.from, self.pos.to);
}
};
CodeMirror.defineExtension("getSearchCursor", function(query, pos, caseFold) {
return new SearchCursor(this, query, pos, caseFold);
});
})();

View File

@ -0,0 +1,16 @@
.CodeMirror-completions {
position: absolute;
z-index: 10;
overflow: hidden;
-webkit-box-shadow: 2px 3px 5px rgba(0,0,0,.2);
-moz-box-shadow: 2px 3px 5px rgba(0,0,0,.2);
box-shadow: 2px 3px 5px rgba(0,0,0,.2);
}
.CodeMirror-completions select {
background: #fafafa;
outline: none;
border: none;
padding: 0;
margin: 0;
font-family: monospace;
}

View File

@ -0,0 +1,72 @@
(function() {
CodeMirror.simpleHint = function(editor, getHints) {
// We want a single cursor position.
if (editor.somethingSelected()) return;
var result = getHints(editor);
if (!result || !result.list.length) return;
var completions = result.list;
function insert(str) {
editor.replaceRange(str, result.from, result.to);
}
// When there is only one completion, use it directly.
if (completions.length == 1) {insert(completions[0]); return true;}
// Build the select widget
var complete = document.createElement("div");
complete.className = "CodeMirror-completions";
var sel = complete.appendChild(document.createElement("select"));
// Opera doesn't move the selection when pressing up/down in a
// multi-select, but it does properly support the size property on
// single-selects, so no multi-select is necessary.
if (!window.opera) sel.multiple = true;
for (var i = 0; i < completions.length; ++i) {
var opt = sel.appendChild(document.createElement("option"));
opt.appendChild(document.createTextNode(completions[i]));
}
sel.firstChild.selected = true;
sel.size = Math.min(10, completions.length);
var pos = editor.cursorCoords();
complete.style.left = pos.x + "px";
complete.style.top = pos.yBot + "px";
document.body.appendChild(complete);
// If we're at the edge of the screen, then we want the menu to appear on the left of the cursor.
var winW = window.innerWidth || Math.max(document.body.offsetWidth, document.documentElement.offsetWidth);
if(winW - pos.x < sel.clientWidth)
complete.style.left = (pos.x - sel.clientWidth) + "px";
// Hack to hide the scrollbar.
if (completions.length <= 10)
complete.style.width = (sel.clientWidth - 1) + "px";
var done = false;
function close() {
if (done) return;
done = true;
complete.parentNode.removeChild(complete);
}
function pick() {
insert(completions[sel.selectedIndex]);
close();
setTimeout(function(){editor.focus();}, 50);
}
CodeMirror.connect(sel, "blur", close);
CodeMirror.connect(sel, "keydown", function(event) {
var code = event.keyCode;
// Enter
if (code == 13) {CodeMirror.e_stop(event); pick();}
// Escape
else if (code == 27) {CodeMirror.e_stop(event); close(); editor.focus();}
else if (code != 38 && code != 40) {
close(); editor.focus();
// Pass the event to the CodeMirror instance so that it can handle things like backspace properly.
editor.triggerOnKeyDown(event);
setTimeout(function(){CodeMirror.simpleHint(editor, getHints);}, 50);
}
});
CodeMirror.connect(sel, "dblclick", pick);
sel.focus();
// Opera sometimes ignores focusing a freshly created node
if (window.opera) setTimeout(function(){if (!done) sel.focus();}, 100);
return true;
};
})();

View File

@ -0,0 +1,271 @@
CodeMirror.defineMode("clike", function(config, parserConfig) {
var indentUnit = config.indentUnit,
keywords = parserConfig.keywords || {},
blockKeywords = parserConfig.blockKeywords || {},
atoms = parserConfig.atoms || {},
hooks = parserConfig.hooks || {},
multiLineStrings = parserConfig.multiLineStrings;
var isOperatorChar = /[+\-*&%=<>!?|\/]/;
var curPunc;
function tokenBase(stream, state) {
var ch = stream.next();
if (hooks[ch]) {
var result = hooks[ch](stream, state);
if (result !== false) return result;
}
if (ch == '"' || ch == "'") {
state.tokenize = tokenString(ch);
return state.tokenize(stream, state);
}
if (/[\[\]{}\(\),;\:\.]/.test(ch)) {
curPunc = ch;
return null;
}
if (/\d/.test(ch)) {
stream.eatWhile(/[\w\.]/);
return "number";
}
if (ch == "/") {
if (stream.eat("*")) {
state.tokenize = tokenComment;
return tokenComment(stream, state);
}
if (stream.eat("/")) {
stream.skipToEnd();
return "comment";
}
}
if (isOperatorChar.test(ch)) {
stream.eatWhile(isOperatorChar);
return "operator";
}
stream.eatWhile(/[\w\$_]/);
var cur = stream.current();
if (keywords.propertyIsEnumerable(cur)) {
if (blockKeywords.propertyIsEnumerable(cur)) curPunc = "newstatement";
return "keyword";
}
if (atoms.propertyIsEnumerable(cur)) return "atom";
return "word";
}
function tokenString(quote) {
return function(stream, state) {
var escaped = false, next, end = false;
while ((next = stream.next()) != null) {
if (next == quote && !escaped) {end = true; break;}
escaped = !escaped && next == "\\";
}
if (end || !(escaped || multiLineStrings))
state.tokenize = null;
return "string";
};
}
function tokenComment(stream, state) {
var maybeEnd = false, ch;
while (ch = stream.next()) {
if (ch == "/" && maybeEnd) {
state.tokenize = null;
break;
}
maybeEnd = (ch == "*");
}
return "comment";
}
function Context(indented, column, type, align, prev) {
this.indented = indented;
this.column = column;
this.type = type;
this.align = align;
this.prev = prev;
}
function pushContext(state, col, type) {
return state.context = new Context(state.indented, col, type, null, state.context);
}
function popContext(state) {
var t = state.context.type;
if (t == ")" || t == "]" || t == "}")
state.indented = state.context.indented;
return state.context = state.context.prev;
}
// Interface
return {
startState: function(basecolumn) {
return {
tokenize: null,
context: new Context((basecolumn || 0) - indentUnit, 0, "top", false),
indented: 0,
startOfLine: true
};
},
token: function(stream, state) {
var ctx = state.context;
if (stream.sol()) {
if (ctx.align == null) ctx.align = false;
state.indented = stream.indentation();
state.startOfLine = true;
}
if (stream.eatSpace()) return null;
curPunc = null;
var style = (state.tokenize || tokenBase)(stream, state);
if (style == "comment" || style == "meta") return style;
if (ctx.align == null) ctx.align = true;
if ((curPunc == ";" || curPunc == ":") && ctx.type == "statement") popContext(state);
else if (curPunc == "{") pushContext(state, stream.column(), "}");
else if (curPunc == "[") pushContext(state, stream.column(), "]");
else if (curPunc == "(") pushContext(state, stream.column(), ")");
else if (curPunc == "}") {
while (ctx.type == "statement") ctx = popContext(state);
if (ctx.type == "}") ctx = popContext(state);
while (ctx.type == "statement") ctx = popContext(state);
}
else if (curPunc == ctx.type) popContext(state);
else if (ctx.type == "}" || ctx.type == "top" || (ctx.type == "statement" && curPunc == "newstatement"))
pushContext(state, stream.column(), "statement");
state.startOfLine = false;
return style;
},
indent: function(state, textAfter) {
if (state.tokenize != tokenBase && state.tokenize != null) return 0;
var ctx = state.context, firstChar = textAfter && textAfter.charAt(0);
if (ctx.type == "statement" && firstChar == "}") ctx = ctx.prev;
var closing = firstChar == ctx.type;
if (ctx.type == "statement") return ctx.indented + (firstChar == "{" ? 0 : indentUnit);
else if (ctx.align) return ctx.column + (closing ? 0 : 1);
else return ctx.indented + (closing ? 0 : indentUnit);
},
electricChars: "{}"
};
});
(function() {
function words(str) {
var obj = {}, words = str.split(" ");
for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
return obj;
}
var cKeywords = "auto if break int case long char register continue return default short do sizeof " +
"double static else struct entry switch extern typedef float union for unsigned " +
"goto while enum void const signed volatile";
function cppHook(stream, state) {
if (!state.startOfLine) return false;
stream.skipToEnd();
return "meta";
}
// C#-style strings where "" escapes a quote.
function tokenAtString(stream, state) {
var next;
while ((next = stream.next()) != null) {
if (next == '"' && !stream.eat('"')) {
state.tokenize = null;
break;
}
}
return "string";
}
CodeMirror.defineMIME("text/x-csrc", {
name: "clike",
keywords: words(cKeywords),
blockKeywords: words("case do else for if switch while struct"),
atoms: words("null"),
hooks: {"#": cppHook}
});
CodeMirror.defineMIME("text/x-c++src", {
name: "clike",
keywords: words(cKeywords + " asm dynamic_cast namespace reinterpret_cast try bool explicit new " +
"static_cast typeid catch operator template typename class friend private " +
"this using const_cast inline public throw virtual delete mutable protected " +
"wchar_t"),
blockKeywords: words("catch class do else finally for if struct switch try while"),
atoms: words("true false null"),
hooks: {"#": cppHook}
});
CodeMirror.defineMIME("text/x-java", {
name: "clike",
keywords: words("abstract assert boolean break byte case catch char class const continue default " +
"do double else enum extends final finally float for goto if implements import " +
"instanceof int interface long native new package private protected public " +
"return short static strictfp super switch synchronized this throw throws transient " +
"try void volatile while"),
blockKeywords: words("catch class do else finally for if switch try while"),
atoms: words("true false null"),
hooks: {
"@": function(stream, state) {
stream.eatWhile(/[\w\$_]/);
return "meta";
}
}
});
CodeMirror.defineMIME("text/x-csharp", {
name: "clike",
keywords: words("abstract as base bool break byte case catch char checked class const continue decimal" +
" default delegate do double else enum event explicit extern finally fixed float for" +
" foreach goto if implicit in int interface internal is lock long namespace new object" +
" operator out override params private protected public readonly ref return sbyte sealed short" +
" sizeof stackalloc static string struct switch this throw try typeof uint ulong unchecked" +
" unsafe ushort using virtual void volatile while add alias ascending descending dynamic from get" +
" global group into join let orderby partial remove select set value var yield"),
blockKeywords: words("catch class do else finally for foreach if struct switch try while"),
atoms: words("true false null"),
hooks: {
"@": function(stream, state) {
if (stream.eat('"')) {
state.tokenize = tokenAtString;
return tokenAtString(stream, state);
}
stream.eatWhile(/[\w\$_]/);
return "meta";
}
}
});
CodeMirror.defineMIME("text/x-scala", {
name: "clike",
keywords: words(
/* scala */
"abstract case catch class def do else extends false final finally for forSome if " +
"implicit import lazy match new null object override package private protected return " +
"sealed super this throw trait try trye type val var while with yield _ : = => <- <: " +
"<% >: # @ " +
/* package scala */
"assert assume require print println printf readLine readBoolean readByte readShort " +
"readChar readInt readLong readFloat readDouble " +
"AnyVal App Application Array BufferedIterator BigDecimal BigInt Char Console Either " +
"Enumeration Equiv Error Exception Fractional Function IndexedSeq Integral Iterable " +
"Iterator List Map Numeric Nil NotNull Option Ordered Ordering PartialFunction PartialOrdering " +
"Product Proxy Range Responder Seq Serializable Set Specializable Stream StringBuilder " +
"StringContext Symbol Throwable Traversable TraversableOnce Tuple Unit Vector :: #:: " +
/* package java.lang */
"Boolean Byte Character CharSequence Class ClassLoader Cloneable Comparable " +
"Compiler Double Exception Float Integer Long Math Number Object Package Pair Process " +
"Runtime Runnable SecurityManager Short StackTraceElement StrictMath String " +
"StringBuffer System Thread ThreadGroup ThreadLocal Throwable Triple Void"
),
blockKeywords: words("catch class do else finally for forSome if match switch try while"),
atoms: words("true false null"),
hooks: {
"@": function(stream, state) {
stream.eatWhile(/[\w\$_]/);
return "meta";
}
}
});
}());

View File

@ -0,0 +1,101 @@
<!doctype html>
<html>
<head>
<title>CodeMirror: C-like mode</title>
<link rel="stylesheet" href="../../lib/codemirror.css">
<script src="../../lib/codemirror.js"></script>
<script src="clike.js"></script>
<link rel="stylesheet" href="../../doc/docs.css">
<style>.CodeMirror {border: 2px inset #dee;}</style>
</head>
<body>
<h1>CodeMirror: C-like mode</h1>
<form><textarea id="code" name="code">
/* C demo code */
#include <zmq.h>
#include <pthread.h>
#include <semaphore.h>
#include <time.h>
#include <stdio.h>
#include <fcntl.h>
#include <malloc.h>
typedef struct {
void* arg_socket;
zmq_msg_t* arg_msg;
char* arg_string;
unsigned long arg_len;
int arg_int, arg_command;
int signal_fd;
int pad;
void* context;
sem_t sem;
} acl_zmq_context;
#define p(X) (context->arg_##X)
void* zmq_thread(void* context_pointer) {
acl_zmq_context* context = (acl_zmq_context*)context_pointer;
char ok = 'K', err = 'X';
int res;
while (1) {
while ((res = sem_wait(&amp;context->sem)) == EINTR);
if (res) {write(context->signal_fd, &amp;err, 1); goto cleanup;}
switch(p(command)) {
case 0: goto cleanup;
case 1: p(socket) = zmq_socket(context->context, p(int)); break;
case 2: p(int) = zmq_close(p(socket)); break;
case 3: p(int) = zmq_bind(p(socket), p(string)); break;
case 4: p(int) = zmq_connect(p(socket), p(string)); break;
case 5: p(int) = zmq_getsockopt(p(socket), p(int), (void*)p(string), &amp;p(len)); break;
case 6: p(int) = zmq_setsockopt(p(socket), p(int), (void*)p(string), p(len)); break;
case 7: p(int) = zmq_send(p(socket), p(msg), p(int)); break;
case 8: p(int) = zmq_recv(p(socket), p(msg), p(int)); break;
case 9: p(int) = zmq_poll(p(socket), p(int), p(len)); break;
}
p(command) = errno;
write(context->signal_fd, &amp;ok, 1);
}
cleanup:
close(context->signal_fd);
free(context_pointer);
return 0;
}
void* zmq_thread_init(void* zmq_context, int signal_fd) {
acl_zmq_context* context = malloc(sizeof(acl_zmq_context));
pthread_t thread;
context->context = zmq_context;
context->signal_fd = signal_fd;
sem_init(&amp;context->sem, 1, 0);
pthread_create(&amp;thread, 0, &amp;zmq_thread, context);
pthread_detach(thread);
return context;
}
</textarea></form>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
lineNumbers: true,
matchBrackets: true,
mode: "text/x-csrc"
});
</script>
<p>Simple mode that tries to handle C-like languages as well as it
can. Takes two configuration parameters: <code>keywords</code>, an
object whose property names are the keywords in the language,
and <code>useCPP</code>, which determines whether C preprocessor
directives are recognized.</p>
<p><strong>MIME types defined:</strong> <code>text/x-csrc</code>
(C code), <code>text/x-c++src</code> (C++
code), <code>text/x-java</code> (Java
code), <code>text/x-csharp</code> (C#).</p>
</body>
</html>

View File

@ -0,0 +1,765 @@
<!doctype html>
<html>
<head>
<title>CodeMirror: C-like mode</title>
<link rel="stylesheet" href="../../lib/codemirror.css">
<link rel="stylesheet" href="../../theme/ambiance.css">
<script src="../../lib/codemirror.js"></script>
<script src="clike.js"></script>
<link rel="stylesheet" href="../../doc/docs.css">
<style>
body
{
margin: 0;
padding: 0;
max-width:inherit;
height: 100%;
}
html, form, .CodeMirror, .CodeMirror-scroll
{
height: 100%;
}
</style>
</head>
<body>
<form>
<textarea id="code" name="code">
/* __ *\
** ________ ___ / / ___ Scala API **
** / __/ __// _ | / / / _ | (c) 2003-2011, LAMP/EPFL **
** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
** /____/\___/_/ |_/____/_/ | | **
** |/ **
\* */
package scala.collection
import generic._
import mutable.{ Builder, ListBuffer }
import annotation.{tailrec, migration, bridge}
import annotation.unchecked.{ uncheckedVariance => uV }
import parallel.ParIterable
/** A template trait for traversable collections of type `Traversable[A]`.
*
* $traversableInfo
* @define mutability
* @define traversableInfo
* This is a base trait of all kinds of $mutability Scala collections. It
* implements the behavior common to all collections, in terms of a method
* `foreach` with signature:
* {{{
* def foreach[U](f: Elem => U): Unit
* }}}
* Collection classes mixing in this trait provide a concrete
* `foreach` method which traverses all the
* elements contained in the collection, applying a given function to each.
* They also need to provide a method `newBuilder`
* which creates a builder for collections of the same kind.
*
* A traversable class might or might not have two properties: strictness
* and orderedness. Neither is represented as a type.
*
* The instances of a strict collection class have all their elements
* computed before they can be used as values. By contrast, instances of
* a non-strict collection class may defer computation of some of their
* elements until after the instance is available as a value.
* A typical example of a non-strict collection class is a
* <a href="../immutable/Stream.html" target="ContentFrame">
* `scala.collection.immutable.Stream`</a>.
* A more general class of examples are `TraversableViews`.
*
* If a collection is an instance of an ordered collection class, traversing
* its elements with `foreach` will always visit elements in the
* same order, even for different runs of the program. If the class is not
* ordered, `foreach` can visit elements in different orders for
* different runs (but it will keep the same order in the same run).'
*
* A typical example of a collection class which is not ordered is a
* `HashMap` of objects. The traversal order for hash maps will
* depend on the hash codes of its elements, and these hash codes might
* differ from one run to the next. By contrast, a `LinkedHashMap`
* is ordered because it's `foreach` method visits elements in the
* order they were inserted into the `HashMap`.
*
* @author Martin Odersky
* @version 2.8
* @since 2.8
* @tparam A the element type of the collection
* @tparam Repr the type of the actual collection containing the elements.
*
* @define Coll Traversable
* @define coll traversable collection
*/
trait TraversableLike[+A, +Repr] extends HasNewBuilder[A, Repr]
with FilterMonadic[A, Repr]
with TraversableOnce[A]
with GenTraversableLike[A, Repr]
with Parallelizable[A, ParIterable[A]]
{
self =>
import Traversable.breaks._
/** The type implementing this traversable */
protected type Self = Repr
/** The collection of type $coll underlying this `TraversableLike` object.
* By default this is implemented as the `TraversableLike` object itself,
* but this can be overridden.
*/
def repr: Repr = this.asInstanceOf[Repr]
/** The underlying collection seen as an instance of `$Coll`.
* By default this is implemented as the current collection object itself,
* but this can be overridden.
*/
protected[this] def thisCollection: Traversable[A] = this.asInstanceOf[Traversable[A]]
/** A conversion from collections of type `Repr` to `$Coll` objects.
* By default this is implemented as just a cast, but this can be overridden.
*/
protected[this] def toCollection(repr: Repr): Traversable[A] = repr.asInstanceOf[Traversable[A]]
/** Creates a new builder for this collection type.
*/
protected[this] def newBuilder: Builder[A, Repr]
protected[this] def parCombiner = ParIterable.newCombiner[A]
/** Applies a function `f` to all elements of this $coll.
*
* Note: this method underlies the implementation of most other bulk operations.
* It's important to implement this method in an efficient way.
*
*
* @param f the function that is applied for its side-effect to every element.
* The result of function `f` is discarded.
*
* @tparam U the type parameter describing the result of function `f`.
* This result will always be ignored. Typically `U` is `Unit`,
* but this is not necessary.
*
* @usecase def foreach(f: A => Unit): Unit
*/
def foreach[U](f: A => U): Unit
/** Tests whether this $coll is empty.
*
* @return `true` if the $coll contain no elements, `false` otherwise.
*/
def isEmpty: Boolean = {
var result = true
breakable {
for (x <- this) {
result = false
break
}
}
result
}
/** Tests whether this $coll is known to have a finite size.
* All strict collections are known to have finite size. For a non-strict collection
* such as `Stream`, the predicate returns `true` if all elements have been computed.
* It returns `false` if the stream is not yet evaluated to the end.
*
* Note: many collection methods will not work on collections of infinite sizes.
*
* @return `true` if this collection is known to have finite size, `false` otherwise.
*/
def hasDefiniteSize = true
def ++[B >: A, That](that: GenTraversableOnce[B])(implicit bf: CanBuildFrom[Repr, B, That]): That = {
val b = bf(repr)
if (that.isInstanceOf[IndexedSeqLike[_, _]]) b.sizeHint(this, that.seq.size)
b ++= thisCollection
b ++= that.seq
b.result
}
@bridge
def ++[B >: A, That](that: TraversableOnce[B])(implicit bf: CanBuildFrom[Repr, B, That]): That =
++(that: GenTraversableOnce[B])(bf)
/** Concatenates this $coll with the elements of a traversable collection.
* It differs from ++ in that the right operand determines the type of the
* resulting collection rather than the left one.
*
* @param that the traversable to append.
* @tparam B the element type of the returned collection.
* @tparam That $thatinfo
* @param bf $bfinfo
* @return a new collection of type `That` which contains all elements
* of this $coll followed by all elements of `that`.
*
* @usecase def ++:[B](that: TraversableOnce[B]): $Coll[B]
*
* @return a new $coll which contains all elements of this $coll
* followed by all elements of `that`.
*/
def ++:[B >: A, That](that: TraversableOnce[B])(implicit bf: CanBuildFrom[Repr, B, That]): That = {
val b = bf(repr)
if (that.isInstanceOf[IndexedSeqLike[_, _]]) b.sizeHint(this, that.size)
b ++= that
b ++= thisCollection
b.result
}
/** This overload exists because: for the implementation of ++: we should reuse
* that of ++ because many collections override it with more efficient versions.
* Since TraversableOnce has no '++' method, we have to implement that directly,
* but Traversable and down can use the overload.
*/
def ++:[B >: A, That](that: Traversable[B])(implicit bf: CanBuildFrom[Repr, B, That]): That =
(that ++ seq)(breakOut)
def map[B, That](f: A => B)(implicit bf: CanBuildFrom[Repr, B, That]): That = {
val b = bf(repr)
b.sizeHint(this)
for (x <- this) b += f(x)
b.result
}
def flatMap[B, That](f: A => GenTraversableOnce[B])(implicit bf: CanBuildFrom[Repr, B, That]): That = {
val b = bf(repr)
for (x <- this) b ++= f(x).seq
b.result
}
/** Selects all elements of this $coll which satisfy a predicate.
*
* @param p the predicate used to test elements.
* @return a new $coll consisting of all elements of this $coll that satisfy the given
* predicate `p`. The order of the elements is preserved.
*/
def filter(p: A => Boolean): Repr = {
val b = newBuilder
for (x <- this)
if (p(x)) b += x
b.result
}
/** Selects all elements of this $coll which do not satisfy a predicate.
*
* @param p the predicate used to test elements.
* @return a new $coll consisting of all elements of this $coll that do not satisfy the given
* predicate `p`. The order of the elements is preserved.
*/
def filterNot(p: A => Boolean): Repr = filter(!p(_))
def collect[B, That](pf: PartialFunction[A, B])(implicit bf: CanBuildFrom[Repr, B, That]): That = {
val b = bf(repr)
for (x <- this) if (pf.isDefinedAt(x)) b += pf(x)
b.result
}
/** Builds a new collection by applying an option-valued function to all
* elements of this $coll on which the function is defined.
*
* @param f the option-valued function which filters and maps the $coll.
* @tparam B the element type of the returned collection.
* @tparam That $thatinfo
* @param bf $bfinfo
* @return a new collection of type `That` resulting from applying the option-valued function
* `f` to each element and collecting all defined results.
* The order of the elements is preserved.
*
* @usecase def filterMap[B](f: A => Option[B]): $Coll[B]
*
* @param pf the partial function which filters and maps the $coll.
* @return a new $coll resulting from applying the given option-valued function
* `f` to each element and collecting all defined results.
* The order of the elements is preserved.
def filterMap[B, That](f: A => Option[B])(implicit bf: CanBuildFrom[Repr, B, That]): That = {
val b = bf(repr)
for (x <- this)
f(x) match {
case Some(y) => b += y
case _ =>
}
b.result
}
*/
/** Partitions this $coll in two ${coll}s according to a predicate.
*
* @param p the predicate on which to partition.
* @return a pair of ${coll}s: the first $coll consists of all elements that
* satisfy the predicate `p` and the second $coll consists of all elements
* that don't. The relative order of the elements in the resulting ${coll}s
* is the same as in the original $coll.
*/
def partition(p: A => Boolean): (Repr, Repr) = {
val l, r = newBuilder
for (x <- this) (if (p(x)) l else r) += x
(l.result, r.result)
}
def groupBy[K](f: A => K): immutable.Map[K, Repr] = {
val m = mutable.Map.empty[K, Builder[A, Repr]]
for (elem <- this) {
val key = f(elem)
val bldr = m.getOrElseUpdate(key, newBuilder)
bldr += elem
}
val b = immutable.Map.newBuilder[K, Repr]
for ((k, v) <- m)
b += ((k, v.result))
b.result
}
/** Tests whether a predicate holds for all elements of this $coll.
*
* $mayNotTerminateInf
*
* @param p the predicate used to test elements.
* @return `true` if the given predicate `p` holds for all elements
* of this $coll, otherwise `false`.
*/
def forall(p: A => Boolean): Boolean = {
var result = true
breakable {
for (x <- this)
if (!p(x)) { result = false; break }
}
result
}
/** Tests whether a predicate holds for some of the elements of this $coll.
*
* $mayNotTerminateInf
*
* @param p the predicate used to test elements.
* @return `true` if the given predicate `p` holds for some of the
* elements of this $coll, otherwise `false`.
*/
def exists(p: A => Boolean): Boolean = {
var result = false
breakable {
for (x <- this)
if (p(x)) { result = true; break }
}
result
}
/** Finds the first element of the $coll satisfying a predicate, if any.
*
* $mayNotTerminateInf
* $orderDependent
*
* @param p the predicate used to test elements.
* @return an option value containing the first element in the $coll
* that satisfies `p`, or `None` if none exists.
*/
def find(p: A => Boolean): Option[A] = {
var result: Option[A] = None
breakable {
for (x <- this)
if (p(x)) { result = Some(x); break }
}
result
}
def scan[B >: A, That](z: B)(op: (B, B) => B)(implicit cbf: CanBuildFrom[Repr, B, That]): That = scanLeft(z)(op)
def scanLeft[B, That](z: B)(op: (B, A) => B)(implicit bf: CanBuildFrom[Repr, B, That]): That = {
val b = bf(repr)
b.sizeHint(this, 1)
var acc = z
b += acc
for (x <- this) { acc = op(acc, x); b += acc }
b.result
}
@migration(2, 9,
"This scanRight definition has changed in 2.9.\n" +
"The previous behavior can be reproduced with scanRight.reverse."
)
def scanRight[B, That](z: B)(op: (A, B) => B)(implicit bf: CanBuildFrom[Repr, B, That]): That = {
var scanned = List(z)
var acc = z
for (x <- reversed) {
acc = op(x, acc)
scanned ::= acc
}
val b = bf(repr)
for (elem <- scanned) b += elem
b.result
}
/** Selects the first element of this $coll.
* $orderDependent
* @return the first element of this $coll.
* @throws `NoSuchElementException` if the $coll is empty.
*/
def head: A = {
var result: () => A = () => throw new NoSuchElementException
breakable {
for (x <- this) {
result = () => x
break
}
}
result()
}
/** Optionally selects the first element.
* $orderDependent
* @return the first element of this $coll if it is nonempty, `None` if it is empty.
*/
def headOption: Option[A] = if (isEmpty) None else Some(head)
/** Selects all elements except the first.
* $orderDependent
* @return a $coll consisting of all elements of this $coll
* except the first one.
* @throws `UnsupportedOperationException` if the $coll is empty.
*/
override def tail: Repr = {
if (isEmpty) throw new UnsupportedOperationException("empty.tail")
drop(1)
}
/** Selects the last element.
* $orderDependent
* @return The last element of this $coll.
* @throws NoSuchElementException If the $coll is empty.
*/
def last: A = {
var lst = head
for (x <- this)
lst = x
lst
}
/** Optionally selects the last element.
* $orderDependent
* @return the last element of this $coll$ if it is nonempty, `None` if it is empty.
*/
def lastOption: Option[A] = if (isEmpty) None else Some(last)
/** Selects all elements except the last.
* $orderDependent
* @return a $coll consisting of all elements of this $coll
* except the last one.
* @throws `UnsupportedOperationException` if the $coll is empty.
*/
def init: Repr = {
if (isEmpty) throw new UnsupportedOperationException("empty.init")
var lst = head
var follow = false
val b = newBuilder
b.sizeHint(this, -1)
for (x <- this.seq) {
if (follow) b += lst
else follow = true
lst = x
}
b.result
}
def take(n: Int): Repr = slice(0, n)
def drop(n: Int): Repr =
if (n <= 0) {
val b = newBuilder
b.sizeHint(this)
b ++= thisCollection result
}
else sliceWithKnownDelta(n, Int.MaxValue, -n)
def slice(from: Int, until: Int): Repr = sliceWithKnownBound(math.max(from, 0), until)
// Precondition: from >= 0, until > 0, builder already configured for building.
private[this] def sliceInternal(from: Int, until: Int, b: Builder[A, Repr]): Repr = {
var i = 0
breakable {
for (x <- this.seq) {
if (i >= from) b += x
i += 1
if (i >= until) break
}
}
b.result
}
// Precondition: from >= 0
private[scala] def sliceWithKnownDelta(from: Int, until: Int, delta: Int): Repr = {
val b = newBuilder
if (until <= from) b.result
else {
b.sizeHint(this, delta)
sliceInternal(from, until, b)
}
}
// Precondition: from >= 0
private[scala] def sliceWithKnownBound(from: Int, until: Int): Repr = {
val b = newBuilder
if (until <= from) b.result
else {
b.sizeHintBounded(until - from, this)
sliceInternal(from, until, b)
}
}
def takeWhile(p: A => Boolean): Repr = {
val b = newBuilder
breakable {
for (x <- this) {
if (!p(x)) break
b += x
}
}
b.result
}
def dropWhile(p: A => Boolean): Repr = {
val b = newBuilder
var go = false
for (x <- this) {
if (!p(x)) go = true
if (go) b += x
}
b.result
}
def span(p: A => Boolean): (Repr, Repr) = {
val l, r = newBuilder
var toLeft = true
for (x <- this) {
toLeft = toLeft && p(x)
(if (toLeft) l else r) += x
}
(l.result, r.result)
}
def splitAt(n: Int): (Repr, Repr) = {
val l, r = newBuilder
l.sizeHintBounded(n, this)
if (n >= 0) r.sizeHint(this, -n)
var i = 0
for (x <- this) {
(if (i < n) l else r) += x
i += 1
}
(l.result, r.result)
}
/** Iterates over the tails of this $coll. The first value will be this
* $coll and the final one will be an empty $coll, with the intervening
* values the results of successive applications of `tail`.
*
* @return an iterator over all the tails of this $coll
* @example `List(1,2,3).tails = Iterator(List(1,2,3), List(2,3), List(3), Nil)`
*/
def tails: Iterator[Repr] = iterateUntilEmpty(_.tail)
/** Iterates over the inits of this $coll. The first value will be this
* $coll and the final one will be an empty $coll, with the intervening
* values the results of successive applications of `init`.
*
* @return an iterator over all the inits of this $coll
* @example `List(1,2,3).inits = Iterator(List(1,2,3), List(1,2), List(1), Nil)`
*/
def inits: Iterator[Repr] = iterateUntilEmpty(_.init)
/** Copies elements of this $coll to an array.
* Fills the given array `xs` with at most `len` elements of
* this $coll, starting at position `start`.
* Copying will stop once either the end of the current $coll is reached,
* or the end of the array is reached, or `len` elements have been copied.
*
* $willNotTerminateInf
*
* @param xs the array to fill.
* @param start the starting index.
* @param len the maximal number of elements to copy.
* @tparam B the type of the elements of the array.
*
*
* @usecase def copyToArray(xs: Array[A], start: Int, len: Int): Unit
*/
def copyToArray[B >: A](xs: Array[B], start: Int, len: Int) {
var i = start
val end = (start + len) min xs.length
breakable {
for (x <- this) {
if (i >= end) break
xs(i) = x
i += 1
}
}
}
def toTraversable: Traversable[A] = thisCollection
def toIterator: Iterator[A] = toStream.iterator
def toStream: Stream[A] = toBuffer.toStream
/** Converts this $coll to a string.
*
* @return a string representation of this collection. By default this
* string consists of the `stringPrefix` of this $coll,
* followed by all elements separated by commas and enclosed in parentheses.
*/
override def toString = mkString(stringPrefix + "(", ", ", ")")
/** Defines the prefix of this object's `toString` representation.
*
* @return a string representation which starts the result of `toString`
* applied to this $coll. By default the string prefix is the
* simple name of the collection class $coll.
*/
def stringPrefix : String = {
var string = repr.asInstanceOf[AnyRef].getClass.getName
val idx1 = string.lastIndexOf('.' : Int)
if (idx1 != -1) string = string.substring(idx1 + 1)
val idx2 = string.indexOf('$')
if (idx2 != -1) string = string.substring(0, idx2)
string
}
/** Creates a non-strict view of this $coll.
*
* @return a non-strict view of this $coll.
*/
def view = new TraversableView[A, Repr] {
protected lazy val underlying = self.repr
override def foreach[U](f: A => U) = self foreach f
}
/** Creates a non-strict view of a slice of this $coll.
*
* Note: the difference between `view` and `slice` is that `view` produces
* a view of the current $coll, whereas `slice` produces a new $coll.
*
* Note: `view(from, to)` is equivalent to `view.slice(from, to)`
* $orderDependent
*
* @param from the index of the first element of the view
* @param until the index of the element following the view
* @return a non-strict view of a slice of this $coll, starting at index `from`
* and extending up to (but not including) index `until`.
*/
def view(from: Int, until: Int): TraversableView[A, Repr] = view.slice(from, until)
/** Creates a non-strict filter of this $coll.
*
* Note: the difference between `c filter p` and `c withFilter p` is that
* the former creates a new collection, whereas the latter only
* restricts the domain of subsequent `map`, `flatMap`, `foreach`,
* and `withFilter` operations.
* $orderDependent
*
* @param p the predicate used to test elements.
* @return an object of class `WithFilter`, which supports
* `map`, `flatMap`, `foreach`, and `withFilter` operations.
* All these operations apply to those elements of this $coll which
* satisfy the predicate `p`.
*/
def withFilter(p: A => Boolean): FilterMonadic[A, Repr] = new WithFilter(p)
/** A class supporting filtered operations. Instances of this class are
* returned by method `withFilter`.
*/
class WithFilter(p: A => Boolean) extends FilterMonadic[A, Repr] {
/** Builds a new collection by applying a function to all elements of the
* outer $coll containing this `WithFilter` instance that satisfy predicate `p`.
*
* @param f the function to apply to each element.
* @tparam B the element type of the returned collection.
* @tparam That $thatinfo
* @param bf $bfinfo
* @return a new collection of type `That` resulting from applying
* the given function `f` to each element of the outer $coll
* that satisfies predicate `p` and collecting the results.
*
* @usecase def map[B](f: A => B): $Coll[B]
*
* @return a new $coll resulting from applying the given function
* `f` to each element of the outer $coll that satisfies
* predicate `p` and collecting the results.
*/
def map[B, That](f: A => B)(implicit bf: CanBuildFrom[Repr, B, That]): That = {
val b = bf(repr)
for (x <- self)
if (p(x)) b += f(x)
b.result
}
/** Builds a new collection by applying a function to all elements of the
* outer $coll containing this `WithFilter` instance that satisfy
* predicate `p` and concatenating the results.
*
* @param f the function to apply to each element.
* @tparam B the element type of the returned collection.
* @tparam That $thatinfo
* @param bf $bfinfo
* @return a new collection of type `That` resulting from applying
* the given collection-valued function `f` to each element
* of the outer $coll that satisfies predicate `p` and
* concatenating the results.
*
* @usecase def flatMap[B](f: A => TraversableOnce[B]): $Coll[B]
*
* @return a new $coll resulting from applying the given collection-valued function
* `f` to each element of the outer $coll that satisfies predicate `p` and concatenating the results.
*/
def flatMap[B, That](f: A => GenTraversableOnce[B])(implicit bf: CanBuildFrom[Repr, B, That]): That = {
val b = bf(repr)
for (x <- self)
if (p(x)) b ++= f(x).seq
b.result
}
/** Applies a function `f` to all elements of the outer $coll containing
* this `WithFilter` instance that satisfy predicate `p`.
*
* @param f the function that is applied for its side-effect to every element.
* The result of function `f` is discarded.
*
* @tparam U the type parameter describing the result of function `f`.
* This result will always be ignored. Typically `U` is `Unit`,
* but this is not necessary.
*
* @usecase def foreach(f: A => Unit): Unit
*/
def foreach[U](f: A => U): Unit =
for (x <- self)
if (p(x)) f(x)
/** Further refines the filter for this $coll.
*
* @param q the predicate used to test elements.
* @return an object of class `WithFilter`, which supports
* `map`, `flatMap`, `foreach`, and `withFilter` operations.
* All these operations apply to those elements of this $coll which
* satisfy the predicate `q` in addition to the predicate `p`.
*/
def withFilter(q: A => Boolean): WithFilter =
new WithFilter(x => p(x) && q(x))
}
// A helper for tails and inits.
private def iterateUntilEmpty(f: Traversable[A @uV] => Traversable[A @uV]): Iterator[Repr] = {
val it = Iterator.iterate(thisCollection)(f) takeWhile (x => !x.isEmpty)
it ++ Iterator(Nil) map (newBuilder ++= _ result)
}
}
</textarea>
</form>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
lineNumbers: true,
matchBrackets: true,
theme: "ambiance",
mode: "text/x-scala"
});
</script>
</body>
</html>

View File

@ -0,0 +1,207 @@
/**
* Author: Hans Engel
* Branched from CodeMirror's Scheme mode (by Koh Zi Han, based on implementation by Koh Zi Chun)
*/
CodeMirror.defineMode("clojure", function (config, mode) {
var BUILTIN = "builtin", COMMENT = "comment", STRING = "string", TAG = "tag",
ATOM = "atom", NUMBER = "number", BRACKET = "bracket", KEYWORD = "keyword";
var INDENT_WORD_SKIP = 2, KEYWORDS_SKIP = 1;
function makeKeywords(str) {
var obj = {}, words = str.split(" ");
for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
return obj;
}
var atoms = makeKeywords("true false nil");
var keywords = makeKeywords(
"defn defn- def def- defonce defmulti defmethod defmacro defstruct deftype defprotocol defrecord defproject deftest slice defalias defhinted defmacro- defn-memo defnk defnk defonce- defunbound defunbound- defvar defvar- let letfn do case cond condp for loop recur when when-not when-let when-first if if-let if-not . .. -> ->> doto and or dosync doseq dotimes dorun doall load import unimport ns in-ns refer try catch finally throw with-open with-local-vars binding gen-class gen-and-load-class gen-and-save-class handler-case handle");
var builtins = makeKeywords(
"* *1 *2 *3 *agent* *allow-unresolved-vars* *assert *clojure-version* *command-line-args* *compile-files* *compile-path* *e *err* *file* *flush-on-newline* *in* *macro-meta* *math-context* *ns* *out* *print-dup* *print-length* *print-level* *print-meta* *print-readably* *read-eval* *source-path* *use-context-classloader* *warn-on-reflection* + - / < <= = == > >= accessor aclone agent agent-errors aget alength alias all-ns alter alter-meta! alter-var-root amap ancestors and apply areduce array-map aset aset-boolean aset-byte aset-char aset-double aset-float aset-int aset-long aset-short assert assoc assoc! assoc-in associative? atom await await-for await1 bases bean bigdec bigint binding bit-and bit-and-not bit-clear bit-flip bit-not bit-or bit-set bit-shift-left bit-shift-right bit-test bit-xor boolean boolean-array booleans bound-fn bound-fn* butlast byte byte-array bytes case cast char char-array char-escape-string char-name-string char? chars chunk chunk-append chunk-buffer chunk-cons chunk-first chunk-next chunk-rest chunked-seq? class class? clear-agent-errors clojure-version coll? comment commute comp comparator compare compare-and-set! compile complement concat cond condp conj conj! cons constantly construct-proxy contains? count counted? create-ns create-struct cycle dec decimal? declare definline defmacro defmethod defmulti defn defn- defonce defstruct delay delay? deliver deref derive descendants destructure disj disj! dissoc dissoc! distinct distinct? doall doc dorun doseq dosync dotimes doto double double-array doubles drop drop-last drop-while empty empty? ensure enumeration-seq eval even? every? extend extend-protocol extend-type extends? extenders false? ffirst file-seq filter find find-doc find-ns find-var first float float-array float? floats flush fn fn? fnext for force format future future-call future-cancel future-cancelled? future-done? future? gen-class gen-interface gensym get get-in get-method get-proxy-class get-thread-bindings get-validator hash hash-map hash-set identical? identity if-let if-not ifn? import in-ns inc init-proxy instance? int int-array integer? interleave intern interpose into into-array ints io! isa? iterate iterator-seq juxt key keys keyword keyword? last lazy-cat lazy-seq let letfn line-seq list list* list? load load-file load-reader load-string loaded-libs locking long long-array longs loop macroexpand macroexpand-1 make-array make-hierarchy map map? mapcat max max-key memfn memoize merge merge-with meta method-sig methods min min-key mod name namespace neg? newline next nfirst nil? nnext not not-any? not-empty not-every? not= ns ns-aliases ns-imports ns-interns ns-map ns-name ns-publics ns-refers ns-resolve ns-unalias ns-unmap nth nthnext num number? odd? or parents partial partition pcalls peek persistent! pmap pop pop! pop-thread-bindings pos? pr pr-str prefer-method prefers primitives-classnames print print-ctor print-doc print-dup print-method print-namespace-doc print-simple print-special-doc print-str printf println println-str prn prn-str promise proxy proxy-call-with-super proxy-mappings proxy-name proxy-super push-thread-bindings pvalues quot rand rand-int range ratio? rational? rationalize re-find re-groups re-matcher re-matches re-pattern re-seq read read-line read-string reify reduce ref ref-history-count ref-max-history ref-min-history ref-set refer refer-clojure release-pending-sends rem remove remove-method remove-ns repeat repeatedly replace replicate require reset! reset-meta! resolve rest resultset-seq reverse reversible? rseq rsubseq satisfies? second select-keys send send-off seq seq? seque sequence sequential? set set-validator! set? short short-array shorts shutdown-agents slurp some sort sort-by sorted-map sorted-map-by sorted-set sorted-set-by sorted? special-form-anchor special-symbol? split-at split-with str stream? string? struct struct-map subs subseq subvec supers swap! symbol symbol? sync syntax-symbol-anchor take take-last take-nth take-while test the-ns time to-array to-array-2d trampoline transient tree-seq true? type unchecked-add unchecked-dec unchecked-divide unchecked-inc unchecked-multiply unchecked-negate unchecked-remainder unchecked-subtract underive unquote unquote-splicing update-in update-proxy use val vals var-get var-set var? vary-meta vec vector vector? when when-first when-let when-not while with-bindings with-bindings* with-in-str with-loading-context with-local-vars with-meta with-open with-out-str with-precision xml-seq");
var indentKeys = makeKeywords(
// Built-ins
"ns fn def defn defmethod bound-fn if if-not case condp when while when-not when-first do future comment doto locking proxy with-open with-precision reify deftype defrecord defprotocol extend extend-protocol extend-type try catch " +
// Binding forms
"let letfn binding loop for doseq dotimes when-let if-let " +
// Data structures
"defstruct struct-map assoc " +
// clojure.test
"testing deftest " +
// contrib
"handler-case handle dotrace deftrace");
var tests = {
digit: /\d/,
digit_or_colon: /[\d:]/,
hex: /[0-9a-fA-F]/,
sign: /[+-]/,
exponent: /[eE]/,
keyword_char: /[^\s\(\[\;\)\]]/,
basic: /[\w\$_\-]/,
lang_keyword: /[\w*+!\-_?:\/]/
};
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;
}
function isNumber(ch, stream){
// hex
if ( ch === '0' && 'x' == stream.peek().toLowerCase() ) {
stream.eat('x');
stream.eatWhile(tests.hex);
return true;
}
// leading sign
if ( ch == '+' || ch == '-' ) {
stream.eat(tests.sign);
ch = stream.next();
}
if ( tests.digit.test(ch) ) {
stream.eat(ch);
stream.eatWhile(tests.digit);
if ( '.' == stream.peek() ) {
stream.eat('.');
stream.eatWhile(tests.digit);
}
if ( 'e' == stream.peek().toLowerCase() ) {
stream.eat(tests.exponent);
stream.eat(tests.sign);
stream.eatWhile(tests.digit);
}
return true;
}
return false;
}
return {
startState: function () {
return {
indentStack: null,
indentation: 0,
mode: 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 string mode
break;
default: // default parsing mode
var ch = stream.next();
if (ch == "\"") {
state.mode = "string";
returnType = STRING;
} else if (ch == "'" && !( tests.digit_or_colon.test(stream.peek()) )) {
returnType = ATOM;
} else if (ch == ";") { // comment
stream.skipToEnd(); // rest of the line is a comment
returnType = COMMENT;
} else if (isNumber(ch,stream)){
returnType = NUMBER;
} else if (ch == "(" || ch == "[") {
var keyWord = ''; var indentTemp = stream.column();
/**
Either
(indent-word ..
(non-indent-word ..
(;something else, bracket, etc.
*/
if (ch == "(") while ((letter = stream.eat(tests.keyword_char)) != 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
returnType = BRACKET;
} else if (ch == ")" || ch == "]") {
returnType = BRACKET;
if (state.indentStack != null && state.indentStack.type == (ch == ")" ? "(" : "[")) {
popStack(state);
}
} else if ( ch == ":" ) {
stream.eatWhile(tests.lang_keyword);
return ATOM;
} else {
stream.eatWhile(tests.basic);
if (keywords && keywords.propertyIsEnumerable(stream.current())) {
returnType = KEYWORD;
} else if (builtins && builtins.propertyIsEnumerable(stream.current())) {
returnType = BUILTIN;
} else if (atoms && atoms.propertyIsEnumerable(stream.current())) {
returnType = ATOM;
} else returnType = null;
}
}
return returnType;
},
indent: function (state, textAfter) {
if (state.indentStack == null) return state.indentation;
return state.indentStack.indent;
}
};
});
CodeMirror.defineMIME("text/x-clojure", "clojure");

View File

@ -0,0 +1,66 @@
<!doctype html>
<html>
<head>
<title>CodeMirror: Clojure mode</title>
<link rel="stylesheet" href="../../lib/codemirror.css">
<script src="../../lib/codemirror.js"></script>
<script src="clojure.js"></script>
<style>.CodeMirror {background: #f8f8f8;}</style>
<link rel="stylesheet" href="../../doc/docs.css">
</head>
<body>
<h1>CodeMirror: Clojure mode</h1>
<form><textarea id="code" name="code">
; Conway's Game of Life, based on the work of:
;; Laurent Petit https://gist.github.com/1200343
;; Christophe Grand http://clj-me.cgrand.net/2011/08/19/conways-game-of-life
(ns ^{:doc "Conway's Game of Life."}
game-of-life)
;; Core game of life's algorithm functions
(defn neighbours
"Given a cell's coordinates, returns the coordinates of its neighbours."
[[x y]]
(for [dx [-1 0 1] dy (if (zero? dx) [-1 1] [-1 0 1])]
[(+ dx x) (+ dy y)]))
(defn step
"Given a set of living cells, computes the new set of living cells."
[cells]
(set (for [[cell n] (frequencies (mapcat neighbours cells))
:when (or (= n 3) (and (= n 2) (cells cell)))]
cell)))
;; Utility methods for displaying game on a text terminal
(defn print-board
"Prints a board on *out*, representing a step in the game."
[board w h]
(doseq [x (range (inc w)) y (range (inc h))]
(if (= y 0) (print "\n"))
(print (if (board [x y]) "[X]" " . "))))
(defn display-grids
"Prints a squence of boards on *out*, representing several steps."
[grids w h]
(doseq [board grids]
(print-board board w h)
(print "\n")))
;; Launches an example board
(def
^{:doc "board represents the initial set of living cells"}
board #{[2 1] [2 2] [2 3]})
(display-grids (take 3 (iterate step board)) 5 5) </textarea></form>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {});
</script>
<p><strong>MIME types defined:</strong> <code>text/x-clojure</code>.</p>
</body>
</html>

View File

@ -0,0 +1,22 @@
The MIT License
Copyright (c) 2011 Jeff Pickhardt
Modified from the Python CodeMirror mode, Copyright (c) 2010 Timothy Farrell
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@ -0,0 +1,347 @@
/**
* Link to the project's GitHub page:
* https://github.com/pickhardt/coffeescript-codemirror-mode
*/
CodeMirror.defineMode('coffeescript', function(conf) {
var ERRORCLASS = 'error';
function wordRegexp(words) {
return new RegExp("^((" + words.join(")|(") + "))\\b");
}
var singleOperators = new RegExp("^[\\+\\-\\*/%&|\\^~<>!\?]");
var singleDelimiters = new RegExp('^[\\(\\)\\[\\]\\{\\}@,:`=;\\.]');
var doubleOperators = new RegExp("^((\->)|(\=>)|(\\+\\+)|(\\+\\=)|(\\-\\-)|(\\-\\=)|(\\*\\*)|(\\*\\=)|(\\/\\/)|(\\/\\=)|(==)|(!=)|(<=)|(>=)|(<>)|(<<)|(>>)|(//))");
var doubleDelimiters = new RegExp("^((\\.\\.)|(\\+=)|(\\-=)|(\\*=)|(%=)|(/=)|(&=)|(\\|=)|(\\^=))");
var tripleDelimiters = new RegExp("^((\\.\\.\\.)|(//=)|(>>=)|(<<=)|(\\*\\*=))");
var identifiers = new RegExp("^[_A-Za-z$][_A-Za-z$0-9]*");
var wordOperators = wordRegexp(['and', 'or', 'not',
'is', 'isnt', 'in',
'instanceof', 'typeof']);
var indentKeywords = ['for', 'while', 'loop', 'if', 'unless', 'else',
'switch', 'try', 'catch', 'finally', 'class'];
var commonKeywords = ['break', 'by', 'continue', 'debugger', 'delete',
'do', 'in', 'of', 'new', 'return', 'then',
'this', 'throw', 'when', 'until'];
var keywords = wordRegexp(indentKeywords.concat(commonKeywords));
indentKeywords = wordRegexp(indentKeywords);
var stringPrefixes = new RegExp("^('{3}|\"{3}|['\"])");
var regexPrefixes = new RegExp("^(/{3}|/)");
var commonConstants = ['Infinity', 'NaN', 'undefined', 'null', 'true', 'false', 'on', 'off', 'yes', 'no'];
var constants = wordRegexp(commonConstants);
// Tokenizers
function tokenBase(stream, state) {
// Handle scope changes
if (stream.sol()) {
var scopeOffset = state.scopes[0].offset;
if (stream.eatSpace()) {
var lineOffset = stream.indentation();
if (lineOffset > scopeOffset) {
return 'indent';
} else if (lineOffset < scopeOffset) {
return 'dedent';
}
return null;
} else {
if (scopeOffset > 0) {
dedent(stream, state);
}
}
}
if (stream.eatSpace()) {
return null;
}
var ch = stream.peek();
// Handle docco title comment (single line)
if (stream.match("####")) {
stream.skipToEnd();
return 'comment';
}
// Handle multi line comments
if (stream.match("###")) {
state.tokenize = longComment;
return state.tokenize(stream, state);
}
// Single line comment
if (ch === '#') {
stream.skipToEnd();
return 'comment';
}
// Handle number literals
if (stream.match(/^-?[0-9\.]/, false)) {
var floatLiteral = false;
// Floats
if (stream.match(/^-?\d*\.\d+(e[\+\-]?\d+)?/i)) {
floatLiteral = true;
}
if (stream.match(/^-?\d+\.\d*/)) {
floatLiteral = true;
}
if (stream.match(/^-?\.\d+/)) {
floatLiteral = true;
}
if (floatLiteral) {
// prevent from getting extra . on 1..
if (stream.peek() == "."){
stream.backUp(1);
}
return 'number';
}
// Integers
var intLiteral = false;
// Hex
if (stream.match(/^-?0x[0-9a-f]+/i)) {
intLiteral = true;
}
// Decimal
if (stream.match(/^-?[1-9]\d*(e[\+\-]?\d+)?/)) {
intLiteral = true;
}
// Zero by itself with no other piece of number.
if (stream.match(/^-?0(?![\dx])/i)) {
intLiteral = true;
}
if (intLiteral) {
return 'number';
}
}
// Handle strings
if (stream.match(stringPrefixes)) {
state.tokenize = tokenFactory(stream.current(), 'string');
return state.tokenize(stream, state);
}
// Handle regex literals
if (stream.match(regexPrefixes)) {
if (stream.current() != '/' || stream.match(/^.*\//, false)) { // prevent highlight of division
state.tokenize = tokenFactory(stream.current(), 'string-2');
return state.tokenize(stream, state);
} else {
stream.backUp(1);
}
}
// Handle operators and delimiters
if (stream.match(tripleDelimiters) || stream.match(doubleDelimiters)) {
return 'punctuation';
}
if (stream.match(doubleOperators)
|| stream.match(singleOperators)
|| stream.match(wordOperators)) {
return 'operator';
}
if (stream.match(singleDelimiters)) {
return 'punctuation';
}
if (stream.match(constants)) {
return 'atom';
}
if (stream.match(keywords)) {
return 'keyword';
}
if (stream.match(identifiers)) {
return 'variable';
}
// Handle non-detected items
stream.next();
return ERRORCLASS;
}
function tokenFactory(delimiter, outclass) {
var singleline = delimiter.length == 1;
return function tokenString(stream, state) {
while (!stream.eol()) {
stream.eatWhile(/[^'"\/\\]/);
if (stream.eat('\\')) {
stream.next();
if (singleline && stream.eol()) {
return outclass;
}
} else if (stream.match(delimiter)) {
state.tokenize = tokenBase;
return outclass;
} else {
stream.eat(/['"\/]/);
}
}
if (singleline) {
if (conf.mode.singleLineStringErrors) {
outclass = ERRORCLASS
} else {
state.tokenize = tokenBase;
}
}
return outclass;
};
}
function longComment(stream, state) {
while (!stream.eol()) {
stream.eatWhile(/[^#]/);
if (stream.match("###")) {
state.tokenize = tokenBase;
break;
}
stream.eatWhile("#");
}
return "comment"
}
function indent(stream, state, type) {
type = type || 'coffee';
var indentUnit = 0;
if (type === 'coffee') {
for (var i = 0; i < state.scopes.length; i++) {
if (state.scopes[i].type === 'coffee') {
indentUnit = state.scopes[i].offset + conf.indentUnit;
break;
}
}
} else {
indentUnit = stream.column() + stream.current().length;
}
state.scopes.unshift({
offset: indentUnit,
type: type
});
}
function dedent(stream, state) {
if (state.scopes.length == 1) return;
if (state.scopes[0].type === 'coffee') {
var _indent = stream.indentation();
var _indent_index = -1;
for (var i = 0; i < state.scopes.length; ++i) {
if (_indent === state.scopes[i].offset) {
_indent_index = i;
break;
}
}
if (_indent_index === -1) {
return true;
}
while (state.scopes[0].offset !== _indent) {
state.scopes.shift();
}
return false
} else {
state.scopes.shift();
return false;
}
}
function tokenLexer(stream, state) {
var style = state.tokenize(stream, state);
var current = stream.current();
// Handle '.' connected identifiers
if (current === '.') {
style = state.tokenize(stream, state);
current = stream.current();
if (style === 'variable') {
return 'variable';
} else {
return ERRORCLASS;
}
}
// Handle properties
if (current === '@') {
stream.eat('@');
return 'keyword';
}
// Handle scope changes.
if (current === 'return') {
state.dedent += 1;
}
if (((current === '->' || current === '=>') &&
!state.lambda &&
state.scopes[0].type == 'coffee' &&
stream.peek() === '')
|| style === 'indent') {
indent(stream, state);
}
var delimiter_index = '[({'.indexOf(current);
if (delimiter_index !== -1) {
indent(stream, state, '])}'.slice(delimiter_index, delimiter_index+1));
}
if (indentKeywords.exec(current)){
indent(stream, state);
}
if (current == 'then'){
dedent(stream, state);
}
if (style === 'dedent') {
if (dedent(stream, state)) {
return ERRORCLASS;
}
}
delimiter_index = '])}'.indexOf(current);
if (delimiter_index !== -1) {
if (dedent(stream, state)) {
return ERRORCLASS;
}
}
if (state.dedent > 0 && stream.eol() && state.scopes[0].type == 'coffee') {
if (state.scopes.length > 1) state.scopes.shift();
state.dedent -= 1;
}
return style;
}
var external = {
startState: function(basecolumn) {
return {
tokenize: tokenBase,
scopes: [{offset:basecolumn || 0, type:'coffee'}],
lastToken: null,
lambda: false,
dedent: 0
};
},
token: function(stream, state) {
var style = tokenLexer(stream, state);
state.lastToken = {style:style, content: stream.current()};
if (stream.eol() && stream.lambda) {
state.lambda = false;
}
return style;
},
indent: function(state, textAfter) {
if (state.tokenize != tokenBase) {
return 0;
}
return state.scopes[0].offset;
}
};
return external;
});
CodeMirror.defineMIME('text/x-coffeescript', 'coffeescript');

View File

@ -0,0 +1,727 @@
<!doctype html>
<html>
<head>
<title>CodeMirror: CoffeeScript mode</title>
<link rel="stylesheet" href="../../lib/codemirror.css">
<script src="../../lib/codemirror.js"></script>
<script src="coffeescript.js"></script>
<style>.CodeMirror {border-top: 1px solid silver; border-bottom: 1px solid silver;}</style>
<link rel="stylesheet" href="../../doc/docs.css">
</head>
<body>
<h1>CodeMirror: CoffeeScript mode</h1>
<form><textarea id="code" name="code">
# CoffeeScript mode for CodeMirror
# Copyright (c) 2011 Jeff Pickhardt, released under
# the MIT License.
#
# Modified from the Python CodeMirror mode, which also is
# under the MIT License Copyright (c) 2010 Timothy Farrell.
#
# The following script, Underscore.coffee, is used to
# demonstrate CoffeeScript mode for CodeMirror.
#
# To download CoffeeScript mode for CodeMirror, go to:
# https://github.com/pickhardt/coffeescript-codemirror-mode
# **Underscore.coffee
# (c) 2011 Jeremy Ashkenas, DocumentCloud Inc.**
# Underscore is freely distributable under the terms of the
# [MIT license](http://en.wikipedia.org/wiki/MIT_License).
# Portions of Underscore are inspired by or borrowed from
# [Prototype.js](http://prototypejs.org/api), Oliver Steele's
# [Functional](http://osteele.com), and John Resig's
# [Micro-Templating](http://ejohn.org).
# For all details and documentation:
# http://documentcloud.github.com/underscore/
# Baseline setup
# --------------
# Establish the root object, `window` in the browser, or `global` on the server.
root = this
# Save the previous value of the `_` variable.
previousUnderscore = root._
### Multiline
comment
###
# Establish the object that gets thrown to break out of a loop iteration.
# `StopIteration` is SOP on Mozilla.
breaker = if typeof(StopIteration) is 'undefined' then '__break__' else StopIteration
#### Docco style single line comment (title)
# Helper function to escape **RegExp** contents, because JS doesn't have one.
escapeRegExp = (string) -> string.replace(/([.*+?^${}()|[\]\/\\])/g, '\\$1')
# Save bytes in the minified (but not gzipped) version:
ArrayProto = Array.prototype
ObjProto = Object.prototype
# Create quick reference variables for speed access to core prototypes.
slice = ArrayProto.slice
unshift = ArrayProto.unshift
toString = ObjProto.toString
hasOwnProperty = ObjProto.hasOwnProperty
propertyIsEnumerable = ObjProto.propertyIsEnumerable
# All **ECMA5** native implementations we hope to use are declared here.
nativeForEach = ArrayProto.forEach
nativeMap = ArrayProto.map
nativeReduce = ArrayProto.reduce
nativeReduceRight = ArrayProto.reduceRight
nativeFilter = ArrayProto.filter
nativeEvery = ArrayProto.every
nativeSome = ArrayProto.some
nativeIndexOf = ArrayProto.indexOf
nativeLastIndexOf = ArrayProto.lastIndexOf
nativeIsArray = Array.isArray
nativeKeys = Object.keys
# Create a safe reference to the Underscore object for use below.
_ = (obj) -> new wrapper(obj)
# Export the Underscore object for **CommonJS**.
if typeof(exports) != 'undefined' then exports._ = _
# Export Underscore to global scope.
root._ = _
# Current version.
_.VERSION = '1.1.0'
# Collection Functions
# --------------------
# The cornerstone, an **each** implementation.
# Handles objects implementing **forEach**, arrays, and raw objects.
_.each = (obj, iterator, context) ->
try
if nativeForEach and obj.forEach is nativeForEach
obj.forEach iterator, context
else if _.isNumber obj.length
iterator.call context, obj[i], i, obj for i in [0...obj.length]
else
iterator.call context, val, key, obj for own key, val of obj
catch e
throw e if e isnt breaker
obj
# Return the results of applying the iterator to each element. Use JavaScript
# 1.6's version of **map**, if possible.
_.map = (obj, iterator, context) ->
return obj.map(iterator, context) if nativeMap and obj.map is nativeMap
results = []
_.each obj, (value, index, list) ->
results.push iterator.call context, value, index, list
results
# **Reduce** builds up a single result from a list of values. Also known as
# **inject**, or **foldl**. Uses JavaScript 1.8's version of **reduce**, if possible.
_.reduce = (obj, iterator, memo, context) ->
if nativeReduce and obj.reduce is nativeReduce
iterator = _.bind iterator, context if context
return obj.reduce iterator, memo
_.each obj, (value, index, list) ->
memo = iterator.call context, memo, value, index, list
memo
# The right-associative version of **reduce**, also known as **foldr**. Uses
# JavaScript 1.8's version of **reduceRight**, if available.
_.reduceRight = (obj, iterator, memo, context) ->
if nativeReduceRight and obj.reduceRight is nativeReduceRight
iterator = _.bind iterator, context if context
return obj.reduceRight iterator, memo
reversed = _.clone(_.toArray(obj)).reverse()
_.reduce reversed, iterator, memo, context
# Return the first value which passes a truth test.
_.detect = (obj, iterator, context) ->
result = null
_.each obj, (value, index, list) ->
if iterator.call context, value, index, list
result = value
_.breakLoop()
result
# Return all the elements that pass a truth test. Use JavaScript 1.6's
# **filter**, if it exists.
_.filter = (obj, iterator, context) ->
return obj.filter iterator, context if nativeFilter and obj.filter is nativeFilter
results = []
_.each obj, (value, index, list) ->
results.push value if iterator.call context, value, index, list
results
# Return all the elements for which a truth test fails.
_.reject = (obj, iterator, context) ->
results = []
_.each obj, (value, index, list) ->
results.push value if not iterator.call context, value, index, list
results
# Determine whether all of the elements match a truth test. Delegate to
# JavaScript 1.6's **every**, if it is present.
_.every = (obj, iterator, context) ->
iterator ||= _.identity
return obj.every iterator, context if nativeEvery and obj.every is nativeEvery
result = true
_.each obj, (value, index, list) ->
_.breakLoop() unless (result = result and iterator.call(context, value, index, list))
result
# Determine if at least one element in the object matches a truth test. Use
# JavaScript 1.6's **some**, if it exists.
_.some = (obj, iterator, context) ->
iterator ||= _.identity
return obj.some iterator, context if nativeSome and obj.some is nativeSome
result = false
_.each obj, (value, index, list) ->
_.breakLoop() if (result = iterator.call(context, value, index, list))
result
# Determine if a given value is included in the array or object,
# based on `===`.
_.include = (obj, target) ->
return _.indexOf(obj, target) isnt -1 if nativeIndexOf and obj.indexOf is nativeIndexOf
return true for own key, val of obj when val is target
false
# Invoke a method with arguments on every item in a collection.
_.invoke = (obj, method) ->
args = _.rest arguments, 2
(if method then val[method] else val).apply(val, args) for val in obj
# Convenience version of a common use case of **map**: fetching a property.
_.pluck = (obj, key) ->
_.map(obj, (val) -> val[key])
# Return the maximum item or (item-based computation).
_.max = (obj, iterator, context) ->
return Math.max.apply(Math, obj) if not iterator and _.isArray(obj)
result = computed: -Infinity
_.each obj, (value, index, list) ->
computed = if iterator then iterator.call(context, value, index, list) else value
computed >= result.computed and (result = {value: value, computed: computed})
result.value
# Return the minimum element (or element-based computation).
_.min = (obj, iterator, context) ->
return Math.min.apply(Math, obj) if not iterator and _.isArray(obj)
result = computed: Infinity
_.each obj, (value, index, list) ->
computed = if iterator then iterator.call(context, value, index, list) else value
computed < result.computed and (result = {value: value, computed: computed})
result.value
# Sort the object's values by a criterion produced by an iterator.
_.sortBy = (obj, iterator, context) ->
_.pluck(((_.map obj, (value, index, list) ->
{value: value, criteria: iterator.call(context, value, index, list)}
).sort((left, right) ->
a = left.criteria; b = right.criteria
if a < b then -1 else if a > b then 1 else 0
)), 'value')
# Use a comparator function to figure out at what index an object should
# be inserted so as to maintain order. Uses binary search.
_.sortedIndex = (array, obj, iterator) ->
iterator ||= _.identity
low = 0
high = array.length
while low < high
mid = (low + high) >> 1
if iterator(array[mid]) < iterator(obj) then low = mid + 1 else high = mid
low
# Convert anything iterable into a real, live array.
_.toArray = (iterable) ->
return [] if (!iterable)
return iterable.toArray() if (iterable.toArray)
return iterable if (_.isArray(iterable))
return slice.call(iterable) if (_.isArguments(iterable))
_.values(iterable)
# Return the number of elements in an object.
_.size = (obj) -> _.toArray(obj).length
# Array Functions
# ---------------
# Get the first element of an array. Passing `n` will return the first N
# values in the array. Aliased as **head**. The `guard` check allows it to work
# with **map**.
_.first = (array, n, guard) ->
if n and not guard then slice.call(array, 0, n) else array[0]
# Returns everything but the first entry of the array. Aliased as **tail**.
# Especially useful on the arguments object. Passing an `index` will return
# the rest of the values in the array from that index onward. The `guard`
# check allows it to work with **map**.
_.rest = (array, index, guard) ->
slice.call(array, if _.isUndefined(index) or guard then 1 else index)
# Get the last element of an array.
_.last = (array) -> array[array.length - 1]
# Trim out all falsy values from an array.
_.compact = (array) -> item for item in array when item
# Return a completely flattened version of an array.
_.flatten = (array) ->
_.reduce array, (memo, value) ->
return memo.concat(_.flatten(value)) if _.isArray value
memo.push value
memo
, []
# Return a version of the array that does not contain the specified value(s).
_.without = (array) ->
values = _.rest arguments
val for val in _.toArray(array) when not _.include values, val
# Produce a duplicate-free version of the array. If the array has already
# been sorted, you have the option of using a faster algorithm.
_.uniq = (array, isSorted) ->
memo = []
for el, i in _.toArray array
memo.push el if i is 0 || (if isSorted is true then _.last(memo) isnt el else not _.include(memo, el))
memo
# Produce an array that contains every item shared between all the
# passed-in arrays.
_.intersect = (array) ->
rest = _.rest arguments
_.select _.uniq(array), (item) ->
_.all rest, (other) ->
_.indexOf(other, item) >= 0
# Zip together multiple lists into a single array -- elements that share
# an index go together.
_.zip = ->
length = _.max _.pluck arguments, 'length'
results = new Array length
for i in [0...length]
results[i] = _.pluck arguments, String i
results
# If the browser doesn't supply us with **indexOf** (I'm looking at you, MSIE),
# we need this function. Return the position of the first occurrence of an
# item in an array, or -1 if the item is not included in the array.
_.indexOf = (array, item) ->
return array.indexOf item if nativeIndexOf and array.indexOf is nativeIndexOf
i = 0; l = array.length
while l - i
if array[i] is item then return i else i++
-1
# Provide JavaScript 1.6's **lastIndexOf**, delegating to the native function,
# if possible.
_.lastIndexOf = (array, item) ->
return array.lastIndexOf(item) if nativeLastIndexOf and array.lastIndexOf is nativeLastIndexOf
i = array.length
while i
if array[i] is item then return i else i--
-1
# Generate an integer Array containing an arithmetic progression. A port of
# [the native Python **range** function](http://docs.python.org/library/functions.html#range).
_.range = (start, stop, step) ->
a = arguments
solo = a.length <= 1
i = start = if solo then 0 else a[0]
stop = if solo then a[0] else a[1]
step = a[2] or 1
len = Math.ceil((stop - start) / step)
return [] if len <= 0
range = new Array len
idx = 0
loop
return range if (if step > 0 then i - stop else stop - i) >= 0
range[idx] = i
idx++
i+= step
# Function Functions
# ------------------
# Create a function bound to a given object (assigning `this`, and arguments,
# optionally). Binding with arguments is also known as **curry**.
_.bind = (func, obj) ->
args = _.rest arguments, 2
-> func.apply obj or root, args.concat arguments
# Bind all of an object's methods to that object. Useful for ensuring that
# all callbacks defined on an object belong to it.
_.bindAll = (obj) ->
funcs = if arguments.length > 1 then _.rest(arguments) else _.functions(obj)
_.each funcs, (f) -> obj[f] = _.bind obj[f], obj
obj
# Delays a function for the given number of milliseconds, and then calls
# it with the arguments supplied.
_.delay = (func, wait) ->
args = _.rest arguments, 2
setTimeout((-> func.apply(func, args)), wait)
# Memoize an expensive function by storing its results.
_.memoize = (func, hasher) ->
memo = {}
hasher or= _.identity
->
key = hasher.apply this, arguments
return memo[key] if key of memo
memo[key] = func.apply this, arguments
# Defers a function, scheduling it to run after the current call stack has
# cleared.
_.defer = (func) ->
_.delay.apply _, [func, 1].concat _.rest arguments
# Returns the first function passed as an argument to the second,
# allowing you to adjust arguments, run code before and after, and
# conditionally execute the original function.
_.wrap = (func, wrapper) ->
-> wrapper.apply wrapper, [func].concat arguments
# Returns a function that is the composition of a list of functions, each
# consuming the return value of the function that follows.
_.compose = ->
funcs = arguments
->
args = arguments
for i in [funcs.length - 1..0] by -1
args = [funcs[i].apply(this, args)]
args[0]
# Object Functions
# ----------------
# Retrieve the names of an object's properties.
_.keys = nativeKeys or (obj) ->
return _.range 0, obj.length if _.isArray(obj)
key for key, val of obj
# Retrieve the values of an object's properties.
_.values = (obj) ->
_.map obj, _.identity
# Return a sorted list of the function names available in Underscore.
_.functions = (obj) ->
_.filter(_.keys(obj), (key) -> _.isFunction(obj[key])).sort()
# Extend a given object with all of the properties in a source object.
_.extend = (obj) ->
for source in _.rest(arguments)
obj[key] = val for key, val of source
obj
# Create a (shallow-cloned) duplicate of an object.
_.clone = (obj) ->
return obj.slice 0 if _.isArray obj
_.extend {}, obj
# Invokes interceptor with the obj, and then returns obj.
# The primary purpose of this method is to "tap into" a method chain,
# in order to perform operations on intermediate results within
the chain.
_.tap = (obj, interceptor) ->
interceptor obj
obj
# Perform a deep comparison to check if two objects are equal.
_.isEqual = (a, b) ->
# Check object identity.
return true if a is b
# Different types?
atype = typeof(a); btype = typeof(b)
return false if atype isnt btype
# Basic equality test (watch out for coercions).
return true if `a == b`
# One is falsy and the other truthy.
return false if (!a and b) or (a and !b)
# One of them implements an `isEqual()`?
return a.isEqual(b) if a.isEqual
# Check dates' integer values.
return a.getTime() is b.getTime() if _.isDate(a) and _.isDate(b)
# Both are NaN?
return false if _.isNaN(a) and _.isNaN(b)
# Compare regular expressions.
if _.isRegExp(a) and _.isRegExp(b)
return a.source is b.source and
a.global is b.global and
a.ignoreCase is b.ignoreCase and
a.multiline is b.multiline
# If a is not an object by this point, we can't handle it.
return false if atype isnt 'object'
# Check for different array lengths before comparing contents.
return false if a.length and (a.length isnt b.length)
# Nothing else worked, deep compare the contents.
aKeys = _.keys(a); bKeys = _.keys(b)
# Different object sizes?
return false if aKeys.length isnt bKeys.length
# Recursive comparison of contents.
return false for key, val of a when !(key of b) or !_.isEqual(val, b[key])
true
# Is a given array or object empty?
_.isEmpty = (obj) ->
return obj.length is 0 if _.isArray(obj) or _.isString(obj)
return false for own key of obj
true
# Is a given value a DOM element?
_.isElement = (obj) -> obj and obj.nodeType is 1
# Is a given value an array?
_.isArray = nativeIsArray or (obj) -> !!(obj and obj.concat and obj.unshift and not obj.callee)
# Is a given variable an arguments object?
_.isArguments = (obj) -> obj and obj.callee
# Is the given value a function?
_.isFunction = (obj) -> !!(obj and obj.constructor and obj.call and obj.apply)
# Is the given value a string?
_.isString = (obj) -> !!(obj is '' or (obj and obj.charCodeAt and obj.substr))
# Is a given value a number?
_.isNumber = (obj) -> (obj is +obj) or toString.call(obj) is '[object Number]'
# Is a given value a boolean?
_.isBoolean = (obj) -> obj is true or obj is false
# Is a given value a Date?
_.isDate = (obj) -> !!(obj and obj.getTimezoneOffset and obj.setUTCFullYear)
# Is the given value a regular expression?
_.isRegExp = (obj) -> !!(obj and obj.exec and (obj.ignoreCase or obj.ignoreCase is false))
# Is the given value NaN -- this one is interesting. `NaN != NaN`, and
# `isNaN(undefined) == true`, so we make sure it's a number first.
_.isNaN = (obj) -> _.isNumber(obj) and window.isNaN(obj)
# Is a given value equal to null?
_.isNull = (obj) -> obj is null
# Is a given variable undefined?
_.isUndefined = (obj) -> typeof obj is 'undefined'
# Utility Functions
# -----------------
# Run Underscore.js in noConflict mode, returning the `_` variable to its
# previous owner. Returns a reference to the Underscore object.
_.noConflict = ->
root._ = previousUnderscore
this
# Keep the identity function around for default iterators.
_.identity = (value) -> value
# Run a function `n` times.
_.times = (n, iterator, context) ->
iterator.call context, i for i in [0...n]
# Break out of the middle of an iteration.
_.breakLoop = -> throw breaker
# Add your own custom functions to the Underscore object, ensuring that
# they're correctly added to the OOP wrapper as well.
_.mixin = (obj) ->
for name in _.functions(obj)
addToWrapper name, _[name] = obj[name]
# Generate a unique integer id (unique within the entire client session).
# Useful for temporary DOM ids.
idCounter = 0
_.uniqueId = (prefix) ->
(prefix or '') + idCounter++
# By default, Underscore uses **ERB**-style template delimiters, change the
# following template settings to use alternative delimiters.
_.templateSettings = {
start: '<%'
end: '%>'
interpolate: /<%=(.+?)%>/g
}
# JavaScript templating a-la **ERB**, pilfered from John Resig's
# *Secrets of the JavaScript Ninja*, page 83.
# Single-quote fix from Rick Strahl.
# With alterations for arbitrary delimiters, and to preserve whitespace.
_.template = (str, data) ->
c = _.templateSettings
endMatch = new RegExp("'(?=[^"+c.end.substr(0, 1)+"]*"+escapeRegExp(c.end)+")","g")
fn = new Function 'obj',
'var p=[],print=function(){p.push.apply(p,arguments);};' +
'with(obj||{}){p.push(\'' +
str.replace(/\r/g, '\\r')
.replace(/\n/g, '\\n')
.replace(/\t/g, '\\t')
.replace(endMatch,"<22><><EFBFBD>")
.split("'").join("\\'")
.split("<22><><EFBFBD>").join("'")
.replace(c.interpolate, "',$1,'")
.split(c.start).join("');")
.split(c.end).join("p.push('") +
"');}return p.join('');"
if data then fn(data) else fn
# Aliases
# -------
_.forEach = _.each
_.foldl = _.inject = _.reduce
_.foldr = _.reduceRight
_.select = _.filter
_.all = _.every
_.any = _.some
_.contains = _.include
_.head = _.first
_.tail = _.rest
_.methods = _.functions
# Setup the OOP Wrapper
# ---------------------
# If Underscore is called as a function, it returns a wrapped object that
# can be used OO-style. This wrapper holds altered versions of all the
# underscore functions. Wrapped objects may be chained.
wrapper = (obj) ->
this._wrapped = obj
this
# Helper function to continue chaining intermediate results.
result = (obj, chain) ->
if chain then _(obj).chain() else obj
# A method to easily add functions to the OOP wrapper.
addToWrapper = (name, func) ->
wrapper.prototype[name] = ->
args = _.toArray arguments
unshift.call args, this._wrapped
result func.apply(_, args), this._chain
# Add all ofthe Underscore functions to the wrapper object.
_.mixin _
# Add all mutator Array functions to the wrapper.
_.each ['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], (name) ->
method = Array.prototype[name]
wrapper.prototype[name] = ->
method.apply(this._wrapped, arguments)
result(this._wrapped, this._chain)
# Add all accessor Array functions to the wrapper.
_.each ['concat', 'join', 'slice'], (name) ->
method = Array.prototype[name]
wrapper.prototype[name] = ->
result(method.apply(this._wrapped, arguments), this._chain)
# Start chaining a wrapped Underscore object.
wrapper::chain = ->
this._chain = true
this
# Extracts the result from a wrapped and chained object.
wrapper::value = -> this._wrapped
</textarea></form>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {});
</script>
<p><strong>MIME types defined:</strong> <code>text/x-coffeescript</code>.</p>
<p>The CoffeeScript mode was written by Jeff Pickhardt (<a href="LICENSE">license</a>).</p>
</body>
</html>

View File

@ -0,0 +1,124 @@
CodeMirror.defineMode("css", function(config) {
var indentUnit = config.indentUnit, type;
function ret(style, tp) {type = tp; return style;}
function tokenBase(stream, state) {
var ch = stream.next();
if (ch == "@") {stream.eatWhile(/[\w\\\-]/); return ret("meta", stream.current());}
else if (ch == "/" && stream.eat("*")) {
state.tokenize = tokenCComment;
return tokenCComment(stream, state);
}
else if (ch == "<" && stream.eat("!")) {
state.tokenize = tokenSGMLComment;
return tokenSGMLComment(stream, state);
}
else if (ch == "=") ret(null, "compare");
else if ((ch == "~" || ch == "|") && stream.eat("=")) return ret(null, "compare");
else if (ch == "\"" || ch == "'") {
state.tokenize = tokenString(ch);
return state.tokenize(stream, state);
}
else if (ch == "#") {
stream.eatWhile(/[\w\\\-]/);
return ret("atom", "hash");
}
else if (ch == "!") {
stream.match(/^\s*\w*/);
return ret("keyword", "important");
}
else if (/\d/.test(ch)) {
stream.eatWhile(/[\w.%]/);
return ret("number", "unit");
}
else if (/[,.+>*\/]/.test(ch)) {
return ret(null, "select-op");
}
else if (/[;{}:\[\]]/.test(ch)) {
return ret(null, ch);
}
else {
stream.eatWhile(/[\w\\\-]/);
return ret("variable", "variable");
}
}
function tokenCComment(stream, state) {
var maybeEnd = false, ch;
while ((ch = stream.next()) != null) {
if (maybeEnd && ch == "/") {
state.tokenize = tokenBase;
break;
}
maybeEnd = (ch == "*");
}
return ret("comment", "comment");
}
function tokenSGMLComment(stream, state) {
var dashes = 0, ch;
while ((ch = stream.next()) != null) {
if (dashes >= 2 && ch == ">") {
state.tokenize = tokenBase;
break;
}
dashes = (ch == "-") ? dashes + 1 : 0;
}
return ret("comment", "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 ret("string", "string");
};
}
return {
startState: function(base) {
return {tokenize: tokenBase,
baseIndent: base || 0,
stack: []};
},
token: function(stream, state) {
if (stream.eatSpace()) return null;
var style = state.tokenize(stream, state);
var context = state.stack[state.stack.length-1];
if (type == "hash" && context != "rule") style = "string-2";
else if (style == "variable") {
if (context == "rule") style = "number";
else if (!context || context == "@media{") style = "tag";
}
if (context == "rule" && /^[\{\};]$/.test(type))
state.stack.pop();
if (type == "{") {
if (context == "@media") state.stack[state.stack.length-1] = "@media{";
else state.stack.push("{");
}
else if (type == "}") state.stack.pop();
else if (type == "@media") state.stack.push("@media");
else if (context == "{" && type != "comment") state.stack.push("rule");
return style;
},
indent: function(state, textAfter) {
var n = state.stack.length;
if (/^\}/.test(textAfter))
n -= state.stack[state.stack.length-1] == "rule" ? 2 : 1;
return state.baseIndent + n * indentUnit;
},
electricChars: "}"
};
});
CodeMirror.defineMIME("text/css", "css");

View File

@ -0,0 +1,55 @@
<!doctype html>
<html>
<head>
<title>CodeMirror: CSS mode</title>
<link rel="stylesheet" href="../../lib/codemirror.css">
<script src="../../lib/codemirror.js"></script>
<script src="css.js"></script>
<style>.CodeMirror {background: #f8f8f8;}</style>
<link rel="stylesheet" href="../../doc/docs.css">
</head>
<body>
<h1>CodeMirror: CSS mode</h1>
<form><textarea id="code" name="code">
/* Some example CSS */
@import url("something.css");
body {
margin: 0;
padding: 3em 6em;
font-family: tahoma, arial, sans-serif;
color: #000;
}
#navigation a {
font-weight: bold;
text-decoration: none !important;
}
h1 {
font-size: 2.5em;
}
h2 {
font-size: 1.7em;
}
h1:before, h2:before {
content: "::";
}
code {
font-family: courier, monospace;
font-size: 80%;
color: #418A8A;
}
</textarea></form>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {});
</script>
<p><strong>MIME types defined:</strong> <code>text/css</code>.</p>
</body>
</html>

View File

@ -0,0 +1,32 @@
CodeMirror.defineMode("diff", function() {
var TOKEN_NAMES = {
'+': 'tag',
'-': 'string',
'@': 'meta'
};
return {
token: function(stream) {
var tw_pos = stream.string.search(/[\t ]+?$/);
if (!stream.sol() || tw_pos === 0) {
stream.skipToEnd();
return ("error " + (
TOKEN_NAMES[stream.string.charAt(0)] || '')).replace(/ $/, '');
}
var token_name = TOKEN_NAMES[stream.peek()] || stream.skipToEnd();
if (tw_pos === -1) {
stream.skipToEnd();
} else {
stream.pos = tw_pos;
}
return token_name;
}
};
});
CodeMirror.defineMIME("text/x-diff", "diff");

View File

@ -0,0 +1,104 @@
<!doctype html>
<html>
<head>
<title>CodeMirror: Diff mode</title>
<link rel="stylesheet" href="../../lib/codemirror.css">
<script src="../../lib/codemirror.js"></script>
<script src="diff.js"></script>
<style>
.CodeMirror {border-top: 1px solid #ddd; border-bottom: 1px solid #ddd;}
span.cm-meta {color: #a0b !important;}
span.cm-error { background-color: black; opacity: 0.4;}
span.cm-error.cm-string { background-color: red; }
span.cm-error.cm-tag { background-color: #2b2; }
</style>
<link rel="stylesheet" href="../../doc/docs.css">
</head>
<body>
<h1>CodeMirror: Diff mode</h1>
<form><textarea id="code" name="code">
diff --git a/index.html b/index.html
index c1d9156..7764744 100644
--- a/index.html
+++ b/index.html
@@ -95,7 +95,8 @@ StringStream.prototype = {
<script>
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
lineNumbers: true,
- autoMatchBrackets: true
+ autoMatchBrackets: true,
+ onGutterClick: function(x){console.log(x);}
});
</script>
</body>
diff --git a/lib/codemirror.js b/lib/codemirror.js
index 04646a9..9a39cc7 100644
--- a/lib/codemirror.js
+++ b/lib/codemirror.js
@@ -399,10 +399,16 @@ var CodeMirror = (function() {
}
function onMouseDown(e) {
- var start = posFromMouse(e), last = start;
+ var start = posFromMouse(e), last = start, target = e.target();
if (!start) return;
setCursor(start.line, start.ch, false);
if (e.button() != 1) return;
+ if (target.parentNode == gutter) {
+ if (options.onGutterClick)
+ options.onGutterClick(indexOf(gutter.childNodes, target) + showingFrom);
+ return;
+ }
+
if (!focused) onFocus();
e.stop();
@@ -808,7 +814,7 @@ var CodeMirror = (function() {
for (var i = showingFrom; i < showingTo; ++i) {
var marker = lines[i].gutterMarker;
if (marker) html.push('<div class="' + marker.style + '">' + htmlEscape(marker.text) + '</div>');
- else html.push("<div>" + (options.lineNumbers ? i + 1 : "\u00a0") + "</div>");
+ else html.push("<div>" + (options.lineNumbers ? i + options.firstLineNumber : "\u00a0") + "</div>");
}
gutter.style.display = "none"; // TODO test whether this actually helps
gutter.innerHTML = html.join("");
@@ -1371,10 +1377,8 @@ var CodeMirror = (function() {
if (option == "parser") setParser(value);
else if (option === "lineNumbers") setLineNumbers(value);
else if (option === "gutter") setGutter(value);
- else if (option === "readOnly") options.readOnly = value;
- else if (option === "indentUnit") {options.indentUnit = indentUnit = value; setParser(options.parser);}
- else if (/^(?:enterMode|tabMode|indentWithTabs|readOnly|autoMatchBrackets|undoDepth)$/.test(option)) options[option] = value;
- else throw new Error("Can't set option " + option);
+ else if (option === "indentUnit") {options.indentUnit = value; setParser(options.parser);}
+ else options[option] = value;
},
cursorCoords: cursorCoords,
undo: operation(undo),
@@ -1402,7 +1406,8 @@ var CodeMirror = (function() {
replaceRange: operation(replaceRange),
operation: function(f){return operation(f)();},
- refresh: function(){updateDisplay([{from: 0, to: lines.length}]);}
+ refresh: function(){updateDisplay([{from: 0, to: lines.length}]);},
+ getInputField: function(){return input;}
};
return instance;
}
@@ -1420,6 +1425,7 @@ var CodeMirror = (function() {
readOnly: false,
onChange: null,
onCursorActivity: null,
+ onGutterClick: null,
autoMatchBrackets: false,
workTime: 200,
workDelay: 300,
</textarea></form>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {});
</script>
<p><strong>MIME types defined:</strong> <code>text/x-diff</code>.</p>
</body>
</html>

View File

@ -0,0 +1,203 @@
CodeMirror.defineMode("ecl", function(config) {
function words(str) {
var obj = {}, words = str.split(" ");
for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
return obj;
}
function metaHook(stream, state) {
if (!state.startOfLine) return false;
stream.skipToEnd();
return "meta";
}
function tokenAtString(stream, state) {
var next;
while ((next = stream.next()) != null) {
if (next == '"' && !stream.eat('"')) {
state.tokenize = null;
break;
}
}
return "string";
}
var indentUnit = config.indentUnit;
var keyword = words("abs acos allnodes ascii asin asstring atan atan2 ave case choose choosen choosesets clustersize combine correlation cos cosh count covariance cron dataset dedup define denormalize distribute distributed distribution ebcdic enth error evaluate event eventextra eventname exists exp failcode failmessage fetch fromunicode getisvalid global graph group hash hash32 hash64 hashcrc hashmd5 having if index intformat isvalid iterate join keyunicode length library limit ln local log loop map matched matchlength matchposition matchtext matchunicode max merge mergejoin min nolocal nonempty normalize parse pipe power preload process project pull random range rank ranked realformat recordof regexfind regexreplace regroup rejected rollup round roundup row rowdiff sample set sin sinh sizeof soapcall sort sorted sqrt stepped stored sum table tan tanh thisnode topn tounicode transfer trim truncate typeof ungroup unicodeorder variance which workunit xmldecode xmlencode xmltext xmlunicode");
var variable = words("apply assert build buildindex evaluate fail keydiff keypatch loadxml nothor notify output parallel sequential soapcall wait");
var variable_2 = words("__compressed__ all and any as atmost before beginc++ best between case const counter csv descend encrypt end endc++ endmacro except exclusive expire export extend false few first flat from full function group header heading hole ifblock import in interface joined keep keyed last left limit load local locale lookup macro many maxcount maxlength min skew module named nocase noroot noscan nosort not of only opt or outer overwrite packed partition penalty physicallength pipe quote record relationship repeat return right scan self separator service shared skew skip sql store terminator thor threshold token transform trim true type unicodeorder unsorted validate virtual whole wild within xml xpath");
var variable_3 = words("ascii big_endian boolean data decimal ebcdic integer pattern qstring real record rule set of string token udecimal unicode unsigned varstring varunicode");
var builtin = words("checkpoint deprecated failcode failmessage failure global independent onwarning persist priority recovery stored success wait when");
var blockKeywords = words("catch class do else finally for if switch try while");
var atoms = words("true false null");
var hooks = {"#": metaHook};
var multiLineStrings;
var isOperatorChar = /[+\-*&%=<>!?|\/]/;
var curPunc;
function tokenBase(stream, state) {
var ch = stream.next();
if (hooks[ch]) {
var result = hooks[ch](stream, state);
if (result !== false) return result;
}
if (ch == '"' || ch == "'") {
state.tokenize = tokenString(ch);
return state.tokenize(stream, state);
}
if (/[\[\]{}\(\),;\:\.]/.test(ch)) {
curPunc = ch;
return null
}
if (/\d/.test(ch)) {
stream.eatWhile(/[\w\.]/);
return "number";
}
if (ch == "/") {
if (stream.eat("*")) {
state.tokenize = tokenComment;
return tokenComment(stream, state);
}
if (stream.eat("/")) {
stream.skipToEnd();
return "comment";
}
}
if (isOperatorChar.test(ch)) {
stream.eatWhile(isOperatorChar);
return "operator";
}
stream.eatWhile(/[\w\$_]/);
var cur = stream.current().toLowerCase();
if (keyword.propertyIsEnumerable(cur)) {
if (blockKeywords.propertyIsEnumerable(cur)) curPunc = "newstatement";
return "keyword";
} else if (variable.propertyIsEnumerable(cur)) {
if (blockKeywords.propertyIsEnumerable(cur)) curPunc = "newstatement";
return "variable";
} else if (variable_2.propertyIsEnumerable(cur)) {
if (blockKeywords.propertyIsEnumerable(cur)) curPunc = "newstatement";
return "variable-2";
} else if (variable_3.propertyIsEnumerable(cur)) {
if (blockKeywords.propertyIsEnumerable(cur)) curPunc = "newstatement";
return "variable-3";
} else if (builtin.propertyIsEnumerable(cur)) {
if (blockKeywords.propertyIsEnumerable(cur)) curPunc = "newstatement";
return "builtin";
} else { //Data types are of from KEYWORD##
var i = cur.length - 1;
while(i >= 0 && (!isNaN(cur[i]) || cur[i] == '_'))
--i;
if (i > 0) {
var cur2 = cur.substr(0, i + 1);
if (variable_3.propertyIsEnumerable(cur2)) {
if (blockKeywords.propertyIsEnumerable(cur2)) curPunc = "newstatement";
return "variable-3";
}
}
}
if (atoms.propertyIsEnumerable(cur)) return "atom";
return "word";
}
function tokenString(quote) {
return function(stream, state) {
var escaped = false, next, end = false;
while ((next = stream.next()) != null) {
if (next == quote && !escaped) {end = true; break;}
escaped = !escaped && next == "\\";
}
if (end || !(escaped || multiLineStrings))
state.tokenize = tokenBase;
return "string";
};
}
function tokenComment(stream, state) {
var maybeEnd = false, ch;
while (ch = stream.next()) {
if (ch == "/" && maybeEnd) {
state.tokenize = tokenBase;
break;
}
maybeEnd = (ch == "*");
}
return "comment";
}
function Context(indented, column, type, align, prev) {
this.indented = indented;
this.column = column;
this.type = type;
this.align = align;
this.prev = prev;
}
function pushContext(state, col, type) {
return state.context = new Context(state.indented, col, type, null, state.context);
}
function popContext(state) {
var t = state.context.type;
if (t == ")" || t == "]" || t == "}")
state.indented = state.context.indented;
return state.context = state.context.prev;
}
// Interface
return {
startState: function(basecolumn) {
return {
tokenize: null,
context: new Context((basecolumn || 0) - indentUnit, 0, "top", false),
indented: 0,
startOfLine: true
};
},
token: function(stream, state) {
var ctx = state.context;
if (stream.sol()) {
if (ctx.align == null) ctx.align = false;
state.indented = stream.indentation();
state.startOfLine = true;
}
if (stream.eatSpace()) return null;
curPunc = null;
var style = (state.tokenize || tokenBase)(stream, state);
if (style == "comment" || style == "meta") return style;
if (ctx.align == null) ctx.align = true;
if ((curPunc == ";" || curPunc == ":") && ctx.type == "statement") popContext(state);
else if (curPunc == "{") pushContext(state, stream.column(), "}");
else if (curPunc == "[") pushContext(state, stream.column(), "]");
else if (curPunc == "(") pushContext(state, stream.column(), ")");
else if (curPunc == "}") {
while (ctx.type == "statement") ctx = popContext(state);
if (ctx.type == "}") ctx = popContext(state);
while (ctx.type == "statement") ctx = popContext(state);
}
else if (curPunc == ctx.type) popContext(state);
else if (ctx.type == "}" || ctx.type == "top" || (ctx.type == "statement" && curPunc == "newstatement"))
pushContext(state, stream.column(), "statement");
state.startOfLine = false;
return style;
},
indent: function(state, textAfter) {
if (state.tokenize != tokenBase && state.tokenize != null) return 0;
var ctx = state.context, firstChar = textAfter && textAfter.charAt(0);
if (ctx.type == "statement" && firstChar == "}") ctx = ctx.prev;
var closing = firstChar == ctx.type;
if (ctx.type == "statement") return ctx.indented + (firstChar == "{" ? 0 : indentUnit);
else if (ctx.align) return ctx.column + (closing ? 0 : 1);
else return ctx.indented + (closing ? 0 : indentUnit);
},
electricChars: "{}"
};
});
CodeMirror.defineMIME("text/x-ecl", "ecl");

View File

@ -0,0 +1,42 @@
<!doctype html>
<html>
<head>
<title>CodeMirror: ECL mode</title>
<link rel="stylesheet" href="../../lib/codemirror.css">
<script src="../../lib/codemirror.js"></script>
<script src="ecl.js"></script>
<link rel="stylesheet" href="../../doc/docs.css">
<style>.CodeMirror {border: 1px solid black;}</style>
</head>
<body>
<h1>CodeMirror: ECL mode</h1>
<form><textarea id="code" name="code">
/*
sample useless code to demonstrate ecl syntax highlighting
this is a multiline comment!
*/
// this is a singleline comment!
import ut;
r :=
record
string22 s1 := '123';
integer4 i1 := 123;
end;
#option('tmp', true);
d := dataset('tmp::qb', r, thor);
output(d);
</textarea></form>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
tabMode: "indent",
matchBrackets: true,
});
</script>
<p>Based on CodeMirror's clike mode. For more information see <a href="http://hpccsystems.com">HPCC Systems</a> web site.</p>
<p><strong>MIME types defined:</strong> <code>text/x-ecl</code>.</p>
</body>
</html>

View File

@ -0,0 +1,251 @@
// erlang -> CodeMirror tag
//
// atom -> atom
// attribute -> attribute
// builtin -> builtin
// comment -> comment
// error -> error
// fun -> meta
// function -> tag
// guard -> property
// keyword -> keyword
// macro -> variable-2
// number -> number
// operator -> operator
// record -> bracket
// string -> string
// type -> def
// variable -> variable
CodeMirror.defineMIME("text/x-erlang", "erlang");
CodeMirror.defineMode("erlang", function(cmCfg, modeCfg) {
var typeWords = [
"-type", "-spec", "-export_type", "-opaque"];
var keywordWords = [
"after","begin","catch","case","cond","end","fun","if",
"let","of","query","receive","try","when"];
var operatorWords = [
"and","andalso","band","bnot","bor","bsl","bsr","bxor",
"div","not","or","orelse","rem","xor"];
var operatorSymbols = [
"+","-","*","/",">",">=","<","=<","=:=","==","=/=","/=","||","<-"];
var guardWords = [
"is_atom","is_binary","is_bitstring","is_boolean","is_float",
"is_function","is_integer","is_list","is_number","is_pid",
"is_port","is_record","is_reference","is_tuple",
"atom","binary","bitstring","boolean","function","integer","list",
"number","pid","port","record","reference","tuple"];
var bifWords = [
"abs","adler32","adler32_combine","alive","apply","atom_to_binary",
"atom_to_list","binary_to_atom","binary_to_existing_atom",
"binary_to_list","binary_to_term","bit_size","bitstring_to_list",
"byte_size","check_process_code","contact_binary","crc32",
"crc32_combine","date","decode_packet","delete_module",
"disconnect_node","element","erase","exit","float","float_to_list",
"garbage_collect","get","get_keys","group_leader","halt","hd",
"integer_to_list","internal_bif","iolist_size","iolist_to_binary",
"is_alive","is_atom","is_binary","is_bitstring","is_boolean",
"is_float","is_function","is_integer","is_list","is_number","is_pid",
"is_port","is_process_alive","is_record","is_reference","is_tuple",
"length","link","list_to_atom","list_to_binary","list_to_bitstring",
"list_to_existing_atom","list_to_float","list_to_integer",
"list_to_pid","list_to_tuple","load_module","make_ref","module_loaded",
"monitor_node","node","node_link","node_unlink","nodes","notalive",
"now","open_port","pid_to_list","port_close","port_command",
"port_connect","port_control","pre_loaded","process_flag",
"process_info","processes","purge_module","put","register",
"registered","round","self","setelement","size","spawn","spawn_link",
"spawn_monitor","spawn_opt","split_binary","statistics",
"term_to_binary","time","throw","tl","trunc","tuple_size",
"tuple_to_list","unlink","unregister","whereis"];
function isMember(element,list) {
return (-1 < list.indexOf(element));
}
function isPrev(stream,string) {
var start = stream.start;
var len = string.length;
if (len <= start) {
var word = stream.string.slice(start-len,start);
return word == string;
}else{
return false;
}
}
var smallRE = /[a-z_]/;
var largeRE = /[A-Z_]/;
var digitRE = /[0-9]/;
var octitRE = /[0-7]/;
var idRE = /[a-z_A-Z0-9]/;
function tokenize(stream, state) {
if (stream.eatSpace()) {
return null;
}
// attributes and type specs
if (stream.sol() && stream.peek() == '-') {
stream.next();
if (stream.eat(smallRE) && stream.eatWhile(idRE)) {
if (stream.peek() == "(") {
return "attribute";
}else if (isMember(stream.current(),typeWords)) {
return "def";
}else{
return null;
}
}
stream.backUp(1);
}
var ch = stream.next();
// comment
if (ch == '%') {
stream.skipToEnd();
return "comment";
}
// macro
if (ch == '?') {
stream.eatWhile(idRE);
return "variable-2";
}
// record
if ( ch == "#") {
stream.eatWhile(idRE);
return "bracket";
}
// char
if ( ch == "$") {
if (stream.next() == "\\") {
if (!stream.eatWhile(octitRE)) {
stream.next();
}
}
return "string";
}
// quoted atom
if (ch == '\'') {
return singleQuote(stream);
}
// string
if (ch == '"') {
return doubleQuote(stream);
}
// variable
if (largeRE.test(ch)) {
stream.eatWhile(idRE);
return "variable";
}
// atom/keyword/BIF/function
if (smallRE.test(ch)) {
stream.eatWhile(idRE);
if (stream.peek() == "/") {
stream.next();
if (stream.eatWhile(digitRE)) {
return "meta"; // f/0 style fun
}else{
stream.backUp(1);
return "atom";
}
}
var w = stream.current();
if (isMember(w,keywordWords)) {
return "keyword"; // keyword
}
if (stream.peek() == "(") {
if (isMember(w,bifWords) &&
(!isPrev(stream,":") || isPrev(stream,"erlang:"))) {
return "builtin"; // BIF
}else{
return "tag"; // function
}
}
if (isMember(w,guardWords)) {
return "property"; // guard
}
if (isMember(w,operatorWords)) {
return "operator"; // operator
}
if (stream.peek() == ":") {
if (w == "erlang") { // f:now() is highlighted incorrectly
return "builtin";
} else {
return "tag"; // function application
}
}
return "atom";
}
// number
if (digitRE.test(ch)) {
stream.eatWhile(digitRE);
if (stream.eat('#')) {
stream.eatWhile(digitRE); // 16#10 style integer
} else {
if (stream.eat('.')) { // float
stream.eatWhile(digitRE);
}
if (stream.eat(/[eE]/)) {
stream.eat(/[-+]/); // float with exponent
stream.eatWhile(digitRE);
}
}
return "number"; // normal integer
}
return null;
}
function doubleQuote(stream) {
return Quote(stream, '"', '\\', "string");
}
function singleQuote(stream) {
return Quote(stream,'\'','\\',"atom");
}
function Quote(stream,quoteChar,escapeChar,tag) {
while (!stream.eol()) {
var ch = stream.next();
if (ch == quoteChar) {
return tag;
}else if (ch == escapeChar) {
stream.next();
}
}
return "error";
}
return {
startState: function() {
return {};
},
token: function(stream, state) {
return tokenize(stream, state);
}
};
});

View File

@ -0,0 +1,61 @@
<!doctype html>
<html>
<head>
<title>CodeMirror: Erlang mode</title>
<link rel="stylesheet" href="../../lib/codemirror.css">
<script src="../../lib/codemirror.js"></script>
<script src="erlang.js"></script>
<link rel="stylesheet" href="../../theme/erlang-dark.css">
<style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
<link rel="stylesheet" href="../../doc/docs.css">
</head>
<body>
<h1>CodeMirror: Erlang mode</h1>
<form><textarea id="code" name="code">
%% -*- mode: erlang; erlang-indent-level: 2 -*-
%%% Created : 7 May 2012 by mats cronqvist <masse@klarna.com>
%% @doc
%% Demonstrates how to print a record.
%% @end
-module('ex').
-author('mats cronqvist').
-export([demo/0,
rec_info/1]).
-record(demo,{a="One",b="Two",c="Three",d="Four"}).
rec_info(demo) -> record_info(fields,demo).
demo() -> expand_recs(?MODULE,#demo{a="A",b="BB"}).
expand_recs(M,List) when is_list(List) ->
[expand_recs(M,L)||L<-List];
expand_recs(M,Tup) when is_tuple(Tup) ->
case tuple_size(Tup) of
L when L < 1 -> Tup;
L ->
try Fields = M:rec_info(element(1,Tup)),
L = length(Fields)+1,
lists:zip(Fields,expand_recs(M,tl(tuple_to_list(Tup))))
catch _:_ ->
list_to_tuple(expand_recs(M,tuple_to_list(Tup)))
end
end;
expand_recs(_,Term) ->
Term.
</textarea></form>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
lineNumbers: true,
matchBrackets: true,
theme: "erlang-dark"
});
</script>
<p><strong>MIME types defined:</strong> <code>text/x-erlang</code>.</p>
</body>
</html>

View File

@ -0,0 +1,144 @@
CodeMirror.defineMode("gfm", function(config, parserConfig) {
var mdMode = CodeMirror.getMode(config, "markdown");
var aliases = {
html: "htmlmixed",
js: "javascript",
json: "application/json",
c: "text/x-csrc",
"c++": "text/x-c++src",
java: "text/x-java",
csharp: "text/x-csharp",
"c#": "text/x-csharp"
};
// make this lazy so that we don't need to load GFM last
var getMode = (function () {
var i, modes = {}, mimes = {}, mime;
var list = CodeMirror.listModes();
for (i = 0; i < list.length; i++) {
modes[list[i]] = list[i];
}
var mimesList = CodeMirror.listMIMEs();
for (i = 0; i < mimesList.length; i++) {
mime = mimesList[i].mime;
mimes[mime] = mimesList[i].mime;
}
for (var a in aliases) {
if (aliases[a] in modes || aliases[a] in mimes)
modes[a] = aliases[a];
}
return function (lang) {
return modes[lang] ? CodeMirror.getMode(config, modes[lang]) : null;
}
}());
function markdown(stream, state) {
// intercept fenced code blocks
if (stream.sol() && stream.match(/^```([\w+#]*)/)) {
// try switching mode
state.localMode = getMode(RegExp.$1)
if (state.localMode)
state.localState = state.localMode.startState();
state.token = local;
return 'code';
}
return mdMode.token(stream, state.mdState);
}
function local(stream, state) {
if (stream.sol() && stream.match(/^```/)) {
state.localMode = state.localState = null;
state.token = markdown;
return 'code';
}
else if (state.localMode) {
return state.localMode.token(stream, state.localState);
} else {
stream.skipToEnd();
return 'code';
}
}
// custom handleText to prevent emphasis in the middle of a word
// and add autolinking
function handleText(stream, mdState) {
var match;
if (stream.match(/^\w+:\/\/\S+/)) {
return 'link';
}
if (stream.match(/^[^\[*\\<>` _][^\[*\\<>` ]*[^\[*\\<>` _]/)) {
return mdMode.getType(mdState);
}
if (match = stream.match(/^[^\[*\\<>` ]+/)) {
var word = match[0];
if (word[0] === '_' && word[word.length-1] === '_') {
stream.backUp(word.length);
return undefined;
}
return mdMode.getType(mdState);
}
if (stream.eatSpace()) {
return null;
}
}
return {
startState: function() {
var mdState = mdMode.startState();
mdState.text = handleText;
return {token: markdown, mode: "markdown", mdState: mdState,
localMode: null, localState: null};
},
copyState: function(state) {
return {token: state.token, mode: state.mode, mdState: CodeMirror.copyState(mdMode, state.mdState),
localMode: state.localMode,
localState: state.localMode ? CodeMirror.copyState(state.localMode, state.localState) : null};
},
token: function(stream, state) {
/* Parse GFM double bracket links */
if ((ch = stream.peek()) != undefined && ch == '[') {
stream.next(); // Advance the stream
/* Only handle double bracket links */
if ((ch = stream.peek()) == undefined || ch != '[') {
stream.backUp(1);
return state.token(stream, state);
}
while ((ch = stream.next()) != undefined && ch != ']') {}
if (ch == ']' && (ch = stream.next()) != undefined && ch == ']')
return 'link';
/* If we did not find the second ']' */
stream.backUp(1);
}
/* Match GFM latex formulas, as well as latex formulas within '$' */
if (stream.match(/^\$[^\$]+\$/)) {
return "string";
}
if (stream.match(/^\\\((.*?)\\\)/)) {
return "string";
}
if (stream.match(/^\$\$[^\$]+\$\$/)) {
return "string";
}
if (stream.match(/^\\\[(.*?)\\\]/)) {
return "string";
}
return state.token(stream, state);
}
}
}, "markdown");

View File

@ -0,0 +1,47 @@
<!doctype html>
<html>
<head>
<title>CodeMirror: GFM mode</title>
<link rel="stylesheet" href="../../lib/codemirror.css">
<script src="../../lib/codemirror.js"></script>
<script src="../xml/xml.js"></script>
<script src="../markdown/markdown.js"></script>
<script src="gfm.js"></script>
<script src="../javascript/javascript.js"></script>
<link rel="stylesheet" href="../markdown/markdown.css">
<style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
<link rel="stylesheet" href="../../doc/docs.css">
</head>
<body>
<h1>CodeMirror: GFM mode</h1>
<!-- source: http://daringfireball.net/projects/markdown/basics.text -->
<form><textarea id="code" name="code">
Github Flavored Markdown
========================
Everything from markdown plus GFM features:
## Fenced code blocks
```javascript
for (var i = 0; i &lt; items.length; i++) {
console.log(items[i], i); // log them
}
```
See http://github.github.com/github-flavored-markdown/
</textarea></form>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
mode: 'gfm',
lineNumbers: true,
matchBrackets: true,
theme: "default"
});
</script>
</body>
</html>

View File

@ -0,0 +1,170 @@
CodeMirror.defineMode("go", function(config, parserConfig) {
var indentUnit = config.indentUnit;
var keywords = {
"break":true, "case":true, "chan":true, "const":true, "continue":true,
"default":true, "defer":true, "else":true, "fallthrough":true, "for":true,
"func":true, "go":true, "goto":true, "if":true, "import":true,
"interface":true, "map":true, "package":true, "range":true, "return":true,
"select":true, "struct":true, "switch":true, "type":true, "var":true,
"bool":true, "byte":true, "complex64":true, "complex128":true,
"float32":true, "float64":true, "int8":true, "int16":true, "int32":true,
"int64":true, "string":true, "uint8":true, "uint16":true, "uint32":true,
"uint64":true, "int":true, "uint":true, "uintptr":true
};
var atoms = {
"true":true, "false":true, "iota":true, "nil":true, "append":true,
"cap":true, "close":true, "complex":true, "copy":true, "imag":true,
"len":true, "make":true, "new":true, "panic":true, "print":true,
"println":true, "real":true, "recover":true
};
var blockKeywords = {
"else":true, "for":true, "func":true, "if":true, "interface":true,
"select":true, "struct":true, "switch":true
};
var isOperatorChar = /[+\-*&^%:=<>!|\/]/;
var curPunc;
function tokenBase(stream, state) {
var ch = stream.next();
if (ch == '"' || ch == "'" || ch == "`") {
state.tokenize = tokenString(ch);
return state.tokenize(stream, state);
}
if (/[\d\.]/.test(ch)) {
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";
}
if (/[\[\]{}\(\),;\:\.]/.test(ch)) {
curPunc = ch;
return null
}
if (ch == "/") {
if (stream.eat("*")) {
state.tokenize = tokenComment;
return tokenComment(stream, state);
}
if (stream.eat("/")) {
stream.skipToEnd();
return "comment";
}
}
if (isOperatorChar.test(ch)) {
stream.eatWhile(isOperatorChar);
return "operator";
}
stream.eatWhile(/[\w\$_]/);
var cur = stream.current();
if (keywords.propertyIsEnumerable(cur)) {
if (cur == "case" || cur == "default") curPunc = "case";
return "keyword";
}
if (atoms.propertyIsEnumerable(cur)) return "atom";
return "word";
}
function tokenString(quote) {
return function(stream, state) {
var escaped = false, next, end = false;
while ((next = stream.next()) != null) {
if (next == quote && !escaped) {end = true; break;}
escaped = !escaped && next == "\\";
}
if (end || !(escaped || quote == "`"))
state.tokenize = tokenBase;
return "string";
};
}
function tokenComment(stream, state) {
var maybeEnd = false, ch;
while (ch = stream.next()) {
if (ch == "/" && maybeEnd) {
state.tokenize = tokenBase;
break;
}
maybeEnd = (ch == "*");
}
return "comment";
}
function Context(indented, column, type, align, prev) {
this.indented = indented;
this.column = column;
this.type = type;
this.align = align;
this.prev = prev;
}
function pushContext(state, col, type) {
return state.context = new Context(state.indented, col, type, null, state.context);
}
function popContext(state) {
var t = state.context.type;
if (t == ")" || t == "]" || t == "}")
state.indented = state.context.indented;
return state.context = state.context.prev;
}
// Interface
return {
startState: function(basecolumn) {
return {
tokenize: null,
context: new Context((basecolumn || 0) - indentUnit, 0, "top", false),
indented: 0,
startOfLine: true
};
},
token: function(stream, state) {
var ctx = state.context;
if (stream.sol()) {
if (ctx.align == null) ctx.align = false;
state.indented = stream.indentation();
state.startOfLine = true;
if (ctx.type == "case") ctx.type = "}";
}
if (stream.eatSpace()) return null;
curPunc = null;
var style = (state.tokenize || tokenBase)(stream, state);
if (style == "comment") return style;
if (ctx.align == null) ctx.align = true;
if (curPunc == "{") pushContext(state, stream.column(), "}");
else if (curPunc == "[") pushContext(state, stream.column(), "]");
else if (curPunc == "(") pushContext(state, stream.column(), ")");
else if (curPunc == "case") ctx.type = "case"
else if (curPunc == "}" && ctx.type == "}") ctx = popContext(state);
else if (curPunc == ctx.type) popContext(state);
state.startOfLine = false;
return style;
},
indent: function(state, textAfter) {
if (state.tokenize != tokenBase && state.tokenize != null) return 0;
var ctx = state.context, firstChar = textAfter && textAfter.charAt(0);
if (ctx.type == "case" && /^(?:case|default)\b/.test(textAfter)) {
state.context.type = "}";
return ctx.indented;
}
var closing = firstChar == ctx.type;
if (ctx.align) return ctx.column + (closing ? 0 : 1);
else return ctx.indented + (closing ? 0 : indentUnit);
},
electricChars: "{}:"
};
});
CodeMirror.defineMIME("text/x-go", "go");

View File

@ -0,0 +1,72 @@
<!doctype html>
<html>
<head>
<title>CodeMirror: Go mode</title>
<link rel="stylesheet" href="../../lib/codemirror.css">
<link rel="stylesheet" href="../../theme/elegant.css">
<script src="../../lib/codemirror.js"></script>
<script src="go.js"></script>
<link rel="stylesheet" href="../../doc/docs.css">
<style>.CodeMirror {border:1px solid #999; background:#ffc}</style>
</head>
<body>
<h1>CodeMirror: Go mode</h1>
<form><textarea id="code" name="code">
// Prime Sieve in Go.
// Taken from the Go specification.
// Copyright © The Go Authors.
package main
import "fmt"
// Send the sequence 2, 3, 4, ... to channel 'ch'.
func generate(ch chan&lt;- int) {
for i := 2; ; i++ {
ch &lt;- i // Send 'i' to channel 'ch'
}
}
// Copy the values from channel 'src' to channel 'dst',
// removing those divisible by 'prime'.
func filter(src &lt;-chan int, dst chan&lt;- int, prime int) {
for i := range src { // Loop over values received from 'src'.
if i%prime != 0 {
dst &lt;- i // Send 'i' to channel 'dst'.
}
}
}
// The prime sieve: Daisy-chain filter processes together.
func sieve() {
ch := make(chan int) // Create a new channel.
go generate(ch) // Start generate() as a subprocess.
for {
prime := &lt;-ch
fmt.Print(prime, "\n")
ch1 := make(chan int)
go filter(ch, ch1, prime)
ch = ch1
}
}
func main() {
sieve()
}
</textarea></form>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
theme: "elegant",
matchBrackets: true,
indentUnit: 8,
tabSize: 8,
indentWithTabs: true,
mode: "text/x-go"
});
</script>
<p><strong>MIME type:</strong> <code>text/x-go</code></p>
</body>
</html>

View File

@ -0,0 +1,210 @@
CodeMirror.defineMode("groovy", function(config, parserConfig) {
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(
"abstract as assert boolean break byte case catch char class const continue def default " +
"do double else enum extends final finally float for goto if implements import in " +
"instanceof int interface long native new package private protected public return " +
"short static strictfp super switch synchronized threadsafe throw throws transient " +
"try void volatile while");
var blockKeywords = words("catch class do else finally for if switch try while enum interface def");
var atoms = words("null true false this");
var curPunc;
function tokenBase(stream, state) {
var ch = stream.next();
if (ch == '"' || ch == "'") {
return startString(ch, stream, state);
}
if (/[\[\]{}\(\),;\:\.]/.test(ch)) {
curPunc = ch;
return null
}
if (/\d/.test(ch)) {
stream.eatWhile(/[\w\.]/);
if (stream.eat(/eE/)) { stream.eat(/\+\-/); stream.eatWhile(/\d/); }
return "number";
}
if (ch == "/") {
if (stream.eat("*")) {
state.tokenize.push(tokenComment);
return tokenComment(stream, state);
}
if (stream.eat("/")) {
stream.skipToEnd();
return "comment";
}
if (expectExpression(state.lastToken)) {
return startString(ch, stream, state);
}
}
if (ch == "-" && stream.eat(">")) {
curPunc = "->";
return null;
}
if (/[+\-*&%=<>!?|\/~]/.test(ch)) {
stream.eatWhile(/[+\-*&%=<>|~]/);
return "operator";
}
stream.eatWhile(/[\w\$_]/);
if (ch == "@") { stream.eatWhile(/[\w\$_\.]/); return "meta"; }
if (state.lastToken == ".") return "property";
if (stream.eat(":")) { curPunc = "proplabel"; return "property"; }
var cur = stream.current();
if (atoms.propertyIsEnumerable(cur)) { return "atom"; }
if (keywords.propertyIsEnumerable(cur)) {
if (blockKeywords.propertyIsEnumerable(cur)) curPunc = "newstatement";
return "keyword";
}
return "word";
}
tokenBase.isBase = true;
function startString(quote, stream, state) {
var tripleQuoted = false;
if (quote != "/" && stream.eat(quote)) {
if (stream.eat(quote)) tripleQuoted = true;
else return "string";
}
function t(stream, state) {
var escaped = false, next, end = !tripleQuoted;
while ((next = stream.next()) != null) {
if (next == quote && !escaped) {
if (!tripleQuoted) { break; }
if (stream.match(quote + quote)) { end = true; break; }
}
if (quote == '"' && next == "$" && !escaped && stream.eat("{")) {
state.tokenize.push(tokenBaseUntilBrace());
return "string";
}
escaped = !escaped && next == "\\";
}
if (end) state.tokenize.pop();
return "string";
}
state.tokenize.push(t);
return t(stream, state);
}
function tokenBaseUntilBrace() {
var depth = 1;
function t(stream, state) {
if (stream.peek() == "}") {
depth--;
if (depth == 0) {
state.tokenize.pop();
return state.tokenize[state.tokenize.length-1](stream, state);
}
} else if (stream.peek() == "{") {
depth++;
}
return tokenBase(stream, state);
}
t.isBase = true;
return t;
}
function tokenComment(stream, state) {
var maybeEnd = false, ch;
while (ch = stream.next()) {
if (ch == "/" && maybeEnd) {
state.tokenize.pop();
break;
}
maybeEnd = (ch == "*");
}
return "comment";
}
function expectExpression(last) {
return !last || last == "operator" || last == "->" || /[\.\[\{\(,;:]/.test(last) ||
last == "newstatement" || last == "keyword" || last == "proplabel";
}
function Context(indented, column, type, align, prev) {
this.indented = indented;
this.column = column;
this.type = type;
this.align = align;
this.prev = prev;
}
function pushContext(state, col, type) {
return state.context = new Context(state.indented, col, type, null, state.context);
}
function popContext(state) {
var t = state.context.type;
if (t == ")" || t == "]" || t == "}")
state.indented = state.context.indented;
return state.context = state.context.prev;
}
// Interface
return {
startState: function(basecolumn) {
return {
tokenize: [tokenBase],
context: new Context((basecolumn || 0) - config.indentUnit, 0, "top", false),
indented: 0,
startOfLine: true,
lastToken: null
};
},
token: function(stream, state) {
var ctx = state.context;
if (stream.sol()) {
if (ctx.align == null) ctx.align = false;
state.indented = stream.indentation();
state.startOfLine = true;
// Automatic semicolon insertion
if (ctx.type == "statement" && !expectExpression(state.lastToken)) {
popContext(state); ctx = state.context;
}
}
if (stream.eatSpace()) return null;
curPunc = null;
var style = state.tokenize[state.tokenize.length-1](stream, state);
if (style == "comment") return style;
if (ctx.align == null) ctx.align = true;
if ((curPunc == ";" || curPunc == ":") && ctx.type == "statement") popContext(state);
// Handle indentation for {x -> \n ... }
else if (curPunc == "->" && ctx.type == "statement" && ctx.prev.type == "}") {
popContext(state);
state.context.align = false;
}
else if (curPunc == "{") pushContext(state, stream.column(), "}");
else if (curPunc == "[") pushContext(state, stream.column(), "]");
else if (curPunc == "(") pushContext(state, stream.column(), ")");
else if (curPunc == "}") {
while (ctx.type == "statement") ctx = popContext(state);
if (ctx.type == "}") ctx = popContext(state);
while (ctx.type == "statement") ctx = popContext(state);
}
else if (curPunc == ctx.type) popContext(state);
else if (ctx.type == "}" || ctx.type == "top" || (ctx.type == "statement" && curPunc == "newstatement"))
pushContext(state, stream.column(), "statement");
state.startOfLine = false;
state.lastToken = curPunc || style;
return style;
},
indent: function(state, textAfter) {
if (!state.tokenize[state.tokenize.length-1].isBase) return 0;
var firstChar = textAfter && textAfter.charAt(0), ctx = state.context;
if (ctx.type == "statement" && !expectExpression(state.lastToken)) ctx = ctx.prev;
var closing = firstChar == ctx.type;
if (ctx.type == "statement") return ctx.indented + (firstChar == "{" ? 0 : config.indentUnit);
else if (ctx.align) return ctx.column + (closing ? 0 : 1);
else return ctx.indented + (closing ? 0 : config.indentUnit);
},
electricChars: "{}"
};
});
CodeMirror.defineMIME("text/x-groovy", "groovy");

View File

@ -0,0 +1,71 @@
<!doctype html>
<html>
<head>
<title>CodeMirror: Groovy mode</title>
<link rel="stylesheet" href="../../lib/codemirror.css">
<script src="../../lib/codemirror.js"></script>
<script src="groovy.js"></script>
<link rel="stylesheet" href="../../doc/docs.css">
<style>.CodeMirror {border-top: 1px solid #500; border-bottom: 1px solid #500;}</style>
</head>
<body>
<h1>CodeMirror: Groovy mode</h1>
<form><textarea id="code" name="code">
//Pattern for groovy script
def p = ~/.*\.groovy/
new File( 'd:\\scripts' ).eachFileMatch(p) {f ->
// imports list
def imports = []
f.eachLine {
// condition to detect an import instruction
ln -> if ( ln =~ '^import .*' ) {
imports << "${ln - 'import '}"
}
}
// print thmen
if ( ! imports.empty ) {
println f
imports.each{ println " $it" }
}
}
/* Coin changer demo code from http://groovy.codehaus.org */
enum UsCoin {
quarter(25), dime(10), nickel(5), penny(1)
UsCoin(v) { value = v }
final value
}
enum OzzieCoin {
fifty(50), twenty(20), ten(10), five(5)
OzzieCoin(v) { value = v }
final value
}
def plural(word, count) {
if (count == 1) return word
word[-1] == 'y' ? word[0..-2] + "ies" : word + "s"
}
def change(currency, amount) {
currency.values().inject([]){ list, coin ->
int count = amount / coin.value
amount = amount % coin.value
list += "$count ${plural(coin.toString(), count)}"
}
}
</textarea></form>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
lineNumbers: true,
matchBrackets: true,
mode: "text/x-groovy"
});
</script>
<p><strong>MIME types defined:</strong> <code>text/x-groovy</code></p>
</body>
</html>

View File

@ -0,0 +1,242 @@
CodeMirror.defineMode("haskell", function(cmCfg, modeCfg) {
function switchState(source, setState, f) {
setState(f);
return f(source, setState);
}
// These should all be Unicode extended, as per the Haskell 2010 report
var smallRE = /[a-z_]/;
var largeRE = /[A-Z]/;
var digitRE = /[0-9]/;
var hexitRE = /[0-9A-Fa-f]/;
var octitRE = /[0-7]/;
var idRE = /[a-z_A-Z0-9']/;
var symbolRE = /[-!#$%&*+.\/<=>?@\\^|~:]/;
var specialRE = /[(),;[\]`{}]/;
var whiteCharRE = /[ \t\v\f]/; // newlines are handled in tokenizer
function normal(source, setState) {
if (source.eatWhile(whiteCharRE)) {
return null;
}
var ch = source.next();
if (specialRE.test(ch)) {
if (ch == '{' && source.eat('-')) {
var t = "comment";
if (source.eat('#')) {
t = "meta";
}
return switchState(source, setState, ncomment(t, 1));
}
return null;
}
if (ch == '\'') {
if (source.eat('\\')) {
source.next(); // should handle other escapes here
}
else {
source.next();
}
if (source.eat('\'')) {
return "string";
}
return "error";
}
if (ch == '"') {
return switchState(source, setState, stringLiteral);
}
if (largeRE.test(ch)) {
source.eatWhile(idRE);
if (source.eat('.')) {
return "qualifier";
}
return "variable-2";
}
if (smallRE.test(ch)) {
source.eatWhile(idRE);
return "variable";
}
if (digitRE.test(ch)) {
if (ch == '0') {
if (source.eat(/[xX]/)) {
source.eatWhile(hexitRE); // should require at least 1
return "integer";
}
if (source.eat(/[oO]/)) {
source.eatWhile(octitRE); // should require at least 1
return "number";
}
}
source.eatWhile(digitRE);
var t = "number";
if (source.eat('.')) {
t = "number";
source.eatWhile(digitRE); // should require at least 1
}
if (source.eat(/[eE]/)) {
t = "number";
source.eat(/[-+]/);
source.eatWhile(digitRE); // should require at least 1
}
return t;
}
if (symbolRE.test(ch)) {
if (ch == '-' && source.eat(/-/)) {
source.eatWhile(/-/);
if (!source.eat(symbolRE)) {
source.skipToEnd();
return "comment";
}
}
var t = "variable";
if (ch == ':') {
t = "variable-2";
}
source.eatWhile(symbolRE);
return t;
}
return "error";
}
function ncomment(type, nest) {
if (nest == 0) {
return normal;
}
return function(source, setState) {
var currNest = nest;
while (!source.eol()) {
var ch = source.next();
if (ch == '{' && source.eat('-')) {
++currNest;
}
else if (ch == '-' && source.eat('}')) {
--currNest;
if (currNest == 0) {
setState(normal);
return type;
}
}
}
setState(ncomment(type, currNest));
return type;
}
}
function stringLiteral(source, setState) {
while (!source.eol()) {
var ch = source.next();
if (ch == '"') {
setState(normal);
return "string";
}
if (ch == '\\') {
if (source.eol() || source.eat(whiteCharRE)) {
setState(stringGap);
return "string";
}
if (source.eat('&')) {
}
else {
source.next(); // should handle other escapes here
}
}
}
setState(normal);
return "error";
}
function stringGap(source, setState) {
if (source.eat('\\')) {
return switchState(source, setState, stringLiteral);
}
source.next();
setState(normal);
return "error";
}
var wellKnownWords = (function() {
var wkw = {};
function setType(t) {
return function () {
for (var i = 0; i < arguments.length; i++)
wkw[arguments[i]] = t;
}
}
setType("keyword")(
"case", "class", "data", "default", "deriving", "do", "else", "foreign",
"if", "import", "in", "infix", "infixl", "infixr", "instance", "let",
"module", "newtype", "of", "then", "type", "where", "_");
setType("keyword")(
"\.\.", ":", "::", "=", "\\", "\"", "<-", "->", "@", "~", "=>");
setType("builtin")(
"!!", "$!", "$", "&&", "+", "++", "-", ".", "/", "/=", "<", "<=", "=<<",
"==", ">", ">=", ">>", ">>=", "^", "^^", "||", "*", "**");
setType("builtin")(
"Bool", "Bounded", "Char", "Double", "EQ", "Either", "Enum", "Eq",
"False", "FilePath", "Float", "Floating", "Fractional", "Functor", "GT",
"IO", "IOError", "Int", "Integer", "Integral", "Just", "LT", "Left",
"Maybe", "Monad", "Nothing", "Num", "Ord", "Ordering", "Rational", "Read",
"ReadS", "Real", "RealFloat", "RealFrac", "Right", "Show", "ShowS",
"String", "True");
setType("builtin")(
"abs", "acos", "acosh", "all", "and", "any", "appendFile", "asTypeOf",
"asin", "asinh", "atan", "atan2", "atanh", "break", "catch", "ceiling",
"compare", "concat", "concatMap", "const", "cos", "cosh", "curry",
"cycle", "decodeFloat", "div", "divMod", "drop", "dropWhile", "either",
"elem", "encodeFloat", "enumFrom", "enumFromThen", "enumFromThenTo",
"enumFromTo", "error", "even", "exp", "exponent", "fail", "filter",
"flip", "floatDigits", "floatRadix", "floatRange", "floor", "fmap",
"foldl", "foldl1", "foldr", "foldr1", "fromEnum", "fromInteger",
"fromIntegral", "fromRational", "fst", "gcd", "getChar", "getContents",
"getLine", "head", "id", "init", "interact", "ioError", "isDenormalized",
"isIEEE", "isInfinite", "isNaN", "isNegativeZero", "iterate", "last",
"lcm", "length", "lex", "lines", "log", "logBase", "lookup", "map",
"mapM", "mapM_", "max", "maxBound", "maximum", "maybe", "min", "minBound",
"minimum", "mod", "negate", "not", "notElem", "null", "odd", "or",
"otherwise", "pi", "pred", "print", "product", "properFraction",
"putChar", "putStr", "putStrLn", "quot", "quotRem", "read", "readFile",
"readIO", "readList", "readLn", "readParen", "reads", "readsPrec",
"realToFrac", "recip", "rem", "repeat", "replicate", "return", "reverse",
"round", "scaleFloat", "scanl", "scanl1", "scanr", "scanr1", "seq",
"sequence", "sequence_", "show", "showChar", "showList", "showParen",
"showString", "shows", "showsPrec", "significand", "signum", "sin",
"sinh", "snd", "span", "splitAt", "sqrt", "subtract", "succ", "sum",
"tail", "take", "takeWhile", "tan", "tanh", "toEnum", "toInteger",
"toRational", "truncate", "uncurry", "undefined", "unlines", "until",
"unwords", "unzip", "unzip3", "userError", "words", "writeFile", "zip",
"zip3", "zipWith", "zipWith3");
return wkw;
})();
return {
startState: function () { return { f: normal }; },
copyState: function (s) { return { f: s.f }; },
token: function(stream, state) {
var t = state.f(stream, function(s) { state.f = s; });
var w = stream.current();
return (w in wellKnownWords) ? wellKnownWords[w] : t;
}
};
});
CodeMirror.defineMIME("text/x-haskell", "haskell");

View File

@ -0,0 +1,60 @@
<!doctype html>
<html>
<head>
<title>CodeMirror: Haskell mode</title>
<link rel="stylesheet" href="../../lib/codemirror.css">
<script src="../../lib/codemirror.js"></script>
<script src="haskell.js"></script>
<link rel="stylesheet" href="../../theme/elegant.css">
<style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
<link rel="stylesheet" href="../../doc/docs.css">
</head>
<body>
<h1>CodeMirror: Haskell mode</h1>
<form><textarea id="code" name="code">
module UniquePerms (
uniquePerms
)
where
-- | Find all unique permutations of a list where there might be duplicates.
uniquePerms :: (Eq a) => [a] -> [[a]]
uniquePerms = permBag . makeBag
-- | An unordered collection where duplicate values are allowed,
-- but represented with a single value and a count.
type Bag a = [(a, Int)]
makeBag :: (Eq a) => [a] -> Bag a
makeBag [] = []
makeBag (a:as) = mix a $ makeBag as
where
mix a [] = [(a,1)]
mix a (bn@(b,n):bs) | a == b = (b,n+1):bs
| otherwise = bn : mix a bs
permBag :: Bag a -> [[a]]
permBag [] = [[]]
permBag bs = concatMap (\(f,cs) -> map (f:) $ permBag cs) . oneOfEach $ bs
where
oneOfEach [] = []
oneOfEach (an@(a,n):bs) =
let bs' = if n == 1 then bs else (a,n-1):bs
in (a,bs') : mapSnd (an:) (oneOfEach bs)
apSnd f (a,b) = (a, f b)
mapSnd = map . apSnd
</textarea></form>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
lineNumbers: true,
matchBrackets: true,
theme: "elegant"
});
</script>
<p><strong>MIME types defined:</strong> <code>text/x-haskell</code>.</p>
</body>
</html>

View File

@ -0,0 +1,68 @@
CodeMirror.defineMode("htmlembedded", function(config, parserConfig) {
//config settings
var scriptStartRegex = parserConfig.scriptStartRegex || /^<%/i,
scriptEndRegex = parserConfig.scriptEndRegex || /^%>/i;
//inner modes
var scriptingMode, htmlMixedMode;
//tokenizer when in html mode
function htmlDispatch(stream, state) {
if (stream.match(scriptStartRegex, false)) {
state.token=scriptingDispatch;
return scriptingMode.token(stream, state.scriptState);
}
else
return htmlMixedMode.token(stream, state.htmlState);
}
//tokenizer when in scripting mode
function scriptingDispatch(stream, state) {
if (stream.match(scriptEndRegex, false)) {
state.token=htmlDispatch;
return htmlMixedMode.token(stream, state.htmlState);
}
else
return scriptingMode.token(stream, state.scriptState);
}
return {
startState: function() {
scriptingMode = scriptingMode || CodeMirror.getMode(config, parserConfig.scriptingModeSpec);
htmlMixedMode = htmlMixedMode || CodeMirror.getMode(config, "htmlmixed");
return {
token : parserConfig.startOpen ? scriptingDispatch : htmlDispatch,
htmlState : htmlMixedMode.startState(),
scriptState : scriptingMode.startState()
}
},
token: function(stream, state) {
return state.token(stream, state);
},
indent: function(state, textAfter) {
if (state.token == htmlDispatch)
return htmlMixedMode.indent(state.htmlState, textAfter);
else
return scriptingMode.indent(state.scriptState, textAfter);
},
copyState: function(state) {
return {
token : state.token,
htmlState : CodeMirror.copyState(htmlMixedMode, state.htmlState),
scriptState : CodeMirror.copyState(scriptingMode, state.scriptState)
}
},
electricChars: "/{}:"
}
}, "htmlmixed");
CodeMirror.defineMIME("application/x-ejs", { name: "htmlembedded", scriptingModeSpec:"javascript"});
CodeMirror.defineMIME("application/x-aspx", { name: "htmlembedded", scriptingModeSpec:"text/x-csharp"});
CodeMirror.defineMIME("application/x-jsp", { name: "htmlembedded", scriptingModeSpec:"text/x-java"});

View File

@ -0,0 +1,49 @@
<!doctype html>
<html>
<head>
<title>CodeMirror: Html Embedded Scripts mode</title>
<link rel="stylesheet" href="../../lib/codemirror.css">
<script src="../../lib/codemirror.js"></script>
<script src="../xml/xml.js"></script>
<script src="../javascript/javascript.js"></script>
<script src="../css/css.js"></script>
<script src="../htmlmixed/htmlmixed.js"></script>
<script src="htmlembedded.js"></script>
<style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
<link rel="stylesheet" href="../../doc/docs.css">
</head>
<body>
<h1>CodeMirror: Html Embedded Scripts mode</h1>
<form><textarea id="code" name="code">
<%
function hello(who) {
return "Hello " + who;
}
%>
This is an example of EJS (embedded javascript)
<p>The program says <%= hello("world") %>.</p>
<script>
alert("And here is some normal JS code"); // also colored
</script>
</textarea></form>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
lineNumbers: true,
matchBrackets: true,
mode: "application/x-ejs",
indentUnit: 4,
indentWithTabs: true,
enterMode: "keep",
tabMode: "shift"
});
</script>
<p>Mode for html embedded scripts like JSP and ASP.NET. Depends on HtmlMixed which in turn depends on
JavaScript, CSS and XML.<br />Other dependancies include those of the scriping language chosen.</p>
<p><strong>MIME types defined:</strong> <code>application/x-aspx</code> (ASP.NET),
<code>application/x-ejs</code> (Embedded Javascript), <code>application/x-jsp</code> (JavaServer Pages)</p>
</body>
</html>

View File

@ -0,0 +1,85 @@
CodeMirror.defineMode("htmlmixed", function(config, parserConfig) {
var htmlMode = CodeMirror.getMode(config, {name: "xml", htmlMode: true});
var jsMode = CodeMirror.getMode(config, "javascript");
var cssMode = CodeMirror.getMode(config, "css");
function html(stream, state) {
var style = htmlMode.token(stream, state.htmlState);
if (style == "tag" && stream.current() == ">" && state.htmlState.context) {
if (/^script$/i.test(state.htmlState.context.tagName)) {
state.token = javascript;
state.localState = jsMode.startState(htmlMode.indent(state.htmlState, ""));
state.mode = "javascript";
}
else if (/^style$/i.test(state.htmlState.context.tagName)) {
state.token = css;
state.localState = cssMode.startState(htmlMode.indent(state.htmlState, ""));
state.mode = "css";
}
}
return style;
}
function maybeBackup(stream, pat, style) {
var cur = stream.current();
var close = cur.search(pat);
if (close > -1) stream.backUp(cur.length - close);
return style;
}
function javascript(stream, state) {
if (stream.match(/^<\/\s*script\s*>/i, false)) {
state.token = html;
state.localState = null;
state.mode = "html";
return html(stream, state);
}
return maybeBackup(stream, /<\/\s*script\s*>/,
jsMode.token(stream, state.localState));
}
function css(stream, state) {
if (stream.match(/^<\/\s*style\s*>/i, false)) {
state.token = html;
state.localState = null;
state.mode = "html";
return html(stream, state);
}
return maybeBackup(stream, /<\/\s*style\s*>/,
cssMode.token(stream, state.localState));
}
return {
startState: function() {
var state = htmlMode.startState();
return {token: html, localState: null, mode: "html", htmlState: state};
},
copyState: function(state) {
if (state.localState)
var local = CodeMirror.copyState(state.token == css ? cssMode : jsMode, state.localState);
return {token: state.token, localState: local, mode: state.mode,
htmlState: CodeMirror.copyState(htmlMode, state.htmlState)};
},
token: function(stream, state) {
return state.token(stream, state);
},
indent: function(state, textAfter) {
if (state.token == html || /^\s*<\//.test(textAfter))
return htmlMode.indent(state.htmlState, textAfter);
else if (state.token == javascript)
return jsMode.indent(state.localState, textAfter);
else
return cssMode.indent(state.localState, textAfter);
},
compareStates: function(a, b) {
if (a.mode != b.mode) return false;
if (a.localState) return CodeMirror.Pass;
return htmlMode.compareStates(a.htmlState, b.htmlState);
},
electricChars: "/{}:"
}
}, "xml", "javascript", "css");
CodeMirror.defineMIME("text/html", "htmlmixed");

View File

@ -0,0 +1,51 @@
<!doctype html>
<html>
<head>
<title>CodeMirror: HTML mixed mode</title>
<link rel="stylesheet" href="../../lib/codemirror.css">
<script src="../../lib/codemirror.js"></script>
<script src="../xml/xml.js"></script>
<script src="../javascript/javascript.js"></script>
<script src="../css/css.js"></script>
<script src="htmlmixed.js"></script>
<link rel="stylesheet" href="../../doc/docs.css">
<style>.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
</head>
<body>
<h1>CodeMirror: HTML mixed mode</h1>
<form><textarea id="code" name="code">
<html style="color: green">
<!-- this is a comment -->
<head>
<title>Mixed HTML Example</title>
<style type="text/css">
h1 {font-family: comic sans; color: #f0f;}
div {background: yellow !important;}
body {
max-width: 50em;
margin: 1em 2em 1em 5em;
}
</style>
</head>
<body>
<h1>Mixed HTML Example</h1>
<script>
function jsFunc(arg1, arg2) {
if (arg1 && arg2) document.body.innerHTML = "achoo";
}
</script>
</body>
</html>
</textarea></form>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {mode: "text/html", tabMode: "indent"});
</script>
<p>The HTML mixed mode depends on the XML, JavaScript, and CSS modes.</p>
<p><strong>MIME types defined:</strong> <code>text/html</code>
(redefined, only takes effect if you load this parser after the
XML parser).</p>
</body>
</html>

View File

@ -0,0 +1,77 @@
<!doctype html>
<html>
<head>
<title>CodeMirror: JavaScript mode</title>
<link rel="stylesheet" href="../../lib/codemirror.css">
<script src="../../lib/codemirror.js"></script>
<script src="javascript.js"></script>
<link rel="stylesheet" href="../../doc/docs.css">
<style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
</head>
<body>
<h1>CodeMirror: JavaScript mode</h1>
<div><textarea id="code" name="code">
// Demo code (the actual new parser character stream implementation)
function StringStream(string) {
this.pos = 0;
this.string = string;
}
StringStream.prototype = {
done: function() {return this.pos >= this.string.length;},
peek: function() {return this.string.charAt(this.pos);},
next: function() {
if (this.pos &lt; this.string.length)
return this.string.charAt(this.pos++);
},
eat: function(match) {
var ch = this.string.charAt(this.pos);
if (typeof match == "string") var ok = ch == match;
else var ok = ch &amp;&amp; match.test ? match.test(ch) : match(ch);
if (ok) {this.pos++; return ch;}
},
eatWhile: function(match) {
var start = this.pos;
while (this.eat(match));
if (this.pos > start) return this.string.slice(start, this.pos);
},
backUp: function(n) {this.pos -= n;},
column: function() {return this.pos;},
eatSpace: function() {
var start = this.pos;
while (/\s/.test(this.string.charAt(this.pos))) this.pos++;
return this.pos - start;
},
match: function(pattern, consume, caseInsensitive) {
if (typeof pattern == "string") {
function cased(str) {return caseInsensitive ? str.toLowerCase() : str;}
if (cased(this.string).indexOf(cased(pattern), this.pos) == this.pos) {
if (consume !== false) this.pos += str.length;
return true;
}
}
else {
var match = this.string.slice(this.pos).match(pattern);
if (match &amp;&amp; consume !== false) this.pos += match[0].length;
return match;
}
}
};
</textarea></div>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
lineNumbers: true,
matchBrackets: true
});
</script>
<p>JavaScript mode supports a single configuration
option, <code>json</code>, which will set the mode to expect JSON
data rather than a JavaScript program.</p>
<p><strong>MIME types defined:</strong> <code>text/javascript</code>, <code>application/json</code>.</p>
</body>
</html>

View File

@ -0,0 +1,361 @@
CodeMirror.defineMode("javascript", function(config, parserConfig) {
var indentUnit = config.indentUnit;
var jsonMode = parserConfig.json;
// Tokenizer
var keywords = function(){
function kw(type) {return {type: type, style: "keyword"};}
var A = kw("keyword a"), B = kw("keyword b"), C = kw("keyword c");
var operator = kw("operator"), atom = {type: "atom", style: "atom"};
return {
"if": A, "while": A, "with": A, "else": B, "do": B, "try": B, "finally": B,
"return": C, "break": C, "continue": C, "new": C, "delete": C, "throw": C,
"var": kw("var"), "const": kw("var"), "let": kw("var"),
"function": kw("function"), "catch": kw("catch"),
"for": kw("for"), "switch": kw("switch"), "case": kw("case"), "default": kw("default"),
"in": operator, "typeof": operator, "instanceof": operator,
"true": atom, "false": atom, "null": atom, "undefined": atom, "NaN": atom, "Infinity": atom
};
}();
var isOperatorChar = /[+\-*&%=<>!?|]/;
function chain(stream, state, f) {
state.tokenize = f;
return f(stream, state);
}
function nextUntilUnescaped(stream, end) {
var escaped = false, next;
while ((next = stream.next()) != null) {
if (next == end && !escaped)
return false;
escaped = !escaped && next == "\\";
}
return escaped;
}
// Used as scratch variables to communicate multiple values without
// consing up tons of objects.
var type, content;
function ret(tp, style, cont) {
type = tp; content = cont;
return style;
}
function jsTokenBase(stream, state) {
var ch = stream.next();
if (ch == '"' || ch == "'")
return chain(stream, state, jsTokenString(ch));
else if (/[\[\]{}\(\),;\:\.]/.test(ch))
return ret(ch);
else if (ch == "0" && stream.eat(/x/i)) {
stream.eatWhile(/[\da-f]/i);
return ret("number", "number");
}
else if (/\d/.test(ch) || ch == "-" && stream.eat(/\d/)) {
stream.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/);
return ret("number", "number");
}
else if (ch == "/") {
if (stream.eat("*")) {
return chain(stream, state, jsTokenComment);
}
else if (stream.eat("/")) {
stream.skipToEnd();
return ret("comment", "comment");
}
else if (state.reAllowed) {
nextUntilUnescaped(stream, "/");
stream.eatWhile(/[gimy]/); // 'y' is "sticky" option in Mozilla
return ret("regexp", "string-2");
}
else {
stream.eatWhile(isOperatorChar);
return ret("operator", null, stream.current());
}
}
else if (ch == "#") {
stream.skipToEnd();
return ret("error", "error");
}
else if (isOperatorChar.test(ch)) {
stream.eatWhile(isOperatorChar);
return ret("operator", null, stream.current());
}
else {
stream.eatWhile(/[\w\$_]/);
var word = stream.current(), known = keywords.propertyIsEnumerable(word) && keywords[word];
return (known && state.kwAllowed) ? ret(known.type, known.style, word) :
ret("variable", "variable", word);
}
}
function jsTokenString(quote) {
return function(stream, state) {
if (!nextUntilUnescaped(stream, quote))
state.tokenize = jsTokenBase;
return ret("string", "string");
};
}
function jsTokenComment(stream, state) {
var maybeEnd = false, ch;
while (ch = stream.next()) {
if (ch == "/" && maybeEnd) {
state.tokenize = jsTokenBase;
break;
}
maybeEnd = (ch == "*");
}
return ret("comment", "comment");
}
// Parser
var atomicTypes = {"atom": true, "number": true, "variable": true, "string": true, "regexp": true};
function JSLexical(indented, column, type, align, prev, info) {
this.indented = indented;
this.column = column;
this.type = type;
this.prev = prev;
this.info = info;
if (align != null) this.align = align;
}
function inScope(state, varname) {
for (var v = state.localVars; v; v = v.next)
if (v.name == varname) return true;
}
function parseJS(state, style, type, content, stream) {
var cc = state.cc;
// Communicate our context to the combinators.
// (Less wasteful than consing up a hundred closures on every call.)
cx.state = state; cx.stream = stream; cx.marked = null, cx.cc = cc;
if (!state.lexical.hasOwnProperty("align"))
state.lexical.align = true;
while(true) {
var combinator = cc.length ? cc.pop() : jsonMode ? expression : statement;
if (combinator(type, content)) {
while(cc.length && cc[cc.length - 1].lex)
cc.pop()();
if (cx.marked) return cx.marked;
if (type == "variable" && inScope(state, content)) return "variable-2";
return style;
}
}
}
// Combinator utils
var cx = {state: null, column: null, marked: null, cc: null};
function pass() {
for (var i = arguments.length - 1; i >= 0; i--) cx.cc.push(arguments[i]);
}
function cont() {
pass.apply(null, arguments);
return true;
}
function register(varname) {
var state = cx.state;
if (state.context) {
cx.marked = "def";
for (var v = state.localVars; v; v = v.next)
if (v.name == varname) return;
state.localVars = {name: varname, next: state.localVars};
}
}
// Combinators
var defaultVars = {name: "this", next: {name: "arguments"}};
function pushcontext() {
if (!cx.state.context) cx.state.localVars = defaultVars;
cx.state.context = {prev: cx.state.context, vars: cx.state.localVars};
}
function popcontext() {
cx.state.localVars = cx.state.context.vars;
cx.state.context = cx.state.context.prev;
}
function pushlex(type, info) {
var result = function() {
var state = cx.state;
state.lexical = new JSLexical(state.indented, cx.stream.column(), type, null, state.lexical, info)
};
result.lex = true;
return result;
}
function poplex() {
var state = cx.state;
if (state.lexical.prev) {
if (state.lexical.type == ")")
state.indented = state.lexical.indented;
state.lexical = state.lexical.prev;
}
}
poplex.lex = true;
function expect(wanted) {
return function expecting(type) {
if (type == wanted) return cont();
else if (wanted == ";") return pass();
else return cont(arguments.callee);
};
}
function statement(type) {
if (type == "var") return cont(pushlex("vardef"), vardef1, expect(";"), poplex);
if (type == "keyword a") return cont(pushlex("form"), expression, statement, poplex);
if (type == "keyword b") return cont(pushlex("form"), statement, poplex);
if (type == "{") return cont(pushlex("}"), block, poplex);
if (type == ";") return cont();
if (type == "function") return cont(functiondef);
if (type == "for") return cont(pushlex("form"), expect("("), pushlex(")"), forspec1, expect(")"),
poplex, statement, poplex);
if (type == "variable") return cont(pushlex("stat"), maybelabel);
if (type == "switch") return cont(pushlex("form"), expression, pushlex("}", "switch"), expect("{"),
block, poplex, poplex);
if (type == "case") return cont(expression, expect(":"));
if (type == "default") return cont(expect(":"));
if (type == "catch") return cont(pushlex("form"), pushcontext, expect("("), funarg, expect(")"),
statement, poplex, popcontext);
return pass(pushlex("stat"), expression, expect(";"), poplex);
}
function expression(type) {
if (atomicTypes.hasOwnProperty(type)) return cont(maybeoperator);
if (type == "function") return cont(functiondef);
if (type == "keyword c") return cont(maybeexpression);
if (type == "(") return cont(pushlex(")"), maybeexpression, expect(")"), poplex, maybeoperator);
if (type == "operator") return cont(expression);
if (type == "[") return cont(pushlex("]"), commasep(expression, "]"), poplex, maybeoperator);
if (type == "{") return cont(pushlex("}"), commasep(objprop, "}"), poplex, maybeoperator);
return cont();
}
function maybeexpression(type) {
if (type.match(/[;\}\)\],]/)) return pass();
return pass(expression);
}
function maybeoperator(type, value) {
if (type == "operator" && /\+\+|--/.test(value)) return cont(maybeoperator);
if (type == "operator" || type == ":") return cont(expression);
if (type == ";") return;
if (type == "(") return cont(pushlex(")"), commasep(expression, ")"), poplex, maybeoperator);
if (type == ".") return cont(property, maybeoperator);
if (type == "[") return cont(pushlex("]"), expression, expect("]"), poplex, maybeoperator);
}
function maybelabel(type) {
if (type == ":") return cont(poplex, statement);
return pass(maybeoperator, expect(";"), poplex);
}
function property(type) {
if (type == "variable") {cx.marked = "property"; return cont();}
}
function objprop(type) {
if (type == "variable") cx.marked = "property";
if (atomicTypes.hasOwnProperty(type)) return cont(expect(":"), expression);
}
function commasep(what, end) {
function proceed(type) {
if (type == ",") return cont(what, proceed);
if (type == end) return cont();
return cont(expect(end));
}
return function commaSeparated(type) {
if (type == end) return cont();
else return pass(what, proceed);
};
}
function block(type) {
if (type == "}") return cont();
return pass(statement, block);
}
function vardef1(type, value) {
if (type == "variable"){register(value); return cont(vardef2);}
return cont();
}
function vardef2(type, value) {
if (value == "=") return cont(expression, vardef2);
if (type == ",") return cont(vardef1);
}
function forspec1(type) {
if (type == "var") return cont(vardef1, forspec2);
if (type == ";") return pass(forspec2);
if (type == "variable") return cont(formaybein);
return pass(forspec2);
}
function formaybein(type, value) {
if (value == "in") return cont(expression);
return cont(maybeoperator, forspec2);
}
function forspec2(type, value) {
if (type == ";") return cont(forspec3);
if (value == "in") return cont(expression);
return cont(expression, expect(";"), forspec3);
}
function forspec3(type) {
if (type != ")") cont(expression);
}
function functiondef(type, value) {
if (type == "variable") {register(value); return cont(functiondef);}
if (type == "(") return cont(pushlex(")"), pushcontext, commasep(funarg, ")"), poplex, statement, popcontext);
}
function funarg(type, value) {
if (type == "variable") {register(value); return cont();}
}
// Interface
return {
startState: function(basecolumn) {
return {
tokenize: jsTokenBase,
reAllowed: true,
kwAllowed: true,
cc: [],
lexical: new JSLexical((basecolumn || 0) - indentUnit, 0, "block", false),
localVars: parserConfig.localVars,
context: parserConfig.localVars && {vars: parserConfig.localVars},
indented: 0
};
},
token: function(stream, state) {
if (stream.sol()) {
if (!state.lexical.hasOwnProperty("align"))
state.lexical.align = false;
state.indented = stream.indentation();
}
if (stream.eatSpace()) return null;
var style = state.tokenize(stream, state);
if (type == "comment") return style;
state.reAllowed = !!(type == "operator" || type == "keyword c" || type.match(/^[\[{}\(,;:]$/));
state.kwAllowed = type != '.';
return parseJS(state, style, type, content, stream);
},
indent: function(state, textAfter) {
if (state.tokenize != jsTokenBase) return 0;
var firstChar = textAfter && textAfter.charAt(0), lexical = state.lexical;
if (lexical.type == "stat" && firstChar == "}") lexical = lexical.prev;
var type = lexical.type, closing = firstChar == type;
if (type == "vardef") return lexical.indented + 4;
else if (type == "form" && firstChar == "{") return lexical.indented;
else if (type == "stat" || type == "form") return lexical.indented + indentUnit;
else if (lexical.info == "switch" && !closing)
return lexical.indented + (/^(?:case|default)\b/.test(textAfter) ? indentUnit : 2 * indentUnit);
else if (lexical.align) return lexical.column + (closing ? 0 : 1);
else return lexical.indented + (closing ? 0 : indentUnit);
},
electricChars: ":{}"
};
});
CodeMirror.defineMIME("text/javascript", "javascript");
CodeMirror.defineMIME("application/json", {name: "javascript", json: true});

View File

@ -0,0 +1,37 @@
<!doctype html>
<html>
<head>
<title>CodeMirror: Jinja2 mode</title>
<link rel="stylesheet" href="../../lib/codemirror.css">
<script src="../../lib/codemirror.js"></script>
<script src="jinja2.js"></script>
<style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
<link rel="stylesheet" href="../../doc/docs.css">
</head>
<body>
<h1>CodeMirror: Jinja2 mode</h1>
<form><textarea id="code" name="code">
&lt;html style="color: green"&gt;
&lt;!-- this is a comment --&gt;
&lt;head&gt;
&lt;title&gt;Jinja2 Example&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;ul&gt;
{# this is a comment #}
{%- for item in li -%}
&lt;li&gt;
{{ item.label }}
&lt;/li&gt;
{% endfor -%}
&lt;/ul&gt;
&lt;/body&gt;
&lt;/html&gt;
</textarea></form>
<script>
var editor =
CodeMirror.fromTextArea(document.getElementById("code"), {mode:
{name: "jinja2", htmlMode: true}});
</script>
</body>
</html>

View File

@ -0,0 +1,42 @@
CodeMirror.defineMode("jinja2", function(config, parserConf) {
var keywords = ["block", "endblock", "for", "endfor", "in", "true", "false",
"loop", "none", "self", "super", "if", "as", "not", "and",
"else", "import", "with", "without", "context"];
keywords = new RegExp("^((" + keywords.join(")|(") + "))\\b");
function tokenBase (stream, state) {
var ch = stream.next();
if (ch == "{") {
if (ch = stream.eat(/\{|%|#/)) {
stream.eat("-");
state.tokenize = inTag(ch);
return "tag";
}
}
}
function inTag (close) {
if (close == "{") {
close = "}";
}
return function (stream, state) {
var ch = stream.next();
if ((ch == close || (ch == "-" && stream.eat(close)))
&& stream.eat("}")) {
state.tokenize = tokenBase;
return "tag";
}
if (stream.match(keywords)) {
return "keyword";
}
return close == "#" ? "comment" : "string";
};
}
return {
startState: function () {
return {tokenize: tokenBase};
},
token: function (stream, state) {
return state.tokenize(stream, state);
}
};
});

View File

@ -0,0 +1,618 @@
<!doctype html>
<html>
<head>
<title>CodeMirror: LESS mode</title>
<link rel="stylesheet" href="../../lib/codemirror.css">
<script src="../../lib/codemirror.js"></script>
<script src="less.js"></script>
<style>.CodeMirror {background: #f8f8f8; border: 1px solid #ddd; font-size:12px} .CodeMirror-scroll {height: 400px}</style>
<link rel="stylesheet" href="../../doc/docs.css">
<link rel="stylesheet" href="../../theme/lesser-dark.css">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<h1>CodeMirror: LESS mode</h1>
<form><textarea id="code" name="code">/* Some LESS code */
button {
width: 32px;
height: 32px;
border: 0;
margin: 4px;
cursor: pointer;
}
button.icon-plus { background: url(http://dahlström.net/tmp/sharp-icons/svg-icon-target.svg#plus) no-repeat; }
button.icon-chart { background: url(http://dahlström.net/tmp/sharp-icons/svg-icon-target.svg#chart) no-repeat; }
button:hover { background-color: #999; }
button:active { background-color: #666; }
@test_a: #eeeQQQ;//this is not a valid hex value and thus parsed as an element id
@test_b: #eeeFFF //this is a valid hex value but the declaration doesn't end with a semicolon and thus parsed as an element id
#eee aaa .box
{
#test bbb {
width: 500px;
height: 250px;
background-image: url(dir/output/sheep.png), url( betweengrassandsky.png );
background-position: center bottom, left top;
background-repeat: no-repeat;
}
}
@base: #f938ab;
.box-shadow(@style, @c) when (iscolor(@c)) {
box-shadow: @style @c;
-webkit-box-shadow: @style @c;
-moz-box-shadow: @style @c;
}
.box-shadow(@style, @alpha: 50%) when (isnumber(@alpha)) {
.box-shadow(@style, rgba(0, 0, 0, @alpha));
}
@color: #4D926F;
#header {
color: @color;
color: #000000;
}
h2 {
color: @color;
}
.rounded-corners (@radius: 5px) {
border-radius: @radius;
-webkit-border-radius: @radius;
-moz-border-radius: @radius;
}
#header {
.rounded-corners;
}
#footer {
.rounded-corners(10px);
}
.box-shadow (@x: 0, @y: 0, @blur: 1px, @alpha) {
@val: @x @y @blur rgba(0, 0, 0, @alpha);
box-shadow: @val;
-webkit-box-shadow: @val;
-moz-box-shadow: @val;
}
.box { @base: #f938ab;
color: saturate(@base, 5%);
border-color: lighten(@base, 30%);
div { .box-shadow(0, 0, 5px, 0.4) }
}
@import url("something.css");
@light-blue: hsl(190, 50%, 65%);
@light-yellow: desaturate(#fefec8, 10%);
@dark-yellow: desaturate(darken(@light-yellow, 10%), 40%);
@darkest: hsl(20, 0%, 15%);
@dark: hsl(190, 20%, 30%);
@medium: hsl(10, 60%, 30%);
@light: hsl(90, 40%, 20%);
@lightest: hsl(90, 20%, 90%);
@highlight: hsl(80, 50%, 90%);
@blue: hsl(210, 60%, 20%);
@alpha-blue: hsla(210, 60%, 40%, 0.5);
.box-shadow (@x, @y, @blur, @alpha) {
@value: @x @y @blur rgba(0, 0, 0, @alpha);
box-shadow: @value;
-moz-box-shadow: @value;
-webkit-box-shadow: @value;
}
.border-radius (@radius) {
border-radius: @radius;
-moz-border-radius: @radius;
-webkit-border-radius: @radius;
}
.border-radius (@radius, bottom) {
border-top-right-radius: 0;
border-top-left-radius: 0;
-moz-border-top-right-radius: 0;
-moz-border-top-left-radius: 0;
-webkit-border-top-left-radius: 0;
-webkit-border-top-right-radius: 0;
}
.border-radius (@radius, right) {
border-bottom-left-radius: 0;
border-top-left-radius: 0;
-moz-border-bottom-left-radius: 0;
-moz-border-top-left-radius: 0;
-webkit-border-bottom-left-radius: 0;
-webkit-border-top-left-radius: 0;
}
.box-shadow-inset (@x, @y, @blur, @color) {
box-shadow: @x @y @blur @color inset;
-moz-box-shadow: @x @y @blur @color inset;
-webkit-box-shadow: @x @y @blur @color inset;
}
.code () {
font-family: 'Bitstream Vera Sans Mono',
'DejaVu Sans Mono',
'Monaco',
Courier,
monospace !important;
}
.wrap () {
text-wrap: wrap;
white-space: pre-wrap; /* css-3 */
white-space: -moz-pre-wrap; /* Mozilla, since 1999 */
white-space: -pre-wrap; /* Opera 4-6 */
white-space: -o-pre-wrap; /* Opera 7 */
word-wrap: break-word; /* Internet Explorer 5.5+ */
}
html { margin: 0 }
body {
background-color: @darkest;
margin: 0 auto;
font-family: Arial, sans-serif;
font-size: 100%;
overflow-x: hidden;
}
nav, header, footer, section, article {
display: block;
}
a {
color: #b83000;
}
h1 a {
color: black;
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
h1, h2, h3, h4 {
margin: 0;
font-weight: normal;
}
ul, li {
list-style-type: none;
}
code { .code; }
code {
.string, .regexp { color: @dark }
.keyword { font-weight: bold }
.comment { color: rgba(0, 0, 0, 0.5) }
.number { color: @blue }
.class, .special { color: rgba(0, 50, 100, 0.8) }
}
pre {
padding: 0 30px;
.wrap;
}
blockquote {
font-style: italic;
}
body > footer {
text-align: left;
margin-left: 10px;
font-style: italic;
font-size: 18px;
color: #888;
}
#logo {
margin-top: 30px;
margin-bottom: 30px;
display: block;
width: 199px;
height: 81px;
background: url(/images/logo.png) no-repeat;
}
nav {
margin-left: 15px;
}
nav a, #dropdown li {
display: inline-block;
color: white;
line-height: 42px;
margin: 0;
padding: 0px 15px;
text-shadow: -1px -1px 1px rgba(0, 0, 0, 0.5);
text-decoration: none;
border: 2px solid transparent;
border-width: 0 2px;
&:hover {
.dark-red;
text-decoration: none;
}
}
.dark-red {
@red: @medium;
border: 2px solid darken(@red, 25%);
border-left-color: darken(@red, 15%);
border-right-color: darken(@red, 15%);
border-bottom: 0;
border-top: 0;
background-color: darken(@red, 10%);
}
.content {
margin: 0 auto;
width: 980px;
}
#menu {
position: absolute;
width: 100%;
z-index: 3;
clear: both;
display: block;
background-color: @blue;
height: 42px;
border-top: 2px solid lighten(@alpha-blue, 20%);
border-bottom: 2px solid darken(@alpha-blue, 25%);
.box-shadow(0, 1px, 8px, 0.6);
-moz-box-shadow: 0 0 0 #000; // Because firefox sucks.
&.docked {
background-color: hsla(210, 60%, 40%, 0.4);
}
&:hover {
background-color: @blue;
}
#dropdown {
margin: 0 0 0 117px;
padding: 0;
padding-top: 5px;
display: none;
width: 190px;
border-top: 2px solid @medium;
color: @highlight;
border: 2px solid darken(@medium, 25%);
border-left-color: darken(@medium, 15%);
border-right-color: darken(@medium, 15%);
border-top-width: 0;
background-color: darken(@medium, 10%);
ul {
padding: 0px;
}
li {
font-size: 14px;
display: block;
text-align: left;
padding: 0;
border: 0;
a {
display: block;
padding: 0px 15px;
text-decoration: none;
color: white;
&:hover {
background-color: darken(@medium, 15%);
text-decoration: none;
}
}
}
.border-radius(5px, bottom);
.box-shadow(0, 6px, 8px, 0.5);
}
}
#main {
margin: 0 auto;
width: 100%;
background-color: @light-blue;
border-top: 8px solid darken(@light-blue, 5%);
#intro {
background-color: lighten(@light-blue, 25%);
float: left;
margin-top: -8px;
margin-right: 5px;
height: 380px;
position: relative;
z-index: 2;
font-family: 'Droid Serif', 'Georgia';
width: 395px;
padding: 45px 20px 23px 30px;
border: 2px dashed darken(@light-blue, 10%);
.box-shadow(1px, 0px, 6px, 0.5);
border-bottom: 0;
border-top: 0;
#download { color: transparent; border: 0; float: left; display: inline-block; margin: 15px 0 15px -5px; }
#download img { display: inline-block}
#download-info {
code {
font-size: 13px;
}
color: @blue + #333; display: inline; float: left; margin: 36px 0 0 15px }
}
h2 {
span {
color: @medium;
}
color: @blue;
margin: 20px 0;
font-size: 24px;
line-height: 1.2em;
}
h3 {
color: @blue;
line-height: 1.4em;
margin: 30px 0 15px 0;
font-size: 1em;
text-shadow: 0px 0px 0px @lightest;
span { color: @medium }
}
#example {
p {
font-size: 18px;
color: @blue;
font-weight: bold;
text-shadow: 0px 1px 1px @lightest;
}
pre {
margin: 0;
text-shadow: 0 -1px 1px @darkest;
margin-top: 20px;
background-color: desaturate(@darkest, 8%);
border: 0;
width: 450px;
color: lighten(@lightest, 2%);
background-repeat: repeat;
padding: 15px;
border: 1px dashed @lightest;
line-height: 15px;
.box-shadow(0, 0px, 15px, 0.5);
.code;
.border-radius(2px);
code .attribute { color: hsl(40, 50%, 70%) }
code .variable { color: hsl(120, 10%, 50%) }
code .element { color: hsl(170, 20%, 50%) }
code .string, .regexp { color: hsl(75, 50%, 65%) }
code .class { color: hsl(40, 40%, 60%); font-weight: normal }
code .id { color: hsl(50, 40%, 60%); font-weight: normal }
code .comment { color: rgba(255, 255, 255, 0.2) }
code .number, .color { color: hsl(10, 40%, 50%) }
code .class, code .mixin, .special { color: hsl(190, 20%, 50%) }
#time { color: #aaa }
}
float: right;
font-size: 12px;
margin: 0;
margin-top: 15px;
padding: 0;
width: 500px;
}
}
.page {
.content {
width: 870px;
padding: 45px;
}
margin: 0 auto;
font-family: 'Georgia', serif;
font-size: 18px;
line-height: 26px;
padding: 0 60px;
code {
font-size: 16px;
}
pre {
border-width: 1px;
border-style: dashed;
padding: 15px;
margin: 15px 0;
}
h1 {
text-align: left;
font-size: 40px;
margin-top: 15px;
margin-bottom: 35px;
}
p + h1 { margin-top: 60px }
h2, h3 {
margin: 30px 0 15px 0;
}
p + h2, pre + h2, code + h2 {
border-top: 6px solid rgba(255, 255, 255, 0.1);
padding-top: 30px;
}
h3 {
margin: 15px 0;
}
}
#docs {
@bg: lighten(@light-blue, 5%);
border-top: 2px solid lighten(@bg, 5%);
color: @blue;
background-color: @light-blue;
.box-shadow(0, -2px, 5px, 0.2);
h1 {
font-family: 'Droid Serif', 'Georgia', serif;
padding-top: 30px;
padding-left: 45px;
font-size: 44px;
text-align: left;
margin: 30px 0 !important;
text-shadow: 0px 1px 1px @lightest;
font-weight: bold;
}
.content {
clear: both;
border-color: transparent;
background-color: lighten(@light-blue, 25%);
.box-shadow(0, 5px, 5px, 0.4);
}
pre {
@background: lighten(@bg, 30%);
color: lighten(@blue, 10%);
background-color: @background;
border-color: lighten(@light-blue, 25%);
border-width: 2px;
code .attribute { color: hsl(40, 50%, 30%) }
code .variable { color: hsl(120, 10%, 30%) }
code .element { color: hsl(170, 20%, 30%) }
code .string, .regexp { color: hsl(75, 50%, 35%) }
code .class { color: hsl(40, 40%, 30%); font-weight: normal }
code .id { color: hsl(50, 40%, 30%); font-weight: normal }
code .comment { color: rgba(0, 0, 0, 0.4) }
code .number, .color { color: hsl(10, 40%, 30%) }
code .class, code .mixin, .special { color: hsl(190, 20%, 30%) }
}
pre code { font-size: 15px }
p + h2, pre + h2, code + h2 { border-top-color: rgba(0, 0, 0, 0.1) }
}
td {
padding-right: 30px;
}
#synopsis {
.box-shadow(0, 5px, 5px, 0.2);
}
#synopsis, #about {
h2 {
font-size: 30px;
padding: 10px 0;
}
h1 + h2 {
margin-top: 15px;
}
h3 { font-size: 22px }
.code-example {
border-spacing: 0;
border-width: 1px;
border-style: dashed;
padding: 0;
pre { border: 0; margin: 0 }
td {
border: 0;
margin: 0;
background-color: desaturate(darken(@darkest, 5%), 20%);
vertical-align: top;
padding: 0;
}
tr { padding: 0 }
}
.css-output {
td {
border-left: 0;
}
}
.less-example {
//border-right: 1px dotted rgba(255, 255, 255, 0.5) !important;
}
.css-output, .less-example {
width: 390px;
}
pre {
padding: 20px;
line-height: 20px;
font-size: 14px;
}
}
#about, #synopsis, #guide {
a {
text-decoration: none;
color: @light-yellow;
border-bottom: 1px dashed rgba(255, 255, 255, 0.2);
&:hover {
text-decoration: none;
border-bottom: 1px dashed @light-yellow;
}
}
@bg: desaturate(darken(@darkest, 5%), 20%);
text-shadow: 0 -1px 1px lighten(@bg, 5%);
color: @highlight;
background-color: @bg;
.content {
background-color: desaturate(@darkest, 20%);
clear: both;
.box-shadow(0, 5px, 5px, 0.4);
}
h1, h2, h3 {
color: @dark-yellow;
}
pre {
code .attribute { color: hsl(40, 50%, 70%) }
code .variable { color: hsl(120, 10%, 50%) }
code .element { color: hsl(170, 20%, 50%) }
code .string, .regexp { color: hsl(75, 50%, 65%) }
code .class { color: hsl(40, 40%, 60%); font-weight: normal }
code .id { color: hsl(50, 40%, 60%); font-weight: normal }
code .comment { color: rgba(255, 255, 255, 0.2) }
code .number, .color { color: hsl(10, 40%, 50%) }
code .class, code .mixin, .special { color: hsl(190, 20%, 50%) }
background-color: @bg;
border-color: darken(@light-yellow, 5%);
}
code {
color: darken(@dark-yellow, 5%);
.string, .regexp { color: desaturate(@light-blue, 15%) }
.keyword { color: hsl(40, 40%, 60%); font-weight: normal }
.comment { color: rgba(255, 255, 255, 0.2) }
.number { color: lighten(@blue, 10%) }
.class, .special { color: hsl(190, 20%, 50%) }
}
}
#guide {
background-color: @darkest;
.content {
background-color: transparent;
}
}
#about {
background-color: @darkest !important;
.content {
background-color: desaturate(lighten(@darkest, 3%), 5%);
}
}
#synopsis {
background-color: desaturate(lighten(@darkest, 3%), 5%) !important;
.content {
background-color: desaturate(lighten(@darkest, 3%), 5%);
}
pre {}
}
#synopsis, #guide {
.content {
.box-shadow(0, 0px, 0px, 0.0);
}
}
#about footer {
margin-top: 30px;
padding-top: 30px;
border-top: 6px solid rgba(0, 0, 0, 0.1);
text-align: center;
font-size: 16px;
color: rgba(255, 255, 255, 0.35);
#copy { font-size: 12px }
text-shadow: -1px -1px 1px rgba(0, 0, 0, 0.02);
}
</textarea></form>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
theme: "lesser-dark",
lineNumbers : true,
matchBrackets : true
});
</script>
<p><strong>MIME types defined:</strong> <code>text/x-less</code>, <code>text/css</code> (if not previously defined).</p>
</body>
</html>

View File

@ -0,0 +1,232 @@
/*
LESS mode - http://www.lesscss.org/
Ported to CodeMirror by Peter Kroon
*/
CodeMirror.defineMode("less", function(config) {
var indentUnit = config.indentUnit, type;
function ret(style, tp) {type = tp; return style;}
//html5 tags
var tags = ["a","abbr","acronym","address","applet","area","article","aside","audio","b","base","basefont","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","command","datalist","dd","del","details","dfn","dir","div","dl","dt","em","embed","fieldset","figcaption","figure","font","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","keygen","kbd","label","legend","li","link","map","mark","menu","meta","meter","nav","noframes","noscript","object","ol","optgroup","option","output","p","param","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strike","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","tt","u","ul","var","video","wbr"];
function inTagsArray(val){
for(var i=0; i<tags.length; i++){
if(val === tags[i]){
return true;
}
}
}
function tokenBase(stream, state) {
var ch = stream.next();
if (ch == "@") {stream.eatWhile(/[\w\-]/); return ret("meta", stream.current());}
else if (ch == "/" && stream.eat("*")) {
state.tokenize = tokenCComment;
return tokenCComment(stream, state);
}
else if (ch == "<" && stream.eat("!")) {
state.tokenize = tokenSGMLComment;
return tokenSGMLComment(stream, state);
}
else if (ch == "=") ret(null, "compare");
else if ((ch == "~" || ch == "|") && stream.eat("=")) return ret(null, "compare");
else if (ch == "\"" || ch == "'") {
state.tokenize = tokenString(ch);
return state.tokenize(stream, state);
}
else if (ch == "/") { // lesscss e.g.: .png will not be parsed as a class
if(stream.eat("/")){
state.tokenize = tokenSComment
return tokenSComment(stream, state);
}else{
stream.eatWhile(/[\a-zA-Z0-9\-_.\s]/);
if(/\/|\)|#/.test(stream.peek() || stream.eol() || (stream.eatSpace() && stream.peek() == ")")))return ret("string", "string");//let url(/images/logo.png) without quotes return as string
return ret("number", "unit");
}
}
else if (ch == "!") {
stream.match(/^\s*\w*/);
return ret("keyword", "important");
}
else if (/\d/.test(ch)) {
stream.eatWhile(/[\w.%]/);
return ret("number", "unit");
}
else if (/[,+<>*\/]/.test(ch)) {//removed . dot character original was [,.+>*\/]
return ret(null, "select-op");
}
else if (/[;{}:\[\]()]/.test(ch)) { //added () char for lesscss original was [;{}:\[\]]
if(ch == ":"){
stream.eatWhile(/[active|hover|link|visited]/);
if( stream.current().match(/active|hover|link|visited/)){
return ret("tag", "tag");
}else{
return ret(null, ch);
}
}else{
return ret(null, ch);
}
}
else if (ch == ".") { // lesscss
stream.eatWhile(/[\a-zA-Z0-9\-_]/);
return ret("tag", "tag");
}
else if (ch == "#") { // lesscss
//we don't eat white-space, we want the hex color and or id only
stream.eatWhile(/[A-Za-z0-9]/);
//check if there is a proper hex color length e.g. #eee || #eeeEEE
if(stream.current().length ===4 || stream.current().length ===7){
if(stream.current().match(/[A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}/,false) != null){//is there a valid hex color value present in the current stream
//when not a valid hex value, parse as id
if(stream.current().substring(1) != stream.current().match(/[A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}/,false))return ret("atom", "tag");
//eat white-space
stream.eatSpace();
//when hex value declaration doesn't end with [;,] but is does with a slash/cc comment treat it as an id, just like the other hex values that don't end with[;,]
if( /[\/<>.(){!$%^&*_\-\\?=+\|#'~`]/.test(stream.peek()) )return ret("atom", "tag");
//#time { color: #aaa }
else if(stream.peek() == "}" )return ret("number", "unit");
//we have a valid hex color value, parse as id whenever an element/class is defined after the hex(id) value e.g. #eee aaa || #eee .aaa
else if( /[a-zA-Z\\]/.test(stream.peek()) )return ret("atom", "tag");
//when a hex value is on the end of a line, parse as id
else if(stream.eol())return ret("atom", "tag");
//default
else return ret("number", "unit");
}else{//when not a valid hexvalue in the current stream e.g. #footer
stream.eatWhile(/[\w\\\-]/);
return ret("atom", "tag");
}
}else{
stream.eatWhile(/[\w\\\-]/);
return ret("atom", "tag");
}
}
else if (ch == "&") {
stream.eatWhile(/[\w\-]/);
return ret(null, ch);
}
else {
stream.eatWhile(/[\w\\\-_%.{]/);
if(stream.current().match(/http|https/) != null){
stream.eatWhile(/[\w\\\-_%.{:\/]/);
return ret("string", "string");
}else if(stream.peek() == "<" || stream.peek() == ">"){
return ret("tag", "tag");
}else if( stream.peek().match(/\(/) != null ){// lessc
return ret(null, ch);
}else if (stream.peek() == "/" && state.stack[state.stack.length-1] != undefined){ // url(dir/center/image.png)
return ret("string", "string");
}else if( stream.current().match(/\-\d|\-.\d/) ){ // lesscss match e.g.: -5px -0.4 etc... only colorize the minus sign
//stream.backUp(stream.current().length-1); //commment out these 2 comment if you want the minus sign to be parsed as null -500px
//return ret(null, ch);
return ret("number", "unit");
}else if( inTagsArray(stream.current()) ){ // lesscss match html tags
return ret("tag", "tag");
}else if( /\/|[\s\)]/.test(stream.peek() || stream.eol() || (stream.eatSpace() && stream.peek() == "/")) && stream.current().indexOf(".") !== -1){
if(stream.current().substring(stream.current().length-1,stream.current().length) == "{"){
stream.backUp(1);
return ret("tag", "tag");
}//end if
if( (stream.eatSpace() && stream.peek().match(/[{<>.a-zA-Z]/) != null) || stream.eol() )return ret("tag", "tag");//e.g. button.icon-plus
return ret("string", "string");//let url(/images/logo.png) without quotes return as string
}else if( stream.eol() ){
if(stream.current().substring(stream.current().length-1,stream.current().length) == "{")stream.backUp(1);
return ret("tag", "tag");
}else{
return ret("variable", "variable");
}
}
}
function tokenSComment(stream, state) {// SComment = Slash comment
stream.skipToEnd();
state.tokenize = tokenBase;
return ret("comment", "comment");
}
function tokenCComment(stream, state) {
var maybeEnd = false, ch;
while ((ch = stream.next()) != null) {
if (maybeEnd && ch == "/") {
state.tokenize = tokenBase;
break;
}
maybeEnd = (ch == "*");
}
return ret("comment", "comment");
}
function tokenSGMLComment(stream, state) {
var dashes = 0, ch;
while ((ch = stream.next()) != null) {
if (dashes >= 2 && ch == ">") {
state.tokenize = tokenBase;
break;
}
dashes = (ch == "-") ? dashes + 1 : 0;
}
return ret("comment", "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 ret("string", "string");
};
}
return {
startState: function(base) {
return {tokenize: tokenBase,
baseIndent: base || 0,
stack: []};
},
token: function(stream, state) {
if (stream.eatSpace()) return null;
var style = state.tokenize(stream, state);
var context = state.stack[state.stack.length-1];
if (type == "hash" && context == "rule") style = "atom";
else if (style == "variable") {
if (context == "rule") style = null; //"tag"
else if (!context || context == "@media{"){
style = stream.current() == "when" ? "variable" :
stream.string.match(/#/g) != undefined ? null :
/[\s,|\s\)]/.test(stream.peek()) ? "tag" : null;
}
}
if (context == "rule" && /^[\{\};]$/.test(type))
state.stack.pop();
if (type == "{") {
if (context == "@media") state.stack[state.stack.length-1] = "@media{";
else state.stack.push("{");
}
else if (type == "}") state.stack.pop();
else if (type == "@media") state.stack.push("@media");
else if (context == "{" && type != "comment") state.stack.push("rule");
return style;
},
indent: function(state, textAfter) {
var n = state.stack.length;
if (/^\}/.test(textAfter))
n -= state.stack[state.stack.length-1] == "rule" ? 2 : 1;
return state.baseIndent + n * indentUnit;
},
electricChars: "}"
};
});
CodeMirror.defineMIME("text/x-less", "less");
if (!CodeMirror.mimeModes.hasOwnProperty("text/css"))
CodeMirror.defineMIME("text/css", "less");

View File

@ -0,0 +1,72 @@
<!doctype html>
<html>
<head>
<title>CodeMirror: Lua mode</title>
<link rel="stylesheet" href="../../lib/codemirror.css">
<script src="../../lib/codemirror.js"></script>
<script src="lua.js"></script>
<link rel="stylesheet" href="../../theme/neat.css">
<style>.CodeMirror {border: 1px solid black;}</style>
<link rel="stylesheet" href="../../doc/docs.css">
</head>
<body>
<h1>CodeMirror: Lua mode</h1>
<form><textarea id="code" name="code">
--[[
example useless code to show lua syntax highlighting
this is multiline comment
]]
function blahblahblah(x)
local table = {
"asd" = 123,
"x" = 0.34,
}
if x ~= 3 then
print( x )
elseif x == "string"
my_custom_function( 0x34 )
else
unknown_function( "some string" )
end
--single line comment
end
function blablabla3()
for k,v in ipairs( table ) do
--abcde..
y=[=[
x=[[
x is a multi line string
]]
but its definition is iside a highest level string!
]=]
print(" \"\" ")
s = math.sin( x )
end
end
</textarea></form>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
tabMode: "indent",
matchBrackets: true,
theme: "neat"
});
</script>
<p>Loosely based on Franciszek
Wawrzak's <a href="http://codemirror.net/1/contrib/lua">CodeMirror
1 mode</a>. One configuration parameter is
supported, <code>specials</code>, to which you can provide an
array of strings to have those identifiers highlighted with
the <code>lua-special</code> style.</p>
<p><strong>MIME types defined:</strong> <code>text/x-lua</code>.</p>
</body>
</html>

View File

@ -0,0 +1,140 @@
// LUA mode. Ported to CodeMirror 2 from Franciszek Wawrzak's
// CodeMirror 1 mode.
// highlights keywords, strings, comments (no leveling supported! ("[==[")), tokens, basic indenting
CodeMirror.defineMode("lua", function(config, parserConfig) {
var indentUnit = config.indentUnit;
function prefixRE(words) {
return new RegExp("^(?:" + words.join("|") + ")", "i");
}
function wordRE(words) {
return new RegExp("^(?:" + words.join("|") + ")$", "i");
}
var specials = wordRE(parserConfig.specials || []);
// long list of standard functions from lua manual
var builtins = wordRE([
"_G","_VERSION","assert","collectgarbage","dofile","error","getfenv","getmetatable","ipairs","load",
"loadfile","loadstring","module","next","pairs","pcall","print","rawequal","rawget","rawset","require",
"select","setfenv","setmetatable","tonumber","tostring","type","unpack","xpcall",
"coroutine.create","coroutine.resume","coroutine.running","coroutine.status","coroutine.wrap","coroutine.yield",
"debug.debug","debug.getfenv","debug.gethook","debug.getinfo","debug.getlocal","debug.getmetatable",
"debug.getregistry","debug.getupvalue","debug.setfenv","debug.sethook","debug.setlocal","debug.setmetatable",
"debug.setupvalue","debug.traceback",
"close","flush","lines","read","seek","setvbuf","write",
"io.close","io.flush","io.input","io.lines","io.open","io.output","io.popen","io.read","io.stderr","io.stdin",
"io.stdout","io.tmpfile","io.type","io.write",
"math.abs","math.acos","math.asin","math.atan","math.atan2","math.ceil","math.cos","math.cosh","math.deg",
"math.exp","math.floor","math.fmod","math.frexp","math.huge","math.ldexp","math.log","math.log10","math.max",
"math.min","math.modf","math.pi","math.pow","math.rad","math.random","math.randomseed","math.sin","math.sinh",
"math.sqrt","math.tan","math.tanh",
"os.clock","os.date","os.difftime","os.execute","os.exit","os.getenv","os.remove","os.rename","os.setlocale",
"os.time","os.tmpname",
"package.cpath","package.loaded","package.loaders","package.loadlib","package.path","package.preload",
"package.seeall",
"string.byte","string.char","string.dump","string.find","string.format","string.gmatch","string.gsub",
"string.len","string.lower","string.match","string.rep","string.reverse","string.sub","string.upper",
"table.concat","table.insert","table.maxn","table.remove","table.sort"
]);
var keywords = wordRE(["and","break","elseif","false","nil","not","or","return",
"true","function", "end", "if", "then", "else", "do",
"while", "repeat", "until", "for", "in", "local" ]);
var indentTokens = wordRE(["function", "if","repeat","do", "\\(", "{"]);
var dedentTokens = wordRE(["end", "until", "\\)", "}"]);
var dedentPartial = prefixRE(["end", "until", "\\)", "}", "else", "elseif"]);
function readBracket(stream) {
var level = 0;
while (stream.eat("=")) ++level;
stream.eat("[");
return level;
}
function normal(stream, state) {
var ch = stream.next();
if (ch == "-" && stream.eat("-")) {
if (stream.eat("["))
return (state.cur = bracketed(readBracket(stream), "comment"))(stream, state);
stream.skipToEnd();
return "comment";
}
if (ch == "\"" || ch == "'")
return (state.cur = string(ch))(stream, state);
if (ch == "[" && /[\[=]/.test(stream.peek()))
return (state.cur = bracketed(readBracket(stream), "string"))(stream, state);
if (/\d/.test(ch)) {
stream.eatWhile(/[\w.%]/);
return "number";
}
if (/[\w_]/.test(ch)) {
stream.eatWhile(/[\w\\\-_.]/);
return "variable";
}
return null;
}
function bracketed(level, style) {
return function(stream, state) {
var curlev = null, ch;
while ((ch = stream.next()) != null) {
if (curlev == null) {if (ch == "]") curlev = 0;}
else if (ch == "=") ++curlev;
else if (ch == "]" && curlev == level) { state.cur = normal; break; }
else curlev = null;
}
return style;
};
}
function string(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.cur = normal;
return "string";
};
}
return {
startState: function(basecol) {
return {basecol: basecol || 0, indentDepth: 0, cur: normal};
},
token: function(stream, state) {
if (stream.eatSpace()) return null;
var style = state.cur(stream, state);
var word = stream.current();
if (style == "variable") {
if (keywords.test(word)) style = "keyword";
else if (builtins.test(word)) style = "builtin";
else if (specials.test(word)) style = "variable-2";
}
if ((style != "comment") && (style != "string")){
if (indentTokens.test(word)) ++state.indentDepth;
else if (dedentTokens.test(word)) --state.indentDepth;
}
return style;
},
indent: function(state, textAfter) {
var closing = dedentPartial.test(textAfter);
return state.basecol + indentUnit * (state.indentDepth - (closing ? 1 : 0));
}
};
});
CodeMirror.defineMIME("text/x-lua", "lua");

View File

@ -0,0 +1,338 @@
<!doctype html>
<html>
<head>
<title>CodeMirror: Markdown mode</title>
<link rel="stylesheet" href="../../lib/codemirror.css">
<script src="../../lib/codemirror.js"></script>
<script src="../xml/xml.js"></script>
<script src="markdown.js"></script>
<style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
<link rel="stylesheet" href="../../doc/docs.css">
</head>
<body>
<h1>CodeMirror: Markdown mode</h1>
<!-- source: http://daringfireball.net/projects/markdown/basics.text -->
<form><textarea id="code" name="code">
Markdown: Basics
================
&lt;ul id="ProjectSubmenu"&gt;
&lt;li&gt;&lt;a href="/projects/markdown/" title="Markdown Project Page"&gt;Main&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="selected" title="Markdown Basics"&gt;Basics&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="/projects/markdown/syntax" title="Markdown Syntax Documentation"&gt;Syntax&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="/projects/markdown/license" title="Pricing and License Information"&gt;License&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="/projects/markdown/dingus" title="Online Markdown Web Form"&gt;Dingus&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
Getting the Gist of Markdown's Formatting Syntax
------------------------------------------------
This page offers a brief overview of what it's like to use Markdown.
The [syntax page] [s] provides complete, detailed documentation for
every feature, but Markdown should be very easy to pick up simply by
looking at a few examples of it in action. The examples on this page
are written in a before/after style, showing example syntax and the
HTML output produced by Markdown.
It's also helpful to simply try Markdown out; the [Dingus] [d] is a
web application that allows you type your own Markdown-formatted text
and translate it to XHTML.
**Note:** This document is itself written using Markdown; you
can [see the source for it by adding '.text' to the URL] [src].
[s]: /projects/markdown/syntax "Markdown Syntax"
[d]: /projects/markdown/dingus "Markdown Dingus"
[src]: /projects/markdown/basics.text
## Paragraphs, Headers, Blockquotes ##
A paragraph is simply one or more consecutive lines of text, separated
by one or more blank lines. (A blank line is any line that looks like
a blank line -- a line containing nothing but spaces or tabs is
considered blank.) Normal paragraphs should not be indented with
spaces or tabs.
Markdown offers two styles of headers: *Setext* and *atx*.
Setext-style headers for `&lt;h1&gt;` and `&lt;h2&gt;` are created by
"underlining" with equal signs (`=`) and hyphens (`-`), respectively.
To create an atx-style header, you put 1-6 hash marks (`#`) at the
beginning of the line -- the number of hashes equals the resulting
HTML header level.
Blockquotes are indicated using email-style '`&gt;`' angle brackets.
Markdown:
A First Level Header
====================
A Second Level Header
---------------------
Now is the time for all good men to come to
the aid of their country. This is just a
regular paragraph.
The quick brown fox jumped over the lazy
dog's back.
### Header 3
&gt; This is a blockquote.
&gt;
&gt; This is the second paragraph in the blockquote.
&gt;
&gt; ## This is an H2 in a blockquote
Output:
&lt;h1&gt;A First Level Header&lt;/h1&gt;
&lt;h2&gt;A Second Level Header&lt;/h2&gt;
&lt;p&gt;Now is the time for all good men to come to
the aid of their country. This is just a
regular paragraph.&lt;/p&gt;
&lt;p&gt;The quick brown fox jumped over the lazy
dog's back.&lt;/p&gt;
&lt;h3&gt;Header 3&lt;/h3&gt;
&lt;blockquote&gt;
&lt;p&gt;This is a blockquote.&lt;/p&gt;
&lt;p&gt;This is the second paragraph in the blockquote.&lt;/p&gt;
&lt;h2&gt;This is an H2 in a blockquote&lt;/h2&gt;
&lt;/blockquote&gt;
### Phrase Emphasis ###
Markdown uses asterisks and underscores to indicate spans of emphasis.
Markdown:
Some of these words *are emphasized*.
Some of these words _are emphasized also_.
Use two asterisks for **strong emphasis**.
Or, if you prefer, __use two underscores instead__.
Output:
&lt;p&gt;Some of these words &lt;em&gt;are emphasized&lt;/em&gt;.
Some of these words &lt;em&gt;are emphasized also&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;Use two asterisks for &lt;strong&gt;strong emphasis&lt;/strong&gt;.
Or, if you prefer, &lt;strong&gt;use two underscores instead&lt;/strong&gt;.&lt;/p&gt;
## Lists ##
Unordered (bulleted) lists use asterisks, pluses, and hyphens (`*`,
`+`, and `-`) as list markers. These three markers are
interchangable; this:
* Candy.
* Gum.
* Booze.
this:
+ Candy.
+ Gum.
+ Booze.
and this:
- Candy.
- Gum.
- Booze.
all produce the same output:
&lt;ul&gt;
&lt;li&gt;Candy.&lt;/li&gt;
&lt;li&gt;Gum.&lt;/li&gt;
&lt;li&gt;Booze.&lt;/li&gt;
&lt;/ul&gt;
Ordered (numbered) lists use regular numbers, followed by periods, as
list markers:
1. Red
2. Green
3. Blue
Output:
&lt;ol&gt;
&lt;li&gt;Red&lt;/li&gt;
&lt;li&gt;Green&lt;/li&gt;
&lt;li&gt;Blue&lt;/li&gt;
&lt;/ol&gt;
If you put blank lines between items, you'll get `&lt;p&gt;` tags for the
list item text. You can create multi-paragraph list items by indenting
the paragraphs by 4 spaces or 1 tab:
* A list item.
With multiple paragraphs.
* Another item in the list.
Output:
&lt;ul&gt;
&lt;li&gt;&lt;p&gt;A list item.&lt;/p&gt;
&lt;p&gt;With multiple paragraphs.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Another item in the list.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
### Links ###
Markdown supports two styles for creating links: *inline* and
*reference*. With both styles, you use square brackets to delimit the
text you want to turn into a link.
Inline-style links use parentheses immediately after the link text.
For example:
This is an [example link](http://example.com/).
Output:
&lt;p&gt;This is an &lt;a href="http://example.com/"&gt;
example link&lt;/a&gt;.&lt;/p&gt;
Optionally, you may include a title attribute in the parentheses:
This is an [example link](http://example.com/ "With a Title").
Output:
&lt;p&gt;This is an &lt;a href="http://example.com/" title="With a Title"&gt;
example link&lt;/a&gt;.&lt;/p&gt;
Reference-style links allow you to refer to your links by names, which
you define elsewhere in your document:
I get 10 times more traffic from [Google][1] than from
[Yahoo][2] or [MSN][3].
[1]: http://google.com/ "Google"
[2]: http://search.yahoo.com/ "Yahoo Search"
[3]: http://search.msn.com/ "MSN Search"
Output:
&lt;p&gt;I get 10 times more traffic from &lt;a href="http://google.com/"
title="Google"&gt;Google&lt;/a&gt; than from &lt;a href="http://search.yahoo.com/"
title="Yahoo Search"&gt;Yahoo&lt;/a&gt; or &lt;a href="http://search.msn.com/"
title="MSN Search"&gt;MSN&lt;/a&gt;.&lt;/p&gt;
The title attribute is optional. Link names may contain letters,
numbers and spaces, but are *not* case sensitive:
I start my morning with a cup of coffee and
[The New York Times][NY Times].
[ny times]: http://www.nytimes.com/
Output:
&lt;p&gt;I start my morning with a cup of coffee and
&lt;a href="http://www.nytimes.com/"&gt;The New York Times&lt;/a&gt;.&lt;/p&gt;
### Images ###
Image syntax is very much like link syntax.
Inline (titles are optional):
![alt text](/path/to/img.jpg "Title")
Reference-style:
![alt text][id]
[id]: /path/to/img.jpg "Title"
Both of the above examples produce the same output:
&lt;img src="/path/to/img.jpg" alt="alt text" title="Title" /&gt;
### Code ###
In a regular paragraph, you can create code span by wrapping text in
backtick quotes. Any ampersands (`&amp;`) and angle brackets (`&lt;` or
`&gt;`) will automatically be translated into HTML entities. This makes
it easy to use Markdown to write about HTML example code:
I strongly recommend against using any `&lt;blink&gt;` tags.
I wish SmartyPants used named entities like `&amp;mdash;`
instead of decimal-encoded entites like `&amp;#8212;`.
Output:
&lt;p&gt;I strongly recommend against using any
&lt;code&gt;&amp;lt;blink&amp;gt;&lt;/code&gt; tags.&lt;/p&gt;
&lt;p&gt;I wish SmartyPants used named entities like
&lt;code&gt;&amp;amp;mdash;&lt;/code&gt; instead of decimal-encoded
entites like &lt;code&gt;&amp;amp;#8212;&lt;/code&gt;.&lt;/p&gt;
To specify an entire block of pre-formatted code, indent every line of
the block by 4 spaces or 1 tab. Just like with code spans, `&amp;`, `&lt;`,
and `&gt;` characters will be escaped automatically.
Markdown:
If you want your page to validate under XHTML 1.0 Strict,
you've got to put paragraph tags in your blockquotes:
&lt;blockquote&gt;
&lt;p&gt;For example.&lt;/p&gt;
&lt;/blockquote&gt;
Output:
&lt;p&gt;If you want your page to validate under XHTML 1.0 Strict,
you've got to put paragraph tags in your blockquotes:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&amp;lt;blockquote&amp;gt;
&amp;lt;p&amp;gt;For example.&amp;lt;/p&amp;gt;
&amp;lt;/blockquote&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
</textarea></form>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
mode: 'markdown',
lineNumbers: true,
matchBrackets: true,
theme: "default"
});
</script>
<p><strong>MIME types defined:</strong> <code>text/x-markdown</code>.</p>
</body>
</html>

View File

@ -0,0 +1,245 @@
CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
var htmlMode = CodeMirror.getMode(cmCfg, { name: 'xml', htmlMode: true });
var header = 'header'
, code = 'comment'
, quote = 'quote'
, list = 'string'
, hr = 'hr'
, linktext = 'link'
, linkhref = 'string'
, em = 'em'
, strong = 'strong'
, emstrong = 'emstrong';
var hrRE = /^([*\-=_])(?:\s*\1){2,}\s*$/
, ulRE = /^[*\-+]\s+/
, olRE = /^[0-9]+\.\s+/
, headerRE = /^(?:\={3,}|-{3,})$/
, textRE = /^[^\[*_\\<>`]+/;
function switchInline(stream, state, f) {
state.f = state.inline = f;
return f(stream, state);
}
function switchBlock(stream, state, f) {
state.f = state.block = f;
return f(stream, state);
}
// Blocks
function blankLine(state) {
// Reset EM state
state.em = false;
// Reset STRONG state
state.strong = false;
return null;
}
function blockNormal(stream, state) {
var match;
if (state.indentationDiff >= 4) {
state.indentation -= state.indentationDiff;
stream.skipToEnd();
return code;
} else if (stream.eatSpace()) {
return null;
} else if (stream.peek() === '#' || stream.match(headerRE)) {
state.header = true;
} else if (stream.eat('>')) {
state.indentation++;
state.quote = true;
} else if (stream.peek() === '[') {
return switchInline(stream, state, footnoteLink);
} else if (stream.match(hrRE, true)) {
return hr;
} else if (match = stream.match(ulRE, true) || stream.match(olRE, true)) {
state.indentation += match[0].length;
return list;
}
return switchInline(stream, state, state.inline);
}
function htmlBlock(stream, state) {
var style = htmlMode.token(stream, state.htmlState);
if (style === 'tag' && state.htmlState.type !== 'openTag' && !state.htmlState.context) {
state.f = inlineNormal;
state.block = blockNormal;
}
return style;
}
// Inline
function getType(state) {
var styles = [];
if (state.strong) { styles.push(state.em ? emstrong : strong); }
else if (state.em) { styles.push(em); }
if (state.header) { styles.push(header); }
if (state.quote) { styles.push(quote); }
return styles.length ? styles.join(' ') : null;
}
function handleText(stream, state) {
if (stream.match(textRE, true)) {
return getType(state);
}
return undefined;
}
function inlineNormal(stream, state) {
var style = state.text(stream, state)
if (typeof style !== 'undefined')
return style;
var ch = stream.next();
if (ch === '\\') {
stream.next();
return getType(state);
}
if (ch === '`') {
return switchInline(stream, state, inlineElement(code, '`'));
}
if (ch === '[') {
return switchInline(stream, state, linkText);
}
if (ch === '<' && stream.match(/^\w/, false)) {
stream.backUp(1);
return switchBlock(stream, state, htmlBlock);
}
var t = getType(state);
if (ch === '*' || ch === '_') {
if (stream.eat(ch)) {
return (state.strong = !state.strong) ? getType(state) : t;
}
return (state.em = !state.em) ? getType(state) : t;
}
return getType(state);
}
function linkText(stream, state) {
while (!stream.eol()) {
var ch = stream.next();
if (ch === '\\') stream.next();
if (ch === ']') {
state.inline = state.f = linkHref;
return linktext;
}
}
return linktext;
}
function linkHref(stream, state) {
stream.eatSpace();
var ch = stream.next();
if (ch === '(' || ch === '[') {
return switchInline(stream, state, inlineElement(linkhref, ch === '(' ? ')' : ']'));
}
return 'error';
}
function footnoteLink(stream, state) {
if (stream.match(/^[^\]]*\]:/, true)) {
state.f = footnoteUrl;
return linktext;
}
return switchInline(stream, state, inlineNormal);
}
function footnoteUrl(stream, state) {
stream.eatSpace();
stream.match(/^[^\s]+/, true);
state.f = state.inline = inlineNormal;
return linkhref;
}
function inlineRE(endChar) {
if (!inlineRE[endChar]) {
// match any not-escaped-non-endChar and any escaped char
// then match endChar or eol
inlineRE[endChar] = new RegExp('^(?:[^\\\\\\' + endChar + ']|\\\\.)*(?:\\' + endChar + '|$)');
}
return inlineRE[endChar];
}
function inlineElement(type, endChar, next) {
next = next || inlineNormal;
return function(stream, state) {
stream.match(inlineRE(endChar));
state.inline = state.f = next;
return type;
};
}
return {
startState: function() {
return {
f: blockNormal,
block: blockNormal,
htmlState: htmlMode.startState(),
indentation: 0,
inline: inlineNormal,
text: handleText,
em: false,
strong: false,
header: false,
quote: false
};
},
copyState: function(s) {
return {
f: s.f,
block: s.block,
htmlState: CodeMirror.copyState(htmlMode, s.htmlState),
indentation: s.indentation,
inline: s.inline,
text: s.text,
em: s.em,
strong: s.strong,
header: s.header,
quote: s.quote
};
},
token: function(stream, state) {
if (stream.sol()) {
if (stream.match(/^\s*$/, true)) { return blankLine(state); }
// Reset state.header
state.header = false;
// Reset state.quote
state.quote = false;
state.f = state.block;
var indentation = stream.match(/^\s*/, true)[0].replace(/\t/g, ' ').length;
state.indentationDiff = indentation - state.indentation;
state.indentation = indentation;
if (indentation > 0) { return null; }
}
return state.f(stream, state);
},
blankLine: blankLine,
getType: getType
};
}, "xml");
CodeMirror.defineMIME("text/x-markdown", "markdown");

View File

@ -0,0 +1,41 @@
<!doctype html>
<html>
<head>
<title>CodeMirror: MySQL mode</title>
<link rel="stylesheet" href="../../lib/codemirror.css">
<script src="../../lib/codemirror.js"></script>
<script src="mysql.js"></script>
<style>.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
<link rel="stylesheet" href="../../doc/docs.css">
</head>
<body>
<h1>CodeMirror: MySQL mode</h1>
<form><textarea id="code" name="code">
-- Comment for the code
-- MySQL Mode for CodeMirror2 by MySQLTools http://github.com/partydroid/MySQL-Tools
SELECT UNIQUE `var1` as `variable`,
MAX(`var5`) as `max`,
MIN(`var5`) as `min`,
STDEV(`var5`) as `dev`
FROM `table`
LEFT JOIN `table2` ON `var2` = `variable`
ORDER BY `var3` DESC
GROUP BY `groupvar`
LIMIT 0,30;
</textarea></form>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
mode: "text/x-mysql",
tabMode: "indent",
matchBrackets: true
});
</script>
<p><strong>MIME types defined:</strong> <code>text/x-mysql</code>.</p>
</body>
</html>

View File

@ -0,0 +1,188 @@
/*
* MySQL Mode for CodeMirror 2 by MySQL-Tools
* @author James Thorne (partydroid)
* @link http://github.com/partydroid/MySQL-Tools
* @link http://mysqltools.org
* @version 02/Jan/2012
*/
CodeMirror.defineMode("mysql", function(config) {
var indentUnit = config.indentUnit;
var curPunc;
function wordRegexp(words) {
return new RegExp("^(?:" + words.join("|") + ")$", "i");
}
var ops = wordRegexp(["str", "lang", "langmatches", "datatype", "bound", "sameterm", "isiri", "isuri",
"isblank", "isliteral", "union", "a"]);
var keywords = wordRegexp([
('ACCESSIBLE'),('ALTER'),('AS'),('BEFORE'),('BINARY'),('BY'),('CASE'),('CHARACTER'),('COLUMN'),('CONTINUE'),('CROSS'),('CURRENT_TIMESTAMP'),('DATABASE'),('DAY_MICROSECOND'),('DEC'),('DEFAULT'),
('DESC'),('DISTINCT'),('DOUBLE'),('EACH'),('ENCLOSED'),('EXIT'),('FETCH'),('FLOAT8'),('FOREIGN'),('GRANT'),('HIGH_PRIORITY'),('HOUR_SECOND'),('IN'),('INNER'),('INSERT'),('INT2'),('INT8'),
('INTO'),('JOIN'),('KILL'),('LEFT'),('LINEAR'),('LOCALTIME'),('LONG'),('LOOP'),('MATCH'),('MEDIUMTEXT'),('MINUTE_SECOND'),('NATURAL'),('NULL'),('OPTIMIZE'),('OR'),('OUTER'),('PRIMARY'),
('RANGE'),('READ_WRITE'),('REGEXP'),('REPEAT'),('RESTRICT'),('RIGHT'),('SCHEMAS'),('SENSITIVE'),('SHOW'),('SPECIFIC'),('SQLSTATE'),('SQL_CALC_FOUND_ROWS'),('STARTING'),('TERMINATED'),
('TINYINT'),('TRAILING'),('UNDO'),('UNLOCK'),('USAGE'),('UTC_DATE'),('VALUES'),('VARCHARACTER'),('WHERE'),('WRITE'),('ZEROFILL'),('ALL'),('AND'),('ASENSITIVE'),('BIGINT'),('BOTH'),('CASCADE'),
('CHAR'),('COLLATE'),('CONSTRAINT'),('CREATE'),('CURRENT_TIME'),('CURSOR'),('DAY_HOUR'),('DAY_SECOND'),('DECLARE'),('DELETE'),('DETERMINISTIC'),('DIV'),('DUAL'),('ELSEIF'),('EXISTS'),('FALSE'),
('FLOAT4'),('FORCE'),('FULLTEXT'),('HAVING'),('HOUR_MINUTE'),('IGNORE'),('INFILE'),('INSENSITIVE'),('INT1'),('INT4'),('INTERVAL'),('ITERATE'),('KEYS'),('LEAVE'),('LIMIT'),('LOAD'),('LOCK'),
('LONGTEXT'),('MASTER_SSL_VERIFY_SERVER_CERT'),('MEDIUMINT'),('MINUTE_MICROSECOND'),('MODIFIES'),('NO_WRITE_TO_BINLOG'),('ON'),('OPTIONALLY'),('OUT'),('PRECISION'),('PURGE'),('READS'),
('REFERENCES'),('RENAME'),('REQUIRE'),('REVOKE'),('SCHEMA'),('SELECT'),('SET'),('SPATIAL'),('SQLEXCEPTION'),('SQL_BIG_RESULT'),('SSL'),('TABLE'),('TINYBLOB'),('TO'),('TRUE'),('UNIQUE'),
('UPDATE'),('USING'),('UTC_TIMESTAMP'),('VARCHAR'),('WHEN'),('WITH'),('YEAR_MONTH'),('ADD'),('ANALYZE'),('ASC'),('BETWEEN'),('BLOB'),('CALL'),('CHANGE'),('CHECK'),('CONDITION'),('CONVERT'),
('CURRENT_DATE'),('CURRENT_USER'),('DATABASES'),('DAY_MINUTE'),('DECIMAL'),('DELAYED'),('DESCRIBE'),('DISTINCTROW'),('DROP'),('ELSE'),('ESCAPED'),('EXPLAIN'),('FLOAT'),('FOR'),('FROM'),
('GROUP'),('HOUR_MICROSECOND'),('IF'),('INDEX'),('INOUT'),('INT'),('INT3'),('INTEGER'),('IS'),('KEY'),('LEADING'),('LIKE'),('LINES'),('LOCALTIMESTAMP'),('LONGBLOB'),('LOW_PRIORITY'),
('MEDIUMBLOB'),('MIDDLEINT'),('MOD'),('NOT'),('NUMERIC'),('OPTION'),('ORDER'),('OUTFILE'),('PROCEDURE'),('READ'),('REAL'),('RELEASE'),('REPLACE'),('RETURN'),('RLIKE'),('SECOND_MICROSECOND'),
('SEPARATOR'),('SMALLINT'),('SQL'),('SQLWARNING'),('SQL_SMALL_RESULT'),('STRAIGHT_JOIN'),('THEN'),('TINYTEXT'),('TRIGGER'),('UNION'),('UNSIGNED'),('USE'),('UTC_TIME'),('VARBINARY'),('VARYING'),
('WHILE'),('XOR'),('FULL'),('COLUMNS'),('MIN'),('MAX'),('STDEV'),('COUNT')
]);
var operatorChars = /[*+\-<>=&|]/;
function tokenBase(stream, state) {
var ch = stream.next();
curPunc = null;
if (ch == "$" || ch == "?") {
stream.match(/^[\w\d]*/);
return "variable-2";
}
else if (ch == "<" && !stream.match(/^[\s\u00a0=]/, false)) {
stream.match(/^[^\s\u00a0>]*>?/);
return "atom";
}
else if (ch == "\"" || ch == "'") {
state.tokenize = tokenLiteral(ch);
return state.tokenize(stream, state);
}
else if (ch == "`") {
state.tokenize = tokenOpLiteral(ch);
return state.tokenize(stream, state);
}
else if (/[{}\(\),\.;\[\]]/.test(ch)) {
curPunc = ch;
return null;
}
else if (ch == "-") {
ch2 = stream.next();
if(ch2=="-")
{
stream.skipToEnd();
return "comment";
}
}
else if (operatorChars.test(ch)) {
stream.eatWhile(operatorChars);
return null;
}
else if (ch == ":") {
stream.eatWhile(/[\w\d\._\-]/);
return "atom";
}
else {
stream.eatWhile(/[_\w\d]/);
if (stream.eat(":")) {
stream.eatWhile(/[\w\d_\-]/);
return "atom";
}
var word = stream.current(), type;
if (ops.test(word))
return null;
else if (keywords.test(word))
return "keyword";
else
return "variable";
}
}
function tokenLiteral(quote) {
return function(stream, state) {
var escaped = false, ch;
while ((ch = stream.next()) != null) {
if (ch == quote && !escaped) {
state.tokenize = tokenBase;
break;
}
escaped = !escaped && ch == "\\";
}
return "string";
};
}
function tokenOpLiteral(quote) {
return function(stream, state) {
var escaped = false, ch;
while ((ch = stream.next()) != null) {
if (ch == quote && !escaped) {
state.tokenize = tokenBase;
break;
}
escaped = !escaped && ch == "\\";
}
return "variable-2";
};
}
function pushContext(state, type, col) {
state.context = {prev: state.context, indent: state.indent, col: col, type: type};
}
function popContext(state) {
state.indent = state.context.indent;
state.context = state.context.prev;
}
return {
startState: function(base) {
return {tokenize: tokenBase,
context: null,
indent: 0,
col: 0};
},
token: function(stream, state) {
if (stream.sol()) {
if (state.context && state.context.align == null) state.context.align = false;
state.indent = stream.indentation();
}
if (stream.eatSpace()) return null;
var style = state.tokenize(stream, state);
if (style != "comment" && state.context && state.context.align == null && state.context.type != "pattern") {
state.context.align = true;
}
if (curPunc == "(") pushContext(state, ")", stream.column());
else if (curPunc == "[") pushContext(state, "]", stream.column());
else if (curPunc == "{") pushContext(state, "}", stream.column());
else if (/[\]\}\)]/.test(curPunc)) {
while (state.context && state.context.type == "pattern") popContext(state);
if (state.context && curPunc == state.context.type) popContext(state);
}
else if (curPunc == "." && state.context && state.context.type == "pattern") popContext(state);
else if (/atom|string|variable/.test(style) && state.context) {
if (/[\}\]]/.test(state.context.type))
pushContext(state, "pattern", stream.column());
else if (state.context.type == "pattern" && !state.context.align) {
state.context.align = true;
state.context.col = stream.column();
}
}
return style;
},
indent: function(state, textAfter) {
var firstChar = textAfter && textAfter.charAt(0);
var context = state.context;
if (/[\]\}]/.test(firstChar))
while (context && context.type == "pattern") context = context.prev;
var closing = context && firstChar == context.type;
if (!context)
return 0;
else if (context.type == "pattern")
return context.col;
else if (context.align)
return context.col + (closing ? 0 : 1);
else
return context.indent + (closing ? 0 : indentUnit);
}
};
});
CodeMirror.defineMIME("text/x-mysql", "mysql");

View File

@ -0,0 +1,32 @@
<!doctype html>
<html>
<head>
<title>CodeMirror: NTriples mode</title>
<link rel="stylesheet" href="../../lib/codemirror.css">
<script src="../../lib/codemirror.js"></script>
<script src="ntriples.js"></script>
<link rel="stylesheet" href="../../doc/docs.css">
<style type="text/css">
.CodeMirror {
border: 1px solid #eee;
}
</style>
</head>
<body>
<h1>CodeMirror: NTriples mode</h1>
<form>
<textarea id="ntriples" name="ntriples">
<http://Sub1> <http://pred1> <http://obj> .
<http://Sub2> <http://pred2#an2> "literal 1" .
<http://Sub3#an3> <http://pred3> _:bnode3 .
_:bnode4 <http://pred4> "literal 2"@lang .
_:bnode5 <http://pred5> "literal 3"^^<http://type> .
</textarea>
</form>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById("ntriples"), {});
</script>
<p><strong>MIME types defined:</strong> <code>text/n-triples</code>.</p>
</body>
</html>

View File

@ -0,0 +1,172 @@
/**********************************************************
* This script provides syntax highlighting support for
* the Ntriples format.
* Ntriples format specification:
* http://www.w3.org/TR/rdf-testcases/#ntriples
***********************************************************/
/*
The following expression defines the defined ASF grammar transitions.
pre_subject ->
{
( writing_subject_uri | writing_bnode_uri )
-> pre_predicate
-> writing_predicate_uri
-> pre_object
-> writing_object_uri | writing_object_bnode |
(
writing_object_literal
-> writing_literal_lang | writing_literal_type
)
-> post_object
-> BEGIN
} otherwise {
-> ERROR
}
*/
CodeMirror.defineMode("ntriples", function() {
Location = {
PRE_SUBJECT : 0,
WRITING_SUB_URI : 1,
WRITING_BNODE_URI : 2,
PRE_PRED : 3,
WRITING_PRED_URI : 4,
PRE_OBJ : 5,
WRITING_OBJ_URI : 6,
WRITING_OBJ_BNODE : 7,
WRITING_OBJ_LITERAL : 8,
WRITING_LIT_LANG : 9,
WRITING_LIT_TYPE : 10,
POST_OBJ : 11,
ERROR : 12
};
function transitState(currState, c) {
var currLocation = currState.location;
var ret;
// Opening.
if (currLocation == Location.PRE_SUBJECT && c == '<') ret = Location.WRITING_SUB_URI;
else if(currLocation == Location.PRE_SUBJECT && c == '_') ret = Location.WRITING_BNODE_URI;
else if(currLocation == Location.PRE_PRED && c == '<') ret = Location.WRITING_PRED_URI;
else if(currLocation == Location.PRE_OBJ && c == '<') ret = Location.WRITING_OBJ_URI;
else if(currLocation == Location.PRE_OBJ && c == '_') ret = Location.WRITING_OBJ_BNODE;
else if(currLocation == Location.PRE_OBJ && c == '"') ret = Location.WRITING_OBJ_LITERAL;
// Closing.
else if(currLocation == Location.WRITING_SUB_URI && c == '>') ret = Location.PRE_PRED;
else if(currLocation == Location.WRITING_BNODE_URI && c == ' ') ret = Location.PRE_PRED;
else if(currLocation == Location.WRITING_PRED_URI && c == '>') ret = Location.PRE_OBJ;
else if(currLocation == Location.WRITING_OBJ_URI && c == '>') ret = Location.POST_OBJ;
else if(currLocation == Location.WRITING_OBJ_BNODE && c == ' ') ret = Location.POST_OBJ;
else if(currLocation == Location.WRITING_OBJ_LITERAL && c == '"') ret = Location.POST_OBJ;
else if(currLocation == Location.WRITING_LIT_LANG && c == ' ') ret = Location.POST_OBJ;
else if(currLocation == Location.WRITING_LIT_TYPE && c == '>') ret = Location.POST_OBJ;
// Closing typed and language literal.
else if(currLocation == Location.WRITING_OBJ_LITERAL && c == '@') ret = Location.WRITING_LIT_LANG;
else if(currLocation == Location.WRITING_OBJ_LITERAL && c == '^') ret = Location.WRITING_LIT_TYPE;
// Spaces.
else if( c == ' ' &&
(
currLocation == Location.PRE_SUBJECT ||
currLocation == Location.PRE_PRED ||
currLocation == Location.PRE_OBJ ||
currLocation == Location.POST_OBJ
)
) ret = currLocation;
// Reset.
else if(currLocation == Location.POST_OBJ && c == '.') ret = Location.PRE_SUBJECT;
// Error
else ret = Location.ERROR;
currState.location=ret;
}
untilSpace = function(c) { return c != ' '; };
untilEndURI = function(c) { return c != '>'; };
return {
startState: function() {
return {
location : Location.PRE_SUBJECT,
uris : [],
anchors : [],
bnodes : [],
langs : [],
types : []
};
},
token: function(stream, state) {
var ch = stream.next();
if(ch == '<') {
transitState(state, ch);
var parsedURI = '';
stream.eatWhile( function(c) { if( c != '#' && c != '>' ) { parsedURI += c; return true; } return false;} );
state.uris.push(parsedURI);
if( stream.match('#', false) ) return 'variable';
stream.next();
transitState(state, '>');
return 'variable';
}
if(ch == '#') {
var parsedAnchor = '';
stream.eatWhile(function(c) { if(c != '>' && c != ' ') { parsedAnchor+= c; return true; } return false});
state.anchors.push(parsedAnchor);
return 'variable-2';
}
if(ch == '>') {
transitState(state, '>');
return 'variable';
}
if(ch == '_') {
transitState(state, ch);
var parsedBNode = '';
stream.eatWhile(function(c) { if( c != ' ' ) { parsedBNode += c; return true; } return false;});
state.bnodes.push(parsedBNode);
stream.next();
transitState(state, ' ');
return 'builtin';
}
if(ch == '"') {
transitState(state, ch);
stream.eatWhile( function(c) { return c != '"'; } );
stream.next();
if( stream.peek() != '@' && stream.peek() != '^' ) {
transitState(state, '"');
}
return 'string';
}
if( ch == '@' ) {
transitState(state, '@');
var parsedLang = '';
stream.eatWhile(function(c) { if( c != ' ' ) { parsedLang += c; return true; } return false;});
state.langs.push(parsedLang);
stream.next();
transitState(state, ' ');
return 'string-2';
}
if( ch == '^' ) {
stream.next();
transitState(state, '^');
var parsedType = '';
stream.eatWhile(function(c) { if( c != '>' ) { parsedType += c; return true; } return false;} );
state.types.push(parsedType);
stream.next();
transitState(state, '>');
return 'variable';
}
if( ch == ' ' ) {
transitState(state, ch);
}
if( ch == '.' ) {
transitState(state, ch);
}
}
};
});
CodeMirror.defineMIME("text/n-triples", "ntriples");

View File

@ -0,0 +1,7 @@
Copyright (c) 2011 souceLair <support@sourcelair.com>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@ -0,0 +1,48 @@
<!doctype html>
<html>
<head>
<title>CodeMirror: Pascal mode</title>
<link rel="stylesheet" href="../../lib/codemirror.css">
<script src="../../lib/codemirror.js"></script>
<script src="pascal.js"></script>
<link rel="stylesheet" href="../../doc/docs.css">
<style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
</head>
<body>
<h1>CodeMirror: Pascal mode</h1>
<div><textarea id="code" name="code">
(* Example Pascal code *)
while a <> b do writeln('Waiting');
if a > b then
writeln('Condition met')
else
writeln('Condition not met');
for i := 1 to 10 do
writeln('Iteration: ', i:1);
repeat
a := a + 1
until a = 10;
case i of
0: write('zero');
1: write('one');
2: write('two')
end;
</textarea></div>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
lineNumbers: true,
matchBrackets: true,
mode: "text/x-pascal"
});
</script>
<p><strong>MIME types defined:</strong> <code>text/x-pascal</code>.</p>
</body>
</html>

View File

@ -0,0 +1,94 @@
CodeMirror.defineMode("pascal", 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("and array begin case const div do downto else end file for forward integer " +
"boolean char function goto if in label mod nil not of or packed procedure " +
"program record repeat set string then to type until var while with");
var atoms = {"null": true};
var isOperatorChar = /[+\-*&%=<>!?|\/]/;
function tokenBase(stream, state) {
var ch = stream.next();
if (ch == "#" && state.startOfLine) {
stream.skipToEnd();
return "meta";
}
if (ch == '"' || ch == "'") {
state.tokenize = tokenString(ch);
return state.tokenize(stream, state);
}
if (ch == "(" && stream.eat("*")) {
state.tokenize = tokenComment;
return tokenComment(stream, state);
}
if (/[\[\]{}\(\),;\:\.]/.test(ch)) {
return null
}
if (/\d/.test(ch)) {
stream.eatWhile(/[\w\.]/);
return "number";
}
if (ch == "/") {
if (stream.eat("/")) {
stream.skipToEnd();
return "comment";
}
}
if (isOperatorChar.test(ch)) {
stream.eatWhile(isOperatorChar);
return "operator";
}
stream.eatWhile(/[\w\$_]/);
var cur = stream.current();
if (keywords.propertyIsEnumerable(cur)) return "keyword";
if (atoms.propertyIsEnumerable(cur)) return "atom";
return "word";
}
function tokenString(quote) {
return function(stream, state) {
var escaped = false, next, end = false;
while ((next = stream.next()) != null) {
if (next == quote && !escaped) {end = true; break;}
escaped = !escaped && next == "\\";
}
if (end || !escaped) state.tokenize = null;
return "string";
};
}
function tokenComment(stream, state) {
var maybeEnd = false, ch;
while (ch = stream.next()) {
if (ch == ")" && maybeEnd) {
state.tokenize = null;
break;
}
maybeEnd = (ch == "*");
}
return "comment";
}
// Interface
return {
startState: function(basecolumn) {
return {tokenize: null};
},
token: function(stream, state) {
if (stream.eatSpace()) return null;
var style = (state.tokenize || tokenBase)(stream, state);
if (style == "comment" || style == "meta") return style;
return style;
},
electricChars: "{}"
};
});
CodeMirror.defineMIME("text/x-pascal", "pascal");

View File

@ -0,0 +1,19 @@
Copyright (C) 2011 by Sabaca <mail@sabaca.com> under the MIT license.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@ -0,0 +1,62 @@
<!doctype html>
<html>
<head>
<title>CodeMirror: Perl mode</title>
<link rel="stylesheet" href="../../lib/codemirror.css">
<script src="../../lib/codemirror.js"></script>
<script src="perl.js"></script>
<link rel="stylesheet" href="../../doc/docs.css">
<style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
</head>
<body>
<h1>CodeMirror: Perl mode</h1>
<div><textarea id="code" name="code">
#!/usr/bin/perl
use Something qw(func1 func2);
# strings
my $s1 = qq'single line';
our $s2 = q(multi-
line);
=item Something
Example.
=cut
my $html=<<'HTML'
<html>
<title>hi!</title>
</html>
HTML
print "first,".join(',', 'second', qq~third~);
if($s1 =~ m[(?<!\s)(l.ne)\z]o) {
$h->{$1}=$$.' predefined variables';
$s2 =~ s/\-line//ox;
$s1 =~ s[
line ]
[
block
]ox;
}
1; # numbers and comments
__END__
something...
</textarea></div>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
lineNumbers: true,
matchBrackets: true
});
</script>
<p><strong>MIME types defined:</strong> <code>text/x-perl</code>.</p>
</body>
</html>

View File

@ -0,0 +1,816 @@
// CodeMirror2 mode/perl/perl.js (text/x-perl) beta 0.10 (2011-11-08)
// This is a part of CodeMirror from https://github.com/sabaca/CodeMirror_mode_perl (mail@sabaca.com)
CodeMirror.defineMode("perl",function(config,parserConfig){
// http://perldoc.perl.org
var PERL={ // null - magic touch
// 1 - keyword
// 2 - def
// 3 - atom
// 4 - operator
// 5 - variable-2 (predefined)
// [x,y] - x=1,2,3; y=must be defined if x{...}
// PERL operators
'->' : 4,
'++' : 4,
'--' : 4,
'**' : 4,
// ! ~ \ and unary + and -
'=~' : 4,
'!~' : 4,
'*' : 4,
'/' : 4,
'%' : 4,
'x' : 4,
'+' : 4,
'-' : 4,
'.' : 4,
'<<' : 4,
'>>' : 4,
// named unary operators
'<' : 4,
'>' : 4,
'<=' : 4,
'>=' : 4,
'lt' : 4,
'gt' : 4,
'le' : 4,
'ge' : 4,
'==' : 4,
'!=' : 4,
'<=>' : 4,
'eq' : 4,
'ne' : 4,
'cmp' : 4,
'~~' : 4,
'&' : 4,
'|' : 4,
'^' : 4,
'&&' : 4,
'||' : 4,
'//' : 4,
'..' : 4,
'...' : 4,
'?' : 4,
':' : 4,
'=' : 4,
'+=' : 4,
'-=' : 4,
'*=' : 4, // etc. ???
',' : 4,
'=>' : 4,
'::' : 4,
// list operators (rightward)
'not' : 4,
'and' : 4,
'or' : 4,
'xor' : 4,
// PERL predefined variables (I know, what this is a paranoid idea, but may be needed for people, who learn PERL, and for me as well, ...and may be for you?;)
'BEGIN' : [5,1],
'END' : [5,1],
'PRINT' : [5,1],
'PRINTF' : [5,1],
'GETC' : [5,1],
'READ' : [5,1],
'READLINE' : [5,1],
'DESTROY' : [5,1],
'TIE' : [5,1],
'TIEHANDLE' : [5,1],
'UNTIE' : [5,1],
'STDIN' : 5,
'STDIN_TOP' : 5,
'STDOUT' : 5,
'STDOUT_TOP' : 5,
'STDERR' : 5,
'STDERR_TOP' : 5,
'$ARG' : 5,
'$_' : 5,
'@ARG' : 5,
'@_' : 5,
'$LIST_SEPARATOR' : 5,
'$"' : 5,
'$PROCESS_ID' : 5,
'$PID' : 5,
'$$' : 5,
'$REAL_GROUP_ID' : 5,
'$GID' : 5,
'$(' : 5,
'$EFFECTIVE_GROUP_ID' : 5,
'$EGID' : 5,
'$)' : 5,
'$PROGRAM_NAME' : 5,
'$0' : 5,
'$SUBSCRIPT_SEPARATOR' : 5,
'$SUBSEP' : 5,
'$;' : 5,
'$REAL_USER_ID' : 5,
'$UID' : 5,
'$<' : 5,
'$EFFECTIVE_USER_ID' : 5,
'$EUID' : 5,
'$>' : 5,
'$a' : 5,
'$b' : 5,
'$COMPILING' : 5,
'$^C' : 5,
'$DEBUGGING' : 5,
'$^D' : 5,
'${^ENCODING}' : 5,
'$ENV' : 5,
'%ENV' : 5,
'$SYSTEM_FD_MAX' : 5,
'$^F' : 5,
'@F' : 5,
'${^GLOBAL_PHASE}' : 5,
'$^H' : 5,
'%^H' : 5,
'@INC' : 5,
'%INC' : 5,
'$INPLACE_EDIT' : 5,
'$^I' : 5,
'$^M' : 5,
'$OSNAME' : 5,
'$^O' : 5,
'${^OPEN}' : 5,
'$PERLDB' : 5,
'$^P' : 5,
'$SIG' : 5,
'%SIG' : 5,
'$BASETIME' : 5,
'$^T' : 5,
'${^TAINT}' : 5,
'${^UNICODE}' : 5,
'${^UTF8CACHE}' : 5,
'${^UTF8LOCALE}' : 5,
'$PERL_VERSION' : 5,
'$^V' : 5,
'${^WIN32_SLOPPY_STAT}' : 5,
'$EXECUTABLE_NAME' : 5,
'$^X' : 5,
'$1' : 5, // - regexp $1, $2...
'$MATCH' : 5,
'$&' : 5,
'${^MATCH}' : 5,
'$PREMATCH' : 5,
'$`' : 5,
'${^PREMATCH}' : 5,
'$POSTMATCH' : 5,
"$'" : 5,
'${^POSTMATCH}' : 5,
'$LAST_PAREN_MATCH' : 5,
'$+' : 5,
'$LAST_SUBMATCH_RESULT' : 5,
'$^N' : 5,
'@LAST_MATCH_END' : 5,
'@+' : 5,
'%LAST_PAREN_MATCH' : 5,
'%+' : 5,
'@LAST_MATCH_START' : 5,
'@-' : 5,
'%LAST_MATCH_START' : 5,
'%-' : 5,
'$LAST_REGEXP_CODE_RESULT' : 5,
'$^R' : 5,
'${^RE_DEBUG_FLAGS}' : 5,
'${^RE_TRIE_MAXBUF}' : 5,
'$ARGV' : 5,
'@ARGV' : 5,
'ARGV' : 5,
'ARGVOUT' : 5,
'$OUTPUT_FIELD_SEPARATOR' : 5,
'$OFS' : 5,
'$,' : 5,
'$INPUT_LINE_NUMBER' : 5,
'$NR' : 5,
'$.' : 5,
'$INPUT_RECORD_SEPARATOR' : 5,
'$RS' : 5,
'$/' : 5,
'$OUTPUT_RECORD_SEPARATOR' : 5,
'$ORS' : 5,
'$\\' : 5,
'$OUTPUT_AUTOFLUSH' : 5,
'$|' : 5,
'$ACCUMULATOR' : 5,
'$^A' : 5,
'$FORMAT_FORMFEED' : 5,
'$^L' : 5,
'$FORMAT_PAGE_NUMBER' : 5,
'$%' : 5,
'$FORMAT_LINES_LEFT' : 5,
'$-' : 5,
'$FORMAT_LINE_BREAK_CHARACTERS' : 5,
'$:' : 5,
'$FORMAT_LINES_PER_PAGE' : 5,
'$=' : 5,
'$FORMAT_TOP_NAME' : 5,
'$^' : 5,
'$FORMAT_NAME' : 5,
'$~' : 5,
'${^CHILD_ERROR_NATIVE}' : 5,
'$EXTENDED_OS_ERROR' : 5,
'$^E' : 5,
'$EXCEPTIONS_BEING_CAUGHT' : 5,
'$^S' : 5,
'$WARNING' : 5,
'$^W' : 5,
'${^WARNING_BITS}' : 5,
'$OS_ERROR' : 5,
'$ERRNO' : 5,
'$!' : 5,
'%OS_ERROR' : 5,
'%ERRNO' : 5,
'%!' : 5,
'$CHILD_ERROR' : 5,
'$?' : 5,
'$EVAL_ERROR' : 5,
'$@' : 5,
'$OFMT' : 5,
'$#' : 5,
'$*' : 5,
'$ARRAY_BASE' : 5,
'$[' : 5,
'$OLD_PERL_VERSION' : 5,
'$]' : 5,
// PERL blocks
'if' :[1,1],
elsif :[1,1],
'else' :[1,1],
'while' :[1,1],
unless :[1,1],
'for' :[1,1],
foreach :[1,1],
// PERL functions
'abs' :1, // - absolute value function
accept :1, // - accept an incoming socket connect
alarm :1, // - schedule a SIGALRM
'atan2' :1, // - arctangent of Y/X in the range -PI to PI
bind :1, // - binds an address to a socket
binmode :1, // - prepare binary files for I/O
bless :1, // - create an object
bootstrap :1, //
'break' :1, // - break out of a "given" block
caller :1, // - get context of the current subroutine call
chdir :1, // - change your current working directory
chmod :1, // - changes the permissions on a list of files
chomp :1, // - remove a trailing record separator from a string
chop :1, // - remove the last character from a string
chown :1, // - change the owership on a list of files
chr :1, // - get character this number represents
chroot :1, // - make directory new root for path lookups
close :1, // - close file (or pipe or socket) handle
closedir :1, // - close directory handle
connect :1, // - connect to a remote socket
'continue' :[1,1], // - optional trailing block in a while or foreach
'cos' :1, // - cosine function
crypt :1, // - one-way passwd-style encryption
dbmclose :1, // - breaks binding on a tied dbm file
dbmopen :1, // - create binding on a tied dbm file
'default' :1, //
defined :1, // - test whether a value, variable, or function is defined
'delete' :1, // - deletes a value from a hash
die :1, // - raise an exception or bail out
'do' :1, // - turn a BLOCK into a TERM
dump :1, // - create an immediate core dump
each :1, // - retrieve the next key/value pair from a hash
endgrent :1, // - be done using group file
endhostent :1, // - be done using hosts file
endnetent :1, // - be done using networks file
endprotoent :1, // - be done using protocols file
endpwent :1, // - be done using passwd file
endservent :1, // - be done using services file
eof :1, // - test a filehandle for its end
'eval' :1, // - catch exceptions or compile and run code
'exec' :1, // - abandon this program to run another
exists :1, // - test whether a hash key is present
exit :1, // - terminate this program
'exp' :1, // - raise I to a power
fcntl :1, // - file control system call
fileno :1, // - return file descriptor from filehandle
flock :1, // - lock an entire file with an advisory lock
fork :1, // - create a new process just like this one
format :1, // - declare a picture format with use by the write() function
formline :1, // - internal function used for formats
getc :1, // - get the next character from the filehandle
getgrent :1, // - get next group record
getgrgid :1, // - get group record given group user ID
getgrnam :1, // - get group record given group name
gethostbyaddr :1, // - get host record given its address
gethostbyname :1, // - get host record given name
gethostent :1, // - get next hosts record
getlogin :1, // - return who logged in at this tty
getnetbyaddr :1, // - get network record given its address
getnetbyname :1, // - get networks record given name
getnetent :1, // - get next networks record
getpeername :1, // - find the other end of a socket connection
getpgrp :1, // - get process group
getppid :1, // - get parent process ID
getpriority :1, // - get current nice value
getprotobyname :1, // - get protocol record given name
getprotobynumber :1, // - get protocol record numeric protocol
getprotoent :1, // - get next protocols record
getpwent :1, // - get next passwd record
getpwnam :1, // - get passwd record given user login name
getpwuid :1, // - get passwd record given user ID
getservbyname :1, // - get services record given its name
getservbyport :1, // - get services record given numeric port
getservent :1, // - get next services record
getsockname :1, // - retrieve the sockaddr for a given socket
getsockopt :1, // - get socket options on a given socket
given :1, //
glob :1, // - expand filenames using wildcards
gmtime :1, // - convert UNIX time into record or string using Greenwich time
'goto' :1, // - create spaghetti code
grep :1, // - locate elements in a list test true against a given criterion
hex :1, // - convert a string to a hexadecimal number
'import' :1, // - patch a module's namespace into your own
index :1, // - find a substring within a string
'int' :1, // - get the integer portion of a number
ioctl :1, // - system-dependent device control system call
'join' :1, // - join a list into a string using a separator
keys :1, // - retrieve list of indices from a hash
kill :1, // - send a signal to a process or process group
last :1, // - exit a block prematurely
lc :1, // - return lower-case version of a string
lcfirst :1, // - return a string with just the next letter in lower case
length :1, // - return the number of bytes in a string
'link' :1, // - create a hard link in the filesytem
listen :1, // - register your socket as a server
local : 2, // - create a temporary value for a global variable (dynamic scoping)
localtime :1, // - convert UNIX time into record or string using local time
lock :1, // - get a thread lock on a variable, subroutine, or method
'log' :1, // - retrieve the natural logarithm for a number
lstat :1, // - stat a symbolic link
m :null, // - match a string with a regular expression pattern
map :1, // - apply a change to a list to get back a new list with the changes
mkdir :1, // - create a directory
msgctl :1, // - SysV IPC message control operations
msgget :1, // - get SysV IPC message queue
msgrcv :1, // - receive a SysV IPC message from a message queue
msgsnd :1, // - send a SysV IPC message to a message queue
my : 2, // - declare and assign a local variable (lexical scoping)
'new' :1, //
next :1, // - iterate a block prematurely
no :1, // - unimport some module symbols or semantics at compile time
oct :1, // - convert a string to an octal number
open :1, // - open a file, pipe, or descriptor
opendir :1, // - open a directory
ord :1, // - find a character's numeric representation
our : 2, // - declare and assign a package variable (lexical scoping)
pack :1, // - convert a list into a binary representation
'package' :1, // - declare a separate global namespace
pipe :1, // - open a pair of connected filehandles
pop :1, // - remove the last element from an array and return it
pos :1, // - find or set the offset for the last/next m//g search
print :1, // - output a list to a filehandle
printf :1, // - output a formatted list to a filehandle
prototype :1, // - get the prototype (if any) of a subroutine
push :1, // - append one or more elements to an array
q :null, // - singly quote a string
qq :null, // - doubly quote a string
qr :null, // - Compile pattern
quotemeta :null, // - quote regular expression magic characters
qw :null, // - quote a list of words
qx :null, // - backquote quote a string
rand :1, // - retrieve the next pseudorandom number
read :1, // - fixed-length buffered input from a filehandle
readdir :1, // - get a directory from a directory handle
readline :1, // - fetch a record from a file
readlink :1, // - determine where a symbolic link is pointing
readpipe :1, // - execute a system command and collect standard output
recv :1, // - receive a message over a Socket
redo :1, // - start this loop iteration over again
ref :1, // - find out the type of thing being referenced
rename :1, // - change a filename
require :1, // - load in external functions from a library at runtime
reset :1, // - clear all variables of a given name
'return' :1, // - get out of a function early
reverse :1, // - flip a string or a list
rewinddir :1, // - reset directory handle
rindex :1, // - right-to-left substring search
rmdir :1, // - remove a directory
s :null, // - replace a pattern with a string
say :1, // - print with newline
scalar :1, // - force a scalar context
seek :1, // - reposition file pointer for random-access I/O
seekdir :1, // - reposition directory pointer
select :1, // - reset default output or do I/O multiplexing
semctl :1, // - SysV semaphore control operations
semget :1, // - get set of SysV semaphores
semop :1, // - SysV semaphore operations
send :1, // - send a message over a socket
setgrent :1, // - prepare group file for use
sethostent :1, // - prepare hosts file for use
setnetent :1, // - prepare networks file for use
setpgrp :1, // - set the process group of a process
setpriority :1, // - set a process's nice value
setprotoent :1, // - prepare protocols file for use
setpwent :1, // - prepare passwd file for use
setservent :1, // - prepare services file for use
setsockopt :1, // - set some socket options
shift :1, // - remove the first element of an array, and return it
shmctl :1, // - SysV shared memory operations
shmget :1, // - get SysV shared memory segment identifier
shmread :1, // - read SysV shared memory
shmwrite :1, // - write SysV shared memory
shutdown :1, // - close down just half of a socket connection
'sin' :1, // - return the sine of a number
sleep :1, // - block for some number of seconds
socket :1, // - create a socket
socketpair :1, // - create a pair of sockets
'sort' :1, // - sort a list of values
splice :1, // - add or remove elements anywhere in an array
'split' :1, // - split up a string using a regexp delimiter
sprintf :1, // - formatted print into a string
'sqrt' :1, // - square root function
srand :1, // - seed the random number generator
stat :1, // - get a file's status information
state :1, // - declare and assign a state variable (persistent lexical scoping)
study :1, // - optimize input data for repeated searches
'sub' :1, // - declare a subroutine, possibly anonymously
'substr' :1, // - get or alter a portion of a stirng
symlink :1, // - create a symbolic link to a file
syscall :1, // - execute an arbitrary system call
sysopen :1, // - open a file, pipe, or descriptor
sysread :1, // - fixed-length unbuffered input from a filehandle
sysseek :1, // - position I/O pointer on handle used with sysread and syswrite
system :1, // - run a separate program
syswrite :1, // - fixed-length unbuffered output to a filehandle
tell :1, // - get current seekpointer on a filehandle
telldir :1, // - get current seekpointer on a directory handle
tie :1, // - bind a variable to an object class
tied :1, // - get a reference to the object underlying a tied variable
time :1, // - return number of seconds since 1970
times :1, // - return elapsed time for self and child processes
tr :null, // - transliterate a string
truncate :1, // - shorten a file
uc :1, // - return upper-case version of a string
ucfirst :1, // - return a string with just the next letter in upper case
umask :1, // - set file creation mode mask
undef :1, // - remove a variable or function definition
unlink :1, // - remove one link to a file
unpack :1, // - convert binary structure into normal perl variables
unshift :1, // - prepend more elements to the beginning of a list
untie :1, // - break a tie binding to a variable
use :1, // - load in a module at compile time
utime :1, // - set a file's last access and modify times
values :1, // - return a list of the values in a hash
vec :1, // - test or set particular bits in a string
wait :1, // - wait for any child process to die
waitpid :1, // - wait for a particular child process to die
wantarray :1, // - get void vs scalar vs list context of current subroutine call
warn :1, // - print debugging info
when :1, //
write :1, // - print a picture record
y :null}; // - transliterate a string
var RXstyle="string-2";
var RXmodifiers=/[goseximacplud]/; // NOTE: "m", "s", "y" and "tr" need to correct real modifiers for each regexp type
function tokenChain(stream,state,chain,style,tail){ // NOTE: chain.length > 2 is not working now (it's for s[...][...]geos;)
state.chain=null; // 12 3tail
state.style=null;
state.tail=null;
state.tokenize=function(stream,state){
var e=false,c,i=0;
while(c=stream.next()){
if(c===chain[i]&&!e){
if(chain[++i]!==undefined){
state.chain=chain[i];
state.style=style;
state.tail=tail}
else if(tail)
stream.eatWhile(tail);
state.tokenize=tokenPerl;
return style}
e=!e&&c=="\\"}
return style};
return state.tokenize(stream,state)}
function tokenSOMETHING(stream,state,string){
state.tokenize=function(stream,state){
if(stream.string==string)
state.tokenize=tokenPerl;
stream.skipToEnd();
return "string"};
return state.tokenize(stream,state)}
function tokenPerl(stream,state){
if(stream.eatSpace())
return null;
if(state.chain)
return tokenChain(stream,state,state.chain,state.style,state.tail);
if(stream.match(/^\-?[\d\.]/,false))
if(stream.match(/^(\-?(\d*\.\d+(e[+-]?\d+)?|\d+\.\d*)|0x[\da-fA-F]+|0b[01]+|\d+(e[+-]?\d+)?)/))
return 'number';
if(stream.match(/^<<(?=\w)/)){ // NOTE: <<SOMETHING\n...\nSOMETHING\n
stream.eatWhile(/\w/);
return tokenSOMETHING(stream,state,stream.current().substr(2))}
if(stream.sol()&&stream.match(/^\=item(?!\w)/)){// NOTE: \n=item...\n=cut\n
return tokenSOMETHING(stream,state,'=cut')}
var ch=stream.next();
if(ch=='"'||ch=="'"){ // NOTE: ' or " or <<'SOMETHING'\n...\nSOMETHING\n or <<"SOMETHING"\n...\nSOMETHING\n
if(stream.prefix(3)=="<<"+ch){
var p=stream.pos;
stream.eatWhile(/\w/);
var n=stream.current().substr(1);
if(n&&stream.eat(ch))
return tokenSOMETHING(stream,state,n);
stream.pos=p}
return tokenChain(stream,state,[ch],"string")}
if(ch=="q"){
var c=stream.look(-2);
if(!(c&&/\w/.test(c))){
c=stream.look(0);
if(c=="x"){
c=stream.look(1);
if(c=="("){
stream.eatSuffix(2);
return tokenChain(stream,state,[")"],RXstyle,RXmodifiers)}
if(c=="["){
stream.eatSuffix(2);
return tokenChain(stream,state,["]"],RXstyle,RXmodifiers)}
if(c=="{"){
stream.eatSuffix(2);
return tokenChain(stream,state,["}"],RXstyle,RXmodifiers)}
if(c=="<"){
stream.eatSuffix(2);
return tokenChain(stream,state,[">"],RXstyle,RXmodifiers)}
if(/[\^'"!~\/]/.test(c)){
stream.eatSuffix(1);
return tokenChain(stream,state,[stream.eat(c)],RXstyle,RXmodifiers)}}
else if(c=="q"){
c=stream.look(1);
if(c=="("){
stream.eatSuffix(2);
return tokenChain(stream,state,[")"],"string")}
if(c=="["){
stream.eatSuffix(2);
return tokenChain(stream,state,["]"],"string")}
if(c=="{"){
stream.eatSuffix(2);
return tokenChain(stream,state,["}"],"string")}
if(c=="<"){
stream.eatSuffix(2);
return tokenChain(stream,state,[">"],"string")}
if(/[\^'"!~\/]/.test(c)){
stream.eatSuffix(1);
return tokenChain(stream,state,[stream.eat(c)],"string")}}
else if(c=="w"){
c=stream.look(1);
if(c=="("){
stream.eatSuffix(2);
return tokenChain(stream,state,[")"],"bracket")}
if(c=="["){
stream.eatSuffix(2);
return tokenChain(stream,state,["]"],"bracket")}
if(c=="{"){
stream.eatSuffix(2);
return tokenChain(stream,state,["}"],"bracket")}
if(c=="<"){
stream.eatSuffix(2);
return tokenChain(stream,state,[">"],"bracket")}
if(/[\^'"!~\/]/.test(c)){
stream.eatSuffix(1);
return tokenChain(stream,state,[stream.eat(c)],"bracket")}}
else if(c=="r"){
c=stream.look(1);
if(c=="("){
stream.eatSuffix(2);
return tokenChain(stream,state,[")"],RXstyle,RXmodifiers)}
if(c=="["){
stream.eatSuffix(2);
return tokenChain(stream,state,["]"],RXstyle,RXmodifiers)}
if(c=="{"){
stream.eatSuffix(2);
return tokenChain(stream,state,["}"],RXstyle,RXmodifiers)}
if(c=="<"){
stream.eatSuffix(2);
return tokenChain(stream,state,[">"],RXstyle,RXmodifiers)}
if(/[\^'"!~\/]/.test(c)){
stream.eatSuffix(1);
return tokenChain(stream,state,[stream.eat(c)],RXstyle,RXmodifiers)}}
else if(/[\^'"!~\/(\[{<]/.test(c)){
if(c=="("){
stream.eatSuffix(1);
return tokenChain(stream,state,[")"],"string")}
if(c=="["){
stream.eatSuffix(1);
return tokenChain(stream,state,["]"],"string")}
if(c=="{"){
stream.eatSuffix(1);
return tokenChain(stream,state,["}"],"string")}
if(c=="<"){
stream.eatSuffix(1);
return tokenChain(stream,state,[">"],"string")}
if(/[\^'"!~\/]/.test(c)){
return tokenChain(stream,state,[stream.eat(c)],"string")}}}}
if(ch=="m"){
var c=stream.look(-2);
if(!(c&&/\w/.test(c))){
c=stream.eat(/[(\[{<\^'"!~\/]/);
if(c){
if(/[\^'"!~\/]/.test(c)){
return tokenChain(stream,state,[c],RXstyle,RXmodifiers)}
if(c=="("){
return tokenChain(stream,state,[")"],RXstyle,RXmodifiers)}
if(c=="["){
return tokenChain(stream,state,["]"],RXstyle,RXmodifiers)}
if(c=="{"){
return tokenChain(stream,state,["}"],RXstyle,RXmodifiers)}
if(c=="<"){
return tokenChain(stream,state,[">"],RXstyle,RXmodifiers)}}}}
if(ch=="s"){
var c=/[\/>\]})\w]/.test(stream.look(-2));
if(!c){
c=stream.eat(/[(\[{<\^'"!~\/]/);
if(c){
if(c=="[")
return tokenChain(stream,state,["]","]"],RXstyle,RXmodifiers);
if(c=="{")
return tokenChain(stream,state,["}","}"],RXstyle,RXmodifiers);
if(c=="<")
return tokenChain(stream,state,[">",">"],RXstyle,RXmodifiers);
if(c=="(")
return tokenChain(stream,state,[")",")"],RXstyle,RXmodifiers);
return tokenChain(stream,state,[c,c],RXstyle,RXmodifiers)}}}
if(ch=="y"){
var c=/[\/>\]})\w]/.test(stream.look(-2));
if(!c){
c=stream.eat(/[(\[{<\^'"!~\/]/);
if(c){
if(c=="[")
return tokenChain(stream,state,["]","]"],RXstyle,RXmodifiers);
if(c=="{")
return tokenChain(stream,state,["}","}"],RXstyle,RXmodifiers);
if(c=="<")
return tokenChain(stream,state,[">",">"],RXstyle,RXmodifiers);
if(c=="(")
return tokenChain(stream,state,[")",")"],RXstyle,RXmodifiers);
return tokenChain(stream,state,[c,c],RXstyle,RXmodifiers)}}}
if(ch=="t"){
var c=/[\/>\]})\w]/.test(stream.look(-2));
if(!c){
c=stream.eat("r");if(c){
c=stream.eat(/[(\[{<\^'"!~\/]/);
if(c){
if(c=="[")
return tokenChain(stream,state,["]","]"],RXstyle,RXmodifiers);
if(c=="{")
return tokenChain(stream,state,["}","}"],RXstyle,RXmodifiers);
if(c=="<")
return tokenChain(stream,state,[">",">"],RXstyle,RXmodifiers);
if(c=="(")
return tokenChain(stream,state,[")",")"],RXstyle,RXmodifiers);
return tokenChain(stream,state,[c,c],RXstyle,RXmodifiers)}}}}
if(ch=="`"){
return tokenChain(stream,state,[ch],"variable-2")}
if(ch=="/"){
if(!/~\s*$/.test(stream.prefix()))
return "operator";
else
return tokenChain(stream,state,[ch],RXstyle,RXmodifiers)}
if(ch=="$"){
var p=stream.pos;
if(stream.eatWhile(/\d/)||stream.eat("{")&&stream.eatWhile(/\d/)&&stream.eat("}"))
return "variable-2";
else
stream.pos=p}
if(/[$@%]/.test(ch)){
var p=stream.pos;
if(stream.eat("^")&&stream.eat(/[A-Z]/)||!/[@$%&]/.test(stream.look(-2))&&stream.eat(/[=|\\\-#?@;:&`~\^!\[\]*'"$+.,\/<>()]/)){
var c=stream.current();
if(PERL[c])
return "variable-2"}
stream.pos=p}
if(/[$@%&]/.test(ch)){
if(stream.eatWhile(/[\w$\[\]]/)||stream.eat("{")&&stream.eatWhile(/[\w$\[\]]/)&&stream.eat("}")){
var c=stream.current();
if(PERL[c])
return "variable-2";
else
return "variable"}}
if(ch=="#"){
if(stream.look(-2)!="$"){
stream.skipToEnd();
return "comment"}}
if(/[:+\-\^*$&%@=<>!?|\/~\.]/.test(ch)){
var p=stream.pos;
stream.eatWhile(/[:+\-\^*$&%@=<>!?|\/~\.]/);
if(PERL[stream.current()])
return "operator";
else
stream.pos=p}
if(ch=="_"){
if(stream.pos==1){
if(stream.suffix(6)=="_END__"){
return tokenChain(stream,state,['\0'],"comment")}
else if(stream.suffix(7)=="_DATA__"){
return tokenChain(stream,state,['\0'],"variable-2")}
else if(stream.suffix(7)=="_C__"){
return tokenChain(stream,state,['\0'],"string")}}}
if(/\w/.test(ch)){
var p=stream.pos;
if(stream.look(-2)=="{"&&(stream.look(0)=="}"||stream.eatWhile(/\w/)&&stream.look(0)=="}"))
return "string";
else
stream.pos=p}
if(/[A-Z]/.test(ch)){
var l=stream.look(-2);
var p=stream.pos;
stream.eatWhile(/[A-Z_]/);
if(/[\da-z]/.test(stream.look(0))){
stream.pos=p}
else{
var c=PERL[stream.current()];
if(!c)
return "meta";
if(c[1])
c=c[0];
if(l!=":"){
if(c==1)
return "keyword";
else if(c==2)
return "def";
else if(c==3)
return "atom";
else if(c==4)
return "operator";
else if(c==5)
return "variable-2";
else
return "meta"}
else
return "meta"}}
if(/[a-zA-Z_]/.test(ch)){
var l=stream.look(-2);
stream.eatWhile(/\w/);
var c=PERL[stream.current()];
if(!c)
return "meta";
if(c[1])
c=c[0];
if(l!=":"){
if(c==1)
return "keyword";
else if(c==2)
return "def";
else if(c==3)
return "atom";
else if(c==4)
return "operator";
else if(c==5)
return "variable-2";
else
return "meta"}
else
return "meta"}
return null}
return{
startState:function(){
return{
tokenize:tokenPerl,
chain:null,
style:null,
tail:null}},
token:function(stream,state){
return (state.tokenize||tokenPerl)(stream,state)},
electricChars:"{}"}});
CodeMirror.defineMIME("text/x-perl", "perl");
// it's like "peek", but need for look-ahead or look-behind if index < 0
CodeMirror.StringStream.prototype.look=function(c){
return this.string.charAt(this.pos+(c||0))};
// return a part of prefix of current stream from current position
CodeMirror.StringStream.prototype.prefix=function(c){
if(c){
var x=this.pos-c;
return this.string.substr((x>=0?x:0),c)}
else{
return this.string.substr(0,this.pos-1)}};
// return a part of suffix of current stream from current position
CodeMirror.StringStream.prototype.suffix=function(c){
var y=this.string.length;
var x=y-this.pos+1;
return this.string.substr(this.pos,(c&&c<y?c:x))};
// return a part of suffix of current stream from current position and change current position
CodeMirror.StringStream.prototype.nsuffix=function(c){
var p=this.pos;
var l=c||(this.string.length-this.pos+1);
this.pos+=l;
return this.string.substr(p,l)};
// eating and vomiting a part of stream from current position
CodeMirror.StringStream.prototype.eatSuffix=function(c){
var x=this.pos+c;
var y;
if(x<=0)
this.pos=0;
else if(x>=(y=this.string.length-1))
this.pos=y;
else
this.pos=x};

View File

@ -0,0 +1,48 @@
<!doctype html>
<html>
<head>
<title>CodeMirror: PHP mode</title>
<link rel="stylesheet" href="../../lib/codemirror.css">
<script src="../../lib/codemirror.js"></script>
<script src="../xml/xml.js"></script>
<script src="../javascript/javascript.js"></script>
<script src="../css/css.js"></script>
<script src="../clike/clike.js"></script>
<script src="php.js"></script>
<style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
<link rel="stylesheet" href="../../doc/docs.css">
</head>
<body>
<h1>CodeMirror: PHP mode</h1>
<form><textarea id="code" name="code">
<?php
function hello($who) {
return "Hello " . $who;
}
?>
<p>The program says <?= hello("World") ?>.</p>
<script>
alert("And here is some JS code"); // also colored
</script>
</textarea></form>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
lineNumbers: true,
matchBrackets: true,
mode: "application/x-httpd-php",
indentUnit: 4,
indentWithTabs: true,
enterMode: "keep",
tabMode: "shift"
});
</script>
<p>Simple HTML/PHP mode based on
the <a href="../clike/">C-like</a> mode. Depends on XML,
JavaScript, CSS, and C-like modes.</p>
<p><strong>MIME types defined:</strong> <code>application/x-httpd-php</code> (HTML with PHP code), <code>text/x-php</code> (plain, non-wrapped PHP code).</p>
</body>
</html>

View File

@ -0,0 +1,150 @@
(function() {
function keywords(str) {
var obj = {}, words = str.split(" ");
for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
return obj;
}
function heredoc(delim) {
return function(stream, state) {
if (stream.match(delim)) state.tokenize = null;
else stream.skipToEnd();
return "string";
}
}
var phpConfig = {
name: "clike",
keywords: keywords("abstract and array as break case catch class clone const continue declare default " +
"do else elseif enddeclare endfor endforeach endif endswitch endwhile extends final " +
"for foreach function global goto if implements interface instanceof namespace " +
"new or private protected public static switch throw trait try use var while xor " +
"die echo empty exit eval include include_once isset list require require_once return " +
"print unset __halt_compiler self static parent"),
blockKeywords: keywords("catch do else elseif for foreach if switch try while"),
atoms: keywords("true false null TRUE FALSE NULL"),
multiLineStrings: true,
hooks: {
"$": function(stream, state) {
stream.eatWhile(/[\w\$_]/);
return "variable-2";
},
"<": function(stream, state) {
if (stream.match(/<</)) {
stream.eatWhile(/[\w\.]/);
state.tokenize = heredoc(stream.current().slice(3));
return state.tokenize(stream, state);
}
return false;
},
"#": function(stream, state) {
while (!stream.eol() && !stream.match("?>", false)) stream.next();
return "comment";
},
"/": function(stream, state) {
if (stream.eat("/")) {
while (!stream.eol() && !stream.match("?>", false)) stream.next();
return "comment";
}
return false;
}
}
};
CodeMirror.defineMode("php", function(config, parserConfig) {
var htmlMode = CodeMirror.getMode(config, {name: "xml", htmlMode: true});
var jsMode = CodeMirror.getMode(config, "javascript");
var cssMode = CodeMirror.getMode(config, "css");
var phpMode = CodeMirror.getMode(config, phpConfig);
function dispatch(stream, state) { // TODO open PHP inside text/css
var isPHP = state.mode == "php";
if (stream.sol() && state.pending != '"') state.pending = null;
if (state.curMode == htmlMode) {
if (stream.match(/^<\?\w*/)) {
state.curMode = phpMode;
state.curState = state.php;
state.curClose = "?>";
state.mode = "php";
return "meta";
}
if (state.pending == '"') {
while (!stream.eol() && stream.next() != '"') {}
var style = "string";
} else if (state.pending && stream.pos < state.pending.end) {
stream.pos = state.pending.end;
var style = state.pending.style;
} else {
var style = htmlMode.token(stream, state.curState);
}
state.pending = null;
var cur = stream.current(), openPHP = cur.search(/<\?/);
if (openPHP != -1) {
if (style == "string" && /\"$/.test(cur) && !/\?>/.test(cur)) state.pending = '"';
else state.pending = {end: stream.pos, style: style};
stream.backUp(cur.length - openPHP);
} else if (style == "tag" && stream.current() == ">" && state.curState.context) {
if (/^script$/i.test(state.curState.context.tagName)) {
state.curMode = jsMode;
state.curState = jsMode.startState(htmlMode.indent(state.curState, ""));
state.curClose = /^<\/\s*script\s*>/i;
state.mode = "javascript";
}
else if (/^style$/i.test(state.curState.context.tagName)) {
state.curMode = cssMode;
state.curState = cssMode.startState(htmlMode.indent(state.curState, ""));
state.curClose = /^<\/\s*style\s*>/i;
state.mode = "css";
}
}
return style;
} else if ((!isPHP || state.php.tokenize == null) &&
stream.match(state.curClose, isPHP)) {
state.curMode = htmlMode;
state.curState = state.html;
state.curClose = null;
state.mode = "html";
if (isPHP) return "meta";
else return dispatch(stream, state);
} else {
return state.curMode.token(stream, state.curState);
}
}
return {
startState: function() {
var html = htmlMode.startState();
return {html: html,
php: phpMode.startState(),
curMode: parserConfig.startOpen ? phpMode : htmlMode,
curState: parserConfig.startOpen ? phpMode.startState() : html,
curClose: parserConfig.startOpen ? /^\?>/ : null,
mode: parserConfig.startOpen ? "php" : "html",
pending: null}
},
copyState: function(state) {
var html = state.html, htmlNew = CodeMirror.copyState(htmlMode, html),
php = state.php, phpNew = CodeMirror.copyState(phpMode, php), cur;
if (state.curState == html) cur = htmlNew;
else if (state.curState == php) cur = phpNew;
else cur = CodeMirror.copyState(state.curMode, state.curState);
return {html: htmlNew, php: phpNew, curMode: state.curMode, curState: cur,
curClose: state.curClose, mode: state.mode,
pending: state.pending};
},
token: dispatch,
indent: function(state, textAfter) {
if ((state.curMode != phpMode && /^\s*<\//.test(textAfter)) ||
(state.curMode == phpMode && /^\?>/.test(textAfter)))
return htmlMode.indent(state.html, textAfter);
return state.curMode.indent(state.curState, textAfter);
},
electricChars: "/{}:"
}
}, "xml", "clike", "javascript", "css");
CodeMirror.defineMIME("application/x-httpd-php", "php");
CodeMirror.defineMIME("application/x-httpd-php-open", {name: "php", startOpen: true});
CodeMirror.defineMIME("text/x-php", phpConfig);
})();

View File

@ -0,0 +1,42 @@
<!doctype html>
<html>
<head>
<title>CodeMirror: Pig Latin mode</title>
<link rel="stylesheet" href="../../lib/codemirror.css">
<script src="../../lib/codemirror.js"></script>
<script src="pig.js"></script>
<link rel="stylesheet" href="../../doc/docs.css">
<style>.CodeMirror {border: 2px inset #dee;}</style>
</head>
<body>
<h1>CodeMirror: Pig Latin mode</h1>
<form><textarea id="code" name="code">
-- Apache Pig (Pig Latin Language) Demo
/*
This is a multiline comment.
*/
a = LOAD "\path\to\input" USING PigStorage('\t') AS (x:long, y:chararray, z:bytearray);
b = GROUP a BY (x,y,3+4);
c = FOREACH b GENERATE flatten(group) as (x,y), SUM(group.$2) as z;
STORE c INTO "\path\to\output";
--
</textarea></form>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
lineNumbers: true,
matchBrackets: true,
indentUnit: 4,
mode: "text/x-pig"
});
</script>
<p>
Simple mode that handles Pig Latin language.
</p>
<p><strong>MIME type defined:</strong> <code>text/x-pig</code>
(PIG code)
</html>

View File

@ -0,0 +1,172 @@
/*
* Pig Latin Mode for CodeMirror 2
* @author Prasanth Jayachandran
* @link https://github.com/prasanthj/pig-codemirror-2
* This implementation is adapted from PL/SQL mode in CodeMirror 2.
*/
CodeMirror.defineMode("pig", function(config, parserConfig) {
var indentUnit = config.indentUnit,
keywords = parserConfig.keywords,
builtins = parserConfig.builtins,
types = parserConfig.types,
multiLineStrings = parserConfig.multiLineStrings;
var isOperatorChar = /[*+\-%<>=&?:\/!|]/;
function chain(stream, state, f) {
state.tokenize = f;
return f(stream, state);
}
var type;
function ret(tp, style) {
type = tp;
return style;
}
function tokenComment(stream, state) {
var isEnd = false;
var ch;
while(ch = stream.next()) {
if(ch == "/" && isEnd) {
state.tokenize = tokenBase;
break;
}
isEnd = (ch == "*");
}
return ret("comment", "comment");
}
function tokenString(quote) {
return function(stream, state) {
var escaped = false, next, end = false;
while((next = stream.next()) != null) {
if (next == quote && !escaped) {
end = true; break;
}
escaped = !escaped && next == "\\";
}
if (end || !(escaped || multiLineStrings))
state.tokenize = tokenBase;
return ret("string", "error");
};
}
function tokenBase(stream, state) {
var ch = stream.next();
// is a start of string?
if (ch == '"' || ch == "'")
return chain(stream, state, tokenString(ch));
// is it one of the special chars
else if(/[\[\]{}\(\),;\.]/.test(ch))
return ret(ch);
// is it a number?
else if(/\d/.test(ch)) {
stream.eatWhile(/[\w\.]/);
return ret("number", "number");
}
// multi line comment or operator
else if (ch == "/") {
if (stream.eat("*")) {
return chain(stream, state, tokenComment);
}
else {
stream.eatWhile(isOperatorChar);
return ret("operator", "operator");
}
}
// single line comment or operator
else if (ch=="-") {
if(stream.eat("-")){
stream.skipToEnd();
return ret("comment", "comment");
}
else {
stream.eatWhile(isOperatorChar);
return ret("operator", "operator");
}
}
// is it an operator
else if (isOperatorChar.test(ch)) {
stream.eatWhile(isOperatorChar);
return ret("operator", "operator");
}
else {
// get the while word
stream.eatWhile(/[\w\$_]/);
// is it one of the listed keywords?
if (keywords && keywords.propertyIsEnumerable(stream.current().toUpperCase())) {
if (stream.eat(")") || stream.eat(".")) {
//keywords can be used as variables like flatten(group), group.$0 etc..
}
else {
return ("keyword", "keyword");
}
}
// is it one of the builtin functions?
if (builtins && builtins.propertyIsEnumerable(stream.current().toUpperCase()))
{
return ("keyword", "variable-2")
}
// is it one of the listed types?
if (types && types.propertyIsEnumerable(stream.current().toUpperCase()))
return ("keyword", "variable-3")
// default is a 'word'
return ret("word", "pig-word");
}
}
// Interface
return {
startState: function(basecolumn) {
return {
tokenize: tokenBase,
startOfLine: true
};
},
token: function(stream, state) {
if(stream.eatSpace()) return null;
var style = state.tokenize(stream, state);
return style;
}
};
});
(function() {
function keywords(str) {
var obj = {}, words = str.split(" ");
for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
return obj;
}
// builtin funcs taken from trunk revision 1303237
var pBuiltins = "ABS ACOS ARITY ASIN ATAN AVG BAGSIZE BINSTORAGE BLOOM BUILDBLOOM CBRT CEIL "
+ "CONCAT COR COS COSH COUNT COUNT_STAR COV CONSTANTSIZE CUBEDIMENSIONS DIFF DISTINCT DOUBLEABS "
+ "DOUBLEAVG DOUBLEBASE DOUBLEMAX DOUBLEMIN DOUBLEROUND DOUBLESUM EXP FLOOR FLOATABS FLOATAVG "
+ "FLOATMAX FLOATMIN FLOATROUND FLOATSUM GENERICINVOKER INDEXOF INTABS INTAVG INTMAX INTMIN "
+ "INTSUM INVOKEFORDOUBLE INVOKEFORFLOAT INVOKEFORINT INVOKEFORLONG INVOKEFORSTRING INVOKER "
+ "ISEMPTY JSONLOADER JSONMETADATA JSONSTORAGE LAST_INDEX_OF LCFIRST LOG LOG10 LOWER LONGABS "
+ "LONGAVG LONGMAX LONGMIN LONGSUM MAX MIN MAPSIZE MONITOREDUDF NONDETERMINISTIC OUTPUTSCHEMA "
+ "PIGSTORAGE PIGSTREAMING RANDOM REGEX_EXTRACT REGEX_EXTRACT_ALL REPLACE ROUND SIN SINH SIZE "
+ "SQRT STRSPLIT SUBSTRING SUM STRINGCONCAT STRINGMAX STRINGMIN STRINGSIZE TAN TANH TOBAG "
+ "TOKENIZE TOMAP TOP TOTUPLE TRIM TEXTLOADER TUPLESIZE UCFIRST UPPER UTF8STORAGECONVERTER ";
// taken from QueryLexer.g
var pKeywords = "VOID IMPORT RETURNS DEFINE LOAD FILTER FOREACH ORDER CUBE DISTINCT COGROUP "
+ "JOIN CROSS UNION SPLIT INTO IF OTHERWISE ALL AS BY USING INNER OUTER ONSCHEMA PARALLEL "
+ "PARTITION GROUP AND OR NOT GENERATE FLATTEN ASC DESC IS STREAM THROUGH STORE MAPREDUCE "
+ "SHIP CACHE INPUT OUTPUT STDERROR STDIN STDOUT LIMIT SAMPLE LEFT RIGHT FULL EQ GT LT GTE LTE "
+ "NEQ MATCHES TRUE FALSE ";
// data types
var pTypes = "BOOLEAN INT LONG FLOAT DOUBLE CHARARRAY BYTEARRAY BAG TUPLE MAP "
CodeMirror.defineMIME("text/x-pig", {
name: "pig",
builtins: keywords(pBuiltins),
keywords: keywords(pKeywords),
types: keywords(pTypes)
});
}());

View File

@ -0,0 +1,62 @@
<!doctype html>
<html>
<head>
<title>CodeMirror: Oracle PL/SQL mode</title>
<link rel="stylesheet" href="../../lib/codemirror.css">
<script src="../../lib/codemirror.js"></script>
<script src="plsql.js"></script>
<link rel="stylesheet" href="../../doc/docs.css">
<style>.CodeMirror {border: 2px inset #dee;}</style>
</head>
<body>
<h1>CodeMirror: Oracle PL/SQL mode</h1>
<form><textarea id="code" name="code">
-- Oracle PL/SQL Code Demo
/*
based on c-like mode, adapted to PL/SQL by Peter Raganitsch ( http://www.oracle-and-apex.com/ )
April 2011
*/
DECLARE
vIdx NUMBER;
vString VARCHAR2(100);
cText CONSTANT VARCHAR2(100) := 'That''s it! Have fun with CodeMirror 2';
BEGIN
vIdx := 0;
--
FOR rDATA IN
( SELECT *
FROM EMP
ORDER BY EMPNO
)
LOOP
vIdx := vIdx + 1;
vString := rDATA.EMPNO || ' - ' || rDATA.ENAME;
--
UPDATE EMP
SET SAL = SAL * 101/100
WHERE EMPNO = rDATA.EMPNO
;
END LOOP;
--
SYS.DBMS_OUTPUT.Put_Line (cText);
END;
--
</textarea></form>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
lineNumbers: true,
matchBrackets: true,
indentUnit: 4,
mode: "text/x-plsql"
});
</script>
<p>
Simple mode that handles Oracle PL/SQL language (and Oracle SQL, of course).
</p>
<p><strong>MIME type defined:</strong> <code>text/x-plsql</code>
(PLSQL code)
</html>

View File

@ -0,0 +1,217 @@
CodeMirror.defineMode("plsql", function(config, parserConfig) {
var indentUnit = config.indentUnit,
keywords = parserConfig.keywords,
functions = parserConfig.functions,
types = parserConfig.types,
sqlplus = parserConfig.sqlplus,
multiLineStrings = parserConfig.multiLineStrings;
var isOperatorChar = /[+\-*&%=<>!?:\/|]/;
function chain(stream, state, f) {
state.tokenize = f;
return f(stream, state);
}
var type;
function ret(tp, style) {
type = tp;
return style;
}
function tokenBase(stream, state) {
var ch = stream.next();
// start of string?
if (ch == '"' || ch == "'")
return chain(stream, state, tokenString(ch));
// is it one of the special signs []{}().,;? Seperator?
else if (/[\[\]{}\(\),;\.]/.test(ch))
return ret(ch);
// start of a number value?
else if (/\d/.test(ch)) {
stream.eatWhile(/[\w\.]/);
return ret("number", "number");
}
// multi line comment or simple operator?
else if (ch == "/") {
if (stream.eat("*")) {
return chain(stream, state, tokenComment);
}
else {
stream.eatWhile(isOperatorChar);
return ret("operator", "operator");
}
}
// single line comment or simple operator?
else if (ch == "-") {
if (stream.eat("-")) {
stream.skipToEnd();
return ret("comment", "comment");
}
else {
stream.eatWhile(isOperatorChar);
return ret("operator", "operator");
}
}
// pl/sql variable?
else if (ch == "@" || ch == "$") {
stream.eatWhile(/[\w\d\$_]/);
return ret("word", "variable");
}
// is it a operator?
else if (isOperatorChar.test(ch)) {
stream.eatWhile(isOperatorChar);
return ret("operator", "operator");
}
else {
// get the whole word
stream.eatWhile(/[\w\$_]/);
// is it one of the listed keywords?
if (keywords && keywords.propertyIsEnumerable(stream.current().toLowerCase())) return ret("keyword", "keyword");
// is it one of the listed functions?
if (functions && functions.propertyIsEnumerable(stream.current().toLowerCase())) return ret("keyword", "builtin");
// is it one of the listed types?
if (types && types.propertyIsEnumerable(stream.current().toLowerCase())) return ret("keyword", "variable-2");
// is it one of the listed sqlplus keywords?
if (sqlplus && sqlplus.propertyIsEnumerable(stream.current().toLowerCase())) return ret("keyword", "variable-3");
// default: just a "word"
return ret("word", "plsql-word");
}
}
function tokenString(quote) {
return function(stream, state) {
var escaped = false, next, end = false;
while ((next = stream.next()) != null) {
if (next == quote && !escaped) {end = true; break;}
escaped = !escaped && next == "\\";
}
if (end || !(escaped || multiLineStrings))
state.tokenize = tokenBase;
return ret("string", "plsql-string");
};
}
function tokenComment(stream, state) {
var maybeEnd = false, ch;
while (ch = stream.next()) {
if (ch == "/" && maybeEnd) {
state.tokenize = tokenBase;
break;
}
maybeEnd = (ch == "*");
}
return ret("comment", "plsql-comment");
}
// Interface
return {
startState: function(basecolumn) {
return {
tokenize: tokenBase,
startOfLine: true
};
},
token: function(stream, state) {
if (stream.eatSpace()) return null;
var style = state.tokenize(stream, state);
return style;
}
};
});
(function() {
function keywords(str) {
var obj = {}, words = str.split(" ");
for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
return obj;
}
var cKeywords = "abort accept access add all alter and any array arraylen as asc assert assign at attributes audit " +
"authorization avg " +
"base_table begin between binary_integer body boolean by " +
"case cast char char_base check close cluster clusters colauth column comment commit compress connect " +
"connected constant constraint crash create current currval cursor " +
"data_base database date dba deallocate debugoff debugon decimal declare default definition delay delete " +
"desc digits dispose distinct do drop " +
"else elsif enable end entry escape exception exception_init exchange exclusive exists exit external " +
"fast fetch file for force form from function " +
"generic goto grant group " +
"having " +
"identified if immediate in increment index indexes indicator initial initrans insert interface intersect " +
"into is " +
"key " +
"level library like limited local lock log logging long loop " +
"master maxextents maxtrans member minextents minus mislabel mode modify multiset " +
"new next no noaudit nocompress nologging noparallel not nowait number_base " +
"object of off offline on online only open option or order out " +
"package parallel partition pctfree pctincrease pctused pls_integer positive positiven pragma primary prior " +
"private privileges procedure public " +
"raise range raw read rebuild record ref references refresh release rename replace resource restrict return " +
"returning reverse revoke rollback row rowid rowlabel rownum rows run " +
"savepoint schema segment select separate session set share snapshot some space split sql start statement " +
"storage subtype successful synonym " +
"tabauth table tables tablespace task terminate then to trigger truncate type " +
"union unique unlimited unrecoverable unusable update use using " +
"validate value values variable view views " +
"when whenever where while with work";
var cFunctions = "abs acos add_months ascii asin atan atan2 average " +
"bfilename " +
"ceil chartorowid chr concat convert cos cosh count " +
"decode deref dual dump dup_val_on_index " +
"empty error exp " +
"false floor found " +
"glb greatest " +
"hextoraw " +
"initcap instr instrb isopen " +
"last_day least lenght lenghtb ln lower lpad ltrim lub " +
"make_ref max min mod months_between " +
"new_time next_day nextval nls_charset_decl_len nls_charset_id nls_charset_name nls_initcap nls_lower " +
"nls_sort nls_upper nlssort no_data_found notfound null nvl " +
"others " +
"power " +
"rawtohex reftohex round rowcount rowidtochar rpad rtrim " +
"sign sin sinh soundex sqlcode sqlerrm sqrt stddev substr substrb sum sysdate " +
"tan tanh to_char to_date to_label to_multi_byte to_number to_single_byte translate true trunc " +
"uid upper user userenv " +
"variance vsize";
var cTypes = "bfile blob " +
"character clob " +
"dec " +
"float " +
"int integer " +
"mlslabel " +
"natural naturaln nchar nclob number numeric nvarchar2 " +
"real rowtype " +
"signtype smallint string " +
"varchar varchar2";
var cSqlplus = "appinfo arraysize autocommit autoprint autorecovery autotrace " +
"blockterminator break btitle " +
"cmdsep colsep compatibility compute concat copycommit copytypecheck " +
"define describe " +
"echo editfile embedded escape exec execute " +
"feedback flagger flush " +
"heading headsep " +
"instance " +
"linesize lno loboffset logsource long longchunksize " +
"markup " +
"native newpage numformat numwidth " +
"pagesize pause pno " +
"recsep recsepchar release repfooter repheader " +
"serveroutput shiftinout show showmode size spool sqlblanklines sqlcase sqlcode sqlcontinue sqlnumber " +
"sqlpluscompatibility sqlprefix sqlprompt sqlterminator suffix " +
"tab term termout time timing trimout trimspool ttitle " +
"underline " +
"verify version " +
"wrap";
CodeMirror.defineMIME("text/x-plsql", {
name: "plsql",
keywords: keywords(cKeywords),
functions: keywords(cFunctions),
types: keywords(cTypes),
sqlplus: keywords(cSqlplus)
});
}());

View File

@ -0,0 +1,40 @@
<!doctype html>
<html>
<head>
<title>CodeMirror: Properties files mode</title>
<link rel="stylesheet" href="../../lib/codemirror.css">
<script src="../../lib/codemirror.js"></script>
<script src="properties.js"></script>
<style>.CodeMirror {border-top: 1px solid #ddd; border-bottom: 1px solid #ddd;}</style>
<link rel="stylesheet" href="../../doc/docs.css">
</head>
<body>
<h1>CodeMirror: Properties files mode</h1>
<form><textarea id="code" name="code">
# This is a properties file
a.key = A value
another.key = http://example.com
! Exclamation mark as comment
but.not=Within ! A value # indeed
# Spaces at the beginning of a line
spaces.before.key=value
backslash=Used for multi\
line entries,\
that's convenient.
# Unicode sequences
unicode.key=This is \u0020 Unicode
no.multiline=here
# Colons
colons : can be used too
# Spaces
spaces\ in\ keys=Not very common...
</textarea></form>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {});
</script>
<p><strong>MIME types defined:</strong> <code>text/x-properties</code>,
<code>text/x-ini</code>.</p>
</body>
</html>

Some files were not shown because too many files have changed in this diff Show More