Commit Graph
79 Commits
Author SHA1 Message Date
Jesse Portnoy 1c58c21b95 Added rpmlint lexer 2025-04-16 13:26:08 +01:00
Jesse Portnoy d1be375d04 README 2025-03-26 23:40:45 +00:00
Jesse Portnoy 7f3fc602a4 Run with Go 1.23.0 2025-03-25 15:58:00 +00:00
Jesse Portnoy bf17668d56 Added tcpdump lexer
Some indentation fixes
2025-03-25 15:49:23 +00:00
Jesse Portnoy 5cbe31b3ce route lexer 2023-09-08 16:11:55 +01:00
Jesse Portnoy aad70c3971 Added a few common shell commands 2023-09-01 00:03:36 +01:00
Jesse Portnoy 3e9c2ec288 ifconfig lexer: interfaces can have '-' in their names 2023-08-05 21:48:13 +01:00
Jesse Portnoy e4585fb2cc improvements to ifconfig lexer 2023-08-05 21:44:58 +01:00
Jesse Portnoy 93cbd28f2e lexers for ifconfig and ip 2023-08-05 21:39:13 +01:00
Jesse Portnoy 0c32bbe78b SQL test case 2023-08-05 21:03:59 +01:00
Jesse Portnoy d888137b13 LICENSE. 2023-08-04 19:06:48 +01:00
Jesse Portnoy 094654c895 . 2023-08-04 00:53:58 +01:00
Jesse Portnoy 73f26d30e6 Better CI 2023-08-04 00:50:51 +01:00
Jesse Portnoy 48b37a1547 Improved JS
Test input for nmap
2023-08-03 20:44:40 +01:00
Jesse Portnoy 524a51e3ce Fixes based on various linter suggestions 2023-08-03 16:13:18 +01:00
Jesse Portnoy 6ae8b2f82e This lexer will work nicely for apt show and apt-cache 2023-08-02 19:08:21 +01:00
Jesse Portnoy 61a0d17de8 - Add synlinks from sh->bash and js(x)->javascript
- Improve JS lexer
2023-08-02 18:41:03 +01:00
Jesse Portnoy e543f7f9f5 . 2023-07-29 23:41:49 +01:00
Jesse Portnoy 0b42849ebd PHP lexer revisions 2023-07-29 23:38:20 +01:00
Jesse Portnoy b3b9a479de [try to] detect go based on header 2023-07-29 03:57:41 +01:00
Jesse Portnoy ae80bdd9b7 Detect go based on header 2023-07-29 03:45:08 +01:00
Jesse Portnoy 9e20d6efc7 Support ss as well 2023-07-25 18:31:05 +01:00
Jesse Portnoy 767de3c0f2 nmap lexer 2023-07-24 17:20:13 +01:00
Jesse Portnoy a1c3190c85 traceroute. 2023-07-23 03:06:16 +01:00
Jesse Portnoy 2c7a879b1b . 2023-07-22 21:56:02 +01:00
Jesse Portnoy 8bad7b78d4 js.yml -> javascript.yaml 2023-07-22 17:00:35 +01:00
Jesse Portnoy 68a246ed23 . 2023-07-21 05:02:48 +01:00
Jesse Portnoy 9254c115d1 . 2023-07-21 04:47:00 +01:00
Jesse Portnoy 543fe406b7 Add XML test. 2023-07-20 17:45:54 +01:00
Jesse Portnoy 67484a4fc4 Improve XML highligher 2023-07-20 17:41:50 +01:00
Jesse Portnoy 0117fef643 . 2023-07-20 02:21:07 +01:00
Jesse Portnoy c580d19b0c . 2023-07-20 00:50:23 +01:00
Jesse Portnoy 137b073d05 - Add du lexer
- Print problematic YAML filename when error is detected
2023-07-19 22:46:52 +01:00
Jesse Portnoy 2a6caac588 fix filetype 2023-07-19 22:04:39 +01:00
Jesse Portnoy 271f421f48 . 2023-07-19 18:29:40 +01:00
Jesse Portnoy 390702b097 run gofmt in CI 2023-07-19 18:27:35 +01:00
Jesse Portnoy d20dc58bbf gofmt 2023-07-19 18:14:32 +01:00
Jesse Portnoy 6f6903a50e Check for parsing errors 2023-07-19 18:04:41 +01:00
Jesse Portnoy 99c6e6f45d Skip parsing of empty files 2023-07-19 17:49:47 +01:00
Jesse Portnoy 81a442c3ba A few more patterns for make files 2023-07-19 17:17:53 +01:00
Jesse Portnoy 3737694512 Highlight more keywords 2023-07-19 16:40:38 +01:00
Jesse Portnoy b5d8dddab5 gofmt 2023-07-18 19:30:52 +01:00
Jesse Portnoy 449702f27b - Support df command
- Return warnings array from ParseSyntaxFiles() in addition to potential
  error. Not being able to parse the dir is a fatal error but if a
