Add Semantic grammar files to etc/grammars

This commit is contained in:
Chong Yidong 2011-07-29 22:06:43 -04:00
parent 096a605265
commit 469d21499d
9 changed files with 4611 additions and 0 deletions

18
etc/grammars/README Normal file
View file

@ -0,0 +1,18 @@
This directory contains grammar files in Bison and Wisent, used to
generate the parser data in the lisp/semantic/bovine/ and
lisp/semantic/wisent/ directories. You can run the parser generators
with
emacs -batch --no-site-file \
-l semantic/bovine -l semantic/wisent -l semantic/grammar \
-l semantic/lex -l bovine-grammar.el \
-f semantic-mode -f semantic-grammar-batch-build-packages *.by
emacs -batch --no-site-file \
-l semantic/bovine -l semantic/wisent -l semantic/grammar \
-l semantic/lex -l wisent-grammar.el \
-f semantic-mode -f semantic-grammar-batch-build-packages *.wy
Currently, the parser files in lisp/ are not generated directly from
these grammar files when making Emacs. This state of affairs, and the
contents of this directory, will change in a future version of Emacs.

View file

@ -0,0 +1,439 @@
;;; bovine-grammar.el --- Bovine's input grammar mode
;;
;; Copyright (C) 2002-2011 Free Software Foundation, Inc.
;;
;; Author: David Ponce <david@dponce.com>
;; Maintainer: David Ponce <david@dponce.com>
;; Created: 26 Aug 2002
;; Keywords: syntax
;; This file is part of GNU Emacs.
;; GNU Emacs 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 of the License, or
;; (at your option) any later version.
;; GNU Emacs 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. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;;
;; Major mode for editing Bovine's input grammar (.by) files.
;;; History:
;;; Code:
(require 'semantic)
(require 'semantic/grammar)
(require 'semantic/find)
(defun bovine-grammar-EXPAND (bounds nonterm)
"Expand call to EXPAND grammar macro.
Return the form to parse from within a nonterminal between BOUNDS.
NONTERM is the nonterminal symbol to start with."
`(semantic-bovinate-from-nonterminal
(car ,bounds) (cdr ,bounds) ',nonterm))
(defun bovine-grammar-EXPANDFULL (bounds nonterm)
"Expand call to EXPANDFULL grammar macro.
Return the form to recursively parse the area between BOUNDS.
NONTERM is the nonterminal symbol to start with."
`(semantic-parse-region
(car ,bounds) (cdr ,bounds) ',nonterm 1))
(defun bovine-grammar-TAG (name class &rest attributes)
"Expand call to TAG grammar macro.
Return the form to create a generic semantic tag.
See the function `semantic-tag' for the meaning of arguments NAME,
CLASS and ATTRIBUTES."
`(semantic-tag ,name ,class ,@attributes))
(defun bovine-grammar-VARIABLE-TAG (name type default-value &rest attributes)
"Expand call to VARIABLE-TAG grammar macro.
Return the form to create a semantic tag of class variable.
See the function `semantic-tag-new-variable' for the meaning of
arguments NAME, TYPE, DEFAULT-VALUE and ATTRIBUTES."
`(semantic-tag-new-variable ,name ,type ,default-value ,@attributes))
(defun bovine-grammar-FUNCTION-TAG (name type arg-list &rest attributes)
"Expand call to FUNCTION-TAG grammar macro.
Return the form to create a semantic tag of class function.
See the function `semantic-tag-new-function' for the meaning of
arguments NAME, TYPE, ARG-LIST and ATTRIBUTES."
`(semantic-tag-new-function ,name ,type ,arg-list ,@attributes))
(defun bovine-grammar-TYPE-TAG (name type members parents &rest attributes)
"Expand call to TYPE-TAG grammar macro.
Return the form to create a semantic tag of class type.
See the function `semantic-tag-new-type' for the meaning of arguments
NAME, TYPE, MEMBERS, PARENTS and ATTRIBUTES."
`(semantic-tag-new-type ,name ,type ,members ,parents ,@attributes))
(defun bovine-grammar-INCLUDE-TAG (name system-flag &rest attributes)
"Expand call to INCLUDE-TAG grammar macro.
Return the form to create a semantic tag of class include.
See the function `semantic-tag-new-include' for the meaning of
arguments NAME, SYSTEM-FLAG and ATTRIBUTES."
`(semantic-tag-new-include ,name ,system-flag ,@attributes))
(defun bovine-grammar-PACKAGE-TAG (name detail &rest attributes)
"Expand call to PACKAGE-TAG grammar macro.
Return the form to create a semantic tag of class package.
See the function `semantic-tag-new-package' for the meaning of
arguments NAME, DETAIL and ATTRIBUTES."
`(semantic-tag-new-package ,name ,detail ,@attributes))
(defun bovine-grammar-CODE-TAG (name detail &rest attributes)
"Expand call to CODE-TAG grammar macro.
Return the form to create a semantic tag of class code.
See the function `semantic-tag-new-code' for the meaning of arguments
NAME, DETAIL and ATTRIBUTES."
`(semantic-tag-new-code ,name ,detail ,@attributes))
(defun bovine-grammar-ALIAS-TAG (name aliasclass definition &rest attributes)
"Expand call to ALIAS-TAG grammar macro.
Return the form to create a semantic tag of class alias.
See the function `semantic-tag-new-alias' for the meaning of arguments
NAME, ALIASCLASS, DEFINITION and ATTRIBUTES."
`(semantic-tag-new-alias ,name ,aliasclass ,definition ,@attributes))
;; Cache of macro definitions currently in use.
(defvar bovine--grammar-macros nil)
(defun bovine-grammar-expand-form (form quotemode &optional inplace)
"Expand FORM into a new one suitable to the bovine parser.
FORM is a list in which we are substituting.
Argument QUOTEMODE is non-nil if we are in backquote mode.
When non-nil, optional argument INPLACE indicates that FORM is being
expanded from elsewhere."
(when (listp form)
(when (eq (car form) 'quote)
(setq form (cdr form))
(cond
((and (= (length form) 1) (listp (car form)))
(insert "\n(append")
(bovine-grammar-expand-form (car form) quotemode nil)
(insert ")")
(setq form nil inplace nil)
)
((and (= (length form) 1) (symbolp (car form)))
(insert "\n'" (symbol-name (car form)))
(setq form nil inplace nil)
)
(t
(insert "\n(list")
(setq inplace t)
)))
(let ((macro (assq (car form) bovine--grammar-macros))
inlist first n q x)
(if macro
(bovine-grammar-expand-form
(apply (cdr macro) (cdr form))
quotemode t)
(if inplace (insert "\n("))
(while form
(setq first (car form)
form (cdr form))
(cond
((eq first nil)
(when (and (not inlist) (not inplace))
(insert "\n(list")
(setq inlist t))
(insert " nil")
)
((listp first)
;;(let ((fn (and (symbolp (caar form)) (fboundp (caar form)))))
(when (and (not inlist) (not inplace))
(insert "\n(list")
(setq inlist t))
;;(if (and inplace (not fn) (not (eq (caar form) 'EXPAND)))
;; (insert " (append"))
(bovine-grammar-expand-form
first quotemode t) ;;(and fn (not (eq fn 'quote))))
;;(if (and inplace (not fn) (not (eq (caar form) 'EXPAND)))
;; (insert ")"))
;;)
)
((symbolp first)
(setq n (symbol-name first) ;the name
q quotemode ;implied quote flag
x nil) ;expand flag
(if (eq (aref n 0) ?,)
(if quotemode
;; backquote mode needs the @
(if (eq (aref n 1) ?@)
(setq n (substring n 2)
q nil
x t)
;; non backquote mode behaves normally.
(setq n (substring n 1)
q nil))
(setq n (substring n 1)
x t)))
(if (string= n "")
(progn
;; We expand only the next item in place (a list?)
;; A regular inline-list...
(bovine-grammar-expand-form (car form) quotemode t)
(setq form (cdr form)))
(if (and (eq (aref n 0) ?$)
;; Don't expand $ tokens in implied quote mode.
;; This acts like quoting in other symbols.
(not q))
(progn
(cond
((and (not x) (not inlist) (not inplace))
(insert "\n(list"))
((and x inlist (not inplace))
(insert ")")
(setq inlist nil)))
(insert "\n(nth " (int-to-string
(1- (string-to-number
(substring n 1))))
" vals)")
(and (not x) (not inplace)
(setq inlist t)))
(when (and (not inlist) (not inplace))
(insert "\n(list")
(setq inlist t))
(or (char-equal (char-before) ?\()
(insert " "))
(insert (if (or inplace (eq first t))
"" "'")
n))) ;; " "
)
(t
(when (and (not inlist) (not inplace))
(insert "\n(list")
(setq inlist t))
(insert (format "\n%S" first))
)
))
(if inlist (insert ")"))
(if inplace (insert ")")))
)))
(defun bovine-grammar-expand-action (textform quotemode)
"Expand semantic action string TEXTFORM into Lisp code.
QUOTEMODE is the mode in which quoted symbols are slurred."
(if (string= "" textform)
nil
(let ((sexp (read textform)))
;; We converted the lambda string into a list. Now write it
;; out as the bovine lambda expression, and do macro-like
;; conversion upon it.
(insert "\n")
(cond
((eq (car sexp) 'EXPAND)
(insert ",(lambda (vals start end)")
;; The EXPAND macro definition is mandatory
(bovine-grammar-expand-form
(apply (cdr (assq 'EXPAND bovine--grammar-macros)) (cdr sexp))
quotemode t)
)
((and (listp (car sexp)) (eq (caar sexp) 'EVAL))
;; The user wants to evaluate the following args.
;; Use a simpler expander
)
(t
(insert ",(semantic-lambda")
(bovine-grammar-expand-form sexp quotemode)
))
(insert ")\n")))
)
(defun bovine-grammar-parsetable-builder ()
"Return the parser table expression as a string value.
The format of a bovine parser table is:
( ( NONTERMINAL-SYMBOL1 MATCH-LIST1 )
( NONTERMINAL-SYMBOL2 MATCH-LIST2 )
...
( NONTERMINAL-SYMBOLn MATCH-LISTn )
Where each NONTERMINAL-SYMBOL is an artificial symbol which can appear
in any child state. As a starting place, one of the NONTERMINAL-SYMBOLS
must be `bovine-toplevel'.
A MATCH-LIST is a list of possible matches of the form:
( STATE-LIST1
STATE-LIST2
...
STATE-LISTN )
where STATE-LIST is of the form:
( TYPE1 [ \"VALUE1\" ] TYPE2 [ \"VALUE2\" ] ... LAMBDA )
where TYPE is one of the returned types of the token stream.
VALUE is a value, or range of values to match against. For
example, a SYMBOL might need to match \"foo\". Some TYPES will not
have matching criteria.
LAMBDA is a lambda expression which is evaled with the text of the
type when it is found. It is passed the list of all buffer text
elements found since the last lambda expression. It should return a
semantic element (see below.)
For consistency between languages, try to use common return values
from your parser. Please reference the chapter \"Writing Parsers\" in
the \"Language Support Developer's Guide -\" in the semantic texinfo
manual."
(let* ((start (semantic-grammar-start))
(scopestart (semantic-grammar-scopestart))
(quotemode (semantic-grammar-quotemode))
(tags (semantic-find-tags-by-class
'token (current-buffer)))
(nterms (semantic-find-tags-by-class
'nonterminal (current-buffer)))
;; Setup the cache of macro definitions.
(bovine--grammar-macros (semantic-grammar-macros))
nterm rules items item actn prec tag type regex)
;; Check some trivial things
(cond
((null nterms)
(error "Bad input grammar"))
(start
(if (cdr start)
(message "Extra start symbols %S ignored" (cdr start)))
(setq start (symbol-name (car start)))
(unless (semantic-find-first-tag-by-name start nterms)
(error "start symbol `%s' has no rule" start)))
(t
;; Default to the first grammar rule.
(setq start (semantic-tag-name (car nterms)))))
(when scopestart
(setq scopestart (symbol-name scopestart))
(unless (semantic-find-first-tag-by-name scopestart nterms)
(error "scopestart symbol `%s' has no rule" scopestart)))
;; Generate the grammar Lisp form.
(with-temp-buffer
(erase-buffer)
(insert "`(")
;; Insert the start/scopestart rules
(insert "\n(bovine-toplevel \n("
start
")\n) ;; end bovine-toplevel\n")
(when scopestart
(insert "\n(bovine-inner-scope \n("
scopestart
")\n) ;; end bovine-inner-scope\n"))
;; Process each nonterminal
(while nterms
(setq nterm (car nterms)
;; We can't use the override form because the current buffer
;; is not the originator of the tag.
rules (semantic-tag-components-semantic-grammar-mode nterm)
nterm (semantic-tag-name nterm)
nterms (cdr nterms))
(when (member nterm '("bovine-toplevel" "bovine-inner-scope"))
(error "`%s' is a reserved internal name" nterm))
(insert "\n(" nterm)
;; Process each rule
(while rules
(setq items (semantic-tag-get-attribute (car rules) :value)
prec (semantic-tag-get-attribute (car rules) :prec)
actn (semantic-tag-get-attribute (car rules) :expr)
rules (cdr rules))
;; Process each item
(insert "\n(")
(if (null items)
;; EMPTY rule
(insert ";;EMPTY" (if actn "" "\n"))
;; Expand items
(while items
(setq item (car items)
items (cdr items))
(if (consp item) ;; mid-rule action
(message "Mid-rule action %S ignored" item)
(or (char-equal (char-before) ?\()
(insert "\n"))
(cond
((member item '("bovine-toplevel" "bovine-inner-scope"))
(error "`%s' is a reserved internal name" item))
;; Replace ITEM by its %token definition.
;; If a '%token TYPE ITEM [REGEX]' definition exists
;; in the grammar, ITEM is replaced by TYPE [REGEX].
((setq tag (semantic-find-first-tag-by-name
item tags)
type (semantic-tag-get-attribute tag :type))
(insert type)
(if (setq regex (semantic-tag-get-attribute tag :value))
(insert (format "\n%S" regex))))
;; Don't change ITEM
(t
(insert (semantic-grammar-item-text item)))
))))
(if prec
(message "%%prec %S ignored" prec))
(if actn
(bovine-grammar-expand-action actn quotemode))
(insert ")"))
(insert "\n) ;; end " nterm "\n"))
(insert ")\n")
(buffer-string))))
(defun bovine-grammar-setupcode-builder ()
"Return the text of the setup code."
(format
"(setq semantic--parse-table %s\n\
semantic-debug-parser-source %S\n\
semantic-debug-parser-class 'semantic-bovine-debug-parser
semantic-flex-keywords-obarray %s\n\
%s)"
(semantic-grammar-parsetable)
(buffer-name)
(semantic-grammar-keywordtable)
(let ((mode (semantic-grammar-languagemode)))
;; Is there more than one major mode?
(if (and (listp mode) (> (length mode) 1))
(format "semantic-equivalent-major-modes '%S\n" mode)
""))))
(defvar bovine-grammar-menu
'("BY Grammar"
)
"BY mode specific grammar menu.
Menu items are appended to the common grammar menu.")
(define-derived-mode bovine-grammar-mode semantic-grammar-mode "BY"
"Major mode for editing Bovine grammars."
(semantic-grammar-setup-menu bovine-grammar-menu)
(semantic-install-function-overrides
'((grammar-parsetable-builder . bovine-grammar-parsetable-builder)
(grammar-setupcode-builder . bovine-grammar-setupcode-builder)
)))
(add-to-list 'auto-mode-alist '("\\.by$" . bovine-grammar-mode))
(defvar-mode-local bovine-grammar-mode semantic-grammar-macros
'(
(ASSOC . semantic-grammar-ASSOC)
(EXPAND . bovine-grammar-EXPAND)
(EXPANDFULL . bovine-grammar-EXPANDFULL)
(TAG . bovine-grammar-TAG)
(VARIABLE-TAG . bovine-grammar-VARIABLE-TAG)
(FUNCTION-TAG . bovine-grammar-FUNCTION-TAG)
(TYPE-TAG . bovine-grammar-TYPE-TAG)
(INCLUDE-TAG . bovine-grammar-INCLUDE-TAG)
(PACKAGE-TAG . bovine-grammar-PACKAGE-TAG)
(CODE-TAG . bovine-grammar-CODE-TAG)
(ALIAS-TAG . bovine-grammar-ALIAS-TAG)
)
"Semantic grammar macros used in bovine grammars.")
(provide 'semantic/bovine/grammar)
;;; semantic/bovine/grammar.el ends here

1205
etc/grammars/c.by Normal file

File diff suppressed because it is too large Load diff

753
etc/grammars/java-tags.wy Normal file
View file

@ -0,0 +1,753 @@
;;; semantic/wisent/java-tags.wy -- Semantic LALR grammar for Java
;;
;; Copyright (C) 2002, 2007 David Ponce
;; Copyright (C) 2007 Eric Ludlam
;;
;; Author: David Ponce <david@dponce.com>
;; Maintainer: David Ponce <david@dponce.com>
;; Created: 25 Feb 2002
;; 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.
%package java-tags-wy
%languagemode java-mode
;; The default start symbol
%start compilation_unit
;; Alternate entry points
;; - Needed by partial re-parse
%start package_declaration
%start import_declaration
%start class_declaration
%start field_declaration
%start method_declaration
%start formal_parameter
%start constructor_declaration
%start interface_declaration
;; - Needed by EXPANDFULL clauses
%start class_member_declaration
%start interface_member_declaration
%start formal_parameters
;; -----------------------------
;; Block & Parenthesis terminals
;; -----------------------------
%type <block> ;;syntax "\\s(\\|\\s)" matchdatatype block
%token <block> PAREN_BLOCK "(LPAREN RPAREN)"
%token <block> BRACE_BLOCK "(LBRACE RBRACE)"
%token <block> BRACK_BLOCK "(LBRACK RBRACK)"
%token <open-paren> LPAREN "("
%token <close-paren> RPAREN ")"
%token <open-paren> LBRACE "{"
%token <close-paren> RBRACE "}"
%token <open-paren> LBRACK "["
%token <close-paren> RBRACK "]"
;; ------------------
;; Operator terminals
;; ------------------
%type <punctuation> ;;syntax "\\(\\s.\\|\\s$\\|\\s'\\)+" matchdatatype string
%token <punctuation> NOT "!"
%token <punctuation> NOTEQ "!="
%token <punctuation> MOD "%"
%token <punctuation> MODEQ "%="
%token <punctuation> AND "&"
%token <punctuation> ANDAND "&&"
%token <punctuation> ANDEQ "&="
%token <punctuation> MULT "*"
%token <punctuation> MULTEQ "*="
%token <punctuation> PLUS "+"
%token <punctuation> PLUSPLUS "++"
%token <punctuation> PLUSEQ "+="
%token <punctuation> COMMA ","
%token <punctuation> MINUS "-"
%token <punctuation> MINUSMINUS "--"
%token <punctuation> MINUSEQ "-="
%token <punctuation> DOT "."
%token <punctuation> DIV "/"
%token <punctuation> DIVEQ "/="
%token <punctuation> COLON ":"
%token <punctuation> SEMICOLON ";"
%token <punctuation> LT "<"
%token <punctuation> LSHIFT "<<"
%token <punctuation> LSHIFTEQ "<<="
%token <punctuation> LTEQ "<="
%token <punctuation> EQ "="
%token <punctuation> EQEQ "=="
%token <punctuation> GT ">"
%token <punctuation> GTEQ ">="
%token <punctuation> RSHIFT ">>"
%token <punctuation> RSHIFTEQ ">>="
%token <punctuation> URSHIFT ">>>"
%token <punctuation> URSHIFTEQ ">>>="
%token <punctuation> QUESTION "?"
%token <punctuation> XOR "^"
%token <punctuation> XOREQ "^="
%token <punctuation> OR "|"
%token <punctuation> OREQ "|="
%token <punctuation> OROR "||"
%token <punctuation> COMP "~"
;; -----------------
;; Literal terminals
;; -----------------
%type <symbol> ;;syntax "\\(\\sw\\|\\s_\\)+"
%token <symbol> IDENTIFIER
%type <string> ;;syntax "\\s\"" matchdatatype sexp
%token <string> STRING_LITERAL
%type <number> ;;syntax semantic-lex-number-expression
%token <number> NUMBER_LITERAL
%type <unicode> syntax "\\\\u[0-9a-f][0-9a-f][0-9a-f][0-9a-f]"
%token <unicode> unicodecharacter
;; -----------------
;; Keyword terminals
;; -----------------
;; Generate a keyword analyzer
%type <keyword> ;;syntax "\\(\\sw\\|\\s_\\)+" matchdatatype keyword
%keyword ABSTRACT "abstract"
%put ABSTRACT summary
"Class|Method declaration modifier: abstract {class|<type>} <name> ..."
%keyword BOOLEAN "boolean"
%put BOOLEAN summary
"Primitive logical quantity type (true or false)"
%keyword BREAK "break"
%put BREAK summary
"break [<label>] ;"
%keyword BYTE "byte"
%put BYTE summary
"Integral primitive type (-128 to 127)"
%keyword CASE "case"
%put CASE summary
"switch(<expr>) {case <const-expr>: <stmts> ... }"
%keyword CATCH "catch"
%put CATCH summary
"try {<stmts>} catch(<parm>) {<stmts>} ... "
%keyword CHAR "char"
%put CHAR summary
"Integral primitive type ('\u0000' to '\uffff') (0 to 65535)"
%keyword CLASS "class"
%put CLASS summary
"Class declaration: class <name>"
%keyword CONST "const"
%put CONST summary
"Unused reserved word"
%keyword CONTINUE "continue"
%put CONTINUE summary
"continue [<label>] ;"
%keyword DEFAULT "default"
%put DEFAULT summary
"switch(<expr>) { ... default: <stmts>}"
%keyword DO "do"
%put DO summary
"do <stmt> while (<expr>);"
%keyword DOUBLE "double"
%put DOUBLE summary
"Primitive floating-point type (double-precision 64-bit IEEE 754)"
%keyword ELSE "else"
%put ELSE summary
"if (<expr>) <stmt> else <stmt>"
%keyword EXTENDS "extends"
%put EXTENDS summary
"SuperClass|SuperInterfaces declaration: extends <name> [, ...]"
%keyword FINAL "final"
%put FINAL summary
"Class|Member declaration modifier: final {class|<type>} <name> ..."
%keyword FINALLY "finally"
%put FINALLY summary
"try {<stmts>} ... finally {<stmts>}"
%keyword FLOAT "float"
%put FLOAT summary
"Primitive floating-point type (single-precision 32-bit IEEE 754)"
%keyword FOR "for"
%put FOR summary
"for ([<init-expr>]; [<expr>]; [<update-expr>]) <stmt>"
%keyword GOTO "goto"
%put GOTO summary
"Unused reserved word"
%keyword IF "if"
%put IF summary
"if (<expr>) <stmt> [else <stmt>]"
%keyword IMPLEMENTS "implements"
%put IMPLEMENTS summary
"Class SuperInterfaces declaration: implements <name> [, ...]"
%keyword IMPORT "import"
%put IMPORT summary
"Import package declarations: import <package>"
%keyword INSTANCEOF "instanceof"
%keyword INT "int"
%put INT summary
"Integral primitive type (-2147483648 to 2147483647)"
%keyword INTERFACE "interface"
%put INTERFACE summary
"Interface declaration: interface <name>"
%keyword LONG "long"
%put LONG summary
"Integral primitive type (-9223372036854775808 to 9223372036854775807)"
%keyword NATIVE "native"
%put NATIVE summary
"Method declaration modifier: native <type> <name> ..."
%keyword NEW "new"
%keyword PACKAGE "package"
%put PACKAGE summary
"Package declaration: package <name>"
%keyword PRIVATE "private"
%put PRIVATE summary
"Access level modifier: private {class|interface|<type>} <name> ..."
%keyword PROTECTED "protected"
%put PROTECTED summary
"Access level modifier: protected {class|interface|<type>} <name> ..."
%keyword PUBLIC "public"
%put PUBLIC summary
"Access level modifier: public {class|interface|<type>} <name> ..."
%keyword RETURN "return"
%put RETURN summary
"return [<expr>] ;"
%keyword SHORT "short"
%put SHORT summary
"Integral primitive type (-32768 to 32767)"
%keyword STATIC "static"
%put STATIC summary
"Declaration modifier: static {class|interface|<type>} <name> ..."
%keyword STRICTFP "strictfp"
%put STRICTFP summary
"Declaration modifier: strictfp {class|interface|<type>} <name> ..."
%keyword SUPER "super"
%keyword SWITCH "switch"
%put SWITCH summary
"switch(<expr>) {[case <const-expr>: <stmts> ...] [default: <stmts>]}"
%keyword SYNCHRONIZED "synchronized"
%put SYNCHRONIZED summary
"synchronized (<expr>) ... | Method decl. modifier: synchronized <type> <name> ..."
%keyword THIS "this"
%keyword THROW "throw"
%put THROW summary
"throw <expr> ;"
%keyword THROWS "throws"
%put THROWS summary
"Method|Constructor declaration: throws <classType>, ..."
%keyword TRANSIENT "transient"
%put TRANSIENT summary
"Field declaration modifier: transient <type> <name> ..."
%keyword TRY "try"
%put TRY summary
"try {<stmts>} [catch(<parm>) {<stmts>} ...] [finally {<stmts>}]"
%keyword VOID "void"
%put VOID summary
"Method return type: void <name> ..."
%keyword VOLATILE "volatile"
%put VOLATILE summary
"Field declaration modifier: volatile <type> <name> ..."
%keyword WHILE "while"
%put WHILE summary
"while (<expr>) <stmt> | do <stmt> while (<expr>);"
;; --------------------------
;; Official javadoc line tags
;; --------------------------
;; Javadoc tags are identified by a 'javadoc' keyword property. The
;; value of this property must be itself a property list where the
;; following properties are recognized:
;;
;; - `seq' (mandatory) is the tag sequence number used to check if tags
;; are correctly ordered in a javadoc comment block.
;;
;; - `usage' (mandatory) is the list of token categories for which this
;; documentation tag is allowed.
;;
;; - `opt' (optional) if non-nil indicates this is an optional tag.
;; By default tags are mandatory.
;;
;; - `with-name' (optional) if non-nil indicates that this tag is
;; followed by an identifier like in "@param <var-name> description"
;; or "@exception <class-name> description".
;;
;; - `with-ref' (optional) if non-nil indicates that the tag is
;; followed by a reference like in "@see <reference>".
%keyword _AUTHOR "@author"
%put _AUTHOR javadoc (seq 1 usage (type))
%keyword _VERSION "@version"
%put _VERSION javadoc (seq 2 usage (type))
%keyword _PARAM "@param"
%put _PARAM javadoc (seq 3 usage (function) with-name t)
%keyword _RETURN "@return"
%put _RETURN javadoc (seq 4 usage (function))
%keyword _EXCEPTION "@exception"
%put _EXCEPTION javadoc (seq 5 usage (function) with-name t)
%keyword _THROWS "@throws"
%put _THROWS javadoc (seq 6 usage (function) with-name t)
%keyword _SEE "@see"
%put _SEE javadoc (seq 7 usage (type function variable) opt t with-ref t)
%keyword _SINCE "@since"
%put _SINCE javadoc (seq 8 usage (type function variable) opt t)
%keyword _SERIAL "@serial"
%put _SERIAL javadoc (seq 9 usage (variable) opt t)
%keyword _SERIALDATA "@serialData"
%put _SERIALDATA javadoc (seq 10 usage (function) opt t)
%keyword _SERIALFIELD "@serialField"
%put _SERIALFIELD javadoc (seq 11 usage (variable) opt t)
%keyword _DEPRECATED "@deprecated"
%put _DEPRECATED javadoc (seq 12 usage (type function variable) opt t)
%%
;; ------------
;; LALR Grammar
;; ------------
;; This grammar is not designed to fully parse correct Java syntax. It
;; is optimized to work in an interactive environment to extract tokens
;; (tags) needed by Semantic. In some cases a syntax not allowed by
;; the Java Language Specification will be accepted by this grammar.
compilation_unit
: package_declaration
| import_declaration
| type_declaration
;
;;; Package statement token
;; ("NAME" package DETAIL "DOCSTRING")
package_declaration
: PACKAGE qualified_name SEMICOLON
(PACKAGE-TAG $2 nil)
;
;;; Include file token
;; ("FILE" include SYSTEM "DOCSTRING")
import_declaration
: IMPORT qualified_name SEMICOLON
(INCLUDE-TAG $2 nil)
| IMPORT qualified_name DOT MULT SEMICOLON
(INCLUDE-TAG (concat $2 $3 $4) nil)
;
type_declaration
: SEMICOLON
()
| class_declaration
| interface_declaration
;
;;; Type Declaration token
;; ("NAME" type "TYPE" ( PART-LIST ) ( PARENTS ) EXTRA-SPEC "DOCSTRING")
class_declaration
: modifiers_opt CLASS qualified_name superc_opt interfaces_opt class_body
(TYPE-TAG $3 $2 $6 (if (or $4 $5) (cons $4 $5)) :typemodifiers $1)
;
superc_opt
: ;;EMPTY
| EXTENDS qualified_name
(identity $2)
;
interfaces_opt
: ;;EMPTY
| IMPLEMENTS qualified_name_list
(nreverse $2)
;
class_body
: BRACE_BLOCK
(EXPANDFULL $1 class_member_declaration)
;
class_member_declaration
: LBRACE
()
| RBRACE
()
| block
()
| static_initializer
()
| constructor_declaration
| interface_declaration
| class_declaration
| method_declaration
| field_declaration
;
;;; Type Declaration token
;; ("NAME" type "TYPE" ( PART-LIST ) ( PARENTS ) EXTRA-SPEC "DOCSTRING")
interface_declaration
: modifiers_opt INTERFACE IDENTIFIER extends_interfaces_opt interface_body
(TYPE-TAG $3 $2 $5 (if $4 (cons nil $4)) :typemodifiers $1)
;
extends_interfaces_opt
: ;;EMPTY
| EXTENDS qualified_name_list
(identity $2)
;
interface_body
: BRACE_BLOCK
(EXPANDFULL $1 interface_member_declaration)
;
interface_member_declaration
: LBRACE
()
| RBRACE
()
| interface_declaration
| class_declaration
| method_declaration
| field_declaration
;
static_initializer
: STATIC block
;
;;; Function token
;; ("NAME" function "TYPE" ( ARG-LIST ) EXTRA-SPEC "DOCSTRING")
constructor_declaration
: modifiers_opt constructor_declarator throwsc_opt constructor_body
(FUNCTION-TAG (car $2) nil (cdr $2)
:typemodifiers $1
:throws $3
:constructor-flag t)
;
constructor_declarator
: IDENTIFIER formal_parameter_list
(cons $1 $2)
;
constructor_body
: block
;
;;; Function token
;; ("NAME" function "TYPE" ( ARG-LIST ) EXTRA-SPEC "DOCSTRING")
method_declaration
: modifiers_opt VOID method_declarator throwsc_opt method_body
(FUNCTION-TAG (car $3) $2 (cdr $3) :typemodifiers $1 :throws $4)
| modifiers_opt type method_declarator throwsc_opt method_body
(FUNCTION-TAG (car $3) $2 (cdr $3) :typemodifiers $1 :throws $4)
;
method_declarator
: IDENTIFIER formal_parameter_list dims_opt
(cons (concat $1 $3) $2)
;
throwsc_opt
: ;;EMPTY
| THROWS qualified_name_list
(nreverse $2)
;
qualified_name_list
: qualified_name_list COMMA qualified_name
(cons $3 $1)
| qualified_name
(list $1)
;
method_body
: SEMICOLON
| block
;
;; Just eat {...} block!
block
: BRACE_BLOCK
;
formal_parameter_list
: PAREN_BLOCK
(EXPANDFULL $1 formal_parameters)
;
formal_parameters
: LPAREN
()
| RPAREN
()
| formal_parameter COMMA
| formal_parameter RPAREN
;
;;; Variable token
;; ("NAME" variable "TYPE" DEFAULT-VALUE EXTRA-SPEC "DOCSTRING")
formal_parameter
: formal_parameter_modifier_opt type variable_declarator_id
(VARIABLE-TAG $3 $2 nil :typemodifiers $1)
;
formal_parameter_modifier_opt
: ;;EMPTY
| FINAL
(list $1)
;
;;; Variable token
;; ("NAME" variable "TYPE" DEFAULT-VALUE EXTRA-SPEC "DOCSTRING")
field_declaration
: modifiers_opt type variable_declarators SEMICOLON
(VARIABLE-TAG $3 $2 nil :typemodifiers $1)
;
variable_declarators
: variable_declarators COMMA variable_declarator
(progn
;; Set the end of the compound declaration to the end of the
;; COMMA delimiter.
(setcdr (cdr (car $1)) (cdr $region2))
(cons $3 $1))
| variable_declarator
(list $1)
;
variable_declarator
: variable_declarator_id EQ variable_initializer
(cons $1 $region)
| variable_declarator_id
(cons $1 $region)
;
variable_declarator_id
: IDENTIFIER dims_opt
(concat $1 $2)
;
variable_initializer
: expression
;
;; Just eat expression!
expression
: expression term
| term
;
term
: literal
| operator
| primitive_type
| IDENTIFIER
| BRACK_BLOCK
| PAREN_BLOCK
| BRACE_BLOCK
| NEW
| CLASS
| THIS
| SUPER
;
literal
;; : NULL_LITERAL
;; | BOOLEAN_LITERAL
: STRING_LITERAL
| NUMBER_LITERAL
;
operator
: NOT
| PLUS
| PLUSPLUS
| MINUS
| MINUSMINUS
| NOTEQ
| MOD
| MODEQ
| AND
| ANDAND
| ANDEQ
| MULT
| MULTEQ
| PLUSEQ
| MINUSEQ
| DOT
| DIV
| DIVEQ
| COLON
| LT
| LSHIFT
| LSHIFTEQ
| LTEQ
| EQ
| EQEQ
| GT
| GTEQ
| RSHIFT
| RSHIFTEQ
| URSHIFT
| URSHIFTEQ
| QUESTION
| XOR
| XOREQ
| OR
| OREQ
| OROR
| COMP
| INSTANCEOF
;
primitive_type
: BOOLEAN
| CHAR
| LONG
| INT
| SHORT
| BYTE
| DOUBLE
| FLOAT
;
modifiers_opt
: ;;EMPTY
| modifiers
(nreverse $1)
;
modifiers
: modifiers modifier
(cons $2 $1)
| modifier
(list $1)
;
modifier
: STRICTFP
| VOLATILE
| TRANSIENT
| SYNCHRONIZED
| NATIVE
| FINAL
| ABSTRACT
| STATIC
| PRIVATE
| PROTECTED
| PUBLIC
;
type
: qualified_name dims_opt
(concat $1 $2)
| primitive_type dims_opt
(concat $1 $2)
;
qualified_name
: qualified_name DOT IDENTIFIER
(concat $1 $2 $3)
| IDENTIFIER
;
dims_opt
: ;;EMPTY
(identity "")
| dims
;
dims
: dims BRACK_BLOCK
(concat $1 "[]")
| BRACK_BLOCK
(identity "[]")
;
%%
;; Define the lexer for this grammar
(define-lex wisent-java-tags-lexer
"Lexical analyzer that handles Java buffers.
It ignores whitespaces, newlines and comments."
semantic-lex-ignore-whitespace
semantic-lex-ignore-newline
semantic-lex-ignore-comments
;;;; Auto-generated analyzers.
semantic/wisent/java-tags-wy--<number>-regexp-analyzer
semantic/wisent/java-tags-wy--<string>-sexp-analyzer
;; Must detect keywords before other symbols
semantic/wisent/java-tags-wy--<keyword>-keyword-analyzer
semantic/wisent/java-tags-wy--<symbol>-regexp-analyzer
semantic/wisent/java-tags-wy--<punctuation>-string-analyzer
semantic/wisent/java-tags-wy--<block>-block-analyzer
;; In theory, unicode chars should be turned into normal chars
;; and then combined into regular ascii keywords and text. This
;; analyzer just keeps these things from making the lexer go boom.
semantic/wisent/java-tags-wy--<unicode>-regexp-analyzer
;;;;
semantic-lex-default-action)
;;; semantic/wisent/java-tags.wy ends here

View file

@ -0,0 +1,503 @@
;;; semantic/wisent/javascript-jv.wy -- LALR grammar for Javascript
;;
;; Copyright (C) 2005 Joakim Verona, Eric Ludlam
;; JAVE Copyright (C) Alex Walker
;;
;; Author: Joakim Verona
;; Maintainer:
;; 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:
;;
;;JAVE converted from a bison javascript definition at:
;; http://www.soton.net/jssyntaxchecker/FinalReport.pdf
;;by Alex Walker
;;and from wisent-javascrypt.wy by Eric Ludlam
;;
;;...and then further modified by Joakim Verona
;;and its more of an experiment than anything useful
%package javascript-jv-wy
;; JAVE I prefere ecmascript-mode
%languagemode ecmascript-mode javascript-mode
;; The default goal
%start Program
;; Other Goals
%start FormalParameterList
;; with the terminals stuff, I used the javacript.y names,
;; but the semantic/wisent/java-tags.wy types
;; when possible
;; ------------------
;; Operator terminals
;; ------------------
;;define-lex-string-type-analyzer gets called with the "syntax" comment
%type <punctuation> ;;syntax "\\(\\s.\\|\\s$\\|\\s'\\)+" matchdatatype string
%token <punctuation> ASSIGN_SYMBOL "="
%token <punctuation> BITWISE_AND "&"
%token <punctuation> BITWISE_AND_EQUALS "&="
%token <punctuation> BITWISE_EXCLUSIVE_OR "^"
%token <punctuation> BITWISE_EXCLUSIVE_OR_EQUALS "^="
%token <punctuation> BITWISE_OR "|"
%token <punctuation> BITWISE_OR_EQUALS "|="
%token <punctuation> BITWISE_SHIFT_LEFT "<<"
%token <punctuation> BITWISE_SHIFT_LEFT_EQUALS "<<="
%token <punctuation> BITWISE_SHIFT_RIGHT ">>"
%token <punctuation> BITWISE_SHIFT_RIGHT_EQUALS ">>="
%token <punctuation> BITWISE_SHIFT_RIGHT_ZERO_FILL ">>>"
%token <punctuation> BITWISE_SHIFT_RIGHT_ZERO_FILL_EQUALS ">>>="
%token <punctuation> NOT_EQUAL "!="
%token <punctuation> DIV_EQUALS "/="
%token <punctuation> EQUALS "=="
%token <punctuation> GREATER_THAN ">"
%token <punctuation> GT_EQUAL ">="
%token <punctuation> LOGICAL_AND "&&"
%token <punctuation> LOGICAL_OR "||"
%token <punctuation> LOGICAL_NOT "!!"
%token <punctuation> LS_EQUAL "<="
%token <punctuation> MINUS "-"
%token <punctuation> MINUS_EQUALS "-="
%token <punctuation> MOD "%"
%token <punctuation> MOD_EQUALS "%="
%token <punctuation> MULTIPLY "*"
%token <punctuation> MULTIPLY_EQUALS "*="
%token <punctuation> PLUS "+"
%token <punctuation> PLUS_EQUALS "+="
%token <punctuation> INCREMENT "++"
%token <punctuation> DECREMENT "--"
%token <punctuation> DIV "/"
%token <punctuation> COLON ":"
%token <punctuation> COMMA ","
%token <punctuation> DOT "."
%token <punctuation> LESS_THAN "<"
%token <punctuation> LINE_TERMINATOR "\n"
%token <punctuation> SEMICOLON ";"
%token <punctuation> ONES_COMPLIMENT "~"
;; -----------------------------
;; Block & Parenthesis terminals
;; -----------------------------
%type <block> ;;syntax "\\s(\\|\\s)" matchdatatype block
%token <block> PAREN_BLOCK "(OPEN_PARENTHESIS CLOSE_PARENTHESIS)"
%token <block> BRACE_BLOCK "(START_BLOCK END_BLOCK)"
%token <block> BRACK_BLOCK "(OPEN_SQ_BRACKETS CLOSE_SQ_BRACKETS)"
%token <open-paren> OPEN_PARENTHESIS "("
%token <close-paren> CLOSE_PARENTHESIS ")"
%token <open-paren> START_BLOCK "{"
%token <close-paren> END_BLOCK "}"
%token <open-paren> OPEN_SQ_BRACKETS "["
%token <close-paren> CLOSE_SQ_BRACKETS "]"
;; -----------------
;; Keyword terminals
;; -----------------
;; Generate a keyword analyzer
%type <keyword> ;;syntax "\\(\\sw\\|\\s_\\)+" matchdatatype keyword
%keyword IF "if"
%put IF summary
"if (<expr>) <stmt> [else <stmt>] (jv)"
%keyword BREAK "break"
%put BREAK summary
"break [<label>] ;"
%keyword CONTINUE "continue"
%put CONTINUE summary
"continue [<label>] ;"
%keyword ELSE "else"
%put ELSE summary
"if (<expr>) <stmt> else <stmt>"
%keyword FOR "for"
%put FOR summary
"for ([<init-expr>]; [<expr>]; [<update-expr>]) <stmt>"
%keyword FUNCTION "function"
%put FUNCTION summary
"function declaration blah blah"
%keyword THIS "this"
%put THIS summary
"this"
%keyword RETURN "return"
%put RETURN summary
"return [<expr>] ;"
%keyword WHILE "while"
%put WHILE summary
"while (<expr>) <stmt> | do <stmt> while (<expr>);"
%keyword VOID_SYMBOL "void"
%put VOID_SYMBOL summary
"Method return type: void <name> ..."
%keyword NEW "new"
%put NEW summary
"new <objecttype> - Creates a new object."
%keyword DELETE "delete"
%put DELETE summary
"delete(<objectreference>) - Deletes the object."
%keyword VAR "var"
%put VAR summary
"var <variablename> [= value];"
%keyword WITH "with"
%put WITH summary
"with "
%keyword TYPEOF "typeof"
%put TYPEOF summary
"typeof "
%keyword IN "in"
%put IN summary
"in something"
;; -----------------
;; Literal terminals
;; -----------------
;;the .y file uses VARIABLE as IDENTIFIER, which seems a bit evil
;; it think the normal .wy convention is better than this
%type <symbol> ;;syntax "\\(\\sw\\|\\s_\\)+"
%token <symbol> VARIABLE
%type <string> ;;syntax "\\s\"" matchdatatype sexp
%token <string> STRING
%type <number> ;;syntax semantic-lex-number-expression
%token <number> NUMBER
%token FALSE
%token TRUE
%token QUERY
%token NULL_TOKEN
;;%token UNDEFINED_TOKEN
;;%token INFINITY
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; associativity and stuff
%left PLUS MINUS
%left MULTIPLY DIV MOD
%nonassoc FALSE
%nonassoc HIGHER_THAN_FALSE
%nonassoc ELSE
%nonassoc LOWER_THAN_CLOSE_PARENTHESIS
%nonassoc CLOSE_PARENTHESIS
%%
Program : SourceElement
;
SourceElement : Statement
| FunctionDeclaration
;
Statement : Block
| VariableStatement
| EmptyStatement
| ExpressionStatement
| IfStatement
| IterationExpression
| ContinueStatement
| BreakStatement
| ReturnStatement
| WithStatement
;
FunctionDeclaration : FUNCTION VARIABLE FormalParameterListBlock Block
(FUNCTION-TAG $2 nil $3)
;
FormalParameterListBlock : PAREN_BLOCK
(EXPANDFULL $1 FormalParameterList)
;
FormalParameterList: OPEN_PARENTHESIS
()
| VARIABLE
(VARIABLE-TAG $1 nil nil)
| CLOSE_PARENTHESIS
()
| COMMA
()
;
StatementList : Statement
| StatementList Statement
;
Block : BRACE_BLOCK
;; If you want to parse the body of the function
;; ( EXPANDFULL $1 BlockExpand )
;
BlockExpand: START_BLOCK StatementList END_BLOCK
| START_BLOCK END_BLOCK
;
VariableStatement : VAR VariableDeclarationList SEMICOLON
(VARIABLE-TAG $2 nil nil)
;
VariableDeclarationList : VariableDeclaration
(list $1)
| VariableDeclarationList COMMA VariableDeclaration
(append $1 (list $3))
;
VariableDeclaration : VARIABLE
(append (list $1 nil) $region)
| VARIABLE Initializer
(append (cons $1 $2) $region)
;
Initializer : ASSIGN_SYMBOL AssignmentExpression
(list $2)
;
EmptyStatement : SEMICOLON
;
ExpressionStatement : Expression SEMICOLON
;
IfStatement : IF OPEN_PARENTHESIS Expression CLOSE_PARENTHESIS Statement %prec HIGHER_THAN_FALSE
| IF OPEN_PARENTHESIS Expression CLOSE_PARENTHESIS Statement ELSE Statement
| IF OPEN_PARENTHESIS FALSE CLOSE_PARENTHESIS Statement
| IF OPEN_PARENTHESIS LeftHandSideExpression AssignmentOperator AssignmentExpression CLOSE_PARENTHESIS Statement
;
IterationExpression : WHILE OPEN_PARENTHESIS Expression CLOSE_PARENTHESIS Statement %prec HIGHER_THAN_FALSE
| WHILE OPEN_PARENTHESIS FALSE CLOSE_PARENTHESIS Statement
| WHILE OPEN_PARENTHESIS LeftHandSideExpression AssignmentOperator AssignmentExpression CLOSE_PARENTHESIS Statement
| FOR OPEN_PARENTHESIS OptionalExpression SEMICOLON OptionalExpression SEMICOLON OptionalExpression CLOSE_PARENTHESIS Statement
| FOR OPEN_PARENTHESIS VAR VariableDeclarationList SEMICOLON OptionalExpression SEMICOLON OptionalExpression CLOSE_PARENTHESIS Statement
| FOR OPEN_PARENTHESIS LeftHandSideExpression IN Expression CLOSE_PARENTHESIS Statement
| FOR OPEN_PARENTHESIS VAR VARIABLE OptionalInitializer IN Expression CLOSE_PARENTHESIS Statement
;
ContinueStatement : CONTINUE SEMICOLON
;
;;JAVE break needs labels
BreakStatement : BREAK SEMICOLON
;; | BREAK identifier SEMICOLON
;
ReturnStatement : RETURN Expression SEMICOLON
| RETURN SEMICOLON
;
WithStatement : WITH OPEN_PARENTHESIS Expression CLOSE_PARENTHESIS Statement
;
OptionalInitializer : Initializer
|
;
PrimaryExpression : THIS
| VARIABLE
| NUMBER
| STRING
| NULL_TOKEN
| TRUE
| FALSE
| OPEN_PARENTHESIS Expression CLOSE_PARENTHESIS
;
MemberExpression : PrimaryExpression
| MemberExpression OPEN_SQ_BRACKETS Expression CLOSE_SQ_BRACKETS
| MemberExpression DOT VARIABLE
| NEW MemberExpression Arguments
;
NewExpression : MemberExpression
| NEW NewExpression
;
CallExpression : MemberExpression Arguments
| CallExpression Arguments
| CallExpression OPEN_SQ_BRACKETS Expression CLOSE_SQ_BRACKETS
| CallExpression DOT VARIABLE
;
Arguments : OPEN_PARENTHESIS CLOSE_PARENTHESIS
| OPEN_PARENTHESIS ArgumentList CLOSE_PARENTHESIS
;
ArgumentList : AssignmentExpression
| ArgumentList COMMA AssignmentExpression
;
LeftHandSideExpression : NewExpression
| CallExpression
;
PostfixExpression : LeftHandSideExpression
| LeftHandSideExpression INCREMENT
| LeftHandSideExpression DECREMENT
;
UnaryExpression : PostfixExpression
| DELETE UnaryExpression
| VOID_SYMBOL UnaryExpression
| TYPEOF UnaryExpression
| INCREMENT UnaryExpression
| DECREMENT UnaryExpression
| PLUS UnaryExpression
| MINUS UnaryExpression
| ONES_COMPLIMENT UnaryExpression
| LOGICAL_NOT UnaryExpression
;
MultiplicativeExpression : UnaryExpression
| MultiplicativeExpression MULTIPLY UnaryExpression
| MultiplicativeExpression DIV UnaryExpression
| MultiplicativeExpression MOD UnaryExpression
;
AdditiveExpression : MultiplicativeExpression
| AdditiveExpression PLUS MultiplicativeExpression
| AdditiveExpression MINUS MultiplicativeExpression
;
ShiftExpression : AdditiveExpression
| ShiftExpression BITWISE_SHIFT_LEFT AdditiveExpression
| ShiftExpression BITWISE_SHIFT_RIGHT AdditiveExpression
| ShiftExpression BITWISE_SHIFT_RIGHT_ZERO_FILL AdditiveExpression
;
RelationalExpression : ShiftExpression
| RelationalExpression LESS_THAN ShiftExpression
| RelationalExpression GREATER_THAN ShiftExpression
| RelationalExpression LS_EQUAL ShiftExpression
| RelationalExpression GT_EQUAL ShiftExpression
;
EqualityExpression : RelationalExpression
| EqualityExpression EQUALS RelationalExpression
| EqualityExpression NOT_EQUAL RelationalExpression
;
BitwiseANDExpression : EqualityExpression
| BitwiseANDExpression BITWISE_AND EqualityExpression
;
BitwiseXORExpression : BitwiseANDExpression
| BitwiseXORExpression BITWISE_EXCLUSIVE_OR BitwiseANDExpression
;
BitwiseORExpression : BitwiseXORExpression
| BitwiseORExpression BITWISE_OR BitwiseXORExpression
;
LogicalANDExpression : BitwiseORExpression
| LogicalANDExpression LOGICAL_AND BitwiseORExpression
;
LogicalORExpression : LogicalANDExpression
| LogicalORExpression LOGICAL_OR LogicalANDExpression
;
ConditionalExpression : LogicalORExpression
| LogicalORExpression QUERY AssignmentExpression COLON AssignmentExpression
;
AssignmentExpression : ConditionalExpression
| LeftHandSideExpression AssignmentOperator AssignmentExpression %prec LOWER_THAN_CLOSE_PARENTHESIS
;
AssignmentOperator : ASSIGN_SYMBOL
| MULTIPLY_EQUALS
| DIV_EQUALS
| MOD_EQUALS
| PLUS_EQUALS
| MINUS_EQUALS
| BITWISE_SHIFT_LEFT_EQUALS
| BITWISE_SHIFT_RIGHT_EQUALS
| BITWISE_SHIFT_RIGHT_ZERO_FILL_EQUALS
| BITWISE_AND_EQUALS
| BITWISE_EXCLUSIVE_OR_EQUALS
| BITWISE_OR_EQUALS
;
Expression : AssignmentExpression
| Expression COMMA AssignmentExpression
;
OptionalExpression : Expression
|
;
%%
;;here something like:
;;(define-lex wisent-java-tags-lexer
;; should go
(define-lex javascript-lexer-jv
"javascript thingy"
;;std stuff
semantic-lex-ignore-whitespace
semantic-lex-ignore-newline
semantic-lex-ignore-comments
;;stuff generated from the wy file(one for each "type" declaration)
semantic/wisent/javascript-jv-wy--<number>-regexp-analyzer
semantic/wisent/javascript-jv-wy--<string>-sexp-analyzer
semantic/wisent/javascript-jv-wy--<keyword>-keyword-analyzer
semantic/wisent/javascript-jv-wy--<symbol>-regexp-analyzer
semantic/wisent/javascript-jv-wy--<punctuation>-string-analyzer
semantic/wisent/javascript-jv-wy--<block>-block-analyzer
;;;;more std stuff
semantic-lex-default-action
)
;;; semantic/wisent/javascript-jv.wy ends here

167
etc/grammars/make.by Normal file
View file

@ -0,0 +1,167 @@
;;; semantic/bovine/make.by -- BY notation for Makefiles.
;;
;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2008 Eric M. Ludlam
;;
;; Author: Eric M. Ludlam <zappo@gnu.org>
;;
;; 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.
;;
%package make-by
%languagemode makefile-mode
%start Makefile
;; This was always a test case.
%quotemode backquote
%token IF "if"
%token IFDEF "ifdef"
%token IFNDEF "ifndef"
%token IFEQ "ifeq"
%token IFNEQ "ifneq"
%token ELSE "else"
%token ENDIF "endif"
%token INCLUDE "include"
%put { IF ELSE ENDIF } summary "Conditional: if (expression) ... else ... endif"
%put IFDEF summary "Conditional: ifdef (expression) ... else ... endif"
%put IFNDEF summary "Conditional: ifndef (expression) ... else ... endif"
%put IFEQ summary "Conditional: ifeq (expression) ... else ... endif"
%put IFNEQ summary "Conditional: ifneq (expression) ... else ... endif"
%put INCLUDE summary "Macro: include filename1 filename2 ..."
%token <punctuation> COLON "\\`[:]\\'"
%token <punctuation> PLUS "\\`[+]\\'"
%token <punctuation> EQUAL "\\`[=]\\'"
%token <punctuation> DOLLAR "\\`[$]\\'"
%token <punctuation> BACKSLASH "\\`[\\]\\'"
%%
Makefile : bol newline (nil)
| bol variable
( ,@$2 )
| bol rule
( ,@$2 )
| bol conditional
( ,@$2 )
| bol include
( ,@$2 )
| whitespace ( nil )
| newline ( nil )
;
variable: symbol opt-whitespace equals opt-whitespace element-list
(VARIABLE-TAG ,$1 nil ,$5)
;
rule: targets opt-whitespace colons opt-whitespace element-list commands
(FUNCTION-TAG ,$1 nil ,$5)
;
targets: target opt-whitespace targets
( (car ,$1) (car ,@$3) )
| target
( (car ,$1) )
;
target: sub-target target
( (concat (car ,$1) (car ,@$3) ) )
| sub-target
( (car ,$1) )
;
sub-target: symbol
| string
| varref
;
conditional: IF some-whitespace symbol newline
( nil )
| IFDEF some-whitespace symbol newline
( nil )
| IFNDEF some-whitespace symbol newline
( nil )
| IFEQ some-whitespace expression newline
( nil )
| IFNEQ some-whitespace expression newline
( nil )
| ELSE newline
( nil )
| ENDIF newline
( nil )
;
expression : semantic-list
;
include: INCLUDE some-whitespace element-list
(INCLUDE-TAG ,$3 nil)
;
equals: COLON EQUAL ()
| PLUS EQUAL ()
| EQUAL ()
;
colons: COLON COLON ()
| COLON ()
;
element-list: elements newline
( ,@$1 )
;
elements: element some-whitespace elements
( ,@$1 ,@$3 )
| element
( ,@$1 )
| ;;EMPTY
;
element: sub-element element
( (concat (car ,$1) (car ,$2)) )
| ;;EMPTY
;
sub-element: symbol
| string
| punctuation
| semantic-list
( (buffer-substring-no-properties
(identity start) (identity end)) )
;
varref: DOLLAR semantic-list
( (buffer-substring-no-properties (identity start) (identity end)) )
;
commands: bol shell-command newline commands
( ,$1 ,@$2 )
| ;;EMPTY
( )
;
opt-whitespace : some-whitespace ( nil )
| ;;EMPTY
;
some-whitespace : whitespace some-whitespace (nil)
| whitespace (nil)
;
;;; semantic/bovine/make.by ends here

1083
etc/grammars/python.wy Normal file

File diff suppressed because it is too large Load diff

86
etc/grammars/scheme.by Normal file
View file

@ -0,0 +1,86 @@
;;; semantic/bovine/scheme.by -- Scheme BNF language specification
;;
;; Copyright (C) 2001, 2003, 2009 Eric M. Ludlam
;;
;; Author: Eric M. Ludlam <zappo@gnu.org>
;;
;; This 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.
%package scm-by
%languagemode scheme-mode
%start scheme
%token DEFINE "define"
%token DEFINE-MODULE "define-module"
%token LOAD "load"
%put DEFINE summary "Function: (define symbol expression)"
%put DEFINE-MODULE summary "Function: (define-module (name arg1 ...)) "
%put LOAD summary "Function: (load \"filename\")"
%token <open-paren> OPENPAREN "("
%token <close-paren> CLOSEPAREN ")"
%%
scheme : semantic-list
(EXPAND $1 scheme-list)
;
scheme-list : OPENPAREN scheme-in-list CLOSEPAREN
( ,$2 )
;
scheme-in-list: DEFINE symbol expression
(VARIABLE-TAG $2 nil $3 )
| DEFINE name-args opt-doc sequence
(FUNCTION-TAG (car ,$2) nil (cdr ,$2) )
| DEFINE-MODULE name-args
(PACKAGE-TAG (nth (length $2) $2 ) nil)
| LOAD string
(INCLUDE-TAG (file-name-nondirectory (read $2)) (read $2) )
| symbol
(CODE-TAG $1 nil)
;
name-args: semantic-list
(EXPAND $1 name-arg-expand)
;
name-arg-expand : open-paren name-arg-expand
( ,$2 )
| symbol name-arg-expand
( ,(cons $1 ,$2) )
| ;; EMPTY
( )
;
opt-doc : string
| ;; EMPTY
;
sequence : expression sequence
| expression
;
expression : symbol
| semantic-list
| string
| number
;
;;; semantic/bovine/scheme.by ends here

View file

@ -0,0 +1,357 @@
;;; wisent-grammar.el --- Wisent's input grammar mode
;; Copyright (C) 2002-2011 Free Software Foundation, Inc.
;;
;; Author: David Ponce <david@dponce.com>
;; Maintainer: David Ponce <david@dponce.com>
;; Created: 26 Aug 2002
;; Keywords: syntax
;; This file is part of GNU Emacs.
;; GNU Emacs 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 of the License, or
;; (at your option) any later version.
;; GNU Emacs 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. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;;
;; Major mode for editing Wisent's input grammar (.wy) files.
;;; Code:
(require 'semantic/grammar)
(require 'semantic/find)
(defsubst wisent-grammar-region-placeholder (symb)
"Given a $N placeholder symbol in SYMB, return a $regionN symbol.
Return nil if $N is not a valid placeholder symbol."
(let ((n (symbol-name symb)))
(if (string-match "^[$]\\([1-9][0-9]*\\)$" n)
(intern (concat "$region" (match-string 1 n))))))
(defun wisent-grammar-EXPAND (symb nonterm)
"Expand call to EXPAND grammar macro.
Return the form to parse from within a nonterminal.
SYMB is a $I placeholder symbol that gives the bounds of the area to
parse.
NONTERM is the nonterminal symbol to start with."
(unless (member nonterm (semantic-grammar-start))
(error "EXPANDFULL macro called with %s, but not used with %%start"
nonterm))
(let (($ri (wisent-grammar-region-placeholder symb)))
(if $ri
`(semantic-bovinate-from-nonterminal
(car ,$ri) (cdr ,$ri) ',nonterm)
(error "Invalid form (EXPAND %s %s)" symb nonterm))))
(defun wisent-grammar-EXPANDFULL (symb nonterm)
"Expand call to EXPANDFULL grammar macro.
Return the form to recursively parse an area.
SYMB is a $I placeholder symbol that gives the bounds of the area.
NONTERM is the nonterminal symbol to start with."
(unless (member nonterm (semantic-grammar-start))
(error "EXPANDFULL macro called with %s, but not used with %%start"
nonterm))
(let (($ri (wisent-grammar-region-placeholder symb)))
(if $ri
`(semantic-parse-region
(car ,$ri) (cdr ,$ri) ',nonterm 1)
(error "Invalid form (EXPANDFULL %s %s)" symb nonterm))))
(defun wisent-grammar-TAG (name class &rest attributes)
"Expand call to TAG grammar macro.
Return the form to create a generic semantic tag.
See the function `semantic-tag' for the meaning of arguments NAME,
CLASS and ATTRIBUTES."
`(wisent-raw-tag
(semantic-tag ,name ,class ,@attributes)))
(defun wisent-grammar-VARIABLE-TAG (name type default-value &rest attributes)
"Expand call to VARIABLE-TAG grammar macro.
Return the form to create a semantic tag of class variable.
See the function `semantic-tag-new-variable' for the meaning of
arguments NAME, TYPE, DEFAULT-VALUE and ATTRIBUTES."
`(wisent-raw-tag
(semantic-tag-new-variable ,name ,type ,default-value ,@attributes)))
(defun wisent-grammar-FUNCTION-TAG (name type arg-list &rest attributes)
"Expand call to FUNCTION-TAG grammar macro.
Return the form to create a semantic tag of class function.
See the function `semantic-tag-new-function' for the meaning of
arguments NAME, TYPE, ARG-LIST and ATTRIBUTES."
`(wisent-raw-tag
(semantic-tag-new-function ,name ,type ,arg-list ,@attributes)))
(defun wisent-grammar-TYPE-TAG (name type members parents &rest attributes)
"Expand call to TYPE-TAG grammar macro.
Return the form to create a semantic tag of class type.
See the function `semantic-tag-new-type' for the meaning of arguments
NAME, TYPE, MEMBERS, PARENTS and ATTRIBUTES."
`(wisent-raw-tag
(semantic-tag-new-type ,name ,type ,members ,parents ,@attributes)))
(defun wisent-grammar-INCLUDE-TAG (name system-flag &rest attributes)
"Expand call to INCLUDE-TAG grammar macro.
Return the form to create a semantic tag of class include.
See the function `semantic-tag-new-include' for the meaning of
arguments NAME, SYSTEM-FLAG and ATTRIBUTES."
`(wisent-raw-tag
(semantic-tag-new-include ,name ,system-flag ,@attributes)))
(defun wisent-grammar-PACKAGE-TAG (name detail &rest attributes)
"Expand call to PACKAGE-TAG grammar macro.
Return the form to create a semantic tag of class package.
See the function `semantic-tag-new-package' for the meaning of
arguments NAME, DETAIL and ATTRIBUTES."
`(wisent-raw-tag
(semantic-tag-new-package ,name ,detail ,@attributes)))
(defun wisent-grammar-CODE-TAG (name detail &rest attributes)
"Expand call to CODE-TAG grammar macro.
Return the form to create a semantic tag of class code.
See the function `semantic-tag-new-code' for the meaning of arguments
NAME, DETAIL and ATTRIBUTES."
`(wisent-raw-tag
(semantic-tag-new-code ,name ,detail ,@attributes)))
(defun wisent-grammar-ALIAS-TAG (name aliasclass definition &rest attributes)
"Expand call to ALIAS-TAG grammar macro.
Return the form to create a semantic tag of class alias.
See the function `semantic-tag-new-alias' for the meaning of arguments
NAME, ALIASCLASS, DEFINITION and ATTRIBUTES."
`(wisent-raw-tag
(semantic-tag-new-alias ,name ,aliasclass ,definition ,@attributes)))
(defun wisent-grammar-EXPANDTAG (raw-tag)
"Expand call to EXPANDTAG grammar macro.
Return the form to produce a list of cooked tags from raw form of
Semantic tag RAW-TAG."
`(wisent-cook-tag ,raw-tag))
(defun wisent-grammar-AST-ADD (ast &rest nodes)
"Expand call to AST-ADD grammar macro.
Return the form to update the abstract syntax tree AST with NODES.
See also the function `semantic-ast-add'."
`(semantic-ast-add ,ast ,@nodes))
(defun wisent-grammar-AST-PUT (ast &rest nodes)
"Expand call to AST-PUT grammar macro.
Return the form to update the abstract syntax tree AST with NODES.
See also the function `semantic-ast-put'."
`(semantic-ast-put ,ast ,@nodes))
(defun wisent-grammar-AST-GET (ast node)
"Expand call to AST-GET grammar macro.
Return the form to get, from the abstract syntax tree AST, the value
of NODE.
See also the function `semantic-ast-get'."
`(semantic-ast-get ,ast ,node))
(defun wisent-grammar-AST-GET1 (ast node)
"Expand call to AST-GET1 grammar macro.
Return the form to get, from the abstract syntax tree AST, the first
value of NODE.
See also the function `semantic-ast-get1'."
`(semantic-ast-get1 ,ast ,node))
(defun wisent-grammar-AST-GET-STRING (ast node)
"Expand call to AST-GET-STRING grammar macro.
Return the form to get, from the abstract syntax tree AST, the value
of NODE as a string.
See also the function `semantic-ast-get-string'."
`(semantic-ast-get-string ,ast ,node))
(defun wisent-grammar-AST-MERGE (ast1 ast2)
"Expand call to AST-MERGE grammar macro.
Return the form to merge the abstract syntax trees AST1 and AST2.
See also the function `semantic-ast-merge'."
`(semantic-ast-merge ,ast1 ,ast2))
(defun wisent-grammar-SKIP-BLOCK (&optional symb)
"Expand call to SKIP-BLOCK grammar macro.
Return the form to skip a parenthesized block.
Optional argument SYMB is a $I placeholder symbol that gives the
bounds of the block to skip. By default, skip the block at `$1'.
See also the function `wisent-skip-block'."
(let ($ri)
(when symb
(unless (setq $ri (wisent-grammar-region-placeholder symb))
(error "Invalid form (SKIP-BLOCK %s)" symb)))
`(wisent-skip-block ,$ri)))
(defun wisent-grammar-SKIP-TOKEN ()
"Expand call to SKIP-TOKEN grammar macro.
Return the form to skip the lookahead token.
See also the function `wisent-skip-token'."
`(wisent-skip-token))
(defun wisent-grammar-assocs ()
"Return associativity and precedence level definitions."
(mapcar
#'(lambda (tag)
(cons (intern (semantic-tag-name tag))
(mapcar #'semantic-grammar-item-value
(semantic-tag-get-attribute tag :value))))
(semantic-find-tags-by-class 'assoc (current-buffer))))
(defun wisent-grammar-terminals ()
"Return the list of terminal symbols.
Keep order of declaration in the WY file without duplicates."
(let (terms)
(mapcar
#'(lambda (tag)
(mapcar #'(lambda (name)
(add-to-list 'terms (intern name)))
(cons (semantic-tag-name tag)
(semantic-tag-get-attribute tag :rest))))
(semantic--find-tags-by-function
#'(lambda (tag)
(memq (semantic-tag-class tag) '(token keyword)))
(current-buffer)))
(nreverse terms)))
;; Cache of macro definitions currently in use.
(defvar wisent--grammar-macros nil)
(defun wisent-grammar-expand-macros (expr)
"Expand expression EXPR into a form without grammar macros.
Return the expanded expression."
(if (or (atom expr) (semantic-grammar-quote-p (car expr)))
expr ;; Just return atom or quoted expression.
(let* ((expr (mapcar 'wisent-grammar-expand-macros expr))
(macro (assq (car expr) wisent--grammar-macros)))
(if macro ;; Expand Semantic built-in.
(apply (cdr macro) (cdr expr))
expr))))
(defun wisent-grammar-nonterminals ()
"Return the list form of nonterminal definitions."
(let ((nttags (semantic-find-tags-by-class
'nonterminal (current-buffer)))
;; Setup the cache of macro definitions.
(wisent--grammar-macros (semantic-grammar-macros))
rltags nterms rules rule elems elem actn sexp prec)
(while nttags
(setq rltags (semantic-tag-components (car nttags))
rules nil)
(while rltags
(setq elems (semantic-tag-get-attribute (car rltags) :value)
prec (semantic-tag-get-attribute (car rltags) :prec)
actn (semantic-tag-get-attribute (car rltags) :expr)
rule nil)
(when elems ;; not an EMPTY rule
(while elems
(setq elem (car elems)
elems (cdr elems))
(setq elem (if (consp elem) ;; mid-rule action
(wisent-grammar-expand-macros (read (car elem)))
(semantic-grammar-item-value elem)) ;; item
rule (cons elem rule)))
(setq rule (nreverse rule)))
(if prec
(setq prec (vector (semantic-grammar-item-value prec))))
(if actn
(setq sexp (wisent-grammar-expand-macros (read actn))))
(setq rule (if actn
(if prec
(list rule prec sexp)
(list rule sexp))
(if prec
(list rule prec)
(list rule))))
(setq rules (cons rule rules)
rltags (cdr rltags)))
(setq nterms (cons (cons (intern (semantic-tag-name (car nttags)))
(nreverse rules))
nterms)
nttags (cdr nttags)))
(nreverse nterms)))
(defun wisent-grammar-grammar ()
"Return Elisp form of the grammar."
(let* ((terminals (wisent-grammar-terminals))
(nonterminals (wisent-grammar-nonterminals))
(assocs (wisent-grammar-assocs)))
(cons terminals (cons assocs nonterminals))))
(defun wisent-grammar-parsetable-builder ()
"Return the value of the parser table."
`(progn
;; Ensure that the grammar [byte-]compiler is available.
(eval-when-compile (require 'semantic/wisent/comp))
(wisent-compile-grammar
',(wisent-grammar-grammar)
',(semantic-grammar-start))))
(defun wisent-grammar-setupcode-builder ()
"Return the parser setup code."
(format
"(semantic-install-function-overrides\n\
'((parse-stream . wisent-parse-stream)))\n\
(setq semantic-parser-name \"LALR\"\n\
semantic--parse-table %s\n\
semantic-debug-parser-source %S\n\
semantic-flex-keywords-obarray %s\n\
semantic-lex-types-obarray %s)\n\
;; Collect unmatched syntax lexical tokens\n\
(semantic-make-local-hook 'wisent-discarding-token-functions)\n\
(add-hook 'wisent-discarding-token-functions\n\
'wisent-collect-unmatched-syntax nil t)"
(semantic-grammar-parsetable)
(buffer-name)
(semantic-grammar-keywordtable)
(semantic-grammar-tokentable)))
(defvar wisent-grammar-menu
'("WY Grammar"
["LALR Compiler Verbose" wisent-toggle-verbose-flag
:style toggle :active (boundp 'wisent-verbose-flag)
:selected (and (boundp 'wisent-verbose-flag)
wisent-verbose-flag)]
)
"WY mode specific grammar menu.
Menu items are appended to the common grammar menu.")
(define-derived-mode wisent-grammar-mode semantic-grammar-mode "WY"
"Major mode for editing Wisent grammars."
(semantic-grammar-setup-menu wisent-grammar-menu)
(semantic-install-function-overrides
'((grammar-parsetable-builder . wisent-grammar-parsetable-builder)
(grammar-setupcode-builder . wisent-grammar-setupcode-builder)
)))
(add-to-list 'auto-mode-alist '("\\.wy$" . wisent-grammar-mode))
(defvar-mode-local wisent-grammar-mode semantic-grammar-macros
'(
(ASSOC . semantic-grammar-ASSOC)
(EXPAND . wisent-grammar-EXPAND)
(EXPANDFULL . wisent-grammar-EXPANDFULL)
(TAG . wisent-grammar-TAG)
(VARIABLE-TAG . wisent-grammar-VARIABLE-TAG)
(FUNCTION-TAG . wisent-grammar-FUNCTION-TAG)
(TYPE-TAG . wisent-grammar-TYPE-TAG)
(INCLUDE-TAG . wisent-grammar-INCLUDE-TAG)
(PACKAGE-TAG . wisent-grammar-PACKAGE-TAG)
(EXPANDTAG . wisent-grammar-EXPANDTAG)
(CODE-TAG . wisent-grammar-CODE-TAG)
(ALIAS-TAG . wisent-grammar-ALIAS-TAG)
(AST-ADD . wisent-grammar-AST-ADD)
(AST-PUT . wisent-grammar-AST-PUT)
(AST-GET . wisent-grammar-AST-GET)
(AST-GET1 . wisent-grammar-AST-GET1)
(AST-GET-STRING . wisent-grammar-AST-GET-STRING)
(AST-MERGE . wisent-grammar-AST-MERGE)
(SKIP-BLOCK . wisent-grammar-SKIP-BLOCK)
(SKIP-TOKEN . wisent-grammar-SKIP-TOKEN)
)
"Semantic grammar macros used in wisent grammars.")
;;; wisent-grammar.el ends here