Click here to Skip to main content
15,860,943 members
Articles / Programming Languages / C#

CodeDom Assistant

Rate me:
Please Sign up or sign in to vote.
4.84/5 (26 votes)
21 Sep 20074 min read 136.5K   6.6K   82  
Generating CodeDom Code By Parsing C# or VB
<?xml version="1.0" encoding="utf-8"?>
<ScintillaNET>
	<Language Name="html">
		<!--  
			I'm adding the HTML and JavaScript Keywords into the Default AutoComplete list
			becuase these are by FAR the most common.
		-->
		<AutoComplete FillUpCharacters=".([&quot;'" SingleLineAccept="True" IsCaseSensitive="False">
			<List>
				!doctype a abbr accept-charset accept accesskey acronym action address align alink alt applet archive area axis b background base basefont bdo bgcolor big blockquote body border br button caption cellpadding cellspacing center char charoff charset checkbox checked cite class classid clear code codebase codetype col colgroup color cols colspan compact content coords data datafld dataformatas datapagesize datasrc datetime dd declare defer del dfn dir disabled div dl dt em enctype event face fieldset file font for form frame frameborder frameset h1 h2 h3 h4 h5 h6 head headers height hidden hr href hreflang hspace html http-equiv i id iframe image img input ins isindex ismap kbd label lang language leftmargin legend li link longdesc map marginwidth marginheight maxlength media menu meta method multiple name noframes nohref noresize noscript noshade nowrap object ol onblur onchange onclick ondblclick onfocus onkeydown onkeypress onkeyup onload onmousedown onmousemove onmouseover onmouseout onmouseup optgroup option onreset onselect onsubmit onunload p param password profile pre prompt public q radio readonly rel reset rev rows rowspan rules s samp scheme scope script select selected shape size small span src standby start strike strong style sub submit summary sup tabindex table target tbody td text textarea tfoot th thead title topmargin tr tt type u ul usemap valign value valuetype var version vlink vspace width xml xmlns
				abstract boolean break byte case catch char class const continue debugger default delete do double else enum export extends final finally float for function goto if implements import in instanceof int interface long native new package private protected public return short static super switch synchronized this throw throws transient try typeof var void volatile while with true false prototype
			</List>
		</AutoComplete>

		<!-- 
			This is a bit of a hack that I picked up from SciTE, We keep the Stream 
			Comments as HTML Style and the Line Comments JavaScript Style. The better
			way to do it would be to change the comment strings whenever the selection
			changes based on if the current style is HTML or JavaScript (or VBScript,
			PHP, etc)			
		 -->
		<Lexer LineCommentPrefix="//" StreamCommentPrefix="&lt;!-- " StreamCommentSuffix=" --&gt;">
			<Keywords List="0" Name="HTML">!doctype a abbr accept-charset accept accesskey acronym action address align alink alt applet archive area axis b background base basefont bdo bgcolor big blockquote body border br button caption cellpadding cellspacing center char charoff charset checkbox checked cite class classid clear code codebase codetype col colgroup color cols colspan compact content coords data datafld dataformatas datapagesize datasrc datetime dd declare defer del dfn dir disabled div dl dt em enctype event face fieldset file font for form frame frameborder frameset h1 h2 h3 h4 h5 h6 head headers height hidden hr href hreflang hspace html http-equiv i id iframe image img input ins isindex ismap kbd label lang language leftmargin legend li link longdesc map marginwidth marginheight maxlength media menu meta method multiple name noframes nohref noresize noscript noshade nowrap object ol onblur onchange onclick ondblclick onfocus onkeydown onkeypress onkeyup onload onmousedown onmousemove onmouseover onmouseout onmouseup optgroup option onreset onselect onsubmit onunload p param password profile pre prompt public q radio readonly rel reset rev rows rowspan rules s samp scheme scope script select selected shape size small span src standby start strike strong style sub submit summary sup tabindex table target tbody td text textarea tfoot th thead title topmargin tr tt type u ul usemap valign value valuetype var version vlink vspace width xml xmlns</Keywords>
			<Keywords List="1" Name="JavaScript">abstract boolean break byte case catch char class const continue debugger default delete do double else enum export extends final finally float for function goto if implements import in instanceof int interface long native new package private protected public return short static super switch synchronized this throw throws transient try typeof var void volatile while with true false prototype</Keywords>
			<Keywords List="2" Name="VBScript">addhandler addressof andalso alias and ansi as assembly attribute auto begin boolean byref byte byval call case catch cbool cbyte cchar cdate cdec cdbl char cint class clng cobj compare const continue cshort csng cstr ctype currency date decimal declare default delegate dim do double each else elseif end enum erase error event exit explicit false finally for friend function get gettype global gosub goto handles if implement implements imports in inherits integer interface is let lib like load long loop lset me mid mod module mustinherit mustoverride mybase myclass namespace new next not nothing notinheritable notoverridable object on option optional or orelse overloads overridable overrides paramarray preserve private property protected public raiseevent readonly redim rem removehandler rset resume return select set shadows shared short single static step stop string structure sub synclock then throw to true try type typeof unload unicode until variant wend when while with withevents writeonly xor</Keywords>
			<Keywords List="3" Name="Python">and as assert break class continue def del elif else except exec finally for from global if import in is lambda None not or pass print raise return triple try while with yield</Keywords>
			<Keywords List="4" Name="PHP">and or xor __file__ __line__ array as break case cfunction class const continue declare default die do echo else elseif empty enddeclare endfor endforeach endif endswitch endwhile eval exit extends for foreach function global if include include_once isset list new old_function print require require_once return static switch unset use var while __function__ __class__ php_version php_os default_include_path pear_install_dir pear_extension_dir php_extension_dir php_bindir php_libdir php_datadir php_sysconfdir php_localstatedir php_config_file_path php_output_handler_start php_output_handler_cont php_output_handler_end e_error e_warning e_parse e_notice e_core_error e_core_warning e_compile_error e_compile_warning e_user_error e_user_warning e_user_notice e_all true false bool boolean int integer float double real string array object resource null class extends parent stdclass directory __sleep __wakeup interface implements abstract public protected private</Keywords>
		</Lexer>

		<!-- 
			Additionally the HTML comment scheme lends itself better to having CTRL+Q toggle
			Line comments and CTRL+SHIFT+Q add Stream comments rather than having VS style
			comments.			
		-->
		<Commands Inherit="True">
			<Binding Key="Q" Modifier="Control" Command="ToggleLineComment" ReplaceCurrent="True"/>
			<Binding Key="Q" Modifier="Shift Control" Command="StreamComment" ReplaceCurrent="True"/>
		</Commands>

		<!-- 
			I saved the best for last. Styles, yeck. This is why the HTML config
			is so damned complicated.
			
			In order for any of the SubLangage Styles to inherit from the default config
			they have to be declared here even if they don't have any values set.
		-->
		<Styles>
		
			<!--
				As sort of a neat side-effect of how the SubLanguage inheritance works
				any styles declared here will be inherited by the sublanguage styles.
				Note that they have to be decalared before any of the sublanguages for
				it to work.
			-->

			<Style Name="DOUBLESTRING" ForeColor="Orchid" />
			<Style Name="SINGLESTRING" ForeColor="Orchid" />
			
			
			<SubLanguage Name="HTML">
				<Style Name="DEFAULT" />
				<Style Name="TAG" />
				<Style Name="TAGUNKNOWN" />
				<Style Name="ATTRIBUTE" />
				<Style Name="ATTRIBUTEUNKNOWN" />
				<Style Name="NUMBER" />
				<Style Name="DOUBLESTRING"  />
				<Style Name="SINGLESTRING"  />
				<Style Name="OTHER" />
				<Style Name="COMMENT" />
				<Style Name="ENTITY" />
				<Style Name="TAGEND" />
				<Style Name="XMLSTART" />
				<Style Name="XMLEND" />
				<Style Name="SCRIPT" />
				<Style Name="ASP" />
				<Style Name="ASPAT" />
				<Style Name="CDATA" />
				<Style Name="QUESTION" />
				<Style Name="VALUE" />
				<Style Name="XCCOMMENT" />
			</SubLanguage>

			<SubLanguage Name="SGML">
				<Style Name="DEFAULT" />
				<Style Name="COMMAND" />
				<Style Name="1ST_PARAM" />
				<Style Name="DOUBLESTRING" />
				<Style Name="SIMPLESTRING" />
				<Style Name="ERROR" />
				<Style Name="SPECIAL" />
				<Style Name="ENTITY" />
				<Style Name="COMMENT" />
				<Style Name="1ST_PARAM_COMMENT" />
				<Style Name="BLOCK_DEFAULT" />
			</SubLanguage>


			<SubLanguage Name="JavaScript">
				<Style Name="START" />
				<Style Name="DEFAULT" />
				<Style Name="COMMENT" />
				<Style Name="COMMENTLINE" />
				<Style Name="COMMENTDOC" />
				<Style Name="NUMBER" />
				<Style Name="WORD" />
				<Style Name="KEYWORD" />
				<Style Name="DOUBLESTRING" />
				<Style Name="SINGLESTRING" />
				<Style Name="SYMBOLS" />
				<Style Name="STRINGEOL" />
				<Style Name="REGEX" />
			</SubLanguage>

			<SubLanguage Name="ASP JavaScript">
				<Style Name="START" />
				<Style Name="DEFAULT" />
				<Style Name="COMMENT" />
				<Style Name="COMMENTLINE" />
				<Style Name="COMMENTDOC" />
				<Style Name="NUMBER" />
				<Style Name="WORD" />
				<Style Name="KEYWORD" />
				<Style Name="DOUBLESTRING" />
				<Style Name="SINGLESTRING" />
				<Style Name="SYMBOLS" />
				<Style Name="STRINGEOL" />
				<Style Name="REGEX" />
			</SubLanguage>

			<SubLanguage Name="VBScript">
				<Style Name="START" />
				<Style Name="DEFAULT" />
				<Style Name="COMMENTLINE" />
				<Style Name="NUMBER" />
				<Style Name="WORD" />
				<Style Name="STRING" />
				<Style Name="IDENTIFIER" />
				<Style Name="STRINGEOL" />
			</SubLanguage>
			
			<SubLanguage Name="ASP VBScript">
				<Style Name="START" />
				<Style Name="DEFAULT" />
				<Style Name="COMMENTLINE" />
				<Style Name="NUMBER" />
				<Style Name="WORD" />
				<Style Name="STRING" />
				<Style Name="IDENTIFIER" />
				<Style Name="STRINGEOL" />
			</SubLanguage>

			<SubLanguage Name="Python">
				<Style Name="START" />
				<Style Name="DEFAULT" />
				<Style Name="COMMENTLINE" />
				<Style Name="NUMBER" />
				<Style Name="STRING" />
				<Style Name="CHARACTER" />
				<Style Name="WORD" />
				<Style Name="TRIPLE" />
				<Style Name="TRIPLEDOUBLE" />
				<Style Name="CLASSNAME" />
				<Style Name="DEFNAME" />
				<Style Name="OPERATOR" />
				<Style Name="IDENTIFIER" />
			</SubLanguage>


			<SubLanguage Name="ASP Python">
				<Style Name="START" />
				<Style Name="DEFAULT" />
				<Style Name="COMMENTLINE" />
				<Style Name="NUMBER" />
				<Style Name="STRING" />
				<Style Name="CHARACTER" />
				<Style Name="WORD" />
				<Style Name="TRIPLE" />
				<Style Name="TRIPLEDOUBLE" />
				<Style Name="CLASSNAME" />
				<Style Name="DEFNAME" />
				<Style Name="OPERATOR" />
				<Style Name="IDENTIFIER" />
			</SubLanguage>

			<SubLanguage Name="PHP">
				<Style Name="COMPLEX_VARIABLE" />
				<Style Name="DEFAULT" />
				<Style Name="HSTRING" />
				<Style Name="SIMPLESTRING" />
				<Style Name="WORD" />
				<Style Name="NUMBER" />
				<Style Name="VARIABLE" />
				<Style Name="COMMENT" />
				<Style Name="COMMENTLINE" />
				<Style Name="HSTRING_VARIABLE" />
				<Style Name="OPERATOR"/>
			</SubLanguage>
		</Styles>
	</Language>
</ScintillaNET>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
Australia Australia
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions