Skip to content

Commit

Permalink
new codemirro 5.65.16 plain
Browse files Browse the repository at this point in the history
  • Loading branch information
JensLincke committed Jun 13, 2024
1 parent cdf8ff0 commit b376f94
Show file tree
Hide file tree
Showing 30 changed files with 2,928 additions and 0 deletions.
384 changes: 384 additions & 0 deletions src/external/code-mirror/mode/clojure/test.js

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions src/external/code-mirror/mode/d/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: https://codemirror.net/5/LICENSE

(function() {
var mode = CodeMirror.getMode({indentUnit: 2}, "d");
function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); }

MT("nested_comments",
"[comment /+]","[comment comment]","[comment +/]","[variable void] [variable main](){}");

})();
128 changes: 128 additions & 0 deletions src/external/code-mirror/mode/dockerfile/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: https://codemirror.net/5/LICENSE

(function() {
var mode = CodeMirror.getMode({indentUnit: 2}, "text/x-dockerfile");
function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); }

MT("simple_nodejs_dockerfile",
"[keyword FROM] node:carbon",
"[comment # Create app directory]",
"[keyword WORKDIR] /usr/src/app",
"[comment # Install app dependencies]",
"[comment # A wildcard is used to ensure both package.json AND package-lock.json are copied]",
"[comment # where available (npm@5+)]",
"[keyword COPY] package*.json ./",
"[keyword RUN] npm install",
"[keyword COPY] . .",
"[keyword EXPOSE] [number 8080] [number 3000]",
"[keyword ENV] NODE_ENV development",
"[keyword CMD] [[ [string \"npm\"], [string \"start\"] ]]");

// Ideally the last space should not be highlighted.
MT("instruction_without_args_1",
"[keyword CMD] ");

MT("instruction_without_args_2",
"[comment # An instruction without args...]",
"[keyword ARG] [error #...is an error]");

MT("multiline",
"[keyword RUN] apt-get update && apt-get install -y \\",
" mercurial \\",
" subversion \\",
" && apt-get clean \\",
" && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*");

MT("from_comment",
" [keyword FROM] debian:stretch # I tend to use stable as that is more stable",
" [keyword FROM] debian:stretch [keyword AS] stable # I am even more stable",
" [keyword FROM] [error # this is an error]");

MT("from_as",
"[keyword FROM] golang:1.9.2-alpine3.6 [keyword AS] build",
"[keyword COPY] --from=build /bin/project /bin/project",
"[keyword ENTRYPOINT] [[ [string \"/bin/project\"] ]]",
"[keyword CMD] [[ [string \"--help\"] ]]");

MT("arg",
"[keyword ARG] VERSION=latest",
"[keyword FROM] busybox:$VERSION",
"[keyword ARG] VERSION",
"[keyword RUN] echo $VERSION > image_version");

MT("label",
"[keyword LABEL] com.example.label-with-value=[string \"foo\"]");

MT("label_multiline",
"[keyword LABEL] description=[string \"This text illustrates ]\\",
"[string that label-values can span multiple lines.\"]");

MT("maintainer",
"[keyword MAINTAINER] Foo Bar [string \"[email protected]\"] ",
"[keyword MAINTAINER] Bar Baz <[email protected]>");

MT("env",
"[keyword ENV] BUNDLE_PATH=[string \"$GEM_HOME\"] \\",
" BUNDLE_APP_CONFIG=[string \"$GEM_HOME\"]");

MT("verify_keyword",
"[keyword RUN] add-apt-repository ppa:chris-lea/node.js");

MT("scripts",
"[comment # Set an entrypoint, to automatically install node modules]",
"[keyword ENTRYPOINT] [[ [string \"/bin/bash\"], [string \"-c\"], [string \"if [[ ! -d node_modules ]]; then npm install; fi; exec \\\"${@:0}\\\";\"] ]]",
"[keyword CMD] npm start",
"[keyword RUN] npm run build && \\",
"[comment # a comment between the shell commands]",
" npm run test");

MT("strings_single",
"[keyword FROM] buildpack-deps:stretch",
"[keyword RUN] { \\",
" echo [string 'install: --no-document']; \\",
" echo [string 'update: --no-document']; \\",
" } >> /usr/local/etc/gemrc");

MT("strings_single_multiline",
"[keyword RUN] set -ex \\",
" \\",
" && buildDeps=[string ' ]\\",
"[string bison ]\\",
"[string dpkg-dev ]\\",
"[string libgdbm-dev ]\\",
"[string ruby ]\\",
"[string '] \\",
" && apt-get update");

