From d602cb68ca2e374e3d3211ac6be68acb8bc84135 Mon Sep 17 00:00:00 2001 From: Zachary Yedidia Date: Mon, 20 Feb 2017 16:09:16 -0500 Subject: [PATCH] Support include statements in syntax files --- cmd/micro/highlighter.go | 2 ++ cmd/micro/runtime.go | 2 +- runtime/syntax/html.yaml | 19 +++++++++++++++++-- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/cmd/micro/highlighter.go b/cmd/micro/highlighter.go index 3f4e2bcc..5dd8a497 100644 --- a/cmd/micro/highlighter.go +++ b/cmd/micro/highlighter.go @@ -14,6 +14,8 @@ func LoadSyntaxFiles() { LoadSyntaxFile(data, f.Name()) } } + + highlight.ResolveIncludes(syntaxDefs) } func LoadSyntaxFile(text []byte, filename string) { diff --git a/cmd/micro/runtime.go b/cmd/micro/runtime.go index 4ac9e039..11b08301 100644 --- a/cmd/micro/runtime.go +++ b/cmd/micro/runtime.go @@ -853,7 +853,7 @@ func runtimeSyntaxGoYaml() (*asset, error) { return a, nil } -var _runtimeSyntaxHtmlYaml = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x3c\xcf\x41\x4e\xc3\x30\x10\x85\xe1\x7d\x4e\x61\x59\x08\x41\x24\x72\x00\x17\xe8\x41\xe2\x54\x72\x9d\x49\x6c\x31\xf1\xa4\x9e\x49\x51\xd1\x1c\x1e\x85\x02\xeb\xf7\x2f\xbe\x37\x65\x04\xb9\xad\xe0\x4c\x92\x05\x9b\x66\x04\x81\x28\xae\x31\xc6\x98\x7d\x2b\x61\x01\x67\xac\xf7\x5d\x92\xa5\xc7\xe1\xf8\x60\x9b\xa6\x6e\x08\x7c\x6f\x5e\x4c\x1e\xa1\x48\x9e\x32\x54\x67\xec\x6b\xd7\x1e\xdf\xed\xef\xc2\x2b\xc4\x1c\xd0\x19\xfb\xd8\x9f\x0e\x7d\xef\x78\x0d\x11\xdc\x30\x0c\xed\xe1\xbf\x91\x20\xb0\x40\x11\x67\xec\x53\x40\xd1\xf3\x1c\x09\xa9\x6a\x82\x3c\x27\xd1\x54\x61\x52\x0c\x67\x40\x45\x2a\xf3\x08\x1c\x75\x37\x29\x95\x88\x39\x7e\x28\x95\x89\xe2\xc6\x4a\x05\x29\x8c\x4a\x65\xa1\x8d\x81\xae\x50\x95\xf3\x17\x28\xaf\xa1\x28\xd7\xa8\x2c\x37\x04\x95\x50\x67\x10\xdd\x2f\xeb\x35\xe0\x06\xfa\x99\x47\x49\xcf\x6f\x7f\xa0\x48\x85\x25\xfc\x78\xbc\xed\x4f\xde\x0e\xad\xb7\x7a\xb9\x78\xaf\x5d\xeb\xbd\xde\xbb\xef\x00\x00\x00\xff\xff\x34\x32\xfb\x2f\x37\x01\x00\x00") +var _runtimeSyntaxHtmlYaml = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x8c\x51\xdb\x6e\xdb\x30\x0c\x7d\xf7\x57\x08\xc2\x30\x6c\x01\x92\xbd\x2b\xd9\xf2\x21\x8e\x07\x30\x12\x6d\x6b\xa3\x25\x43\xa4\x53\xa4\xe0\xc7\x17\x86\x73\x29\x9a\x16\x2d\x1f\x79\xa8\x73\x53\x1b\x09\xe5\x3c\xa2\x33\xbd\x0c\x54\x55\x01\x05\xbd\xb8\xca\x18\x63\x66\x2c\xc1\x80\xce\xd8\xc3\x61\xd3\xcb\x50\x53\xb3\xff\x66\xab\xaa\x4c\x84\xbc\xdc\xac\x4d\x0c\x98\x24\xb6\x11\x8b\x33\x76\xb7\x59\xed\xff\xd8\x0b\xc2\x23\xfa\x08\xe4\x8c\xfd\x5e\xff\xdd\xd6\xb5\xe3\x11\x3c\xba\xa6\x69\x56\xdb\xdb\x8d\x80\xe0\x80\x49\x9c\xb1\x3f\x80\x44\x8f\x9d\xcf\x94\x8b\xf6\x18\xbb\x5e\xb4\x2f\xd8\x2a\xc1\x11\x49\x29\xa7\x2e\x20\x7b\x9d\x3d\x69\x4e\x9e\xa2\xff\xaf\x39\xb5\xd9\x4f\xac\x39\x51\x86\xa0\x39\x0d\x79\x62\xcc\x27\x2c\xca\xf1\x19\x95\x47\x48\xca\xc5\x2b\xcb\x99\x50\x05\x4a\x87\xa2\x73\x64\x3d\x01\x4d\xa8\x4f\x31\x48\xff\xf3\xb7\xad\x2e\x8e\x7c\x4e\x2c\x90\x64\xc3\x52\x62\xea\x96\x98\xf3\xb0\x40\x99\x6d\x1e\xac\xbd\xed\x30\x85\x37\x9b\xa5\x1b\x53\x37\x57\xbe\x80\x2d\x4c\x24\x8f\x3c\x3b\xf6\x25\x8e\x72\x6f\xec\x4e\xb8\xfb\xf5\x1e\xf6\xaa\xf6\xeb\xac\x4d\x4c\x9e\xa6\x30\xff\xd1\x3f\x38\xc1\xf2\xcc\x7e\x41\x7b\x6e\xe3\x03\xe9\x47\xe8\x13\x65\xcf\x6c\xab\x97\x00\x00\x00\xff\xff\xfb\xda\x9f\x58\x4a\x02\x00\x00") func runtimeSyntaxHtmlYamlBytes() ([]byte, error) { return bindataRead( diff --git a/runtime/syntax/html.yaml b/runtime/syntax/html.yaml index d3684876..3987ac38 100644 --- a/runtime/syntax/html.yaml +++ b/runtime/syntax/html.yaml @@ -7,5 +7,20 @@ rules: - identifier: "<.*?>" - special: "&[^;[[:space:]]]*;" - statement: "(alt|bgcolor|height|href|label|longdesc|name|onclick|onfocus|onload|onmouseover|size|span|src|style|target|type|value|width)=" - - constant: "\"[^\"]*\"|qq\\|.*\\|" - \ No newline at end of file + + - constant.string: + start: "\"" + end: "\"" + rules: [] + + - default: + start: "" + end: "" + rules: + - include: "javascript" + + - default: + start: "" + end: "" + rules: + - include: "css"