
// Just tags
Syntaxed.Lang.HTML = { tokens: {
	'WHITESPACE'	:		/^[\s\n]+/,
	'LESS_THAN'		:		/^</,
	'GREATER_THAN'	:		/^>/,
	'DOCTYPE_START'	:		/^<!/,
	'DOCTYPE_TEXT'	:		/^[^>"']+/,
	'EQUALS'		:		/^=/,
	'DBL_QUOTE_STRING':		/^"([^"]|\\")*"/,
	'SINGLE_QUOTE_STRING':	/^'([^']|\\')*'/,
	'COMMENT_START'	:		/^<!--/,
	'COMMENT_TEXT'	:		/^[^\-]+/,
	'COMMENT_DASH'	:		/^-/,
	'COMMENT_END'	:		/^-->/,
	'ENTITY_START'	:		/^&/,
	'ENTITY_TEXT'	:		/^[^;]+/,
	'ENTITY_END'	:		/^;/,
	'TEXT_NODE'		:		/^[^&<"]+/,
	'TAG_IDENTIFIER':		/^\/?[^<>&0-9"':_\-\s=\/][^<>&'"\s=\/]*/,
	'TAG_END'		:		/^\/?>/,
	'ATTR_END'		:		/^(?=(\/>|>|\s))/
} , grammar: {
	'INITIAL':	{ 'COMMENT_START': 'comment', 'DOCTYPE_START': 'doctype', 'ENTITY_START': 'entity', 'LESS_THAN': 'tag', 'TEXT_NODE': 'text-node'},
	'doctype':	{ 'DOCTYPE_TEXT': 'doctype_text', 'DBL_QUOTE_STRING': 'string-double', 'SINGLE_QUOTE_STRING': 'string-single', 'GREATER_THAN': false},
	'tag': { 'TAG_IDENTIFIER': 'tag-name', 'WHITESPACE': 'tag-attributes', 'TAG_END': false},
	'tag-attributes': { 'TAG_IDENTIFIER': 'tag-attribute', 'WHITESPACE': 'whitespace', 'TAG_END': false },
	'tag-attribute': { 'EQUALS': 'attribute-value', 'WHITESPACE': false, 'ATTR_END': false },
	'attribute-value': { 'DBL_QUOTE_STRING': 'string-double', 'SINGLE_QUOTE_STRING': 'string-single', 'ATTR_END':  false },
	'comment': {'COMMENT_TEXT': 'comment-text', 'COMMENT_END': false, 'COMMENT_DASH': 'comment-text'},
	'entity': {'ENTITY_TEXT': 'entity-text', 'ENTITY_END': false}

}};