MT("strings_single_multiline_2",
"[keyword RUN] echo [string 'say \\' ]\\",
"[string it works'] ");

MT("strings_double",
"[keyword RUN] apt-get install -y --no-install-recommends $buildDeps \\",
" \\",
" && wget -O ruby.tar.xz [string \"https://cache.ruby-lang.org/pub/ruby/${RUBY_MAJOR%-rc}/ruby-$RUBY_VERSION.tar.xz\"] \\",
" && echo [string \"$RUBY_DOWNLOAD_SHA256 *ruby.tar.xz\"] | sha256sum -c - ");

MT("strings_double_multiline",
"[keyword RUN] echo [string \"say \\\" ]\\",
"[string it works\"] ");

MT("escape",
"[comment # escape=`]",
"[keyword FROM] microsoft/windowsservercore",
"[keyword RUN] powershell.exe -Command `",
" $ErrorActionPreference = [string 'Stop']; `",
" wget https://www.python.org/ftp/python/3.5.1/python-3.5.1.exe -OutFile c:\python-3.5.1.exe ; `",
" Start-Process c:\python-3.5.1.exe -ArgumentList [string '/quiet InstallAllUsers=1 PrependPath=1'] -Wait ; `",
" Remove-Item c:\python-3.5.1.exe -Force)");

MT("escape_strings",
"[comment # escape=`]",
"[keyword FROM] python:3.6-windowsservercore [keyword AS] python",
"[keyword RUN] $env:PATH = [string 'C:\\Python;C:\\Python\\Scripts;{0}'] -f $env:PATH ; `",
// It should not consider \' as escaped.
// " Set-ItemProperty -Path [string 'HKLM:\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment\\'] -Name Path -Value $env:PATH ;");
" Set-ItemProperty -Path [string 'HKLM:\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment\\' -Name Path -Value $env:PATH ;]");
})();
122 changes: 122 additions & 0 deletions src/external/code-mirror/mode/sass/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: https://codemirror.net/5/LICENSE

(function() {
var mode = CodeMirror.getMode({indentUnit: 2}, "sass");
// Since Sass has an indent-based syntax, is almost impossible to test correctly the indentation in all cases.
// So disable it for tests.
mode.indent = undefined;
function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); }

MT("comment",
"[comment // this is a comment]",
"[comment also this is a comment]")

MT("comment_multiline",
"[comment /* this is a comment]",
"[comment also this is a comment]")

MT("variable",
"[variable-2 $page-width][operator :] [number 800][unit px]")

MT("global_attributes",
"[tag body]",
" [property font][operator :]",
" [property family][operator :] [atom sans-serif]",
" [property size][operator :] [number 30][unit em]",
" [property weight][operator :] [atom bold]")

MT("scoped_styles",
"[builtin #contents]",
" [property width][operator :] [variable-2 $page-width]",
" [builtin #sidebar]",
" [property float][operator :] [atom right]",
" [property width][operator :] [variable-2 $sidebar-width]",
" [builtin #main]",
" [property width][operator :] [variable-2 $page-width] [operator -] [variable-2 $sidebar-width]",
" [property background][operator :] [variable-2 $primary-color]",
" [tag h2]",
" [property color][operator :] [keyword blue]")

// Sass allows to write the colon as first char instead of a "separator".
// :color red
// Not supported
// MT("property_syntax",
// "[qualifier .foo]",
// " [operator :][property color] [keyword red]")

MT("import",
"[def @import] [string \"sass/variables\"]",
// Probably it should parsed as above: as a string even without the " or '
// "[def @import] [string sass/baz]"
"[def @import] [tag sass][operator /][tag baz]")

MT("def",
"[def @if] [variable-2 $foo] [def @else]")

MT("tag_on_more_lines",
"[tag td],",
"[tag th]",
" [property font-family][operator :] [string \"Arial\"], [atom serif]")

MT("important",
"[qualifier .foo]",
" [property text-decoration][operator :] [atom none] [keyword !important]",
"[tag h1]",
" [property font-size][operator :] [number 2.5][unit em]")

MT("selector",
// SCSS doesn't highlight the :
// "[tag h1]:[variable-3 before],",
// "[tag h2]:[variable-3 before]",
"[tag h1][variable-3 :before],",
"[tag h2][variable-3 :before]",
" [property content][operator :] [string \"::\"]")