random file cannot be read, it should be considered a warning.
2023-07-18 18:46:01 +01:00
Jesse Portnoy 57b5bfb135 Revise example. 2023-07-18 17:18:48 +01:00
Jesse Portnoy 21c71649f6 Add ping parser 2023-07-18 17:00:17 +01:00
Jesse Portnoy 78b6c61665 gofmt 2023-07-18 04:37:42 +01:00
Jesse Portnoy 01852470c7 Fix tests 2023-07-18 04:06:03 +01:00
Jesse Portnoy 07420a4df2 Sort go.mod 2023-07-18 03:59:23 +01:00
Jesse Portnoy 98bcf777fc Docs 2023-07-18 00:24:58 +01:00
Jesse Portnoy 75eb8dfe19 Adjust header pattern 2023-07-17 23:52:44 +01:00
Jesse Portnoy 809287683c . 2023-07-17 23:12:39 +01:00
Jesse Portnoy 7bc99257be Commit test inputs 2023-07-17 23:07:25 +01:00
Jesse Portnoy 61be1084fb . 2023-07-17 23:05:40 +01:00
Jesse Portnoy 92f93fe9d6 Merge branch 'master' of github.com:jessp01/highlight 2023-07-17 23:04:36 +01:00
Jesse Portnoy 5813132695 . 2023-07-17 22:58:58 +01:00
Jesse Portnoy f35df55523 Beginning of unit tests 2023-07-17 22:55:24 +01:00
Jesse Portnoy 9d859df1ae Fix anchor 2023-07-17 16:05:46 +01:00
Jesse Portnoy 3a3e164991 More README stuff.. 2023-07-17 16:03:45 +01:00
Jesse Portnoy 9cad29d17b README additions. 2023-07-17 15:56:08 +01:00
Jesse Portnoy eb804a2dd6 following gofmt -s 2023-07-17 14:26:19 +01:00
Jesse Portnoy d9ba8dbabb .git/config is just an INI file and the lexer for INI is acutally better so... deleting. 2023-07-17 14:10:26 +01:00
Jesse Portnoy 90e6641fc5 . 2023-07-17 04:00:50 +01:00
Jesse Portnoy e41cefacba Double '||'.. hard to spot, causes a mess 2023-07-17 03:45:35 +01:00
Jesse Portnoy 571529568c - Revised code example
- Added new lexers and revised existing
2023-07-16 23:44:37 +01:00
Jesse Portnoy 3e2e307e62 Merge branch 'helper-method-to-parse-syntax-files' 2023-07-16 17:31:59 +01:00
Jesse Portnoy e93520cea4 Fix example to use the new parse helper function 2023-07-16 17:21:03 +01:00
Jesse Portnoy 00bc494d7b Merge branch 'helper-method-to-parse-syntax-files' of github.com:jessp01/highlight into helper-method-to-parse-syntax-files 2023-07-16 17:05:44 +01:00
Jesse Portnoy c255706700 . 2023-07-16 17:03:46 +01:00
Jesse Portnoy 8969d1f05a . 2023-07-16 17:03:21 +01:00
Jesse Portnoy 8e81b0cb4d Fixes. 2023-07-16 17:01:33 +01:00
Jesse Portnoy 28dec9874b Fixes. 2023-07-16 17:00:58 +01:00
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