// CodeMirror, copyright (c) by Marijn Haverbeke and others // Distributed under an MIT license: https://codemirror.net/LICENSE // Originally written by Alf Nielsen, re-written by Michael Zhou ;(function (mod) { if (typeof exports == 'object' && typeof module == 'object') // CommonJS mod(require('../../lib/codemirror')) else if (typeof define == 'function' && define.amd) // AMD define(['../../lib/codemirror'], mod) // Plain browser env else mod(CodeMirror) })(function (CodeMirror) { 'use strict' function words(str) { var obj = {}, words = str.split(',') for (var i = 0; i < words.length; ++i) { var allCaps = words[i].toUpperCase() var firstCap = words[i].charAt(0).toUpperCase() + words[i].slice(1) obj[words[i]] = true obj[allCaps] = true obj[firstCap] = true } return obj } function metaHook(stream) { stream.eatWhile(/[\w\$_]/) return 'meta' } CodeMirror.defineMode('vhdl', function (config, parserConfig) { var indentUnit = config.indentUnit, 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,' + 'body,buffer,bus,case,component,configuration,constant,disconnect,downto,else,elsif,end,end block,end case,' + 'end component,end for,end generate,end if,end loop,end process,end record,end units,entity,exit,file,for,' + 'function,generate,generic,generic map,group,guarded,if,impure,in,inertial,inout,is,label,library,linkage,' + 'literal,loop,map,mod,nand,new,next,nor,null,of,on,open,or,others,out,package,package body,port,port map,' + 'postponed,procedure,process,pure,range,record,register,reject,rem,report,return,rol,ror,select,severity,signal,' + 'sla,sll,sra,srl,subtype,then,to,transport,type,unaffected,units,until,use,variable,wait,when,while,with,xnor,xor' ) var blockKeywords = words('architecture,entity,begin,case,port,else,elsif,end,for,function,if') var isOperatorChar = /[&|~>