# Style sheet for C#
# Copyright (c) 2002-2006 Karen Christenson
#

#
# This file is part of a2ps.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; see the file COPYING.  If not, see
# <https://www.gnu.org/licenses/gpl-3.0.html>.
#
# 1.0 Karen Christenson
# Implemented Class/Interface/Struct decl as operator

style "C#" is
version is 1.0
requires a2ps version 4.13
written by "Karen Christenson <kchristenson@mac.com>"
documentation is
  "This style is for the .NET object-oriented language C#, and is based"
  "on the C# Language Specification published in 2002 by Microsoft in"
  "the MSDN library."
  "XML comments are mapped to strong comments, and any other comment is a plain"
  "comment."
  "The C style-sheet was not selected as an ancestor in order to treat"
  "a struct the same as a class or an interface.  The CPP style-sheet was not"
  "selected as an ancestor because C# set of preprocessor directives is much"
  "smaller."
  "Keywords, XML comments, preprocessor directives, label statements, and"
  "[] style attributes are high-lighted."
end documentation

first alphabet is
   "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_@"
second alphabet is
   "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz._"

case sensitive

# Specifies primitive types, literals, and special variables.
keywords in Keyword are
   "base", "bool", "byte",
   "char",
   "decimal", "double",
   "enum",
   "false", "float",
   "int",
   "long",
   "null",
   "object",
   "sbyte", "short", "string",
   "this", "true", 
   "uint", "ulong", "ushort",
   "value", "void"
end keywords

# The remaining keywords (except for class, interface, and struct).
keywords in Keyword_strong are
   "abstract", "as",
   "break",
   "case", "catch", "checked", "const", "continue",
   "default", "delegate", "do",
   "else", "event", "explicit", "extern",
   "finally", "fixed", "for", "foreach",
   "get", "goto",
   "if", "implicit", "in", "internal", "is",
   "lock",
   "namespace", "new",
   "operator", "out", "override",
   "params", "private", "protected", "public",
   "readonly", "ref", "return",
   "sealed", "set", "sizeof", "stackalloc", "static", "switch",
   "throw", "try", "typeof",
   "unchecked", "unsafe", "using",
   "virtual", "volatile",
   "while"
end keywords

optional operators are
   -> \rightarrow,
   <<=,
   >>=,
   <= \leq,
   >= \geq
end operators

operators are
  # class/interface/struct declarations.
  (/(class|interface|struct)/	# keyword
   /([[:space:]]+)/	  			# whitespace
   /([^[:space:]]+)/	  		# class/interface/struct name
   \1 Keyword_strong, \2 Plain, \3 Label_strong),

   # [] attribute-section
   /^[[:space:]]*\\[[[:alpha:]_][^\]]*\\][[:space:]]*/ Label_strong,

   # this-access or base-access
   /(this|base)\./ Keyword,

  # preprocessor directives
  /^[[:space:]]*#[[:space:]]*(define|e(l(if|se)|nd(|region|if)|rror)|if|line|warning|region|undef|warning)/ Keyword

end operators

sequences are
    "/*" Comment Comment "*/" Comment,
    "//" Comment,
    "///" Comment,
    C-string,
	C-char
end sequences
end style
