Skip to content

Commit

Permalink
Merge pull request #929 from wakatime/feature/ida-lexer
Browse files Browse the repository at this point in the history
Add support for IDA family
  • Loading branch information
gandarez authored Sep 13, 2023
2 parents c25291e + cb689c0 commit 785401c
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pkg/heartbeat/language.go
Original file line number Diff line number Diff line change
Expand Up @@ -655,6 +655,8 @@ const (
LanguageHyPhy
// LanguageIcon represents the Icon programming language.
LanguageIcon
// LanguageIDA represents the IDA programming language.
LanguageIDA
// LanguageIDL represents the IDL programming language.
LanguageIDL
// LanguageIdris represents the Idris programming language.
Expand Down Expand Up @@ -1888,6 +1890,7 @@ const (
languageHybrisStr = "Hybris"
languageHyPhyStr = "HyPhy"
languageIconStr = "Icon"
languageIDAStr = "IDA"
languageIDLStr = "IDL"
languageIdrisStr = "Idris"
languageIgnoreListStr = "Ignore List"
Expand Down Expand Up @@ -3047,6 +3050,8 @@ func ParseLanguage(s string) (Language, bool) {
return LanguageHyPhy, true
case normalizeString(languageIconStr):
return LanguageIcon, true
case normalizeString(languageIDAStr):
return LanguageIDA, true
case normalizeString(languageIDLStr):
return LanguageIDL, true
case normalizeString(languageIdrisStr):
Expand Down Expand Up @@ -4725,6 +4730,8 @@ func (l Language) String() string {
return languageHyPhyStr
case LanguageIcon:
return languageIconStr
case LanguageIDA:
return languageIDAStr
case LanguageIDL:
return languageIDLStr
case LanguageIdris:
Expand Down
1 change: 1 addition & 0 deletions pkg/heartbeat/language_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,7 @@ func languageTests() map[string]heartbeat.Language {
"Hybris": heartbeat.LanguageHybris,
"HyPhy": heartbeat.LanguageHyPhy,
"Icon": heartbeat.LanguageIcon,
"IDA": heartbeat.LanguageIDA,
"IDL": heartbeat.LanguageIDL,
"Idris": heartbeat.LanguageIdris,
"Ignore List": heartbeat.LanguageIgnoreList,
Expand Down
32 changes: 32 additions & 0 deletions pkg/lexer/ida.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package lexer

import (
"github.com/wakatime/wakatime-cli/pkg/heartbeat"

"github.com/alecthomas/chroma/v2"
)

// IDA lexer.
type IDA struct{}

// Lexer returns the lexer.
func (l IDA) Lexer() chroma.Lexer {
return chroma.MustNewLexer(
&chroma.Config{
Name: l.Name(),
Aliases: []string{"IDA Pro", "IDA Free"},
Filenames: []string{"*.i64", "*.idb"},
MimeTypes: []string{"text/x-ida"},
},
func() chroma.Rules {
return chroma.Rules{
"root": {},
}
},
)
}

// Name returns the name of the lexer.
func (IDA) Name() string {
return heartbeat.LanguageIDA.StringChroma()
}
1 change: 1 addition & 0 deletions pkg/lexer/lexer.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ func RegisterAll() error {
INI{},
IRCLogs{},
Icon{},
IDA{},
Inform6{},
Inform6Template{},
Inform7{},
Expand Down

0 comments on commit 785401c

Please sign in to comment.