//Tags, CSS (within a <style> tag)
//TODO: JavaScript within a <script> tag
Syntaxed.Lang.HTMLWithCSSAndJS = { tokens: {
	'WHITESPACE'	:		/^[\s\n]+/,
	'LESS_THAN'		:		/^</,
	'GREATER_THAN'	:		/^>/,
	'DOCTYPE_START'	:		/^<!/,
	'DOCTYPE_TEXT'	:		/^[^>"']+/,
	'EQUALS'		:		/^=/,
	'DBL_QUOTE_STRING':		/^"([^"]|\\")*"/,
	'SINGLE_QUOTE_STRING':	/^'([^']|\\')*'/,
	'COMMENT_START'	:		/^<!--/,
	'COMMENT_TEXT'	:		/^[^\-]+/,
	'COMMENT_DASH'	:		/^-/,
	'COMMENT_END'	:		/^-->/,
	'ENTITY_START'	:		/^&/,
	'ENTITY_TEXT'	:		/^[^;]+/,
	'ENTITY_END'	:		/^;/,
	'TEXT_NODE'		:		/^[^&<"]+/,
	'TAG_IDENTIFIER':		/^\/?[^<>&0-9"':_\-\s=\/][^<>&'"\s=\/]*/,
	'TAG_END'		:		/^\/?>/,
	'ATTR_END'		:		/^(?=(\/>|>|\s))/,
	//css tokens
	'STYLE_START'	:		/^<(?=style)/i,
	'STYLE_TAG_END'	:		/^(?=>)/,
	'STYLE_END'		:		/^(?=<\/style>)/i,
	//taken essentially verbatim from the CSS 2.1 grammar; hopefully it's accurate ;-)
	'CSS_COMMENT'	:		/^\/\*[^*]*\*+([^/*][^*]*\*+)*\//,		// editplus thinks this line starts a comment so this is to close it */ 
	'CSS_BLOCK_START':		/^\{/,
	'CSS_SELECTORGROUP':	/^[^{}<"'@]+/,		//this is over-inclusive, but that's better for highlighting than under-inclusive
	'CSS_ATDIRECTIVE':		/^@(?=media|import|charset|page)/i,
	'CSS_ATKEYWORD'	:		/^(media|import|charset|page)/i,	
	'CSS_PARENTHETICAL':	/^\([^)]*\)/,
	'CSS_BLOCK_END'	:		/^\}/,
	'CSS_ATRULE_END':		/^\}/,		//duplicated so a terminated defblock in an atblock won't terminate the atblock
	'CSS_DEF_END'	:		/^;/,
	'CSS_PROPERTY'	:		/^(ascent|azimuth|background-attachment|background-color|background-image|background-position|background-repeat|background|baseline|bbox|border-collapse|border-color|border-spacing|border-style|border-top-color|border-right-color|border-bottom-color|border-left-color|border-top-style|border-right-style|border-bottom-style|border-left-style|border-top-width|border-right-width|border-bottom-width|border-left-width|border-top|border-right|border-bottom|border-left|border-width|border|bottom|cap-height|caption-side|centerline|clear|clip|color|content|counter-increment|counter-reset|cue-after|cue-before|cue|cursor|definition-src|descent|direction|display|elevation|empty-cells|float|font-family|font-size-adjust|font-size|font-stretch|font-style|font-variant|font-weight|font|height|left|letter-spacing|line-height|list-style-image|list-style-position|list-style-type|list-style|margin-top|margin-right|margin-bottom|margin-left|marker-offset|margin|marks|mathline|max-height|max-width|min-height|min-width|orphans|outline-color|outline-style|outline-width|outline|overflow|padding-top|padding-right|padding-bottom|padding-left|padding|page-break-after|page-break-before|page-break-inside|page|panose-1|pause-after|pause-before|pause|pitch-range|pitch|play-during|position|quotes|richness|right|size|slope|src|speak-header|speak-numeral|speak-punctuation|speak|speech-rate|stemh|stemv|stress|table-layout|text-align|text-decoration|text-indent|text-shadow|text-transform|top|unicode-bidi|unicode-range|units-per-em|vertical-align|visibility|voice-family|volume|white-space|widows|width|widths|word-spacing|x-height|z-index)/i,
	'CSS_COLON'		:		/^:/,
	'CSS_PUNCTUATION':		/^[\[\]>:|=\.#\*]/,
	'CSS_VALUE'		:		/^(above|absolute|ActiveBorder|ActiveCaption|all|always|AppWorkspace|aqua|armenian|attr|aural|auto|avoid|Background|baseline|behind|below|bidi-override|black|blink|block|blue|bold|bolder|both|bottom|braille|ButtonFace|ButtonHighlight|ButtonShadow|ButtonText|capitalize|caption|CaptionText|center|center-left|center-right|circle|cjk-ideographic|close-quote|code|collapse|compact|condensed|continuous|counter|counters|crop|cross|crosshair|cursive|dashed|decimal|decimal-leading-zero|default|digits|disc|dotted|double|embed|embossed|e-resize|expanded|extra-condensed|extra-expanded|fantasy|far-left|far-right|fast|faster|fixed|format|fuchsia|georgian|gray|GrayText|green|groove|handheld|hebrew|help|hidden|hide|high|higher|Highlight|HighlightText|hiragana|hiragana-iroha|icon|InactiveBorder|InactiveCaption|InactiveCaptionText|InfoBackground|InfoText|inline|inline-table|inset|inside|invert|italic|justify|katakana|katakana-iroha|landscape|large|larger|left|left-side|leftwards|level|lighter|lime|line-through|list-item|local|loud|low|lower|lower-alpha|lowercase|lower-greek|lower-latin|lower-roman|ltr|marker|maroon|medium|Menu|MenuText|message-box|middle|mix|monospace|move|narrower|navy|ne-resize|no-close-quote|none|no-open-quote|no-repeat|normal|nowrap|n-resize|nw-resize|oblique|olive|once|open-quote|outset|outside|overline|pointer|portrait|pre|print|projection|purple|red|relative|repeat|repeat-x|repeat-y|rgb|ridge|right|right-side|rightwards|rtl|run-in|sans-serif|screen|scroll|Scrollbar|semi-condensed|semi-expanded|separate|se-resize|serif|show|silent|silver|slow|slower|small|small-caps|small-caption|smaller|soft|solid|speech|spell-out|square|s-resize|static|status-bar|sub|super|sw-resize|table|table-caption|table-cell|table-column|table-column-group|table-footer-group|table-header-group|table-row|table-row-group|teal|text|text-bottom|text-top|thick|thin|ThreeDDarkShadow|ThreeDFace|ThreeDHighlight|ThreeDLightShadow|ThreeDShadow|top|transparent|tty|tv|ultra-condensed|ultra-expanded|underline|upper-alpha|uppercase|upper-latin|upper-roman|url|visible|wait|white|wider|Window|WindowFrame|WindowText|w-resize|x-fast|x-high|x-large|x-loud|x-low|x-slow|x-small|x-soft|xx-large|xx-small|yellow)/i,
	'CSS_COLOR_HEX'	:		/^#[a-fA-F0-9]+/,
	'CSS_COLOR_RGB'	:		/^rgb\(\s*[0-9\.]+\s*,\s*[0-9\.]+\s*,\s*[0-9\.]+\s*\)/,
	'CSS_SCALAR'	:		/^-?[0-9\.]+(em|ex|px|cm|mm|in|pt|pc|deg|g?rad|m?s|k?hz|%)?/i,
	//for custom/future properties
	'CSS_PROP_TEXT'	: /^[^;:_\s]+/,

	//JS tokens
	'SCRIPT_START'	:		/^<(?=script)/i,
	'SCRIPT_TAG_END':		/^(?=>)/,
	'SCRIPT_END'	:		/^(?=<\/script>)/i,
	'JS_RESERVED'	:		/^(abstract|boolean|break|byte|case|catch|char|class|const|continue|default|delete|do|double|else|extends|false|final|finally|float|for|function|goto|if|implements|import|in|instanceof|int|interface|long|native|new|null|package|private|protected|public|return|short|static|super|switch|synchronized|this|throw|throws|transient|true|try|typeof|var|void|while|with)/,
	'JS_STRING'		:		/^"(?:.|\s|\\")*(?!\\)"/


} , grammar: {
	'INITIAL':	{ 'COMMENT_START': 'comment', 'DOCTYPE_START': 'doctype', 'ENTITY_START': 'entity', 'STYLE_START': 'style-tag', 'LESS_THAN': 'tag', 'TEXT_NODE': 'text-node'},
	'doctype':	{ 'DOCTYPE_TEXT': 'doctype_text', 'DBL_QUOTE_STRING': 'string-double', 'SINGLE_QUOTE_STRING': 'string-single', 'GREATER_THAN': false},
	'tag': { 'TAG_IDENTIFIER': 'tag-name', 'WHITESPACE': 'tag-attributes', 'TAG_END': false},
	'style-tag': { 'TAG_IDENTIFIER': 'tag-name', 'WHITESPACE': 'style-tag-attributes', 'TAG_END': 'css-initial', 'STYLE_END': false},
	'tag-attributes': { 'TAG_IDENTIFIER': 'tag-attribute', 'WHITESPACE': 'whitespace', 'TAG_END': false },
	'style-tag-attributes': { 'TAG_IDENTIFIER': 'tag-attribute', 'WHITESPACE': 'whitespace', 'STYLE_TAG_END': false },
	'tag-attribute': { 'EQUALS': 'attribute-value', 'WHITESPACE': false, 'ATTR_END': false },
	'attribute-value': { 'DBL_QUOTE_STRING': 'string-double', 'SINGLE_QUOTE_STRING': 'string-single', 'ATTR_END':  false },
	'comment': {'COMMENT_TEXT': 'comment-text', 'COMMENT_END': false, 'COMMENT_DASH': 'comment-text'},
	'entity': {'ENTITY_TEXT': 'entity-text', 'ENTITY_END': false},

	//css states
	'css-initial':	{ 'WHITESPACE': 'whitespace', 'CSS_COMMENT': 'css-comment', 'STYLE_END': false, 
		'CSS_SELECTORGROUP': 'css-selector', 'CSS_ATDIRECTIVE': 'css-atdirective'},

	'css-atdirective': { 'STYLE_END': false, 'WHITESPACE': 'whitespace', 'CSS_ATKEYWORD': 'css-keyword', 'CSS_PROPERTY': 'css-property', 
		'CSS_PARENTHETICAL': 'css-parenthetical', 'CSS_BLOCK_START': 'css-defblock', 'CSS_VALUE': 'css-value', 'CSS_DEF_END': false, 'CSS_ATRULE_END': false },

	'css-selector':	{ 'STYLE_END': false, 'CSS_COMMENT': 'css-comment', 'WHITESPACE': 'whitespace', 'CSS_PUNCTUATION': 'css-punctuation', 'CSS_SELECTORGROUP': 'css-selector-text', 
		'CSS_BLOCK_START': 'css-defblock', 'CSS_BLOCK_END': false },

	'css-defblock': { 'STYLE_END': false, 'CSS_COMMENT': 'css-comment', 'WHITESPACE': 'whitespace', 'CSS_PROPERTY': 'css-definition', 'CSS_COLON': 'css-punctuation', 'CSS_COLOR_RGB': 'css-color', 'CSS_SCALAR': 'css-scalar', 
		'CSS_VALUE': 'css-value', 'CSS_DEF_END': 'css-punctuation', 'CSS_BLOCK_START': 'css-defblock', 
		'CSS_COLOR_HEX': 'css-color', 'CSS_BLOCK_END': false, 'CSS_PROP_TEXT': 'css-unknown-text'},

	'css-definition': { 'STYLE_END': false, 'CSS_COMMENT': 'css-comment', 'WHITESPACE': 'whitespace', 'CSS_COLON': 'css-punctuation',  'DBL_QUOTE_STRING': 'string', 'SINGLE_QUOTE_STRING': 'string', 'CSS_COLOR_RGB': 'css-color', 'CSS_SCALAR': 'css-scalar', 
		'CSS_VALUE': 'css-value', 'CSS_DEF_END': false, 'CSS_COLOR_HEX': 'css-color', 'CSS_BLOCK_END': false, 'CSS_PROP_TEXT': 'css-unknown-text'}
}

};
	

