--[[
Mitchell's lexers/rhtml.lua
Copyright (c) 2006-2008 Mitchell Foral. All rights reserved.
SciTE-tools homepage: http://caladbolg.net/scite.php
Send email to: mitchellcaladbolgnet
Permission to use, copy, modify, and distribute this file
is granted, provided credit is given to Mitchell.
RHTML LPeg lexer
]]--
module(..., package.seeall)
local P, S = lpeg.P, lpeg.S
local html = require 'html'
local ruby = require 'ruby'
function LoadTokens()
html.LoadTokens()
ruby.LoadTokens()
local start_token = token('rhtml_tag', '<%' * P('=')^-1)
local end_token = token('rhtml_tag', '%>')
ruby.TokenPatterns.whitespace = token('rhtml_whitespace', space^1)
ruby.TokenPatterns.string = -P('%>') * ruby.TokenPatterns.string
ruby.TokenPatterns.operator = token('operator', S('!^&*()[]{}-=+/|:;.,?<>~') +
'%' * -P('>'))
ruby.TokenPatterns.any_char = token('rhtml_default', any - end_token)
make_embeddable(ruby, html, start_token, end_token)
embed_language(html, ruby, true)
-- TODO: modify HTML, CSS, and JS patterns accordingly
UseOtherTokens = html.Tokens
end
function LoadStyles()
html.LoadStyles()
ruby.LoadStyles()
add_style('rhtml_whitespace', style_nothing)
add_style('rhtml_default', style_nothing)
add_style('rhtml_tag', style_tag..{ back = color('44', '44', '44') })
end