Commit Graph
63 Commits
Author SHA1 Message Date
Jesse Portnoy 9bebc7ad73 Merge branch 'synlink-yaml-to-yml' 2023-07-16 16:39:09 +01:00
Jesse Portnoy 5d44bdc87e Merge branch 'protect-against-a-case-where-rules-are-nil' 2023-07-16 16:38:25 +01:00
Jesse Portnoy 9ebe0cb27f Merge branch 'fix-sh-brackets-detection' 2023-07-16 16:37:07 +01:00
Jesse Portnoy 0606b69176 Helper method to parse syntax files 2023-07-16 16:26:54 +01:00
Jesse Portnoy 92d5b017bb Fix sh brackets detection 2023-07-16 16:15:29 +01:00
Jesse Portnoy b5b98d2281 In highlightEmptyRegion(), if no rules are defined, return
immediately.

The following snippet will trigger SIGSEGV otherwise:
```go
    syntaxFile, _ := ioutil.ReadFile("/non/existing/path"  + "yml.yaml")
    syntaxDef, err := highlight.ParseDef(syntaxFile)
    if err != nil {
        return err
    }
    h := highlight.NewHighlighter(syntaxDef)
    matches := h.HighlightString(string(codeBlock.Literal))
```

```
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x574656]

goroutine 1 [running]:
github.com/zyedidia/highlight.(*Highlighter).highlightEmptyRegion(0xc000129b98, 0xc0000db980?, 0x0, 0x1, 0x0?, {0xc0001880b0, 0x2a, 0x2c}, 0x0)
	/home/jesse/go/pkg/mod/github.com/zyedidia/highlight@v0.0.0-20200217010119-291680feaca1/highlighter.go:215 +0x96
github.com/zyedidia/highlight.(*Highlighter).HighlightString(0xc000129b98, {0xc0000db980?, 0x2b?})
	/home/jesse/go/pkg/mod/github.com/zyedidia/highlight@v0.0.0-20200217010119-291680feaca1/highlighter.go:278 +0x130
```
2023-07-16 02:17:04 +01:00
Jesse Portnoy 5fa7eb841e - Guard aginst non-existing syn highlighter file
- Create mod file in `examples` dir
2023-07-16 02:12:12 +01:00
Jesse Portnoy fe2757664e Symlink yml.yaml (bpth forms are generally valid by other highlighters) 2023-07-16 01:43:47 +01:00
Robert-André Mauchin 291680feac Update import path of highlight (#12) 2020-02-16 20:01:19 -05:00
Zachary Yedidia 201131ce5c Merge pull request #8 from amrnt/master
Add missing ruby comment syntax and more ruby extensions
2017-03-30 10:34:49 -04:00
Zachary Yedidia c6faee5e6c Fix region highlighting and skipping
Ref #8
2017-03-30 10:33:52 -04:00
Amr Tamimi f87a95fdca Add missing ruby comment syntax. Add more ruby extensions 2017-03-30 11:20:40 +02:00
Zachary Yedidia 98b6b4f75e Add support for skipping 2017-03-27 20:47:03 -04:00
Zachary Yedidia 7c0a62e2a4 Improve unicode support 2017-03-27 19:31:14 -04:00
Zachary Yedidia 760b4668b3 Add badges to readme 2017-03-26 20:16:26 -04:00
Zachary Yedidia 1a97fc1b03 Small update to syncat 2017-03-26 20:10:57 -04:00
Zachary Yedidia cb792c0985 Make some types private 2017-03-26 20:09:06 -04:00
Zachary Yedidia d7faef9d8d Update readme 2017-03-26 19:26:24 -04:00
Zachary Yedidia d68bb0a055 Merge branch 'master' of https://github.com/zyedidia/highlight 2017-03-26 19:16:06 -04:00
Zachary Yedidia 084c2be66c Many optimizations and new syntax files 2017-03-26 19:14:03 -04:00
Zachary Yedidia b7281ff9c0 Merge pull request #7 from amrnt/master
fix python syntax to prioritize multi liner comments
2017-03-23 15:18:35 -04:00
Amr Tamimi eaf4eb2d63 fix python syntax to prioritize multi liner comments 2017-03-23 11:27:44 +01:00
Zachary Yedidia 56f3992cdb Fix bug with regions 2017-03-16 13:15:05 -04:00
Zachary Yedidia 41e9b0079d Add support for including syntax file in each other 2017-02-20 16:03:21 -05:00
Zachary Yedidia feb6f0700e Add arduino, asm, caddyfile, coffeescript, dockerfile 2017-02-20 09:23:22 -05:00
Zachary Yedidia a89c9319b3 Fix syncat example 2017-02-19 21:00:54 -05:00
Zachary Yedidia aa571f2f0c Update readme 2017-02-19 20:41:57 -05:00
Zachary Yedidia a0ff047911 Minor fixes 2017-02-19 11:35:23 -05:00
Zachary Yedidia 8ad8b71842 Set matches in the input 2017-02-19 11:16:18 -05:00
Zachary Yedidia 6dfc8e081f Improve api 2017-02-18 21:29:17 -05:00
Zachary Yedidia 0f7ed208c1 Fix a couple issues with syntax files 2017-02-18 13:54:30 -05:00
Zachary Yedidia 5bee5d8588 Merge pull request #6 from ColinRioux/master
Added css, html, makefile, micro, scala, typescript, and xml
2017-02-18 12:24:53 -05:00
Colin Rioux c18751d613 Added css, html, makefile, micro, scala, typescript, and xml 2017-02-18 11:43:47 -05:00
Zachary Yedidia d7cfd7f95c Merge pull request #5 from ColinRioux/master
Modified readme, added another syntax
2017-02-18 10:57:03 -05:00
Zachary Yedidia 91a5a0d62d Merge branch 'master' into master 2017-02-18 10:56:10 -05:00
Zachary Yedidia e5fe4b8eaa update readme and add examples 2017-02-18 10:54:45 -05:00
Colin Rioux 7fbb9e8127 Modified readme, added another syntax 2017-02-18 10:47:37 -05:00
Zachary Yedidia 3ef9cb838a Add readme and yaml.yaml file 2017-02-18 10:47:31 -05:00
Zachary Yedidia c5a9df25ab Merge pull request #4 from ColinRioux/master
added asciidoc
2017-02-18 10:09:47 -05:00
Zachary Yedidia 9838375668 Add syntax_checker.go
Please use this file to check if the syntax files compile.
2017-02-18 10:08:49 -05:00
Zachary Yedidia e690c2cd5e Fix highlighting for regions starting in regions 2017-02-18 09:57:16 -05:00
Zachary Yedidia b604855378 Fix bugs in syntax files
Fix various bugs in syntax files.
Add c++ syntax file.
Only save last line's endstate in highlight function.
2017-02-18 09:45:07 -05:00
Colin Rioux eb98db6c9f added asciidoc 2017-02-17 23:47:08 -05:00
Zachary Yedidia 076e9c1634 Add fish and toml 2017-02-17 10:39:28 -05:00
Zachary Yedidia 0cce513e73 Minor fixes and additional colorscheme support 2017-02-17 10:22:56 -05:00
Colin Rioux 4193133ce4 Added a lot more syntax files (#3)
* Added ct, git, glsl, json, pascal, sol, and text

* ct

* \n

* Added dart, keymap, lily, mail, ocaml, r, and rest
2017-02-17 10:13:08 -05:00
Zachary Yedidia d6d0b44fa5 Add markdown, objc, zsh 2017-02-16 19:27:32 -05:00
Zachary Yedidia 3cb7d7271c Add rust, sh, swift 2017-02-16 19:03:26 -05:00
Zachary Yedidia 651099f42f Merge pull request #2 from ColinRioux/master
D and vi syntax files
2017-02-16 19:03:00 -05:00
Colin Rioux 2260e9c5e8 Fixed newline 2017-02-16 18:53:35 -05:00