# -*- coding: utf-8 -*- # # frozen_string_literal: true module Rouge module Lexers class Meson < RegexLexer title "Meson" desc "Meson's specification language (mesonbuild.com)" tag 'meson' filenames 'meson.build', 'meson_options.txt' mimetypes 'text/x-meson' def self.keywords @keywords ||= %w( continue break elif else endif if true false foreach endforeach ) end def self.builtin_variables @builtin_variables ||= %w( meson host_machine build_machine target_machine ) end def self.builtin_functions @builtin_functions ||= %w( add_global_arguments add_project_arguments add_global_link_arguments add_project_link_arguments add_test_setup add_languages alias_target assert benchmark both_libraries build_target configuration_data configure_file custom_target declare_dependency dependency disabler environment error executable generator gettext get_option get_variable files find_library find_program include_directories import install_data install_headers install_man install_subdir is_disabler is_variable jar join_paths library message option project run_target run_command set_variable subdir subdir_done subproject summary shared_library shared_module static_library test vcs_tag warning ) end identifier = /[[:alpha:]_][[:alnum:]_]*/ def current_string @current_string ||= StringRegister.new end state :root do rule %r/\n+/m, Text rule %r/[^\S\n]+/, Text rule %r(#(.*)?\n?), Comment::Single rule %r/[\[\]{}:(),;.]/, Punctuation rule %r/\\\n/, Text rule %r/\\/, Text rule %r/(in|and|or|not)\b/, Operator::Word rule %r/[-+\/*%=<>]=?|!=/, Operator rule %r/([f]?)('''|['])/i do |m| groups Str::Affix, Str current_string.register type: m[1].downcase, delim: m[2] push :generic_string end rule %r/(?