Files
news.gitea.happylizard.me/bin/gems/rouge-4.5.1/lib/rouge/lexers/cmhg.rb
T
pizza2d1 4cee170d66
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 9s
Add bin and edit workflow
2026-09-16 13:11:16 -06:00

35 lines
959 B
Ruby

# -*- coding: utf-8 -*- #
# frozen_string_literal: true
module Rouge
module Lexers
class CMHG < RegexLexer
title "CMHG"
desc "RISC OS C module header generator source file"
tag 'cmhg'
filenames '*.cmhg'
def self.preproc_keyword
@preproc_keyword ||= %w(
define elif else endif error if ifdef ifndef include line pragma undef warning
)
end
state :root do
rule %r/;[^\n]*/, Comment
rule %r/^([ \t]*)(#[ \t]*(?:(?:#{CMHG.preproc_keyword.join('|')})(?:[ \t].*)?)?)(?=\n)/ do
groups Text, Comment::Preproc
end
rule %r/[-a-z]+:/, Keyword::Declaration
rule %r/[a-z_]\w+/i, Name::Entity
rule %r/"[^"]*"/, Literal::String
rule %r/(?:&|0x)\h+/, Literal::Number::Hex
rule %r/\d+/, Literal::Number
rule %r/[,\/()]/, Punctuation
rule %r/[ \t]+/, Text
rule %r/\n+/, Text
end
end
end
end