From f6b7aaebbd1d4625548ed035475d4140db939242 Mon Sep 17 00:00:00 2001 From: Saeed Rasooli Date: Thu, 13 Oct 2016 01:52:10 +0330 Subject: [PATCH 1/3] Improvement: FindFileType: header regex should be prior to file extention --- cmd/micro/highlighter.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/cmd/micro/highlighter.go b/cmd/micro/highlighter.go index 413372d6..c71870e5 100644 --- a/cmd/micro/highlighter.go +++ b/cmd/micro/highlighter.go @@ -259,13 +259,16 @@ func LoadRulesFromFile(text, filename string) []SyntaxRule { // FindFileType finds the filetype for the given buffer func FindFileType(buf *Buffer) string { + for r := range syntaxFiles { + if r[1] != nil && r[1].MatchString(buf.Line(0)) { + // The header statement matches the first line + return syntaxFiles[r].filetype + } + } for r := range syntaxFiles { if r[0] != nil && r[0].MatchString(buf.Path) { // The syntax statement matches the extension return syntaxFiles[r].filetype - } else if r[1] != nil && r[1].MatchString(buf.Line(0)) { - // The header statement matches the first line - return syntaxFiles[r].filetype } } return "Unknown" From 80bd2694d67525026449f9195e2d4e42bcda86fc Mon Sep 17 00:00:00 2001 From: Saeed Rasooli Date: Fri, 28 Oct 2016 20:54:25 +0330 Subject: [PATCH 2/3] fixes in python (2.7) syntax file, and rename to python2.micro constants: sort by name, and __file__, remove __import__ functions: add next, help, __import__ separate types (like int and str) from builtin functions separate and comment out methods/attrs of standard library (why hightlight?) comment out NonSenseTypes like IntType, they are never used in code magic methods: add __dict__ exec and map are functions, not keyword remove trailing spaces --- cmd/micro/runtime.go | 20 ++++++++-------- runtime/syntax/python.micro | 43 --------------------------------- runtime/syntax/python2.micro | 46 ++++++++++++++++++++++++++++++++++++ 3 files changed, 56 insertions(+), 53 deletions(-) delete mode 100644 runtime/syntax/python.micro create mode 100644 runtime/syntax/python2.micro diff --git a/cmd/micro/runtime.go b/cmd/micro/runtime.go index 6b8792b5..73b88d92 100644 --- a/cmd/micro/runtime.go +++ b/cmd/micro/runtime.go @@ -90,7 +90,7 @@ // runtime/syntax/privoxy-config.micro // runtime/syntax/privoxy-filter.micro // runtime/syntax/puppet.micro -// runtime/syntax/python.micro +// runtime/syntax/python2.micro // runtime/syntax/r.micro // runtime/syntax/reST.micro // runtime/syntax/rpmspec.micro @@ -1980,22 +1980,22 @@ func runtimeSyntaxPuppetMicro() (*asset, error) { return a, nil } -var _runtimeSyntaxPythonMicro = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\x7c\x56\xdd\x73\x1b\x37\x0e\x7f\xd7\x5f\xb1\x59\xe5\x4e\xb2\x73\x56\xee\xf5\xae\x4d\x9b\x2f\x7b\xea\x69\xbe\x26\x4e\x3f\x26\x96\xa3\xe1\x92\x58\x89\x11\x97\xe4\x80\x5c\x49\x9b\xa2\xff\x7b\x07\x24\xd7\x91\x9b\xa4\x0f\x5a\xfc\x08\x01\x20\x00\x82\x00\xa7\xd3\xea\x27\x40\xa8\x74\xa8\x84\xad\xe0\x20\x3a\x6f\xa0\x6a\x1d\x56\x6f\x86\xb8\x71\x76\x31\x99\x4e\x27\x61\xb0\x51\x1c\xaa\xda\x27\x56\x5d\xd5\xcb\x85\x1f\xee\xd7\x93\x0d\x08\x05\x58\xd5\x1f\xa6\xf7\x16\xa7\x0f\xe7\x60\x77\xd5\x83\x93\x1f\xb3\xd4\xbc\xa2\xfb\x27\xf5\x64\x32\x9d\x56\x4d\xaf\x4d\x3c\xd3\xb6\x72\xcd\x47\x90\x31\x4c\xa4\x33\x0e\x2b\xe9\x6c\x88\xc2\xc6\xaa\x5e\x36\xf3\x57\xce\x02\x05\x30\x2d\xbd\xc3\x1e\xe8\x42\x98\x00\x27\xcb\xa6\xbe\xa3\x2f\x62\x44\xdd\xf4\x11\xbe\x6a\x62\xb5\x4a\x82\xda\xae\x56\xb4\x5a\x29\x2d\x63\x02\x1d\xc4\x8d\x53\xa1\xe0\xae\x01\xcc\x58\x1a\x11\x32\x6a\x44\x80\x8c\x74\xe7\x1d\x66\x35\x2b\x3a\xc8\x86\x9c\x4c\x94\x9d\xcb\x0c\x68\xfa\xf5\x6a\xf5\x85\x77\x6d\x6f\x65\xd4\xce\x8e\xce\x69\x05\x36\xea\x56\x73\x86\x96\xcd\x5c\x34\x81\x84\xf7\x60\x15\x13\x33\x50\xd3\xb7\x2d\x20\x49\x61\x8c\x68\x0c\x90\xdc\x20\x49\x03\x82\xbf\x2e\x40\xfe\x2a\x92\x9d\x27\xe9\x00\x25\x90\x74\x9d\xd7\x26\x53\x03\x07\x92\xce\x7e\xec\xd7\x22\x32\xc7\x0f\x24\x5d\x6f\x23\x29\x30\x9c\x27\x52\x9a\x7f\xbb\xce\x29\x82\x9d\x30\x04\x07\x90\x2d\x6b\xc3\x21\xb2\x13\x8c\xad\x63\x12\x01\xa9\x35\x4e\x44\x6a\x4d\x1f\x36\xb4\x86\xc8\xbf\x64\x65\x6d\x5c\x23\x4c\xa0\x8d\x08\xab\x2d\x0c\x4c\x13\x7f\x23\xc2\x86\x36\x70\x20\xad\x48\x5b\xc5\xc0\xfa\x3e\x92\xb6\x01\x90\x49\xfa\x01\x5a\xd2\xac\x30\x90\x0e\x3a\x9d\x95\x04\xd2\x21\xf4\x4d\x4a\x3f\xe9\x08\x5d\xa0\x2d\x0c\x81\x0c\x58\x32\x3a\x44\x32\x4e\xf2\x8e\xc6\xd9\x35\x75\xc2\x53\x27\x0e\xd4\x69\x4b\x9d\x53\x40\x7c\x2c\xe4\x64\x24\xe7\xc1\x92\x43\x45\xde\x79\xf2\x6e\x4f\x28\xec\x1a\x08\xc5\x7e\x95\x3d\x41\x10\x2a\x7d\x8c\xb6\x70\x0b\x02\x21\xa8\x5e\x32\xc3\xb8\x24\xd0\xb9\x1d\xaf\x3c\x12\xc2\x0e\x30\x00\xa1\xeb\xad\xa2\x00\xb0\xa5\x50\xd2\x10\x8c\x96\x40\xc1\xb5\x31\x78\x91\x10\x46\x0a\x11\x29\x82\x31\x14\xb1\xb7\x92\x8f\x21\xf6\xde\x00\xc5\xc1\x03\xf5\x56\xf3\x81\x32\x61\xbf\x7b\xaf\x58\x60\x27\x4c\x0f\x81\x76\x02\x03\xed\x51\x47\xc8\xdf\xec\xd9\x21\x87\xf0\x49\xfb\xb1\xb6\x82\x07\xa9\x85\xa9\x72\x0d\x57\x1c\xfc\x37\xaa\x6b\xb5\x12\x4d\xae\x61\xa1\x54\xa6\x36\x53\xae\xaf\x0c\x3a\x9f\x69\x2a\xa6\x02\x53\x21\x15\xcc\x31\x8c\x30\x0a\x6d\x43\x29\x77\x33\x52\x4e\xc5\x88\xf9\xe4\x46\x9c\xb2\x53\x6e\xdd\x6e\xa4\x9d\xcb\xfb\xa7\xca\x4a\xa8\xd4\xd4\x88\x6f\x2d\xac\x21\x7e\xb6\xc0\x85\x95\x41\xf1\x4b\x5b\x1d\x0b\x18\xe9\x6e\xa4\x50\x2e\xab\x81\x7c\xe9\xb9\x66\x32\x08\x1b\xdd\x96\xfb\x5f\xfc\xe8\xfa\x1c\x87\x85\x2c\x62\x9d\xfd\x04\xe8\x12\x76\xa5\x57\xb8\xec\x9c\x77\xa1\xd0\x7d\xa2\x38\xe6\x14\xc7\xa4\xe2\x98\x4c\x1c\x23\xc6\xa3\x90\x11\x3c\x94\x98\xb9\xb0\x32\x38\x72\x09\x6f\x05\x47\xa7\xb0\xec\x8c\xb7\x5b\xe2\x91\xf8\x31\xec\x9b\x0c\x0e\x45\x23\x1c\x25\x35\x1c\x25\x35\x1c\x27\x35\x8c\x02\x45\x3b\x29\x8f\x45\x06\x07\x09\x9e\x1b\x57\x95\xee\x24\x84\xc9\xb4\x2a\xed\x75\x10\x36\x55\xd7\xf9\x28\x42\x57\x51\x58\x25\x50\x9d\x23\x3a\xa4\x27\xa8\xe3\xa6\x83\xa8\x65\x5e\xbf\x70\x6e\xdb\xfb\x8c\xcf\xed\x4e\xa3\xb3\x1d\xd8\x58\x84\x03\xb7\x06\xed\x6c\x59\x8e\xcd\xbc\x88\xbf\xbe\xc8\xe0\x82\xeb\x45\xdb\xf5\x1b\xa7\x47\xcd\xcb\xd7\x85\xa6\xf6\x5c\x30\x37\x9d\x0c\x7f\x86\xe1\x16\x34\x4e\xa0\xba\xe4\xce\x83\xbd\x8f\xf4\x12\x3a\x87\xe5\xdf\x57\xa2\x2b\x7b\xbd\x72\xf1\x92\x0b\x9f\x7d\x83\x12\xca\xeb\xab\x42\x77\x80\xad\x71\xfb\xbc\x7a\xdb\xdb\xa8\x47\xb5\xab\x34\x06\x47\x1c\x22\x74\x77\xf0\x41\x47\x7a\x37\xf8\x22\xfc\x8b\x6d\xb8\x8d\xbc\xe0\x66\x36\x72\x52\x2b\xc8\x8b\x5f\xb9\x11\x64\xf8\x9b\xb6\xca\xed\x43\x5e\xbc\x07\x74\xcf\xf5\x4e\x87\x31\x4f\xe3\x29\x71\x53\x19\xef\x3e\xe3\xdb\xa9\xc9\x5b\xa6\x7d\x13\xb8\xb4\x31\xd1\x17\xce\xae\x13\x48\xe9\x4c\xe8\x59\xbe\xec\x09\x5f\x45\xd4\x45\xa0\xb8\x95\xf0\xd3\x34\x92\xb2\x45\x6e\x65\xd9\x94\x0e\xd9\xc0\x73\x2d\x33\xb8\x28\x93\x2e\xff\x2d\xba\x46\x89\xb2\x43\xb1\xf3\x8c\x0b\xa9\x58\x4f\x69\x78\x99\x1a\x58\xf1\x30\x8f\x81\xb4\x38\xe2\x3f\xcd\xc3\xfb\x8e\xed\xc2\x3b\x92\x7a\xe9\x54\x5f\xfc\xba\xd0\x05\xfc\xfe\x96\xfb\x66\xf6\x1a\x85\x84\x46\xc8\x6d\x96\x40\xd1\x65\xfe\x15\x5f\x85\x84\xce\x8d\xd1\x3e\xe8\xe4\xdd\x98\x5b\x05\x2d\x77\x99\x6f\xcc\x6e\x05\x6d\x75\x2d\xce\x3e\x3d\x39\x7b\xbf\xfa\xef\xd9\xff\x6e\x1e\xd4\x15\x2b\x6d\x61\xd8\x3b\x54\xa3\x46\x88\x22\xa6\x82\xca\xc3\x9e\xa7\x7c\x20\x91\x4a\x9e\x1a\x04\xb1\xa5\x3c\xf1\xb8\xb7\x6a\xdb\x03\x29\x68\x79\x56\x13\x18\xdd\x12\x98\xc0\x83\x99\x6f\x59\x1a\xd4\xd4\x6a\x2b\x8c\x19\xa8\x75\x48\x2d\xba\xae\x0c\x62\xd2\x2d\xe5\x47\x0a\x69\x1e\xad\x64\x52\xf6\xd3\x9c\xb4\x2e\x92\x43\xf2\xbc\x8b\x47\x9e\xc0\x28\x34\x8f\x33\x88\x3d\x5a\x8a\x38\xd0\x5e\xc7\x0d\xed\x37\xfc\x0a\x18\x34\x18\xc5\x09\xa8\x26\x39\x05\xd2\xa1\x88\x0e\xc7\x78\x1a\xd4\xeb\x4d\x5c\x23\x80\xad\xea\xc7\x8b\xd3\xeb\xf9\x4d\x7e\xcd\x39\x0f\x77\x04\x8f\x02\xbf\x5e\xfc\xff\xbb\xff\x3c\x38\xa5\x47\xf7\x96\xff\x7a\x7c\x53\x57\xf5\xf7\x75\x55\xff\x50\x57\xf5\xc3\xba\xaa\xcf\xea\xaa\xfe\x77\x36\xe1\x05\x82\x8d\x1b\x08\xf0\x35\x23\xf3\x93\x3f\xfe\x64\xe5\xe5\x35\x7f\xca\xae\xb6\x4f\x2f\xb7\xbf\xbd\xfb\x16\x99\xcd\x29\xbf\x4e\x47\xc3\x07\x9a\x06\x67\xaa\xef\x2f\xc4\x33\xbb\xaa\xeb\xf9\x72\xb9\xa0\xeb\x0f\xf5\xcd\xc9\x69\x4d\xb3\xb2\x9a\xdd\x9c\x9c\xce\xca\x93\x35\x45\xdf\x18\x21\xb7\x9f\x8d\x74\xd9\xc1\xe9\xe2\xf4\x7e\x91\x32\x4e\x6e\xff\x49\x36\x44\x81\xf1\x51\x5d\xd7\xf5\x9c\x37\xe3\x17\x71\x05\x56\x25\x4e\xfd\x75\xd9\xd9\x6c\x36\x67\x57\x3e\xcb\xce\x66\xb3\x7a\xf2\x57\x00\x00\x00\xff\xff\x85\xf5\x39\x86\xa8\x0b\x00\x00") +var _runtimeSyntaxPython2Micro = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\x7c\x57\x59\x73\x23\xb7\x11\x7e\xd7\xaf\x18\x0f\x37\x21\xa5\x8d\xb4\x79\xcd\xe1\xc4\xd7\xaa\xb2\x95\x3d\x5c\x96\x73\x94\x25\x99\x85\x01\x7a\x38\x6d\x62\x00\x54\x03\x43\x72\x36\x9d\xff\x9e\x6a\x00\xa3\xe5\xda\xeb\x3c\x88\xf8\x80\x69\x34\xba\x3f\xf4\x01\xad\x56\xcd\xdf\x80\xa0\xc1\xd8\x28\xd7\xc0\x49\x8d\xc1\x42\xd3\x7b\x6a\xbe\x9d\xd3\xe0\xdd\xcd\xc5\x6a\x75\x11\x67\x97\xd4\xa9\x69\x43\x5e\x6a\x9b\xf6\xe1\x26\xcc\xcf\xda\x8b\x01\x94\x01\x6a\xda\x1f\x57\x9f\xdd\x5c\xbd\xd8\x80\x3b\x34\xcf\x2f\xff\x5a\xa4\x36\x0d\x3f\xbb\x6c\x2f\x2e\x56\xab\xa6\x9b\xd0\xa6\x6b\x74\x8d\xef\x7e\x02\x9d\xe2\x85\xf6\xd6\x53\xa3\xbd\x8b\x49\xb9\xd4\xb4\x0f\xdd\xe6\xad\x77\xc0\x11\x6c\xcf\xdf\xd3\x04\x7c\xab\x6c\x84\xcb\x87\xae\xfd\x68\xbf\x4a\x89\xb0\x9b\x12\x7c\x52\xc5\x76\xdb\xa9\x08\x71\xbb\xe5\xed\x36\x6f\x41\x97\xb1\xb6\x2a\x96\x55\x03\xdd\xb4\x2b\x08\x75\x2a\xc0\xeb\x3c\xf6\x68\x21\x83\x11\xc6\x0e\x28\x56\x9c\x06\x6f\x0a\x76\x6a\x2c\x02\x62\xe4\x76\xfb\x0b\xdb\xfa\xc9\xe9\x84\xde\x2d\xa6\xa1\x01\x97\xb0\x47\xe1\xe7\xa1\xdb\xa8\x2e\xb2\x0a\xc1\xce\xac\x95\xb5\xaa\xb3\xc0\x7a\x20\xd6\x63\x60\xed\xc7\x80\x16\xd8\x80\x15\x07\xd9\xa0\xfc\x1d\x46\x6f\x18\x0e\xca\x32\x9c\x40\xe7\x1f\xb1\x91\x7b\xb4\x09\x88\x7b\x4f\xa3\x4a\xbc\x83\x94\xf7\xec\xac\xef\x94\x8d\x3c\xa8\x98\xe7\x83\x8a\x03\x0f\x60\x03\x0f\x70\x62\x34\x8c\x2e\x4c\x89\xd1\x25\x20\xc7\x18\x31\xf3\xa6\x81\x31\xc6\xa9\xcb\x0c\xb1\x05\xc7\xd6\x6b\x51\x33\xaa\x13\x8f\xe8\xd8\xc1\x29\xb1\xd7\x89\x7d\x00\xc7\x9e\x0c\x07\x7f\x64\x52\x6e\x07\x4c\xea\xb8\x2d\x5a\x09\xcc\xa4\x81\x09\xac\x57\x86\x09\x02\x31\xf9\xc9\x19\x8e\xd5\xba\xc9\xa1\x38\x7b\x50\x14\xf9\x3d\x06\xde\x6e\x71\x0c\x9e\xd2\x07\x1a\xa3\x1f\xa1\x11\x93\x8c\x22\xd3\x58\xec\x48\xd1\xdc\x54\xfe\x9b\x17\xe7\x37\xbf\xfa\x34\xbf\x21\x80\x33\xac\x2d\x28\x62\x6d\x7d\x84\xf2\x6b\x58\x7b\x20\x0d\xac\xbd\xfb\x69\xda\xa9\x24\x28\xcc\xac\xfd\xe4\x12\xc3\x29\xc9\x2e\x21\xd6\x79\xee\xed\x14\x07\xa1\x54\xe8\xdb\xee\x61\x66\x74\x46\xe8\x73\x11\x28\x31\x26\x18\x23\x13\x64\x1f\x95\xb1\xe8\xe0\x09\x44\x46\x21\x7e\xe6\x3d\xcc\x91\x47\x6f\x80\x25\x60\x38\xf8\xc0\x04\xa3\x3f\x88\xe8\x01\x28\x4a\x90\xc3\x9e\xa3\xef\x53\x0c\x4a\x03\x47\x4f\x89\x13\x58\xcb\x89\x26\xa7\xc5\xc0\x23\xe1\xf2\x5b\x74\x4f\xc1\xc8\xfa\x41\xd9\x09\xe2\x13\x65\x01\x34\x2a\x5b\x49\x6a\xe4\xb8\x5f\x89\xbd\xed\x56\x75\x25\x88\x95\x31\x65\x74\x65\x94\x58\x2c\x60\x0c\x65\xcc\x64\x55\x28\xa5\xe0\x54\xb1\x58\xb6\xc0\xa4\xd0\x2d\x09\x65\x97\x51\x6e\x68\xc1\xc2\xd4\xcf\xd2\x0c\x6c\xb4\x58\x35\x1b\x3c\x2c\xe3\xe8\x8b\x21\xbd\xf5\x55\x7f\x8d\xe8\x05\x3f\xa9\xda\x41\xfa\xa0\x41\xc2\xbb\x80\x6a\x20\x3a\x4c\x15\x2c\xe3\x61\x19\x81\xca\x92\x85\x52\x0f\xac\x77\xa5\x08\xd8\x38\x60\x5f\xbe\x2d\x76\x8c\x53\x71\xc8\x41\x11\x71\xde\xbd\x07\xf2\x19\xfb\xea\x8b\x2f\xc6\x05\x1f\xeb\x78\xcc\x23\x2d\xe4\xd2\xc2\x2e\x2d\xac\xd2\xe2\x31\x9d\xb9\x4c\x10\xa0\xfa\x2c\x29\x53\xc0\x99\x49\xf4\x24\xb8\x18\x45\xf5\x64\x7a\x3a\x92\xce\xc4\xcf\xe1\xd4\x15\x70\xaa\x3b\xe2\x19\xa9\xf1\x8c\xd4\x78\x4e\x6a\x5c\x04\xea\xee\xbc\x79\x89\x36\x38\x69\x08\x52\xdf\x9a\x5c\x2c\x24\x0f\x9b\x5a\x83\x67\xe5\x72\x98\xbd\x5c\x44\xf8\xae\x26\xf2\x4b\x22\x4f\xfc\x25\x61\x1a\x46\x48\xa8\xcb\xfc\xb5\xf7\xfb\x29\x14\xfc\xd2\x1d\x90\xbc\x1b\xc1\xa5\x2a\x1c\x25\xd7\xd0\xbb\x3a\x5d\xf2\xbe\x8a\xbf\xbb\x2d\xe0\x56\xe2\x05\xdd\xee\x5b\x8f\xcb\xce\x57\xef\xea\x98\x4b\x4b\xc5\x92\xbf\x05\xfe\x1d\xe6\x27\xd0\x79\x45\xe6\x95\xd4\x42\x9a\x42\xe2\x37\x30\x7a\xaa\x5f\xdf\xaa\xb1\x9e\xf5\xd6\xa7\x57\x92\x01\x62\x1b\x54\x57\xde\xdd\xd5\xf1\x00\xd4\x5b\x7f\x2c\xb3\xef\x26\x97\x70\xd9\x76\x97\x7b\xe5\x82\x63\x82\xf1\x23\x7c\xc2\xc4\xdf\xcf\xa1\x0a\xff\xc3\x75\x52\x28\x5f\x4b\xd5\x5d\x56\x50\x7b\x53\x3f\xff\x53\x12\xbe\xc0\x7f\xa1\x33\xfe\x18\xcb\xe4\x07\x20\xff\x0d\x1e\x30\x2e\x3c\x2d\xb7\x94\xe6\xf0\x54\x04\x04\xe7\x7b\xc9\x5d\x31\x11\xba\x1d\x77\xde\x5b\xee\xa6\xbe\x07\xe2\x6e\x4e\xa0\x88\xd4\x9c\x51\xe4\x7c\xaf\xa5\x98\x70\xcd\x7d\x96\xfc\x65\x70\xd3\x08\x24\x05\xa8\x34\x20\xa1\x9e\x7b\xf2\xef\xc1\x45\xc8\x3d\x85\x2d\xc6\xc4\x92\x57\x3c\xaa\xc0\x63\xe6\xf3\x80\x70\xe4\xd2\xf1\x39\x90\x0f\x40\x69\x5e\x8a\x60\x6e\x0d\x9c\x43\x8f\x63\x52\x09\x75\x3d\x38\x26\xe2\x38\x05\x20\x4e\x53\xb0\xc0\xe2\x44\x6e\x1f\x52\x51\x4f\xb9\xf1\x5c\xb6\x4b\x0b\x78\xf2\x50\x1e\x0f\x42\x6a\x66\x36\x83\x57\x2e\xe5\xf1\xb5\x77\xbb\x0c\x72\xc0\x64\xf4\x75\xf1\x2d\xe3\xbb\x4c\x4b\x86\x95\xf8\x8c\xbf\xca\x0c\x15\x8d\x62\x46\x51\x85\xb1\x28\xf8\x06\x75\x01\xb7\xb5\xe5\x97\xcf\x6a\xec\x8c\xaa\x27\x54\x3d\x5f\x0b\xa5\x55\x7b\xbe\xe8\x37\xd9\xcb\x6a\x61\xe9\xc0\x79\x72\xb6\xfe\x55\x79\xb9\x7c\xa4\xbb\xae\x9d\x49\xbd\xf1\x66\xaa\x76\xdd\x62\x05\xff\xfe\x4e\xe8\x29\x56\x93\xd2\xd0\x29\xbd\x2f\x12\xa4\xc6\xb2\x7e\x27\x8c\x67\xf4\xd2\x5a\x0c\x11\xb3\x75\x4b\xf4\x18\xe8\xa5\x8e\xfe\xca\x23\xc6\x40\xdf\xdc\xab\xeb\xf7\x5f\x5e\xff\xb0\xfd\xfd\xf5\x1f\x1e\x9f\xe7\x3d\x7b\x98\x8f\x9e\xcc\xb2\x41\x2e\x33\x67\x4c\x69\xca\xce\xb0\x8a\xac\x72\x4e\x73\x47\xa0\xf6\x25\xcc\xa4\x1b\x27\x74\x93\x3c\x7a\x7a\x79\xf8\x30\x58\xec\x19\x6c\x04\x2e\x95\x86\x7b\x74\xca\xda\x59\x1e\x3a\x12\x6c\x63\x7d\xe2\x30\xf6\x5c\x1e\x0f\x8c\xf2\x90\x61\x9b\x79\x67\xe7\x13\x7b\xe2\x20\xca\x03\x49\x4c\x92\xc2\x28\x5d\x37\x4d\xe4\x38\xd1\xcc\xc7\x41\xc2\xf7\x88\x69\xe0\x19\xc1\x9a\xec\x76\xf1\x5b\x7b\x52\xc9\xd3\xe2\x45\x47\xb8\x1b\xd2\x8e\x00\x5c\xd3\x7e\x71\x73\x75\xbf\x79\x2c\x92\x12\xc5\xe7\x82\x67\xee\xde\xdf\xfc\xf1\x4f\xbf\x7b\x7e\xc5\x9f\x7f\xf6\xf0\x9b\x2f\x1e\xdb\xa6\xfd\x73\xdb\xb4\x7f\x69\x9b\xf6\x45\xdb\xb4\xd7\x6d\xd3\xfe\xb6\xa8\x08\x8a\xc0\xa5\x01\x22\x7c\x4a\xc9\xe6\xf2\x3f\xff\x95\xcd\x0f\xf7\xf2\x53\x4f\x75\x53\x7e\x92\xfe\xec\xcd\x7b\x53\x96\x85\xe8\xfb\x7c\x1f\x8b\x3b\x25\xd7\x7f\x21\x5e\x96\x9b\xb6\xdd\x3c\x3c\xdc\xf0\xfd\x8f\xed\xe3\xe5\x55\xcb\xeb\x3a\x5b\x3f\x5e\x5e\xad\xeb\x73\x3d\x7b\xdf\x59\xa5\xf7\x1f\x94\x8c\xc5\xc0\xd5\xcd\xd5\xb3\x2a\x65\xbd\xde\xff\x3f\xd9\x98\x14\xa5\xcf\xdb\xb6\x6d\x37\x72\x98\xfc\x37\xd0\x80\x33\x79\xa5\xfd\xb4\xec\x7a\xbd\xde\x88\x29\x1f\x64\xd7\xeb\x75\x7b\xf1\xbf\x00\x00\x00\xff\xff\xda\xd2\x89\x51\xa4\x0c\x00\x00") -func runtimeSyntaxPythonMicroBytes() ([]byte, error) { +func runtimeSyntaxPython2MicroBytes() ([]byte, error) { return bindataRead( - _runtimeSyntaxPythonMicro, - "runtime/syntax/python.micro", + _runtimeSyntaxPython2Micro, + "runtime/syntax/python2.micro", ) } -func runtimeSyntaxPythonMicro() (*asset, error) { - bytes, err := runtimeSyntaxPythonMicroBytes() +func runtimeSyntaxPython2Micro() (*asset, error) { + bytes, err := runtimeSyntaxPython2MicroBytes() if err != nil { return nil, err } - info := bindataFileInfo{name: "runtime/syntax/python.micro", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} + info := bindataFileInfo{name: "runtime/syntax/python2.micro", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -2582,7 +2582,7 @@ var _bindata = map[string]func() (*asset, error){ "runtime/syntax/privoxy-config.micro": runtimeSyntaxPrivoxyConfigMicro, "runtime/syntax/privoxy-filter.micro": runtimeSyntaxPrivoxyFilterMicro, "runtime/syntax/puppet.micro": runtimeSyntaxPuppetMicro, - "runtime/syntax/python.micro": runtimeSyntaxPythonMicro, + "runtime/syntax/python2.micro": runtimeSyntaxPython2Micro, "runtime/syntax/r.micro": runtimeSyntaxRMicro, "runtime/syntax/reST.micro": runtimeSyntaxRestMicro, "runtime/syntax/rpmspec.micro": runtimeSyntaxRpmspecMicro, @@ -2749,7 +2749,7 @@ var _bintree = &bintree{nil, map[string]*bintree{ "privoxy-config.micro": &bintree{runtimeSyntaxPrivoxyConfigMicro, map[string]*bintree{}}, "privoxy-filter.micro": &bintree{runtimeSyntaxPrivoxyFilterMicro, map[string]*bintree{}}, "puppet.micro": &bintree{runtimeSyntaxPuppetMicro, map[string]*bintree{}}, - "python.micro": &bintree{runtimeSyntaxPythonMicro, map[string]*bintree{}}, + "python2.micro": &bintree{runtimeSyntaxPython2Micro, map[string]*bintree{}}, "r.micro": &bintree{runtimeSyntaxRMicro, map[string]*bintree{}}, "reST.micro": &bintree{runtimeSyntaxRestMicro, map[string]*bintree{}}, "rpmspec.micro": &bintree{runtimeSyntaxRpmspecMicro, map[string]*bintree{}}, diff --git a/runtime/syntax/python.micro b/runtime/syntax/python.micro deleted file mode 100644 index ed5f5302..00000000 --- a/runtime/syntax/python.micro +++ /dev/null @@ -1,43 +0,0 @@ -## Here is an example for Python. -## -syntax "python" "\.py$" -header "^#!.*/(env +)?python( |$)" - -## built-in objects -color constant "\b(None|self|True|False)\b" -## built-in attributes -color constant "\b(__builtin__|__dict__|__methods__|__members__|__class__|__bases__|__import__|__name__|__doc__|__self__|__debug__)\b" -## built-in functions -color identifier "\b(abs|append|apply|buffer|callable|chr|clear|close|closed|cmp|coerce|compile|complex|conjugate|copy|count|delattr|dir|divmod|eval|execfile|extend|fileno|filter|float|flush|get|getattr|globals|has_key|hasattr|hash|hex|id|index|input|insert|int|intern|isatty|isinstance|issubclass|items|keys|len|list|locals|long|map|max|min|mode|name|oct|open|ord|pop|pow|range|raw_input|read|readline|readlines|reduce|reload|remove|repr|reverse|round|seek|setattr|slice|softspace|sort|str|tell|truncate|tuple|type|unichr|unicode|update|values|vars|write|writelines|xrange|zip)\b" -## special method names -color identifier "\b(__abs__|__add__|__and__|__call__|__cmp__|__coerce__|__complex__|__concat__|__contains__|__del__|__delattr__|__delitem__|__delslice__|__div__|__divmod__|__float__|__getattr__|__getitem__|__getslice__|__hash__|__hex__|__init__|__int__|__inv__|__invert__|__len__|__long__|__lshift__|__mod__|__mul__|__neg__|__nonzero__|__oct__|__or__|__pos__|__pow__|__radd__|__rand__|__rcmp__|__rdiv__|__rdivmod__|__repeat__|__repr__|__rlshift__|__rmod__|__rmul__|__ror__|__rpow__|__rrshift__|__rshift__|__rsub__|__rxor__|__setattr__|__setitem__|__setslice__|__str__|__sub__|__xor__)\b" -## exception classes -# color cyan "\b(Exception|StandardError|ArithmeticError|LookupError|EnvironmentError|AssertionError|AttributeError|EOFError|FloatingPointError|IOError|ImportError|IndexError|KeyError|KeyboardInterrupt|MemoryError|NameError|NotImplementedError|OSError|OverflowError|RuntimeError|SyntaxError|SystemError|SystemExit|TypeError|UnboundLocalError|UnicodeError|ValueError|WindowsError|ZeroDivisionError)\b" -## types -color type "\b(NoneType|TypeType|IntType|LongType|FloatType|ComplexType|StringType|UnicodeType|BufferType|TupleType|ListType|DictType|FunctionType|LambdaType|CodeType|ClassType|UnboundMethodType|InstanceType|MethodType|BuiltinFunctionType|BuiltinMethodType|ModuleType|FileType|XRangeType|TracebackType|FrameType|SliceType|EllipsisType)\b" -## definitions -color identifier "def [a-zA-Z_0-9]+" -## keywords -color statement "\b(and|as|assert|break|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|map|not|or|pass|print|raise|return|try|with|while|yield)\b" - -## decorators -color brightgreen "@.*[(]" - -## operators -color statement "[.:;,+*|=!\%@]" "<" ">" "/" "-" "&" - -## parentheses -color statement "[(){}]" "\[" "\]" - -## numbers -color constant.number "\b[0-9]+\b" - -## strings -color constant.string ""(\\.|[^"])*"|'(\\.|[^'])*'" - -## brightblacks -color comment "#.*$" - -## block brightblacks -color comment start=""""([^"]|$)" end=""""" -color comment start="'''([^']|$)" end="'''" diff --git a/runtime/syntax/python2.micro b/runtime/syntax/python2.micro new file mode 100644 index 00000000..71904d17 --- /dev/null +++ b/runtime/syntax/python2.micro @@ -0,0 +1,46 @@ +## Here is an example for Python. +## +syntax "python" "\.py$" +header "^#!.*/(env +)?python( |$)" + +## built-in objects +color constant "\b(None|self|True|False)\b" +## built-in attributes +color constant "\b(__bases__|__builtin__|__class__|__debug__|__dict__|__doc__|__file__|__members__|__methods__|__name__|__self__)\b" +## built-in functions +color identifier "\b(abs|apply|callable|chr|cmp|compile|delattr|dir|divmod|eval|exec|execfile|filter|format|getattr|globals|hasattr|hash|help|hex|id|input|intern|isinstance|issubclass|len|locals|max|min|next|oct|open|ord|pow|range|raw_input|reduce|reload|repr|round|setattr|unichr|vars|zip|__import__)\b" +## some standard library methods / attributes +#color identifier "\b(append|clear|close|closed|coerce|conjugate|copy|count|extend|fileno|flush|get|has_key|index|insert|items|read|readline|readlines|isatty|keys|mode|name|pop|remove|reverse|seek|softspace|sort|tell|truncate|write|writelines|update|values)\b" +## special method names +color identifier "\b(__abs__|__add__|__and__|__call__|__cmp__|__coerce__|__complex__|__concat__|__contains__|__del__|__delattr__|__delitem__|__dict__|__delslice__|__div__|__divmod__|__float__|__getattr__|__getitem__|__getslice__|__hash__|__hex__|__init__|__int__|__inv__|__invert__|__len__|__long__|__lshift__|__mod__|__mul__|__neg__|__nonzero__|__oct__|__or__|__pos__|__pow__|__radd__|__rand__|__rcmp__|__rdiv__|__rdivmod__|__repeat__|__repr__|__rlshift__|__rmod__|__rmul__|__ror__|__rpow__|__rrshift__|__rshift__|__rsub__|__rxor__|__setattr__|__setitem__|__setslice__|__str__|__sub__|__xor__)\b" +## exception classes +# color cyan "\b(Exception|StandardError|ArithmeticError|LookupError|EnvironmentError|AssertionError|AttributeError|EOFError|FloatingPointError|IOError|ImportError|IndexError|KeyError|KeyboardInterrupt|MemoryError|NameError|NotImplementedError|OSError|OverflowError|RuntimeError|SyntaxError|SystemError|SystemExit|TypeError|UnboundLocalError|UnicodeError|ValueError|WindowsError|ZeroDivisionError)\b" +## types +color type "\b(basestring|bool|buffer|bytearray|bytes|classmethod|complex|dict|enumerate|file|float|frozenset|int|list|long|map|memoryview|object|property|reversed|set|slice|staticmethod|str|super|tuple|type|unicode|xrange)" +#color type "\b(NoneType|TypeType|IntType|LongType|FloatType|ComplexType|StringType|UnicodeType|BufferType|TupleType|ListType|DictType|FunctionType|LambdaType|CodeType|ClassType|UnboundMethodType|InstanceType|MethodType|BuiltinFunctionType|BuiltinMethodType|ModuleType|FileType|XRangeType|TracebackType|FrameType|SliceType|EllipsisType)\b" +## definitions +color identifier "def [a-zA-Z_0-9]+" +## keywords +color statement "\b(and|as|assert|break|class|continue|def|del|elif|else|except|finally|for|from|global|if|import|in|is|lambda|not|or|pass|print|raise|return|try|while|with|yield)\b" + +## decorators +color brightgreen "@.*[(]" + +## operators +color statement "[.:;,+*|=!\%@]" "<" ">" "/" "-" "&" + +## parentheses +color statement "[(){}]" "\[" "\]" + +## numbers +color constant.number "\b[0-9]+\b" + +## strings +color constant.string ""(\\.|[^"])*"|'(\\.|[^'])*'" + +## brightblacks +color comment "#.*$" + +## block brightblacks +color comment start=""""([^"]|$)" end=""""" +color comment start="'''([^']|$)" end="'''" From 418720f6df456b0506ec5ae5925a9dc032387d71 Mon Sep 17 00:00:00 2001 From: Saeed Rasooli Date: Fri, 28 Oct 2016 20:55:29 +0330 Subject: [PATCH 3/3] add python3 syntax highlighting (detect from header) --- cmd/micro/runtime.go | 23 ++++++++++++++++++ runtime/syntax/python3.micro | 46 ++++++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+) create mode 100644 runtime/syntax/python3.micro diff --git a/cmd/micro/runtime.go b/cmd/micro/runtime.go index 73b88d92..792d7274 100644 --- a/cmd/micro/runtime.go +++ b/cmd/micro/runtime.go @@ -91,6 +91,7 @@ // runtime/syntax/privoxy-filter.micro // runtime/syntax/puppet.micro // runtime/syntax/python2.micro +// runtime/syntax/python3.micro // runtime/syntax/r.micro // runtime/syntax/reST.micro // runtime/syntax/rpmspec.micro @@ -2000,6 +2001,26 @@ func runtimeSyntaxPython2Micro() (*asset, error) { return a, nil } +var _runtimeSyntaxPython3Micro = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\x7c\x56\x6d\x73\x1b\xb9\x0d\xfe\xee\x5f\xb1\xb7\x4a\x2b\xdb\xa9\x9d\xce\xf4\x53\x5f\xae\xbd\xb7\x78\x9a\x69\x5e\x6e\xea\xb4\x9d\x39\xdb\xa7\xe1\x92\x58\x2d\x4e\x5c\x92\x03\x72\x25\x6d\x8a\xfe\xf7\x0e\x48\xae\xa2\xf4\x72\xfd\xa0\xc5\x43\x0a\x04\xc1\x87\x00\x88\xd5\xaa\xf9\x2b\x10\x34\x18\x1b\xe5\x1a\x38\xaa\x31\x58\x68\x7a\x4f\xcd\xf7\x73\x1a\xbc\xbb\xbd\x58\xad\x2e\xe2\xec\x92\x3a\x36\x6d\xc8\x53\xbf\x6b\x9b\xf6\xf1\x36\xcc\xcf\xda\x8b\x01\x94\x01\x6a\xda\x1f\x57\x5f\xdc\x5e\xbf\xb8\x04\xb7\x6f\x9e\x5f\xfd\xa5\xaa\x3d\x6b\x2f\x2e\x56\xab\xa6\x9b\xd0\xa6\x1b\x74\x8d\xef\x7e\x02\x9d\xe2\x85\xf6\xd6\x53\xa3\xbd\x8b\x49\xb9\xd4\xb4\x8f\xdd\xe5\x5b\xef\x80\x23\xd8\x9e\xdf\xd3\x04\x7c\xa7\x6c\x84\xab\xc7\xae\xfd\x64\xbd\x4a\x89\xb0\x9b\x12\x7c\xd6\xc4\x66\xd3\xa9\x08\x71\xb3\xe1\xcd\x26\x2f\x41\x97\xb1\xb6\x2a\x96\x59\x03\xdd\xb4\x2d\x08\x75\x2a\xc0\xeb\x2c\x7b\xb4\x90\xc1\x08\x63\x07\x14\x2b\x4e\x83\x37\x05\x3b\x35\x16\x05\x71\x72\xb3\xf9\x99\x6f\xfd\xe4\x74\x42\xef\x16\xd7\xd0\x80\x4b\xd8\xa3\x90\xf3\xd8\x5d\xaa\x2e\xb2\xb2\x96\x95\x9b\x59\x45\x8d\xc8\x1d\x3a\xd6\xca\x5a\xd5\x59\x60\x3d\x10\x6b\x3f\x06\xb4\xc0\x06\xac\x1c\x94\x0d\xca\x6f\x3f\x7a\xc3\xb0\x57\x96\xe1\x08\x9a\x7b\x4f\xa3\x4a\xbc\x85\x94\x75\xb6\xd6\x77\xca\x46\x1e\x54\xcc\xe3\x41\xc5\x81\x07\xb0\x81\x07\x38\x32\x1a\x46\x17\xa6\xc4\x18\x31\x13\xa5\x81\x31\xc6\xa9\xcb\x94\x30\x26\x20\xb6\xe0\xd8\x7a\x2d\x46\x46\x75\xe4\x11\x1d\x3b\x38\x26\xf6\x3a\xb1\x0f\xe0\xd8\x93\xe1\xe0\x0f\x1c\x08\x5d\x62\x82\x40\x4c\x7e\x72\x86\x63\xf5\x21\x7a\x4a\x60\x38\x4e\x23\xef\x15\x45\xde\x6c\x70\x0c\x9e\xd2\x47\x92\xa2\x1f\xa1\x91\xfd\x8d\x22\xd3\x58\xec\x48\xd1\xdc\x54\x76\x9b\x17\xe7\xf7\xba\xfa\x3c\x7b\x21\x80\x33\xac\x2d\x28\x62\x6d\x7d\x84\xf2\x35\xac\x3d\x90\x06\xd6\xde\xfd\x34\x6d\x55\x12\x14\x66\xd6\x7e\x72\x89\xe1\x98\x64\x95\x5c\xad\xf3\xdc\xdb\x29\x0e\x42\x9c\x90\xb4\xd9\xc1\xcc\xe8\x8c\x90\xe4\x22\x50\x12\x32\xc6\xc8\x04\xca\xe4\x8f\x45\x07\x27\x10\x19\x85\xde\x99\x77\x30\x47\x1e\xbd\x01\x96\x70\xe0\xe0\x03\x13\x8c\x7e\x2f\xaa\x7b\xa0\x28\x21\x0c\x3b\x8e\xbe\x4f\x31\x28\x0d\x99\x1b\x4e\x60\x2d\x27\x9a\x9c\x16\x07\x0f\x84\xcb\xb7\xd8\x9e\x82\x91\xf9\xbd\xb2\x13\xc4\x13\x65\x01\x34\x2a\x5b\x49\x6a\x64\xbb\x5f\x88\xac\xcd\x46\x75\x25\x44\x95\x31\x45\xba\x22\x25\xba\x0a\x18\x43\x91\x99\xac\x0a\x25\xcd\x8f\x15\x8b\x67\x0b\x4c\x0a\xdd\x92\x2e\x76\x91\x72\x43\x0b\x16\xa6\x16\x1c\x2d\x56\x83\x06\xf7\x8b\x1c\x7d\xd9\xbf\xb7\xbe\x9a\xad\xe1\xba\xe0\x93\x85\x2d\xa4\x8f\x16\x24\x76\x0b\xa8\x7e\xa1\xc3\x54\xc1\x22\xf7\x8b\x04\x2a\x53\x16\xdc\xa7\x09\x6d\xbd\x2b\x29\x6e\xe3\x80\x7d\x99\x5b\x1c\x1a\xa7\x72\x20\x07\xdb\x2a\x8f\x45\xc1\x79\xf7\x01\xc8\x67\xec\xab\x21\x5f\xdc\x0d\x3e\x56\x79\xc8\x92\x16\x96\x69\xa1\x99\x16\x7a\x69\xe1\x80\xce\x48\x20\x08\x50\x59\x90\xdc\x29\xe0\xcc\x37\x3a\x29\x2e\xde\x51\xdd\x99\x4e\x5b\xd2\x99\xfa\x39\x9c\xba\x02\x8e\x75\x45\x3c\xa3\x39\x9e\xd1\x1c\xcf\x69\x8e\x8b\x42\x5d\x9d\x17\x2f\x61\x07\x47\x0d\x41\xca\x58\x93\x4b\x84\x24\x64\x53\x4b\xed\xac\x5c\x8e\xb7\x97\x8b\x0a\xdf\xd7\x8c\x7e\x49\xe4\x89\xbf\x26\x4c\xc3\x08\x09\x75\x19\xbf\xf6\x7e\x37\x85\x82\x5f\xba\x3d\x92\x77\x23\xb8\x54\x95\xa3\x24\x1d\x7a\x57\x87\x4b\x01\xa8\xea\xef\xee\x0a\xb8\x93\x08\x42\xb7\xfd\xde\xe3\xb2\xf2\xd5\xbb\x2a\x73\x8d\xa9\x58\x12\xb9\xc0\xbf\xc1\x7c\x02\x9d\x57\x64\x5e\xb9\x04\x44\x53\x48\xfc\x06\x46\x4f\xf5\xdf\xb7\x6a\xac\x7b\xbd\xf5\xe9\x95\xa4\x82\xf8\x06\xf5\x28\xef\xee\xab\xdc\x03\xf5\xd6\x1f\xca\xe8\xef\x93\x4b\xb8\x2c\xbb\xcf\x0f\xe2\x82\x63\x82\xf1\x13\x7c\xc4\xc4\xef\xe7\x50\x95\xff\xe1\x3a\xa9\x98\xaf\xa5\xcc\x2e\x33\xa8\xbd\xa9\x7f\xff\x53\x32\xbf\xc0\x7f\xa1\x33\xfe\x10\xcb\xe0\x07\x20\xff\x1d\xee\x31\x2e\x3c\x2d\xb7\x94\xe6\x70\xaa\x06\x82\xf3\xbd\x74\xde\x5b\xee\xe6\x04\x8a\x48\xcd\x19\x45\xce\xb7\x58\x6a\x08\xd7\x94\x67\x49\x15\x06\x37\x8d\x40\x52\x77\x7a\xb4\xf2\x0e\xe4\x64\xe5\x9e\xfc\x07\x70\x11\x12\x4b\xb1\xb7\x18\x13\x8f\x2a\xf0\x98\xa9\xdb\x23\x1c\xb8\xbc\xe1\x1c\xc8\x07\xa0\x34\x33\x29\xb7\x3d\x95\xbf\xfc\x28\x70\x8e\x35\x8e\x49\x25\xd4\x75\xef\x28\xef\xc4\x14\x80\x38\x4d\xc1\x02\x8b\xd7\xfc\x01\xc3\x55\xbb\x54\xfc\xd3\x39\xa4\x13\x10\xea\x32\x7f\x19\xbc\x72\x29\xcb\xd7\xde\x6d\x33\xc8\x61\x91\xd1\xb7\xe5\x4c\x19\xdf\x27\xc2\xaa\x50\xe9\xcd\xf8\x9b\xa9\xef\x81\x8a\x45\xd9\xbb\x98\xc2\x58\x0c\x7c\x87\xba\x80\xbb\xfa\x7e\x97\xbf\xd5\xd8\x19\x55\x77\xa8\x76\xbe\x15\x2a\xab\xf5\x7c\x9d\x6f\xf2\xd1\xaa\x87\xe5\x75\xcd\x83\xb3\xf9\x6f\x4a\x1b\xf2\x89\xed\x3a\x77\xa6\xf5\xc6\x9b\xa9\xfa\x75\x87\x15\xbc\x27\xa5\xa1\x53\x7a\x57\xa6\x49\x8d\x65\xfe\x5e\xb8\xcd\xe8\xa5\xb5\x18\x22\x66\x97\x96\xc0\x30\xd0\x4b\xd1\xfc\x85\x36\xc4\x40\xdf\x3c\xa8\x9b\x0f\x5f\xdf\xfc\xb0\xf9\xed\xcd\xef\x9f\x9e\xb7\x8d\x2c\xda\xc1\x7c\xf0\x64\x96\x15\x72\x6f\x39\x1b\xca\xcb\xeb\x0c\xab\xc8\x2a\xe7\x2b\x77\x04\x6a\x57\x82\x4a\x9e\xdc\x84\x6e\x92\x7e\xa5\x97\x9e\x85\xc1\x62\xcf\x60\x23\x70\xa9\x22\xdc\xa3\x53\xd6\xce\xd2\xb3\x48\x60\x8d\xb5\x5b\x61\xec\xb9\x74\x08\x8c\x8e\x31\xb2\xcd\x6c\xb3\xf3\x2e\x37\x22\xec\x7c\x62\x4f\x1c\x64\x17\x52\x18\x25\xbc\xd2\x44\x8e\x13\xcd\x7c\x18\xa4\x47\x3a\x60\x1a\x78\x46\xb0\x46\x8e\xde\x5c\x94\xc3\x6b\x4f\x2a\x79\x5a\x4e\xd2\x11\x6e\x87\xb4\x25\x00\xd7\xb4\x5f\xdd\x5e\x3f\x5c\x3e\x95\x86\x54\x42\xf7\x5c\xf1\xec\xc8\x0f\xb7\x7f\xf8\xe3\x6f\x9e\x5f\xf3\x97\x5f\x3c\xfe\xea\xab\xa7\xb6\x69\xff\xd4\x36\xed\x9f\xdb\xa6\x7d\xd1\x36\xed\x4d\xdb\xb4\xbf\x2e\x26\x82\x22\x70\x69\x80\x08\x9f\x33\x72\x79\xf5\xef\xff\xc8\xe2\xc7\x07\xf9\xd4\x5d\xdd\x94\x3b\xcb\xff\x69\x5d\x6f\xcb\xb4\x90\xfd\x90\x2f\x45\xae\x32\x77\x00\x39\x9c\x7f\xa6\x5e\xa6\x9b\xb6\xbd\x7c\x7c\xbc\xe5\x87\x1f\xdb\xa7\xab\xeb\x96\xd7\x75\xb4\x7e\xba\xba\x5e\xd7\xae\x3b\x9f\xbe\xb3\x4a\xef\x3e\x1a\x19\x8b\x83\xab\xdb\xeb\xa5\x37\xb7\x5e\xef\xfe\x9f\x6e\x4c\x8a\xd2\x97\x6d\xdb\xb6\x97\xb2\x19\x3f\xbb\x6a\x1b\x70\x26\xcf\xb4\x9f\xd7\x5d\xaf\xd7\x97\xe2\xca\x47\xdd\xf5\x7a\xdd\x5e\xfc\x37\x00\x00\xff\xff\x11\xf5\x83\x29\x69\x0c\x00\x00") + +func runtimeSyntaxPython3MicroBytes() ([]byte, error) { + return bindataRead( + _runtimeSyntaxPython3Micro, + "runtime/syntax/python3.micro", + ) +} + +func runtimeSyntaxPython3Micro() (*asset, error) { + bytes, err := runtimeSyntaxPython3MicroBytes() + if err != nil { + return nil, err + } + + info := bindataFileInfo{name: "runtime/syntax/python3.micro", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} + a := &asset{bytes: bytes, info: info} + return a, nil +} + var _runtimeSyntaxRMicro = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\x54\xce\xb1\x6a\xc3\x40\x0c\xc6\xf1\xfd\x9e\xe2\xb8\x64\x48\x3a\xe4\x1d\x3c\xa4\x50\x30\x37\xb8\xcd\x66\x30\xf2\x55\x6e\x8e\x9e\xa5\xa0\x93\xa9\x0b\x7a\xf8\x92\xc6\x4b\x26\xfd\xa6\xbf\xbe\x9d\xef\x7c\xe5\x45\x12\xfa\xc4\x9f\xe8\x5c\xfd\x25\x85\xd5\x07\x09\x3e\xf4\xa7\x83\x58\x77\xdc\x07\xe7\x12\x17\x16\x5f\x15\x14\x67\x24\xf5\xa1\x1f\x0f\xa3\x20\x7c\x1b\x96\x8a\x36\xb1\xd8\xb4\x50\xd2\xcc\x64\x79\xb2\x4c\x46\xb8\xaa\x09\xde\x10\xee\x47\x17\x21\xfb\xb9\xe6\x82\xc7\x7e\x0c\x5b\x2e\x31\x55\x85\xad\xf6\xd1\x5d\xce\xf6\xda\xb4\xef\x67\x8b\x97\xb6\xb5\x37\x9a\x2c\x42\xb4\xd8\x58\x6c\x86\x4c\x8a\x5f\x28\xc3\xdd\x82\x50\xfe\x91\x78\xbe\x15\x5c\x1f\xbe\x82\x40\x52\x94\xe1\xe9\xc1\xfc\x58\xbb\x3b\xbd\xec\x83\x77\x7f\x01\x00\x00\xff\xff\xd2\xcf\x96\x95\xee\x00\x00\x00") func runtimeSyntaxRMicroBytes() ([]byte, error) { @@ -2583,6 +2604,7 @@ var _bindata = map[string]func() (*asset, error){ "runtime/syntax/privoxy-filter.micro": runtimeSyntaxPrivoxyFilterMicro, "runtime/syntax/puppet.micro": runtimeSyntaxPuppetMicro, "runtime/syntax/python2.micro": runtimeSyntaxPython2Micro, + "runtime/syntax/python3.micro": runtimeSyntaxPython3Micro, "runtime/syntax/r.micro": runtimeSyntaxRMicro, "runtime/syntax/reST.micro": runtimeSyntaxRestMicro, "runtime/syntax/rpmspec.micro": runtimeSyntaxRpmspecMicro, @@ -2750,6 +2772,7 @@ var _bintree = &bintree{nil, map[string]*bintree{ "privoxy-filter.micro": &bintree{runtimeSyntaxPrivoxyFilterMicro, map[string]*bintree{}}, "puppet.micro": &bintree{runtimeSyntaxPuppetMicro, map[string]*bintree{}}, "python2.micro": &bintree{runtimeSyntaxPython2Micro, map[string]*bintree{}}, + "python3.micro": &bintree{runtimeSyntaxPython3Micro, map[string]*bintree{}}, "r.micro": &bintree{runtimeSyntaxRMicro, map[string]*bintree{}}, "reST.micro": &bintree{runtimeSyntaxRestMicro, map[string]*bintree{}}, "rpmspec.micro": &bintree{runtimeSyntaxRpmspecMicro, map[string]*bintree{}}, diff --git a/runtime/syntax/python3.micro b/runtime/syntax/python3.micro new file mode 100644 index 00000000..39e45ba3 --- /dev/null +++ b/runtime/syntax/python3.micro @@ -0,0 +1,46 @@ +## Here is an example for Python. +## +syntax "python3" "\.py$" +header "^#!.*/(env +)?python3$" + +## built-in objects +color constant "\b(None|self|True|False)\b" +## built-in attributes +color constant "\b(__bases__|__builtin__|__class__|__debug__|__dict__|__doc__|__file__|__members__|__methods__|__name__|__self__)\b" +## built-in functions +color identifier "\b(abs|all|any|ascii|bin|callable|chr|compile|delattr|dir|divmod|eval|exec|format|getattr|globals|hasattr|hash|help|hex|id|input|isinstance|issubclass|iter|len|locals|max|min|next|oct|open|ord|pow|print|repr|round|setattr|sorted|sum|vars|__import__)\b" +## some standard library methods / attributes +#color identifier "\b(append|clear|close|closed|coerce|conjugate|copy|count|extend|fileno|flush|get|has_key|index|insert|items|read|readline|readlines|isatty|keys|mode|name|pop|remove|reverse|seek|softspace|sort|tell|truncate|write|writelines|update|values)\b" +## special method names +color identifier "\b(__abs__|__add__|__and__|__call__|__cmp__|__coerce__|__complex__|__concat__|__contains__|__del__|__delattr__|__delitem__|__delslice__|__div__|__divmod__|__float__|__getattr__|__getitem__|__getslice__|__hash__|__hex__|__init__|__int__|__inv__|__invert__|__len__|__dict__|__long__|__lshift__|__mod__|__mul__|__neg__|__next__|__nonzero__|__oct__|__or__|__pos__|__pow__|__radd__|__rand__|__rcmp__|__rdiv__|__rdivmod__|__repeat__|__repr__|__rlshift__|__rmod__|__rmul__|__ror__|__rpow__|__rrshift__|__rshift__|__rsub__|__rxor__|__setattr__|__setitem__|__setslice__|__str__|__sub__|__xor__)\b" +## exception classes +# color cyan "\b(Exception|StandardError|ArithmeticError|LookupError|EnvironmentError|AssertionError|AttributeError|EOFError|FloatingPointError|IOError|ImportError|IndexError|KeyError|KeyboardInterrupt|MemoryError|NameError|NotImplementedError|OSError|OverflowError|RuntimeError|SyntaxError|SystemError|SystemExit|TypeError|UnboundLocalError|UnicodeError|ValueError|WindowsError|ZeroDivisionError)\b" +## types +color type "\b(bool|bytearray|bytes|classmethod|complex|dict|enumerate|filter|float|frozenset|int|list|map|memoryview|object|property|range|reversed|set|slice|staticmethod|str|super|tuple|type|zip)" +#color type "\b(NoneType|TypeType|IntType|LongType|FloatType|ComplexType|StringType|UnicodeType|BufferType|TupleType|ListType|DictType|FunctionType|LambdaType|CodeType|ClassType|UnboundMethodType|InstanceType|MethodType|BuiltinFunctionType|BuiltinMethodType|ModuleType|FileType|TracebackType|FrameType|SliceType|EllipsisType)\b" +## definitions +color identifier "def [a-zA-Z_0-9]+" +## keywords +color statement "\b(and|as|assert|break|class|continue|def|del|elif|else|except|finally|for|from|global|if|import|in|is|lambda|nonlocal|not|or|pass|raise|return|try|while|with|yield)\b" + +## decorators +color brightgreen "@.*[(]" + +## operators +color statement "[.:;,+*|=!\%@]" "<" ">" "/" "-" "&" + +## parentheses +color statement "[(){}]" "\[" "\]" + +## numbers +color constant.number "\b[0-9]+\b" + +## strings +color constant.string ""(\\.|[^"])*"|'(\\.|[^'])*'" + +## brightblacks +color comment "#.*$" + +## block brightblacks +color comment start=""""([^"]|$)" end=""""" +color comment start="'''([^']|$)" end="'''"