Skip to content

Commit

Permalink
syntax: fix all string-like Syntax to parse empty string
Browse files Browse the repository at this point in the history
  • Loading branch information
kybin committed Dec 1, 2017
1 parent c2a6e3a commit 277dec7
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions syntax/syntax.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import (

func init() {
Languages["go"] = Language{
Syntax{"string", regexp.MustCompile(`^(?m)".*?(?:[^\\]"|$)`), termbox.ColorRed, termbox.ColorBlack},
Syntax{"string", regexp.MustCompile(`^(?m)".*?(?:[^\\]?"|$)`), termbox.ColorRed, termbox.ColorBlack},
Syntax{"raw string", regexp.MustCompile(`^(?s)` + "`" + `.*?` + "(?:`|$)"), termbox.ColorRed, termbox.ColorBlack},
Syntax{"rune", regexp.MustCompile(`^(?m)'.*?(?:[^\\]'|$)`), termbox.ColorYellow, termbox.ColorBlack},
Syntax{"rune", regexp.MustCompile(`^(?m)'.*?(?:[^\\]?'|$)`), termbox.ColorYellow, termbox.ColorBlack},
Syntax{"comment", regexp.MustCompile(`^(?m)//.*`), termbox.ColorMagenta, termbox.ColorBlack},
Syntax{"multi line comment", regexp.MustCompile(`^(?s)/[*].*?(?:[*]/|$)`), termbox.ColorMagenta, termbox.ColorBlack},
Syntax{"trailing spaces", regexp.MustCompile(`^(?m)[ \t]+$`), termbox.ColorBlack, termbox.ColorYellow},
Expand All @@ -21,8 +21,8 @@ func init() {
Languages["py"] = Language{
Syntax{"multi line string1", regexp.MustCompile(`^(?s)""".*?(?:"""|$)`), termbox.ColorRed, termbox.ColorBlack},
Syntax{"multi line string2", regexp.MustCompile(`^(?s)'''.*?(?:'''|$)`), termbox.ColorYellow, termbox.ColorBlack},
Syntax{"string1", regexp.MustCompile(`^(?m)".*?(?:[^\\]"|$)`), termbox.ColorRed, termbox.ColorBlack},
Syntax{"string2", regexp.MustCompile(`^(?m)'.*?(?:[^\\]'|$)`), termbox.ColorYellow, termbox.ColorBlack},
Syntax{"string1", regexp.MustCompile(`^(?m)".*?(?:[^\\]?"|$)`), termbox.ColorRed, termbox.ColorBlack},
Syntax{"string2", regexp.MustCompile(`^(?m)'.*?(?:[^\\]?'|$)`), termbox.ColorYellow, termbox.ColorBlack},
Syntax{"comment", regexp.MustCompile(`^(?m)#.*`), termbox.ColorMagenta, termbox.ColorBlack},
Syntax{"trailing spaces", regexp.MustCompile(`^(?m)[ \t]+$`), termbox.ColorBlack, termbox.ColorYellow},
}
Expand Down

0 comments on commit 277dec7

Please sign in to comment.