Skip to content

Commit

Permalink
[vhdl mode] Integrate
Browse files Browse the repository at this point in the history
Issue #3372
  • Loading branch information
marijnh committed Jul 13, 2015
1 parent bd36c1d commit e5b224a
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 13 deletions.
1 change: 1 addition & 0 deletions doc/compress.html
Expand Up @@ -208,6 +208,7 @@ <h2>Script compression helper</h2>
<option value="http://codemirror.net/mode/vbscript/vbscript.js">vbscript.js</option>
<option value="http://codemirror.net/mode/velocity/velocity.js">velocity.js</option>
<option value="http://codemirror.net/mode/verilog/verilog.js">verilog.js</option>
<option value="http://codemirror.net/mode/vhdl/vhdl.js">vhdl.js</option>
<option value="http://codemirror.net/mode/xml/xml.js">xml.js</option>
<option value="http://codemirror.net/mode/xquery/xquery.js">xquery.js</option>
<option value="http://codemirror.net/mode/yaml/yaml.js">yaml.js</option>
Expand Down
1 change: 1 addition & 0 deletions mode/index.html
Expand Up @@ -137,6 +137,7 @@ <h2>Language modes</h2>
<li><a href="vbscript/index.html">VBScript</a></li>
<li><a href="velocity/index.html">Velocity</a></li>
<li><a href="verilog/index.html">Verilog/SystemVerilog</a></li>
<li><a href="vhdl/index.html">VHDL</a></li>
<li><a href="xml/index.html">XML/HTML</a></li>
<li><a href="xquery/index.html">XQuery</a></li>
<li><a href="yaml/index.html">YAML</a></li>
Expand Down
2 changes: 1 addition & 1 deletion mode/vhdl/index.html
Expand Up @@ -87,7 +87,7 @@ <h2>Configuration options:</h2>
<ul>
<li><strong>atoms</strong> - List of atom words. Default: "null"</li>
<li><strong>hooks</strong> - List of meta hooks. Default: ["`", "$"]</li>
<li><strong>multiLineStrings</strong> - Whether multi-line strings are accepted. Default: undefined</li>
<li><strong>multiLineStrings</strong> - Whether multi-line strings are accepted. Default: false</li>
</ul>
</p>

Expand Down
20 changes: 8 additions & 12 deletions mode/vhdl/vhdl.js
Expand Up @@ -24,10 +24,15 @@ function words(str) {
return obj;
}

function metaHook(stream) {
stream.eatWhile(/[\w\$_]/);
return "meta";
}

CodeMirror.defineMode("vhdl", function(config, parserConfig) {
var indentUnit = config.indentUnit,
atoms = parserConfig.atoms || {},
hooks = parserConfig.hooks || {},
atoms = parserConfig.atoms || words("null"),
hooks = parserConfig.hooks || {"`": metaHook, "$": metaHook},
multiLineStrings = parserConfig.multiLineStrings;

var keywords = words("abs,access,after,alias,all,and,architecture,array,assert,attribute,begin,block," +
Expand Down Expand Up @@ -179,15 +184,6 @@ CodeMirror.defineMode("vhdl", function(config, parserConfig) {
};
});

function metaHook(stream) {
stream.eatWhile(/[\w\$_]/);
return "meta";
}

CodeMirror.defineMIME("text/x-vhdl", {
name: "vhdl",
atoms: words("null"),
hooks: {"`": metaHook, "$": metaHook}
});
CodeMirror.defineMIME("text/x-vhdl", "vhdl");

});

0 comments on commit e5b224a

Please sign in to comment.