mirror of
https://github.com/alecthomas/chroma.git
synced 2025-07-15 01:14:21 +02:00
Split PHP into two lexers - PHP and PHTML.
The former is pure PHP code while the latter is PHP code in <? ?> tags, within HTML. Fixes #210.
This commit is contained in:
@ -160,6 +160,14 @@ func Tokenise(lexer Lexer, options *TokeniseOptions, text string) ([]Token, erro
|
||||
// Rules maps from state to a sequence of Rules.
|
||||
type Rules map[string][]Rule
|
||||
|
||||
// Rename clones rules then a rule.
|
||||
func (r Rules) Rename(old, new string) Rules {
|
||||
r = r.Clone()
|
||||
r[new] = r[old]
|
||||
delete(r, old)
|
||||
return r
|
||||
}
|
||||
|
||||
// Clone returns a clone of the Rules.
|
||||
func (r Rules) Clone() Rules {
|
||||
out := map[string][]Rule{}
|
||||
|
Reference in New Issue
Block a user