;;; wisent-csharp.wy -- LALR grammar for C# ;; ;; Copyright (C) 2003 David Shilvock ;; Time-stamp: <2003-12-08 19:11:48 dave> ;; ;; Author: David Shilvock ;; Maintainer: David Shilvock ;; Created: November 2003 ;; Keywords: syntax ;; ;; This file is not part of GNU Emacs. ;; ;; 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 2, or (at ;; your option) any later version. ;; ;; This software 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 GNU Emacs; see the file COPYING. If not, write to the ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, ;; Boston, MA 02110-1301, USA. ;;; Commentary: ;; ;; This is a LALR parser for the C# language. It tries to follow the C# ;; language definition as closely as possible, but in some cases allows syntax ;; that the compiler would reject. ;; A bunch of this is ripped from wisent-java-tags.wy (David Ponce) ;;----------- ;; * Settings ;;----------- ;;%package wisent-csharp-wy %languagemode csharp-mode ;; The default start symbol %start compilation_unit ;; Alternate entry points - for partial re-parse %start using_directive %start namespace_declaration %start class_declaration %start const_declaration %start field_declaration %start constructor_declaration %start method_declaration %start property_declaration %start indexer_declaration %start event_declaration %start fixed_parameter %start interface_declaration %start delegate_declaration ;; - Needed by EXPANDFULL clauses %start namespace_member_declaration %start class_member_declaration %start struct_member_declaration %start interface_member_declaration %start accessor_declaration %start event_accessor_declaration %start formal_parameters %start indexer_parameters %start enum_members ;; - Need for semantic-get-local-variables %start local_variable_declaration %start local_foreach_declaration ;;------------------------ ;; * Parenthesis terminals ;;------------------------ %token LPAREN "(" %token RPAREN ")" %token LBRACE "{" %token RBRACE "}" %token LBRACK "[" %token RBRACK "]" ;;------------------ ;; * Block terminals ;;------------------ %token PAREN_BLOCK "^(" %token BRACE_BLOCK "^{" %token BRACK_BLOCK "^\\[" ;;--------------------- ;; * Operator terminals ;;--------------------- %token NOT "!" %token NOTEQ "!=" %token MOD "%" %token MODEQ "%=" %token AND "&" %token ANDAND "&&" %token ANDEQ "&=" %token MULT "*" %token MULTEQ "*=" %token PLUS "+" %token PLUSPLUS "++" %token PLUSEQ "+=" %token COMMA "," %token MINUS "-" %token MINUSMINUS "--" %token MINUSEQ "-=" %token DOT "." %token DIV "/" %token DIVEQ "/=" %token COLON ":" %token SEMICOLON ";" %token DEREF "->" %token LT "<" %token LSHIFT "<<" %token LSHIFTEQ "<<=" %token LTEQ "<=" %token EQ "=" %token EQEQ "==" %token GT ">" %token GTEQ ">=" %token RSHIFT ">>" %token RSHIFTEQ ">>=" %token QUESTION "?" %token XOR "^" %token XOREQ "^=" %token OR "|" %token OREQ "|=" %token OROR "||" %token COMP "~" ;;-------------------- ;; * Literal terminals ;;-------------------- %token NULL_LITERAL "null" %token BOOLEAN_LITERAL "false" %token BOOLEAN_LITERAL "true" %token IDENTIFIER %token STRING_LITERAL %token NUMBER_LITERAL ;;-------------------- ;; * Keyword terminals ;;-------------------- %token ABSTRACT "abstract" %put ABSTRACT summary "Class|Method declaration modifier: abstract {class|} ..." %token ADD "add" %put ADD summary "" %token AS "as" %put AS summary "" %token BASE "base" %put BASE summary "" %token BOOL "bool" %put BOOL summary "Primitive logical quantity type (true or false)" %token BREAK "break" %put BREAK summary "break [