logo

oasis-root

Compiled tree of Oasis Linux based on own branch at <https://hacktivis.me/git/oasis/> git clone https://anongit.hacktivis.me/git/oasis-root.git

asp.lua (1093B)


  1. -- Copyright 2006-2024 Mitchell. See LICENSE.
  2. -- ASP LPeg lexer.
  3. local lexer = lexer
  4. local P, S = lpeg.P, lpeg.S
  5. local html = lexer.load('html')
  6. local lex = lexer.new(..., {inherit = html}) -- proxy for HTML
  7. -- Embedded VB.
  8. local vb = lexer.load('vb')
  9. local vb_start_rule = lex:tag(lexer.PREPROCESSOR, '<%' * P('=')^-1)
  10. local vb_end_rule = lex:tag(lexer.PREPROCESSOR, '%>')
  11. lex:embed(vb, vb_start_rule, vb_end_rule)
  12. -- Embedded VBScript.
  13. local vbs = lexer.load('vb', 'vbscript')
  14. local script_element = lexer.word_match('script', true)
  15. local vbs_start_rule = #('<' * script_element * (P(function(input, index)
  16. if input:find('^%s+language%s*=%s*(["\'])vbscript%1', index) or
  17. input:find('^%s+type%s*=%s*(["\'])text/vbscript%1', index) then return true end
  18. end) + '>')) * html.embed_start_tag -- <script language="vbscript">
  19. local vbs_end_rule = #('</' * script_element * '>') * html.embed_end_tag -- </script>
  20. lex:embed(vbs, vbs_start_rule, vbs_end_rule)
  21. -- Fold points.
  22. lex:add_fold_point(lexer.PREPROCESSOR, '<%', '%>')
  23. lexer.property['scintillua.comment'] = '<!--|-->'
  24. return lex