1
0
mirror of https://github.com/alecthomas/chroma.git synced 2025-10-30 23:57:49 +02:00

Analysre for PHP.

This commit is contained in:
Alec Thomas
2018-03-19 00:47:15 +11:00
parent b21a6da792
commit 5ef2d37c8c

View File

@@ -1,6 +1,8 @@
package circular
import (
"strings"
. "github.com/alecthomas/chroma" // nolint
"github.com/alecthomas/chroma/lexers/h"
"github.com/alecthomas/chroma/lexers/internal"
@@ -81,4 +83,9 @@ var PHP = internal.Register(DelegatingLexer(h.HTML, MustNewLexer(
{`[${\\]`, LiteralStringDouble, nil},
},
},
)))
).SetAnalyser(func(text string) float32 {
if strings.Contains(text, "<?php") {
return 0.5
}
return 0.0
})))