MT("definition_mixin_equal",
"[variable-2 $defined-bs-type][operator :] [atom border-box] [keyword !default]",
"[meta =bs][operator (][variable-2 $bs-type][operator :] [variable-2 $defined-bs-type][operator )]",
" [meta -webkit-][property box-sizing][operator :] [variable-2 $bs-type]",
" [property box-sizing][operator :] [variable-2 $bs-type]")

MT("definition_mixin_with_space",
"[variable-2 $defined-bs-type][operator :] [atom border-box] [keyword !default]",
"[def @mixin] [tag bs][operator (][variable-2 $bs-type][operator :] [variable-2 $defined-bs-type][operator )] ",
" [meta -moz-][property box-sizing][operator :] [variable-2 $bs-type]",
" [property box-sizing][operator :] [variable-2 $bs-type]")

MT("numbers_start_dot_include_plus",
// The % is not highlighted correctly
// "[meta =button-links][operator (][variable-2 $button-base][operator :] [atom darken][operator (][variable-2 $color11], [number 10][unit %][operator )][operator )]",
"[meta =button-links][operator (][variable-2 $button-base][operator :] [atom darken][operator (][variable-2 $color11], [number 10][operator %))]",
" [property padding][operator :] [number .3][unit em] [number .6][unit em]",
" [variable-3 +border-radius][operator (][number 8][unit px][operator )]",
" [property background-color][operator :] [variable-2 $button-base]")

MT("include",
"[qualifier .bar]",
" [def @include] [tag border-radius][operator (][number 8][unit px][operator )]")

MT("reference_parent",
"[qualifier .col]",
" [property clear][operator :] [atom both]",
// SCSS doesn't highlight the :
// " &:[variable-3 after]",
" &[variable-3 :after]",
" [property content][operator :] [string '']",
" [property clear][operator :] [atom both]")

MT("reference_parent_with_spaces",
"[tag section]",
" [property border-left][operator :] [number 20][unit px] [atom transparent] [atom solid] ",
" &[qualifier .section3]",
" [qualifier .title]",
" [property color][operator :] [keyword white] ",
" [qualifier .vermas]",
" [property display][operator :] [atom none]")

MT("font_face",
"[def @font-face]",
" [property font-family][operator :] [string 'icomoon']",
" [property src][operator :] [atom url][operator (][string fonts/icomoon.ttf][operator )]")
})();
73 changes: 73 additions & 0 deletions src/external/code-mirror/mode/wast/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<!DOCTYPE html>

<title>CodeMirror: WebAssembly mode</title>
<meta charset="utf-8" />
<link rel=stylesheet href="../../doc/docs.css">

<link rel="stylesheet" href="../../lib/codemirror.css">
<script src="../../lib/codemirror.js"></script>
<script src="../../addon/mode/simple.js"></script>
<script src="wast.js"></script>
<style>
.CodeMirror {
border-top: 1px solid black;
border-bottom: 1px solid black;
}
</style>
<div id=nav>
<a href="https://codemirror.net/5">
<h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt="">
</a>

<ul>
<li><a href="../../index.html">Home</a>
<li><a href="../../doc/manual.html">Manual</a>
<li><a href="https://github.com/codemirror/codemirror5">Code</a>
</ul>
<ul>
<li><a href="../index.html">Language modes</a>
<li><a class=active href="#">WebAssembly</a>
</ul>
</div>

<article>
<h2>WebAssembly mode</h2>


<div><textarea id="code" name="code">
/* Example WebAssembly */
(module $foo
(export "fac" (func $fac))
(export "plus" (func $plus))

(func $fac (type $t0) (param $p0 i64) (result i64)
(if $I0 (result i64)
(i64.lt_s
(local.get $p0)
(i64.const 1))
(then
(i64.const 1))
(else
(i64.mul
(local.get $p0)
(call $fac
(i64.sub
(local.get $p0)
(i64.const 1)))))))

(func $plus (param $x i32) (param $y i32) (result i32)
(i32.add
(local.get $x)
(local.get $y))))</textarea></div>

<script>
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
lineNumbers: true,
lineWrapping: true,
indentUnit: 4,
mode: "wast"
});
</script>

<p><strong>MIME types defined:</strong> <code>text/webassembly</code>.</p>
</article>
Loading

0 comments on commit b376f94

Please sign in to comment.