1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-06 06:20:55 -08:00

Merge from trunk.

This commit is contained in:
Paul Eggert 2011-08-02 22:05:38 -07:00
parent 29c8a348c5
commit 9a70f03d70
60 changed files with 5623 additions and 618 deletions

2
autogen/configure vendored
View file

@ -10240,7 +10240,7 @@ fi
### Use -lrsvg-2 if available, unless `--with-rsvg=no' is specified.
HAVE_RSVG=no
if test "${HAVE_X11}" = "yes" || test "${NS_IMPL_GNUSTEP}" = "yes"; then
if test "${HAVE_X11}" = "yes" || test "${HAVE_NS}" = "yes"; then
if test "${with_rsvg}" != "no"; then
RSVG_REQUIRED=2.11.0
RSVG_MODULE="librsvg-2.0 >= $RSVG_REQUIRED"

View file

@ -1,3 +1,8 @@
2011-07-30 Michael Albinus <michael.albinus@gmx.de>
* mini.texi (Minibuffer File): Insert a reference to Tramp for
remote file name completion. (Bug#9197)
2011-07-28 Eli Zaretskii <eliz@gnu.org>
* mule.texi (Bidirectional Editing): Document the fact that

View file

@ -125,6 +125,10 @@ file names, change the variable @code{insert-default-directory} to
Nonetheless, relative file name arguments are still interpreted based
on the same default directory.
For rules how to read remote file names in the minibuffer, see
@ref{Filename completion, file name completion,, tramp}, in the Tramp
manual.
@node Minibuffer Edit
@section Editing in the Minibuffer
@ -491,7 +495,7 @@ argument (@code{previous-history-element}).
Move to the next item in the minibuffer history
(@code{next-history-element}).
@item M-r @var{regexp} @key{RET}
Move to an earlier item in the minibuffer history that
Move to an earlier item in the minibuffer history that
matches @var{regexp} (@code{previous-matching-history-element}).
@item M-s @var{regexp} @key{RET}
Move to a later item in the minibuffer history that matches

View file

@ -1,3 +1,9 @@
2011-07-30 Michael Albinus <michael.albinus@gmx.de>
Sync with Tramp 2.2.2.
* trampver.texi: Update release number.
2011-07-28 Bastien Guerry <bzg@gnu.org>
* org.texi (Using the mapping API): mention 'region as a possible

View file

@ -8,7 +8,7 @@
@c In the Tramp CVS, the version number is auto-frobbed from
@c configure.ac, so you should edit that file and run
@c "autoconf && ./configure" to change the version number.
@set trampver 2.2.2-pre
@set trampver 2.2.2
@c Other flags from configuration
@set instprefix /usr/local

View file

@ -1,3 +1,7 @@
2011-07-30 Chong Yidong <cyd@stupidchicken.com>
* grammars: New directory.
2011-07-28 Andreas Schwab <schwab@linux-m68k.org>
* NEWS: Document ## and #:.

20
etc/grammars/README Normal file
View file

@ -0,0 +1,20 @@
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 bovine-grammar.el -f semantic-mode \
-f semantic-grammar-batch-build-packages *.by
emacs -batch --no-site-file -l wisent-grammar.el -f semantic-mode \
-f semantic-grammar-batch-build-packages *.wy
The output files were subsequently edited by hand to fix copyright
headers, variable names (to follow library name conventions), and
feature names. These changes do not alter the code logic, and can be
viewed by diffing to the files in lisp/semantic/bovine/ and
lisp/semantic/wisent/.
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,438 @@
;;; 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)
(require 'semantic/lex)
(require 'semantic/wisent)
(require 'semantic/bovine)
(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 (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)
;;; bovine-grammar.el ends here

1202
etc/grammars/c.by Normal file

File diff suppressed because it is too large Load diff

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

@ -0,0 +1,750 @@
;;; java-tags.wy -- Semantic LALR grammar for Java
;; 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/>.
%package wisent-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.
wisent-java-tags-wy--<number>-regexp-analyzer
wisent-java-tags-wy--<string>-sexp-analyzer
;; Must detect keywords before other symbols
wisent-java-tags-wy--<keyword>-keyword-analyzer
wisent-java-tags-wy--<symbol>-regexp-analyzer
wisent-java-tags-wy--<punctuation>-string-analyzer
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.
wisent-java-tags-wy--<unicode>-regexp-analyzer
;;;;
semantic-lex-default-action)
;;; java-tags.wy ends here

526
etc/grammars/js.wy Normal file
View file

@ -0,0 +1,526 @@
;;; javascript-jv.wy -- LALR grammar for Javascript
;; Copyright (C) 2005-2011 Free Software Foundation, Inc.
;; Copyright (C) 1998-2011 Ecma International.
;; Author: Joakim Verona
;; 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:
;; The grammar itself is transcribed from the ECMAScript Language
;; Specification published at
;;
;; http://www.ecma-international.org/publications/standards/Ecma-262.htm
;;
;; and redistributed under the following license:
;; Redistribution and use in source and binary forms, with or without
;; modification, are permitted provided that the following conditions
;; are met:
;; 1. Redistributions of source code must retain the above copyright
;; notice, this list of conditions and the following disclaimer.
;; 2. Redistributions in binary form must reproduce the above
;; copyright notice, this list of conditions and the following
;; disclaimer in the documentation and/or other materials provided
;; with the distribution.
;; 3. Neither the name of the authors nor Ecma International may be
;; used to endorse or promote products derived from this software
;; without specific prior written permission. THIS SOFTWARE IS
;; PROVIDED BY THE ECMA INTERNATIONAL "AS IS" AND ANY EXPRESS OR
;; IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
;; ARE DISCLAIMED. IN NO EVENT SHALL ECMA INTERNATIONAL BE LIABLE FOR
;; ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
;; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
;; OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
;; BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
;; LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
;; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
;; USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
;; DAMAGE.
%package wisent-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)
wisent-javascript-jv-wy--<number>-regexp-analyzer
wisent-javascript-jv-wy--<string>-sexp-analyzer
wisent-javascript-jv-wy--<keyword>-keyword-analyzer
wisent-javascript-jv-wy--<symbol>-regexp-analyzer
wisent-javascript-jv-wy--<punctuation>-string-analyzer
wisent-javascript-jv-wy--<block>-block-analyzer
;;;;more std stuff
semantic-lex-default-action
)
;;; javascript-jv.wy ends here

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

@ -0,0 +1,168 @@
;;; make.by -- BY notation for Makefiles.
;; Copyright (C) 1999-2011 Free Software Foundation, Inc.
;;
;; Author: Eric M. Ludlam <zappo@gnu.org>
;; David Ponce <david@dponce.com>
;; Klaus Berndl <klaus.berndl@sdm.de>
;;
;; 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/>.
%package semantic-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)
;
;;; make.by ends here

1132
etc/grammars/python.wy Normal file

File diff suppressed because it is too large Load diff

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

@ -0,0 +1,84 @@
;;; scheme.by -- Scheme BNF language specification
;; Copyright (C) 2001-2011 Free Software Foundation, Inc.
;; 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/>.
%package semantic-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
;
;;; scheme.by ends here

View file

@ -0,0 +1,361 @@
;;; 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)
(require 'semantic/grammar)
(require 'semantic/find)
(require 'semantic/lex)
(require 'semantic/wisent)
(require 'semantic/bovine)
(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

View file

@ -1,7 +1,70 @@
2011-08-03 Stefan Monnier <monnier@iro.umontreal.ca>
* progmodes/sh-script.el (sh-font-lock-paren): Don't mistake "main" for
"in" (bug#9190).
2011-08-02 Lars Magne Ingebrigtsen <larsi@gnus.org>
* mail/sendmail.el (sendmail-query-once): Restore the current
buffer after querying (bug#9074).
* dired.el (dired-flagged): Use different faces for marked and
flagged files (bug#6117).
* emacs-lisp/cl-macs.el (dolist): Mention that there's a nil block
(bug#4433).
* ido.el (ido-mode): Switch off the message if called
non-interactively.
* mail/smtpmail.el (smtpmail-query-smtp-server): Try port 25
before 587, since it appears that that's more likely to work for
more people.
* cus-edit.el (custom-file): When running under emacs -q, always
refuse to save the customisations, even if the .emacs file doesn't
exist.
* info.el: Remove the `Info-beginning-of-buffer' function
(bug#8325).
* net/network-stream.el (network-stream-open-starttls):
Use `starttls-available-p' to see whether starttls.el can be used.
2011-08-01 Martin Rudalics <rudalics@gmx.at>
* window.el (display-buffer-in-window): Don't set dedicated status
of window here (Bug#9215).
(display-buffer-pop-up-window, display-buffer-pop-up-frame)
(display-buffer-pop-up-side-window)
(display-buffer-in-side-window): Set dedicated status of window here.
2011-08-01 Stefan Monnier <monnier@iro.umontreal.ca>
* emacs-lisp/package.el (package-generate-autoloads): Load autoloads
before binding generated-autoload-file.
2011-08-01 Deniz Dogan <deniz@dogan.se>
* net/rcirc.el (rcirc-handler-333): Clarify docstring.
2011-07-30 Michael Albinus <michael.albinus@gmx.de>
Sync with Tramp 2.2.2.
* net/trampver.el: Update release number.
2011-07-30 Juri Linkov <juri@jurta.org>
* dired-aux.el (dired-touch-initial): Remove function.
(dired-do-chxxx): For op-symbol `touch', set `initial' to the
current time, and `default' to the last modification time of the
current marked file (bug#6887).
2011-07-28 Jose E. Marchesi <jemarch@gnu.org>
* simple.el (goto-line): Use string-to-number to provide a
numeric argument to read-number.
numeric argument to read-number (bug#9163).
2011-07-27 Michael Albinus <michael.albinus@gmx.de>
@ -28,8 +91,8 @@
QT keyword "more" to prevent "more slots: ...." being spuriously
parsed as a bitfield declaraion.
* progmodes/cc-engine.el (c-beginning-of-statement-1): Refactor
and enhance to handle bitfield declarations.
* progmodes/cc-engine.el (c-beginning-of-statement-1):
Refactor and enhance to handle bitfield declarations.
(c-punctuation-in): New function.
(c-forward-decl-or-cast-1): Enhance CASE 3 to handle bitfield
declarations properly.
@ -38,7 +101,7 @@
* calendar/icalendar.el (icalendar--all-events): Take care of
multiple vcalendars in a single file.
(icalendar--convert-float-to-ical): checkdoc fixes.
(icalendar--convert-float-to-ical): Checkdoc fixes.
2011-07-25 Deniz Dogan <deniz@dogan.se>
@ -72,8 +135,7 @@
(display-buffer-pop-up-side-window)
(display-buffer-in-side-window): Call display-buffer-set-height
and display-buffer-set-width after setting the new window's
buffer so `fit-window-to-buffer' and friends work on the right
buffer.
buffer so `fit-window-to-buffer' and friends work on the right buffer.
2011-07-20 Sam Steingold <sds@gnu.org>
@ -105,8 +167,8 @@
2011-07-19 Martin Rudalics <rudalics@gmx.at>
* window.el (display-buffer-alist-of-strings-p)
(display-buffer-alist-set-1, display-buffer-alist-set-2): New
functions.
(display-buffer-alist-set-1, display-buffer-alist-set-2):
New functions.
(display-buffer-alist-set): Rewrite to handle Emacs 23 options
more accurately.
@ -117,8 +179,8 @@
* progmodes/cc-langs.el (c-symbol-chars): Correct a typo.
* progmodes/cc-fonts.el (c-font-lock-enclosing-decls): New
function.
* progmodes/cc-fonts.el (c-font-lock-enclosing-decls):
New function.
(c-complex-decl-matchers): Insert reference to
c-font-lock-enclosing-decls.
@ -137,7 +199,7 @@
2011-07-16 Lars Magne Ingebrigtsen <larsi@gnus.org>
* net/gnutls.el (gnutls-log-level): Removed.
* net/gnutls.el (gnutls-log-level): Remove.
* textmodes/fill.el (adaptive-fill-regexp): Include EN DASH as an
indentation character (bug#6380).
@ -159,11 +221,10 @@
2011-07-16 Martin Rudalics <rudalics@gmx.at>
* frame.el (select-frame-set-input-focus): New argument
NORECORD.
* frame.el (select-frame-set-input-focus): New argument NORECORD.
* window.el (pop-to-buffer): Select window used even if it was
selected before, see discussion of (Bug#8615), (Bug#6954). Pass
argument NORECORD on to select-frame-set-input-focus.
selected before, see discussion of (Bug#8615), (Bug#6954).
Pass argument NORECORD on to select-frame-set-input-focus.
2011-07-15 Glenn Morris <rgm@gnu.org>
@ -177,8 +238,8 @@
2011-07-15 Lars Magne Ingebrigtsen <larsi@gnus.org>
* net/gnutls.el (gnutls-negotiate): Upcase
`gnutls-algorithm-priority'.
* net/gnutls.el (gnutls-negotiate):
Upcase `gnutls-algorithm-priority'.
2011-07-15 Glenn Morris <rgm@gnu.org>
@ -259,9 +320,9 @@
* printing.el (pr-toggle-region): Clarify the documentation
slightly (bug#7493).
* time.el (display-time-update): Allow
`display-time-mail-function' to return nil (bug#7158). Fix
suggested by Detlev Zundel.
* time.el (display-time-update):
Allow `display-time-mail-function' to return nil (bug#7158).
Fix suggested by Detlev Zundel.
* vc/diff.el (diff): Clarify the order the file names are read
(bug#7111).
@ -277,8 +338,8 @@
2011-07-14 Martin Rudalics <rudalics@gmx.at>
* window.el (display-buffer-normalize-special): Replace
`dedicated' by `dedicate' to dedicate window (Bug#9072).
* window.el (display-buffer-normalize-special):
Replace `dedicated' by `dedicate' to dedicate window (Bug#9072).
2011-07-14 Eli Zaretskii <eliz@gnu.org>
@ -299,7 +360,7 @@
switch-to-buffer.
* net/tramp-compat.el (tramp-compat-pop-to-buffer-same-window):
Deleted.
Delete.
2011-07-14 Juanma Barranquero <lekktu@gmail.com>
@ -317,8 +378,8 @@
2011-07-13 Chong Yidong <cyd@stupidchicken.com>
* window.el (switch-to-buffer): New arg FORCE-SAME-WINDOW. Use
pop-to-buffer buffer-or-name if it is nil.
* window.el (switch-to-buffer): New arg FORCE-SAME-WINDOW.
Use pop-to-buffer buffer-or-name if it is nil.
* emacs-lisp/bytecomp.el (byte-compile-interactive-only-functions):
Remove switch-to-buffer.
@ -343,8 +404,8 @@
2011-07-13 Lars Magne Ingebrigtsen <larsi@gnus.org>
* progmodes/cperl-mode.el (cperl-syntaxify-by-font-lock): Rewrite
to avoid awkward possessive "s" (bug#5986).
* progmodes/cperl-mode.el (cperl-syntaxify-by-font-lock):
Rewrite to avoid awkward possessive "s" (bug#5986).
2011-07-13 Glenn Morris <rgm@gnu.org>
@ -438,15 +499,15 @@
2011-07-12 Roland Winkler <winkler@gnu.org>
* textmodes/bibtex.el (bibtex-initialize): Use
pop-to-buffer-same-window.
* textmodes/bibtex.el (bibtex-initialize):
Use pop-to-buffer-same-window.
(bibtex-search-entries): Fix interactive call.
2011-07-12 Lars Magne Ingebrigtsen <larsi@gnus.org>
* progmodes/compile.el (compilation-error-regexp-alist-alist):
Fontise bytecomp Error lines more correctly (bug#2490). Fix
suggested by Johan Bockgård.
Fontise bytecomp Error lines more correctly (bug#2490).
Fix suggested by Johan Bockgård.
* subr.el (remove-duplicates): Remove; `delete-dups' is sufficient.
@ -459,8 +520,8 @@
2011-07-11 Lars Magne Ingebrigtsen <larsi@gnus.org>
* mail/sendmail.el (sendmail-query-once): Use
`customize-save-variable' unconditionally, now that it works under
* mail/sendmail.el (sendmail-query-once):
Use `customize-save-variable' unconditionally, now that it works under
emacs -Q.
* mail/smtpmail.el (smtpmail-query-smtp-server): Ditto.
@ -525,16 +586,15 @@
2011-07-09 Bob Nnamtrop <bobnnamtrop@gmail.com> (tiny change)
* emulation/viper-cmd.el (viper-change-state-to-vi): Limit
triggering of abbrev expansion (Bug#9038).
* emulation/viper-cmd.el (viper-change-state-to-vi):
Limit triggering of abbrev expansion (Bug#9038).
2011-07-09 Martin Rudalics <rudalics@gmx.at>
* window.el (display-buffer-default-specifiers): Remove.
(display-buffer-macro-specifiers): Remove default specifiers.
(display-buffer-alist): Default to nil.
(display-buffer-reuse-window): New optional argument
other-window.
(display-buffer-reuse-window): New optional argument other-window.
(display-buffer-pop-up-window): Allow splitting internal
windows. Check whether a live window was created.
(display-buffer-other-window-means-other-frame)
@ -549,11 +609,10 @@
(display-buffer): Process other-window specifier and call
display-buffer-reuse-window with it. Emulate Emacs 23 behavior
more faithfully.
(pop-up-windows, even-window-heights): Restore Emacs 23 default
values.
(pop-up-windows, even-window-heights): Restore Emacs 23 default values.
(display-buffer-alist-set): Don't handle 'unset default values.
(display-buffer-in-window, display-buffer-alist-set): Replace
symbol "dedicated" by "dedicate". Reported by Tassilo Horn
(display-buffer-in-window, display-buffer-alist-set):
Replace symbol "dedicated" by "dedicate". Reported by Tassilo Horn
<tassilo@member.fsf.org>.
2011-07-09 Leo Liu <sdl.web@gmail.com>

View file

@ -1,3 +1,8 @@
2011-07-30 Chong Yidong <cyd@stupidchicken.com>
* semantic/grammar.el (semantic-grammar-insert-defanalyzers): Fix
require.
2011-07-04 Darren Hoo <darren.hoo@gmail.com> (tiny change)
* semantic/db.el (semanticdb-file-table-object): Don't bug out on

View file

@ -19,8 +19,7 @@
;;; Commentary:
;;
;; This file was generated from the grammar file semantic/bovine/c.by
;; in the CEDET repository.
;; This file was generated from etc/grammars/c.by.
;;; Code:

View file

@ -19,8 +19,7 @@
;;; Commentary:
;;
;; This file was generated from the grammar file
;; semantic/bovine/make.by in the CEDET repository.
;; This file was generated from etc/grammars/make.by.
;;; Code:

View file

@ -19,8 +19,7 @@
;;; Commentary:
;;
;; This file was generated from the grammar file
;; semantic/bovine/scm.by in the CEDET repository.
;; This file was generated from etc/grammars/scm.by.
;;; Code:

View file

@ -801,7 +801,7 @@ Block definitions are read from the current table of lexical types."
(with-current-buffer semantic--grammar-input-buffer
(setq tokens (semantic-grammar-tokens)
props (semantic-grammar-token-properties tokens)))
(insert "(require 'semantic-lex)\n\n")
(insert "(require 'semantic/lex)\n\n")
(let ((semantic-lex-types-obarray
(semantic-lex-make-type-table tokens props))
semantic-grammar--lex-block-specs)

View file

@ -19,8 +19,7 @@
;;; Commentary:
;;
;; This file was generated from the grammar file
;; semantic/wisent/wisent-java-tags.wy in the CEDET repository.
;; This file was generated from etc/java-tags.wy.
;;; Code:

View file

@ -1,6 +1,7 @@
;;; semantic/wisent/js-wy.el --- Generated parser support file
;; Copyright (C) 2005, 2009-2011 Free Software Foundation, Inc.
;; Copyright (C) Ecma International.
;; This file is part of GNU Emacs.
@ -19,8 +20,7 @@
;;; Commentary:
;;
;; This file was generated from the grammar file
;; semantic/wisent/wisent-javascript-jv.wy in the CEDET repository.
;; This file was generated from etc/grammars/javascript-jv.wy.
;;; Code:
(require 'semantic/lex)

View file

@ -1,6 +1,7 @@
;;; semantic/wisent/python-wy.el --- Generated parser support file
;; Copyright (C) 2002-2004, 2007, 2010-2011 Free Software Foundation, Inc.
;; Copyright (C) 2001-2010 Python Software Foundation
;; This file is part of GNU Emacs.
@ -19,8 +20,7 @@
;;; Commentary:
;;
;; This file was generated from the grammar file
;; semantic/wisent/wisent-python.wy in the CEDET repository.
;; This file was generated from etc/grammars/python.wy.
;;; Code:

View file

@ -4409,25 +4409,14 @@ if only the first line of the docstring is shown."))
(defun custom-file (&optional no-error)
"Return the file name for saving customizations."
(let ((file
(or custom-file
(let ((user-init-file user-init-file)
(default-init-file
(if (eq system-type 'ms-dos) "~/_emacs" "~/.emacs")))
(when (null user-init-file)
(if (or (file-exists-p default-init-file)
(and (eq system-type 'windows-nt)
(file-exists-p "~/_emacs")))
;; Started with -q, i.e. the file containing
;; Custom settings hasn't been read. Saving
;; settings there would overwrite other settings.
(if no-error
nil
(error "Saving settings from \"emacs -q\" would overwrite existing customizations"))
(setq user-init-file default-init-file)))
user-init-file))))
(and file
(file-chase-links file))))
(if (null user-init-file)
;; Started with -q, i.e. the file containing Custom settings
;; hasn't been read. Saving settings there won't make much
;; sense.
(if no-error
nil
(error "Saving settings from \"emacs -q\" would overwrite existing customizations"))
(file-chase-links (or custom-file user-init-file))))
;; If recentf-mode is non-nil, this is defined.
(declare-function recentf-expand-file-name "recentf" (name))

View file

@ -226,34 +226,28 @@ List has a form of (file-name full-file-name (attribute-list))."
(file-attributes full-file-name))))
(directory-files dir)))
(defun dired-touch-initial (files)
"Create initial input value for `touch' command."
;; Nobody can explain what this version is supposed to do. (Bug#6887)
;; Also, the manual says it uses "the present time".
;;; (let (initial)
;;; (while files
;;; (let ((current (nth 5 (file-attributes (car files)))))
;;; (if (and initial (not (equal initial current)))
;;; (setq initial (current-time) files nil)
;;; (setq initial current))
;;; (setq files (cdr files))))
;;; (format-time-string "%Y%m%d%H%M.%S" initial)))
(format-time-string "%Y%m%d%H%M.%S" (current-time)))
;;; Change file attributes
(defun dired-do-chxxx (attribute-name program op-symbol arg)
;; Change file attributes (mode, group, owner, timestamp) of marked files and
;; Change file attributes (group, owner, timestamp) of marked files and
;; refresh their file lines.
;; ATTRIBUTE-NAME is a string describing the attribute to the user.
;; PROGRAM is the program used to change the attribute.
;; OP-SYMBOL is the type of operation (for use in dired-mark-pop-up).
;; ARG describes which files to use, as in dired-get-marked-files.
;; OP-SYMBOL is the type of operation (for use in `dired-mark-pop-up').
;; ARG describes which files to use, as in `dired-get-marked-files'.
(let* ((files (dired-get-marked-files t arg))
(initial
(if (eq op-symbol 'touch)
(format-time-string "%Y%m%d%H%M.%S")))
(default
(if (eq op-symbol 'touch)
(and (stringp (car files))
(format-time-string "%Y%m%d%H%M.%S"
(nth 5 (file-attributes (car files)))))))
(new-attribute
(dired-mark-read-string
(concat "Change " attribute-name " of %s to: ")
(if (eq op-symbol 'touch) (dired-touch-initial files))
op-symbol arg files))
initial op-symbol arg files default))
(operation (concat program " " new-attribute))
failures)
(setq failures

View file

@ -350,7 +350,7 @@ Subexpression 2 must end right before the \\n or \\r.")
"Face name used for marked files.")
(defface dired-flagged
'((t (:inherit font-lock-warning-face)))
'((t (:inherit font-lock-variable-name-face)))
"Face used for files flagged for deletion."
:group 'dired-faces
:version "22.1")
@ -3663,7 +3663,7 @@ Ask means pop up a menu for the user to select one of copy, move or link."
;;;;;; dired-run-shell-command dired-do-shell-command dired-do-async-shell-command
;;;;;; dired-clean-directory dired-do-print dired-do-touch dired-do-chown
;;;;;; dired-do-chgrp dired-do-chmod dired-compare-directories dired-backup-diff
;;;;;; dired-diff) "dired-aux" "dired-aux.el" "ab62f310329f404f96a29e4f0ab8df73")
;;;;;; dired-diff) "dired-aux" "dired-aux.el" "bbb53a5b6bf56c413fe0f898559bef8d")
;;; Generated autoloads from dired-aux.el
(autoload 'dired-diff "dired-aux" "\

View file

@ -1233,6 +1233,7 @@ Valid clauses are:
"Loop over a list.
Evaluate BODY with VAR bound to each `car' from LIST, in turn.
Then evaluate RESULT to get return value, default nil.
An implicit nil block is established around the loop.
\(fn (VAR LIST [RESULT]) BODY...)"
(let ((temp (make-symbol "--cl-dolist-temp--")))

View file

@ -570,11 +570,11 @@ EXTRA-PROPERTIES is currently unused."
file)
(defun package-generate-autoloads (name pkg-dir)
(require 'autoload) ;Load before we let-bind generated-autoload-file!
(let* ((auto-name (concat name "-autoloads.el"))
(ignore-name (concat name "-pkg.el"))
(generated-autoload-file (expand-file-name auto-name pkg-dir))
(version-control 'never))
(require 'autoload)
(unless (fboundp 'autoload-ensure-default-file)
(package-autoload-ensure-default-file generated-autoload-file))
(update-directory-autoloads pkg-dir)))

View file

@ -1,3 +1,50 @@
2011-08-02 Andrew Cohen <cohen@andy.bu.edu>
* nnir.el (nnir-search-thread): Position point on referring article
line.
(nnir-warp-to-article): Clean up summary buffers.
* nnimap.el (nnimap-request-thread): Whitespace fix.
2011-08-02 Steve Purcell <steve@sanityinc.com> (tiny change)
* nnimap.el (nnimap-get-groups): Decode "&" correctly.
2011-08-02 Lars Magne Ingebrigtsen <larsi@gnus.org>
* starttls.el (starttls-available-p): Renamed from
`starttls-any-program-available' and changed return convention.
2011-07-31 Lars Ingebrigtsen <larsi@gnus.org>
* nnmaildir.el (nnmaildir-request-accept-article): Don't call
`unix-sync' unless it's defined.
2011-07-31 Marcus Harnisch <marcus.harnisch@gmx.net> (tiny change)
* gnus-art.el (gnus-article-stop-animations): Use `elt' instead of
`aref' for XEmacs compatibiltiy.
2011-07-31 Lars Magne Ingebrigtsen <larsi@gnus.org>
* spam.el (spam-fetch-field-fast): Rewrite slightly for clarity.
2011-07-31 Dave Abrahams <dave@boostpro.com> (tiny change)
* gnus-sum.el (gnus-summary-refer-thread): Since lambdas aren't
closures, quote the form properly (bug#9194).
2011-07-31 Lars Magne Ingebrigtsen <larsi@gnus.org>
* gnus-sum.el (gnus-summary-insert-new-articles): Clean up slightly.
(gnus-summary-insert-new-articles): Protect against servers that are
down.
2011-07-29 Daniel Dehennin <daniel.dehennin@baby-gnu.org>
* mm-decode.el (mm-dissect-buffer): Add a default content-disposition
in mm handle if none is specified.
2011-07-24 Andrew Cohen <cohen@andy.bu.edu>
* nnimap.el (nnimap-make-thread-query): Quote message-ids for gmail.

View file

@ -4541,7 +4541,7 @@ commands:
(defun gnus-article-stop-animations ()
(dolist (timer (and (boundp 'timer-list)
timer-list))
(when (eq (aref timer 5) 'image-animate-timeout)
(when (eq (elt timer 5) 'image-animate-timeout)
(cancel-timer timer))))
;; Set article window start at LINE, where LINE is the number of lines

View file

@ -9015,9 +9015,9 @@ non-numeric or nil fetch the number specified by the
(refs (split-string (or (mail-header-references header)
"")))
(gnus-parse-headers-hook
(lambda () (goto-char (point-min))
`(lambda () (goto-char (point-min))
(keep-lines
(regexp-opt (append refs (list id subject)))))))
(regexp-opt ',(append refs (list id subject)))))))
(gnus-fetch-headers (list last) (if (numberp limit)
(* 2 limit) limit) t)))))
(when (listp new-headers)
@ -12851,26 +12851,26 @@ If ALL is a number, fetch this number of articles."
(defun gnus-summary-insert-new-articles ()
"Insert all new articles in this group."
(interactive)
(prog1
(let ((old (sort (mapcar 'car gnus-newsgroup-data) '<))
(old-high gnus-newsgroup-highest)
(nnmail-fetched-sources (list t))
i new)
(setq gnus-newsgroup-active
(gnus-copy-sequence
(gnus-activate-group gnus-newsgroup-name 'scan)))
(setq i (cdr gnus-newsgroup-active)
gnus-newsgroup-highest i)
(while (> i old-high)
(push i new)
(decf i))
(if (not new)
(message "No gnus is bad news")
(gnus-summary-insert-articles new)
(setq gnus-newsgroup-unreads
(gnus-sorted-nunion gnus-newsgroup-unreads new))
(gnus-summary-limit (gnus-sorted-nunion old new))))
(gnus-summary-position-point)))
(let ((old (sort (mapcar 'car gnus-newsgroup-data) '<))
(old-high gnus-newsgroup-highest)
(nnmail-fetched-sources (list t))
(new-active (gnus-activate-group gnus-newsgroup-name 'scan))
i new)
(unless new-active
(error "Couldn't fetch new data"))
(setq gnus-newsgroup-active (gnus-copy-sequence new-active))
(setq i (cdr gnus-newsgroup-active)
gnus-newsgroup-highest i)
(while (> i old-high)
(push i new)
(decf i))
(if (not new)
(message "No gnus is bad news")
(gnus-summary-insert-articles new)
(setq gnus-newsgroup-unreads
(gnus-sorted-nunion gnus-newsgroup-unreads new))
(gnus-summary-limit (gnus-sorted-nunion old new))))
(gnus-summary-position-point))
;;; Bookmark support for Gnus.
(declare-function bookmark-make-record-default

View file

@ -564,7 +564,13 @@ Postpone undisplaying of viewers for types in
(setq ct (mail-fetch-field "content-type")
ctl (and ct (mail-header-parse-content-type ct))
cte (mail-fetch-field "content-transfer-encoding")
cd (mail-fetch-field "content-disposition")
cd (or (mail-fetch-field "content-disposition")
(when (and ctl
(eq 'mm-inline-text
(cadr (mm-assoc-string-match
mm-inline-media-tests
(car ctl)))))
"inline"))
;; Newlines in description should be stripped so as
;; not to break the MIME tag into two or more lines.
description (message-fetch-field "content-description")

View file

@ -1107,9 +1107,9 @@ textual parts.")
(separator (read (current-buffer)))
(group (read (current-buffer))))
(unless (member '%NoSelect flags)
(push (if (stringp group)
group
(format "%s" group))
(push (utf7-decode (if (stringp group)
group
(format "%s" group)) t)
groups))))
(nreverse groups)))
@ -1168,7 +1168,7 @@ textual parts.")
(nnimap-get-groups)))
(unless (assoc group nnimap-current-infos)
;; Insert dummy numbers here -- they don't matter.
(insert (format "%S 0 1 y\n" group))))
(insert (format "%S 0 1 y\n" (utf7-encode group)))))
t)))
(deffoo nnimap-retrieve-group-data-early (server infos)
@ -1566,7 +1566,7 @@ textual parts.")
(articles &optional limit force-new dependencies))
(deffoo nnimap-request-thread (header &optional group server)
(if gnus-refer-thread-use-nnir
(if gnus-refer-thread-use-nnir
(nnir-search-thread header)
(when (nnimap-possibly-change-group group server)
(let* ((cmd (nnimap-make-thread-query header))

View file

@ -767,11 +767,18 @@ Add an entry here when adding a new search engine.")
(deffoo nnir-warp-to-article ()
(let* ((cur (if (> (gnus-summary-article-number) 0)
(gnus-summary-article-number)
(error "This is not a real article.")))
(gnus-newsgroup-name (nnir-article-group cur))
(backend-number (nnir-article-number cur)))
(gnus-summary-read-group-1 gnus-newsgroup-name t t gnus-summary-buffer
nil (list backend-number))))
(error "This is not a real article")))
(backend-article-group (nnir-article-group cur))
(backend-article-number (nnir-article-number cur))
(quit-config (gnus-ephemeral-group-p gnus-newsgroup-name)))
;; first exit from the nnir summary buffer.
(gnus-summary-exit)
;; and if the nnir summary buffer in turn came from another
;; summary buffer we have to clean that summary up too.
(when (eq (cdr quit-config) 'summary)
(gnus-summary-exit))
(gnus-summary-read-group-1 backend-article-group t t nil
nil (list backend-article-number))))
(nnoo-define-skeleton nnir)
@ -1659,7 +1666,8 @@ server is of form 'backend:name'."
(cons 'server (gnus-method-to-server
(gnus-find-method-for-group
gnus-newsgroup-name))))))
(gnus-group-make-nnir-group nil parm)))
(gnus-group-make-nnir-group nil parm)
(gnus-summary-goto-subject (gnus-id-to-article (mail-header-id header)))))
;; unused?
(defun nnir-artlist-groups (artlist)

View file

@ -1381,7 +1381,8 @@ by nnmaildir-request-article.")
(error
(gmm-write-region (point-min) (point-max) tmpfile nil 'no-message nil
'excl)
(unix-sync))) ;; no fsync :(
(when (fboundp 'unix-sync)
(unix-sync)))) ;; no fsync :(
(nnheader-cancel-timer 24h)
(condition-case err
(add-name-to-file tmpfile curfile)

View file

@ -1581,31 +1581,31 @@ to find it out)."
(when (numberp article)
(let* ((data-header (or prepared-data-header
(spam-fetch-article-header article))))
(if (arrayp data-header)
(cond
((equal field 'number)
(mail-header-number data-header))
((equal field 'from)
(mail-header-from data-header))
((equal field 'message-id)
(mail-header-message-id data-header))
((equal field 'subject)
(mail-header-subject data-header))
((equal field 'references)
(mail-header-references data-header))
((equal field 'date)
(mail-header-date data-header))
((equal field 'xref)
(mail-header-xref data-header))
((equal field 'extra)
(mail-header-extra data-header))
(t
(gnus-error
5
"spam-fetch-field-fast: unknown field %s requested"
field)
nil))
(gnus-message 6 "Article %d has a nil data header" article)))))
(cond
((not (arrayp data-header))
(gnus-message 6 "Article %d has a nil data header" article))
((equal field 'number)
(mail-header-number data-header))
((equal field 'from)
(mail-header-from data-header))
((equal field 'message-id)
(mail-header-message-id data-header))
((equal field 'subject)
(mail-header-subject data-header))
((equal field 'references)
(mail-header-references data-header))
((equal field 'date)
(mail-header-date data-header))
((equal field 'xref)
(mail-header-xref data-header))
((equal field 'extra)
(mail-header-extra data-header))
(t
(gnus-error
5
"spam-fetch-field-fast: unknown field %s requested"
field)
nil)))))
(defun spam-fetch-field-from-fast (article &optional prepared-data-header)
(spam-fetch-field-fast article 'from prepared-data-header))

View file

@ -295,18 +295,11 @@ GNUTLS requires a port number."
(starttls-set-process-query-on-exit-flag process nil)
process)))
(defun starttls-any-program-available ()
(let ((program (if starttls-use-gnutls
starttls-gnutls-program
starttls-program)))
(condition-case ()
(progn
(call-process program)
program)
(error (progn
(message "No STARTTLS program was available (tried '%s')"
program)
nil)))))
(defun starttls-available-p ()
"Say whether the STARTTLS programs are available."
(executable-find (if starttls-use-gnutls
starttls-gnutls-program
starttls-program)))
(provide 'starttls)

View file

@ -1557,7 +1557,8 @@ This function also adds a hook to the minibuffer."
(setq ido-minor-mode-map-entry (cons 'ido-mode map))
(add-to-list 'minor-mode-map-alist ido-minor-mode-map-entry))))
(message "Ido mode %s" (if ido-mode "enabled" "disabled")))
(when (called-interactively-p 'any)
(message "Ido mode %s" (if ido-mode "enabled" "disabled"))))
;;; IDO KEYMAP

View file

@ -2789,11 +2789,6 @@ N is the digit argument used to invoke this command."
(goto-char (point-max)))))
(t (error "No previous nodes"))))
(defun Info-beginning-of-buffer ()
"Go to the beginnning of the buffer."
(interactive)
(goto-char (point-min)))
(defun Info-scroll-up ()
"Scroll one screenful forward in Info, considering all nodes as one sequence.
Once you scroll far enough in a node that its menu appears on the screen
@ -3655,7 +3650,7 @@ If FORK is non-nil, it is passed to `Info-goto-node'."
(defvar Info-mode-map
(let ((map (make-keymap)))
(suppress-keymap map)
(define-key map "." 'Info-beginning-of-buffer)
(define-key map "." 'beginning-of-buffer)
(define-key map " " 'Info-scroll-up)
(define-key map "\C-m" 'Info-follow-nearest-node)
(define-key map "\t" 'Info-next-reference)
@ -3676,8 +3671,8 @@ If FORK is non-nil, it is passed to `Info-goto-node'."
(define-key map "[" 'Info-backward-node)
(define-key map "<" 'Info-top-node)
(define-key map ">" 'Info-final-node)
(define-key map "b" 'Info-beginning-of-buffer)
(put 'Info-beginning-of-buffer :advertised-binding "b")
(define-key map "b" 'beginning-of-buffer)
(put 'beginning-of-buffer :advertised-binding "b")
(define-key map "d" 'Info-directory)
(define-key map "e" 'Info-edit)
(define-key map "f" 'Info-follow-reference)
@ -3731,7 +3726,7 @@ If FORK is non-nil, it is passed to `Info-goto-node'."
:help "Go backward one node, considering all as a sequence"]
["Forward" Info-forward-node
:help "Go forward one node, considering all as a sequence"]
["Beginning" Info-beginning-of-buffer
["Beginning" beginning-of-buffer
:help "Go to beginning of this node"]
["Top" Info-top-node
:help "Go to top node of file"]
@ -3937,7 +3932,7 @@ Moving within a node:
\\[Info-scroll-down] Normally, scroll backward. If the beginning of the buffer is
already visible, try to go to the previous menu entry, or up
if there is none.
\\[Info-beginning-of-buffer] Go to beginning of node.
\\[beginning-of-buffer] Go to beginning of node.
Advanced commands:
\\[Info-search] Search through this Info file for specified regexp,

File diff suppressed because it is too large Load diff

View file

@ -165,7 +165,8 @@ This is used by the default mail-sending commands. See also
If `sendmail-query-once-function' is `query', ask the user what
function to use, and then save that choice."
(when (equal sendmail-query-once-function 'query)
(let* ((default
(let* ((mail-buffer (current-buffer))
(default
(cond
((or (and window-system (eq system-type 'darwin))
(eq system-type 'windows-nt))
@ -195,7 +196,8 @@ function to use, and then save that choice."
(if (y-or-n-p "Configure outgoing SMTP in Emacs? ")
'smtpmail-send-it
default))
(kill-buffer (current-buffer))))))
(kill-buffer (current-buffer))
(set-buffer mail-buffer)))))
(customize-save-variable 'sendmail-query-once-function function)))
(funcall sendmail-query-once-function))

View file

@ -589,7 +589,7 @@ The list is in preference order.")
(defun smtpmail-query-smtp-server ()
(let ((server (read-string "Outgoing SMTP mail server: "))
(ports '(587 "smtp"))
(ports '("smtp" 587))
stream port)
(when (and smtpmail-smtp-server
(not (member smtpmail-smtp-server ports)))

View file

@ -230,7 +230,7 @@ functionality.
(or builtin-starttls
(and (or require-tls
(plist-get parameters :use-starttls-if-possible))
(executable-find "gnutls-cli")))
(starttls-available-p)))
(not (eq (plist-get parameters :type) 'plain)))
;; If using external STARTTLS, drop this connection and start
;; anew with `starttls-open-stream'.

View file

@ -2695,7 +2695,8 @@ the only argument."
(setq rcirc-topic (caddr args)))))
(defun rcirc-handler-333 (process sender args text)
"Not in rfc1459.txt"
"333 says who set the topic and when.
Not in rfc1459.txt"
(let ((buffer (or (rcirc-get-buffer process (cadr args))
(rcirc-get-temp-buffer-create process (cadr args)))))
(with-current-buffer buffer

View file

@ -31,7 +31,7 @@
;; should be changed only there.
;;;###tramp-autoload
(defconst tramp-version "2.2.2-pre"
(defconst tramp-version "2.2.2"
"This version of Tramp.")
;;;###tramp-autoload
@ -44,7 +44,7 @@
(= emacs-major-version 21)
(>= emacs-minor-version 4)))
"ok"
(format "Tramp 2.2.2-pre is not fit for %s"
(format "Tramp 2.2.2 is not fit for %s"
(when (string-match "^.*$" (emacs-version))
(match-string 0 (emacs-version)))))))
(unless (string-match "\\`ok\\'" x) (error "%s" x)))

View file

@ -1,3 +1,8 @@
2011-07-30 Carsten Dominik <carsten.dominik@gmail.com>
* ob.el (org-babel-src-block-regexp): If a code block has a body,
its last character must be a newline.
2011-07-28 Bastien Guerry <bzg@gnu.org>
* org-publish.el (org-publish-index-generate-theindex): rename

View file

@ -137,7 +137,7 @@ remove code block execution from the C-c C-c keybinding."
;; (4) header arguments
"\\([^\n]*\\)\n"
;; (5) body
"\\([^\000]*?\\)[ \t]*#\\+end_src")
"\\([^\000]*?\n\\)?[ \t]*#\\+end_src")
"Regexp used to identify code blocks.")
(defvar org-babel-inline-src-block-regexp

View file

@ -1028,45 +1028,45 @@ subshells can nest."
(defun sh-font-lock-paren (start)
(unless (nth 8 (syntax-ppss))
(save-excursion
(goto-char start)
;; Skip through all patterns
(while
(progn
(save-excursion
(goto-char start)
;; Skip through all patterns
(while
(progn
(while
(progn
(forward-comment (- (point-max)))
(forward-comment (- (point-max)))
(when (and (eolp) (sh-is-quoted-p (point)))
(forward-char -1)
t)))
;; Skip through one pattern
(while
(or (/= 0 (skip-syntax-backward "w_"))
;; Skip through one pattern
(while
(or (/= 0 (skip-syntax-backward "w_"))
(/= 0 (skip-chars-backward "-$=?[]*@/\\\\"))
(and (sh-is-quoted-p (1- (point)))
(goto-char (- (point) 2)))
(and (sh-is-quoted-p (1- (point)))
(goto-char (- (point) 2)))
(when (memq (char-before) '(?\" ?\' ?\}))
(condition-case nil (progn (backward-sexp 1) t)
(error nil)))))
;; Patterns can be preceded by an open-paren (Bug#1320).
(if (eq (char-before (point)) ?\()
(backward-char 1))
(while (progn
(forward-comment (- (point-max)))
;; Maybe we've bumped into an escaped newline.
(sh-is-quoted-p (point)))
(backward-char 1))
(when (eq (char-before) ?|)
(backward-char 1) t)))
(when (progn (backward-char 2)
(if (> start (line-end-position))
(put-text-property (point) (1+ start)
'syntax-multiline t))
;; FIXME: The `in' may just be a random argument to
;; a normal command rather than the real `in' keyword.
;; I.e. we should look back to try and find the
;; corresponding `case'.
(and (looking-at ";[;&]\\|in")
(condition-case nil (progn (backward-sexp 1) t)
(error nil)))))
;; Patterns can be preceded by an open-paren (Bug#1320).
(if (eq (char-before (point)) ?\()
(backward-char 1))
(while (progn
(forward-comment (- (point-max)))
;; Maybe we've bumped into an escaped newline.
(sh-is-quoted-p (point)))
(backward-char 1))
(when (eq (char-before) ?|)
(backward-char 1) t)))
(when (progn (backward-char 2)
(if (> start (line-end-position))
(put-text-property (point) (1+ start)
'syntax-multiline t))
;; FIXME: The `in' may just be a random argument to
;; a normal command rather than the real `in' keyword.
;; I.e. we should look back to try and find the
;; corresponding `case'.
(and (looking-at ";[;&]\\|\\_<in")
;; ";; esac )" is a case that looks like a case-pattern
;; but it's really just a close paren after a case
;; statement. I.e. if we skipped over `esac' just now,

View file

@ -4715,15 +4715,12 @@ documentation of `display-buffer-alist' for a description."
(setq window (window-normalize-live-window window))
(let* ((old-frame (selected-frame))
(new-frame (window-frame window))
(dedicate (cdr (assq 'dedicate specifiers)))
(no-other-window (cdr (assq 'no-other-window specifiers))))
;; Show BUFFER in WINDOW.
(unless (eq buffer (window-buffer window))
;; If we show another buffer in WINDOW, undedicate it first.
(set-window-dedicated-p window nil))
(set-window-buffer window buffer)
(when dedicate
(set-window-dedicated-p window dedicate))
(when no-other-window
(set-window-parameter window 'no-other-window t))
(unless (or (eq old-frame new-frame)
@ -4965,7 +4962,7 @@ Return the new window, nil if it could not be created."
(selected-window (selected-window))
root new new-parent)
;; We are in an atomic window.
;; We are in an atomic window.
(when (and (window-parameter window 'window-atom) (not nest))
;; Split the root window.
(setq window (window-atom-root window)))
@ -5059,6 +5056,10 @@ description."
(setq display-buffer-window (cons window 'new-window))
;; Install BUFFER in the new window.
(display-buffer-in-window buffer window specifiers)
(let ((dedicate (cdr (assq 'dedicate specifiers))))
(when dedicate
;; Dedicate window to buffer.
(set-window-dedicated-p window dedicate)))
;; Adjust sizes if asked for (for `fit-window-to-buffer'
;; and friends BUFFER must be already shown in the new
;; window).
@ -5094,7 +5095,12 @@ documentation of `display-buffer-alist' for a description."
(set-window-parameter
window 'quit-restore (list 'new-frame buffer selected-window))
(setq display-buffer-window (cons window 'new-frame))
(display-buffer-in-window buffer window specifiers))))))
(display-buffer-in-window buffer window specifiers)
(let ((dedicate (cdr (assq 'dedicate specifiers))))
(when dedicate
;; Dedicate window to buffer.
(set-window-dedicated-p window dedicate)))
window)))))
(defun display-buffer-pop-up-side-window (buffer side slot &optional specifiers)
"Display BUFFER in a new window on SIDE of the selected frame.
@ -5142,6 +5148,10 @@ failed."
(setq display-buffer-window (cons window 'new-window))
;; Install BUFFER in new window.
(display-buffer-in-window buffer window specifiers)
(let ((dedicate (cdr (assq 'dedicate specifiers))))
(when dedicate
;; Dedicate window to buffer.
(set-window-dedicated-p window dedicate)))
;; Adjust sizes of new window if asked for.
(display-buffer-set-height window specifiers)
(display-buffer-set-width window specifiers)
@ -5282,6 +5292,10 @@ SPECIFIERS must be a list of buffer display specifiers."
(set-window-parameter window 'window-slot slot))
;; Install BUFFER in the window.
(display-buffer-in-window buffer window specifiers)
(let ((dedicate (cdr (assq 'dedicate specifiers))))
(when dedicate
;; Dedicate window to buffer.
(set-window-dedicated-p window dedicate)))
(when new-window
;; Adjust sizes if asked for (for `fit-window-to-buffer' and
;; friends BUFFER must be already shown in the new window).

View file

@ -1,3 +1,56 @@
2011-08-02 Eli Zaretskii <eliz@gnu.org>
Fix slow cursor motion and scrolling in large buffers with
selective display, like Org Mode buffers. (Bug#9218)
* dispextern.h (struct bidi_it): New member disp_prop_p.
* xdisp.c: Remove one-slot cache of display string positions.
(compute_display_string_pos): Accept an additional argument
DISP_PROP_P; callers changed. Scan at most 5K characters forward
for a display string or property. If found, set DISP_PROP_P
non-zero.
* bidi.c (bidi_fetch_char): Accept an additional argument
DISP_PROP_P, and pass it to compute_display_string_pos. Only
handle text covered by a display string if DISP_PROP_P is returned
non-zero. All callers of bidi_fetch_char changed.
2011-08-02 Stefan Monnier <monnier@iro.umontreal.ca>
* keymap.c (Fdefine_key): Fix Lisp_Object/int mixup; apply some CSE.
2010-12-03 Don March <don@ohspite.net>
* keymap.c (Fdefine_key): Fix non-prefix key error message when
last character M-[char] is translated to ESC [char] (bug#7541).
2011-08-02 Kenichi Handa <handa@m17n.org>
* lisp.h (uniprop_table): Extern it.
* chartab.c (uniprop_table): Make it non-static.
2011-08-01 Eli Zaretskii <eliz@gnu.org>
* xdisp.c (forward_to_next_line_start): Accept additional argument
BIDI_IT_PREV, and store into it the state of the bidi iterator had
on the newline.
(reseat_at_next_visible_line_start): Use the bidi iterator state
returned by forward_to_next_line_start to restore the state of
it->bidi_it after backing up to previous newline. (Bug#9212)
2011-07-30 Andreas Schwab <schwab@linux-m68k.org>
* regex.c (re_comp): Protoize.
(re_exec): Fix return type.
(regexec): Fix type of `ret'. (Bug#9203)
2011-07-29 Paul Eggert <eggert@cs.ucla.edu>
* image.c (check_image_size): Use 1024x1024 if unknown frame (Bug#9189).
This is needed if max-image-size is a floating-point number.
2011-07-28 Andreas Schwab <schwab@linux-m68k.org>
* print.c (print_object): Print empty symbol as ##.

View file

@ -792,6 +792,7 @@ bidi_init_it (EMACS_INT charpos, EMACS_INT bytepos, int frame_window_p,
bidi_it->prev_for_neutral.orig_type = UNKNOWN_BT;
bidi_it->sor = L2R; /* FIXME: should it be user-selectable? */
bidi_it->disp_pos = -1; /* invalid/unknown */
bidi_it->disp_prop_p = 0;
/* We can only shrink the cache if we are at the bottom level of its
"stack". */
if (bidi_cache_start == 0)
@ -874,14 +875,16 @@ bidi_char_at_pos (EMACS_INT bytepos, const unsigned char *s, int unibyte)
covered characters as a single character u+FFFC, and return their
combined length in CH_LEN and NCHARS. DISP_POS specifies the
character position of the next display string, or -1 if not yet
computed. When the next character is at or beyond that position,
the function updates DISP_POS with the position of the next display
string. STRING->s is the C string to iterate, or NULL if iterating
over a buffer or a Lisp string; in the latter case, STRING->lstring
is the Lisp string. */
computed. DISP_PROP_P non-zero means that there's really a display
string at DISP_POS, as opposed to when we searched till DISP_POS
without findingone. When the next character is at or beyond that
position, the function updates DISP_POS with the position of the
next display string. STRING->s is the C string to iterate, or NULL
if iterating over a buffer or a Lisp string; in the latter case,
STRING->lstring is the Lisp string. */
static inline int
bidi_fetch_char (EMACS_INT bytepos, EMACS_INT charpos, EMACS_INT *disp_pos,
struct bidi_string_data *string,
int *disp_prop_p, struct bidi_string_data *string,
int frame_window_p, EMACS_INT *ch_len, EMACS_INT *nchars)
{
int ch;
@ -894,7 +897,8 @@ bidi_fetch_char (EMACS_INT bytepos, EMACS_INT charpos, EMACS_INT *disp_pos,
if (charpos < endpos && charpos > *disp_pos)
{
SET_TEXT_POS (pos, charpos, bytepos);
*disp_pos = compute_display_string_pos (&pos, string, frame_window_p);
*disp_pos = compute_display_string_pos (&pos, string, frame_window_p,
disp_prop_p);
}
/* Fetch the character at BYTEPOS. */
@ -904,8 +908,9 @@ bidi_fetch_char (EMACS_INT bytepos, EMACS_INT charpos, EMACS_INT *disp_pos,
*ch_len = 1;
*nchars = 1;
*disp_pos = endpos;
*disp_prop_p = 0;
}
else if (charpos >= *disp_pos)
else if (charpos >= *disp_pos && *disp_prop_p)
{
EMACS_INT disp_end_pos;
@ -972,10 +977,12 @@ bidi_fetch_char (EMACS_INT bytepos, EMACS_INT charpos, EMACS_INT *disp_pos,
/* If we just entered a run of characters covered by a display
string, compute the position of the next display string. */
if (charpos + *nchars <= endpos && charpos + *nchars > *disp_pos)
if (charpos + *nchars <= endpos && charpos + *nchars > *disp_pos
&& *disp_prop_p)
{
SET_TEXT_POS (pos, charpos + *nchars, bytepos + *ch_len);
*disp_pos = compute_display_string_pos (&pos, string, frame_window_p);
*disp_pos = compute_display_string_pos (&pos, string, frame_window_p,
disp_prop_p);
}
return ch;
@ -1083,6 +1090,7 @@ bidi_paragraph_init (bidi_dir_t dir, struct bidi_it *bidi_it, int no_default_p)
int ch;
EMACS_INT ch_len, nchars;
EMACS_INT pos, disp_pos = -1;
int disp_prop_p = 0;
bidi_type_t type;
const unsigned char *s;
@ -1130,7 +1138,8 @@ bidi_paragraph_init (bidi_dir_t dir, struct bidi_it *bidi_it, int no_default_p)
bytepos = pstartbyte;
if (!string_p)
pos = BYTE_TO_CHAR (bytepos);
ch = bidi_fetch_char (bytepos, pos, &disp_pos, &bidi_it->string,
ch = bidi_fetch_char (bytepos, pos, &disp_pos, &disp_prop_p,
&bidi_it->string,
bidi_it->frame_window_p, &ch_len, &nchars);
type = bidi_get_type (ch, NEUTRAL_DIR);
@ -1157,7 +1166,8 @@ bidi_paragraph_init (bidi_dir_t dir, struct bidi_it *bidi_it, int no_default_p)
&& bidi_at_paragraph_end (pos, bytepos) >= -1)
break;
/* Fetch next character and advance to get past it. */
ch = bidi_fetch_char (bytepos, pos, &disp_pos, &bidi_it->string,
ch = bidi_fetch_char (bytepos, pos, &disp_pos,
&disp_prop_p, &bidi_it->string,
bidi_it->frame_window_p, &ch_len, &nchars);
pos += nchars;
bytepos += ch_len;
@ -1290,6 +1300,7 @@ bidi_resolve_explicit_1 (struct bidi_it *bidi_it)
bidi_it->ch_len = 1;
bidi_it->nchars = 1;
bidi_it->disp_pos = (string_p ? bidi_it->string.schars : ZV);
bidi_it->disp_prop_p = 0;
}
else
{
@ -1297,8 +1308,8 @@ bidi_resolve_explicit_1 (struct bidi_it *bidi_it)
display string, treat the entire run of covered characters as
a single character u+FFFC. */
curchar = bidi_fetch_char (bidi_it->bytepos, bidi_it->charpos,
&bidi_it->disp_pos, &bidi_it->string,
bidi_it->frame_window_p,
&bidi_it->disp_pos, &bidi_it->disp_prop_p,
&bidi_it->string, bidi_it->frame_window_p,
&bidi_it->ch_len, &bidi_it->nchars);
}
bidi_it->ch = curchar;
@ -2032,12 +2043,13 @@ bidi_level_of_next_char (struct bidi_it *bidi_it)
struct bidi_string_data bs = bidi_it->string;
bidi_type_t chtype;
int fwp = bidi_it->frame_window_p;
int dpp = bidi_it->disp_prop_p;
if (bidi_it->nchars <= 0)
abort ();
do {
ch = bidi_fetch_char (bpos += clen, cpos += nc, &disp_pos, &bs, fwp,
&clen, &nc);
ch = bidi_fetch_char (bpos += clen, cpos += nc, &disp_pos, &dpp, &bs,
fwp, &clen, &nc);
if (ch == '\n' || ch == BIDI_EOB /* || ch == LINESEP_CHAR */)
chtype = NEUTRAL_B;
else

View file

@ -1310,7 +1310,7 @@ uniprop_get_encoder (Lisp_Object table)
function may load a Lisp file and thus may cause
garbage-collection. */
static Lisp_Object
Lisp_Object
uniprop_table (Lisp_Object prop)
{
Lisp_Object val, table, result;

View file

@ -1868,6 +1868,8 @@ struct bidi_it {
bidi_dir_t paragraph_dir; /* current paragraph direction */
EMACS_INT separator_limit; /* where paragraph separator should end */
EMACS_INT disp_pos; /* position of display string after ch */
int disp_prop_p; /* if non-zero, there really is a
`display' property/string at disp_pos */
unsigned first_elt : 1; /* if non-zero, examine current char first */
unsigned new_paragraph : 1; /* if non-zero, we expect a new paragraph */
unsigned frame_window_p : 1; /* non-zero if displaying on a GUI frame */
@ -3035,7 +3037,8 @@ extern Lisp_Object lookup_glyphless_char_display (int, struct it *);
extern int calc_pixel_width_or_height (double *, struct it *, Lisp_Object,
struct font *, int, int *);
extern EMACS_INT compute_display_string_pos (struct text_pos *,
struct bidi_string_data *, int);
struct bidi_string_data *,
int, int *);
extern EMACS_INT compute_display_string_end (EMACS_INT,
struct bidi_string_data *);

View file

@ -1053,9 +1053,13 @@ check_image_size (struct frame *f, int width, int height)
&& height <= XINT (Vmax_image_size));
else if (FLOATP (Vmax_image_size))
{
xassert (f);
w = FRAME_PIXEL_WIDTH (f);
h = FRAME_PIXEL_HEIGHT (f);
if (f != NULL)
{
w = FRAME_PIXEL_WIDTH (f);
h = FRAME_PIXEL_HEIGHT (f);
}
else
w = h = 1024; /* Arbitrary size for unknown frame. */
return (width <= XFLOAT_DATA (Vmax_image_size) * w
&& height <= XFLOAT_DATA (Vmax_image_size) * h);
}

View file

@ -1216,13 +1216,20 @@ binding KEY to DEF is added at the front of KEYMAP. */)
keymap = get_keymap (cmd, 0, 1);
if (!CONSP (keymap))
/* We must use Fkey_description rather than just passing key to
error; key might be a vector, not a string. */
error ("Key sequence %s starts with non-prefix key %s",
SDATA (Fkey_description (key, Qnil)),
SDATA (Fkey_description (Fsubstring (key, make_number (0),
make_number (idx)),
Qnil)));
{
const char *trailing_esc = ((EQ (c, meta_prefix_char) && metized)
? (idx == 0 ? "ESC" : " ESC")
: "");
/* We must use Fkey_description rather than just passing key to
error; key might be a vector, not a string. */
error ("Key sequence %s starts with non-prefix key %s%s",
SDATA (Fkey_description (key, Qnil)),
SDATA (Fkey_description (Fsubstring (key, make_number (0),
make_number (idx)),
Qnil)),
trailing_esc);
}
}
}

View file

@ -2861,6 +2861,7 @@ extern void map_char_table_for_charset (void (*c_function) (Lisp_Object, Lisp_Ob
Lisp_Object, Lisp_Object,
Lisp_Object, struct charset *,
unsigned, unsigned);
extern Lisp_Object uniprop_table (Lisp_Object);
extern void syms_of_chartab (void);
/* Defined in print.c */

View file

@ -6381,8 +6381,7 @@ char *
regcomp/regexec below without link errors. */
weak_function
# endif
re_comp (s)
const char *s;
re_comp (const char *s)
{
reg_errcode_t ret;
@ -6421,7 +6420,7 @@ re_comp (s)
}
regoff_t
int
# ifdef _LIBC
weak_function
# endif
@ -6558,7 +6557,7 @@ reg_errcode_t
regexec (const regex_t *__restrict preg, const char *__restrict string,
size_t nmatch, regmatch_t pmatch[__restrict_arr], int eflags)
{
reg_errcode_t ret;
regoff_t ret;
struct re_registers regs;
regex_t private_preg;
size_t len = strlen (string);

View file

@ -1439,7 +1439,7 @@ x_draw_glyphless_glyph_string_foreground (struct glyph_string *s)
Nominally, highlight colors for `3d' faces are calculated by
brightening an object's color by a constant scale factor, but this
doesn't yield good results for dark colors, so for colors who's
doesn't yield good results for dark colors, so for colors whose
brightness is less than this value (on a scale of 0-255) have to
use an additional additive factor.
@ -1618,8 +1618,9 @@ x_setup_relief_colors (struct glyph_string *s)
static void
w32_draw_relief_rect (struct frame *f,
int left_x, int top_y, int right_x, int bottom_y, int width,
int raised_p, int top_p, int bot_p, int left_p, int right_p,
int left_x, int top_y, int right_x, int bottom_y,
int width, int raised_p,
int top_p, int bot_p, int left_p, int right_p,
RECT *clip_rect)
{
int i;
@ -1880,7 +1881,8 @@ x_draw_image_relief (struct glyph_string *s)
if (s->hl == DRAW_IMAGE_SUNKEN
|| s->hl == DRAW_IMAGE_RAISED)
{
thick = tool_bar_button_relief >= 0 ? tool_bar_button_relief : DEFAULT_TOOL_BAR_BUTTON_RELIEF;
thick = tool_bar_button_relief >= 0 ? tool_bar_button_relief
: DEFAULT_TOOL_BAR_BUTTON_RELIEF;
raised_p = s->hl == DRAW_IMAGE_RAISED;
}
else
@ -3486,7 +3488,7 @@ my_destroy_window (struct frame * f, HWND hwnd)
/* Create a scroll bar and return the scroll bar vector for it. W is
the Emacs window on which to create the scroll bar. TOP, LEFT,
WIDTH and HEIGHT are.the pixel coordinates and dimensions of the
WIDTH and HEIGHT are the pixel coordinates and dimensions of the
scroll bar. */
static struct scroll_bar *
@ -3872,7 +3874,7 @@ w32_scroll_bar_handle_click (struct scroll_bar *bar, W32Msg *msg,
si.fMask = SIF_POS;
si.nPos = y;
/* Remember apparent position (we actually lag behind the real
position, so don't set that directly. */
position, so don't set that directly). */
last_scroll_bar_drag_pos = y;
SetScrollInfo (SCROLL_BAR_W32_WINDOW (bar), SB_CTL, &si, FALSE);
@ -4771,7 +4773,7 @@ w32_read_socket (struct terminal *terminal, int expected,
pending_autoraise_frame = 0;
}
/* Check which frames are still visisble, if we have enqueued any user
/* Check which frames are still visible, if we have enqueued any user
events or been notified of events that may affect visibility. We
do this here because there doesn't seem to be any direct
notification from Windows that the visibility of a window has

View file

@ -899,7 +899,7 @@ static void init_to_row_start (struct it *, struct window *,
static int init_to_row_end (struct it *, struct window *,
struct glyph_row *);
static void back_to_previous_line_start (struct it *);
static int forward_to_next_line_start (struct it *, int *);
static int forward_to_next_line_start (struct it *, int *, struct bidi_it *);
static struct text_pos string_pos_nchars_ahead (struct text_pos,
Lisp_Object, EMACS_INT);
static struct text_pos string_pos (EMACS_INT, Lisp_Object);
@ -3134,13 +3134,10 @@ next_overlay_change (EMACS_INT pos)
return endpos;
}
/* Record one cached display string position found recently by
compute_display_string_pos. */
static EMACS_INT cached_disp_pos;
static EMACS_INT cached_prev_pos = -1;
static struct buffer *cached_disp_buffer;
static int cached_disp_modiff;
static int cached_disp_overlay_modiff;
/* How many characters forward to search for a display property or
display string. Enough for a screenful of 100 lines x 50
characters in a line. */
#define MAX_DISP_SCAN 5000
/* Return the character position of a display string at or after
position specified by POSITION. If no display string exists at or
@ -3152,57 +3149,33 @@ static int cached_disp_overlay_modiff;
on a GUI frame. */
EMACS_INT
compute_display_string_pos (struct text_pos *position,
struct bidi_string_data *string, int frame_window_p)
struct bidi_string_data *string,
int frame_window_p, int *disp_prop_p)
{
/* OBJECT = nil means current buffer. */
Lisp_Object object =
(string && STRINGP (string->lstring)) ? string->lstring : Qnil;
Lisp_Object pos, spec;
Lisp_Object pos, spec, limpos;
int string_p = (string && (STRINGP (string->lstring) || string->s));
EMACS_INT eob = string_p ? string->schars : ZV;
EMACS_INT begb = string_p ? 0 : BEGV;
EMACS_INT bufpos, charpos = CHARPOS (*position);
EMACS_INT lim =
(charpos < eob - MAX_DISP_SCAN) ? charpos + MAX_DISP_SCAN : eob;
struct text_pos tpos;
struct buffer *b;
*disp_prop_p = 1;
if (charpos >= eob
/* We don't support display properties whose values are strings
that have display string properties. */
|| string->from_disp_str
/* C strings cannot have display properties. */
|| (string->s && !STRINGP (object)))
return eob;
/* Check the cached values. */
if (!STRINGP (object))
{
if (NILP (object))
b = current_buffer;
else
b = XBUFFER (object);
if (b == cached_disp_buffer
&& BUF_MODIFF (b) == cached_disp_modiff
&& BUF_OVERLAY_MODIFF (b) == cached_disp_overlay_modiff
&& !b->clip_changed)
{
if (cached_prev_pos >= 0
&& cached_prev_pos < charpos && charpos <= cached_disp_pos)
return cached_disp_pos;
/* Handle overstepping either end of the known interval. */
if (charpos > cached_disp_pos)
cached_prev_pos = cached_disp_pos;
else /* charpos <= cached_prev_pos */
cached_prev_pos = max (charpos - 1, 0);
}
/* Record new values in the cache. */
if (b != cached_disp_buffer)
{
cached_disp_buffer = b;
cached_prev_pos = max (charpos - 1, 0);
}
cached_disp_modiff = BUF_MODIFF (b);
cached_disp_overlay_modiff = BUF_OVERLAY_MODIFF (b);
*disp_prop_p = 0;
return eob;
}
/* If the character at CHARPOS is where the display string begins,
@ -3221,22 +3194,24 @@ compute_display_string_pos (struct text_pos *position,
&& handle_display_spec (NULL, spec, object, Qnil, &tpos, bufpos,
frame_window_p))
{
if (!STRINGP (object))
cached_disp_pos = charpos;
return charpos;
}
/* Look forward for the first character with a `display' property
that will replace the underlying text when displayed. */
limpos = make_number (lim);
do {
pos = Fnext_single_char_property_change (pos, Qdisplay, object, Qnil);
pos = Fnext_single_char_property_change (pos, Qdisplay, object, limpos);
CHARPOS (tpos) = XFASTINT (pos);
if (CHARPOS (tpos) >= lim)
{
*disp_prop_p = 0;
break;
}
if (STRINGP (object))
BYTEPOS (tpos) = string_char_to_byte (object, CHARPOS (tpos));
else
BYTEPOS (tpos) = CHAR_TO_BYTE (CHARPOS (tpos));
if (CHARPOS (tpos) >= eob)
break;
spec = Fget_char_property (pos, Qdisplay, object);
if (!STRINGP (object))
bufpos = CHARPOS (tpos);
@ -3244,8 +3219,6 @@ compute_display_string_pos (struct text_pos *position,
|| !handle_display_spec (NULL, spec, object, Qnil, &tpos, bufpos,
frame_window_p));
if (!STRINGP (object))
cached_disp_pos = CHARPOS (tpos);
return CHARPOS (tpos);
}
@ -5494,6 +5467,9 @@ back_to_previous_line_start (struct it *it)
continuously over the text). Otherwise, don't change the value
of *SKIPPED_P.
If BIDI_IT_PREV is non-NULL, store into it the state of the bidi
iterator on the newline, if it was found.
Newlines may come from buffer text, overlay strings, or strings
displayed via the `display' property. That's the reason we can't
simply use find_next_newline_no_quit.
@ -5506,7 +5482,8 @@ back_to_previous_line_start (struct it *it)
leads to wrong cursor motion. */
static int
forward_to_next_line_start (struct it *it, int *skipped_p)
forward_to_next_line_start (struct it *it, int *skipped_p,
struct bidi_it *bidi_it_prev)
{
EMACS_INT old_selective;
int newline_found_p, n;
@ -5518,6 +5495,8 @@ forward_to_next_line_start (struct it *it, int *skipped_p)
&& it->c == '\n'
&& CHARPOS (it->position) == IT_CHARPOS (*it))
{
if (it->bidi_p && bidi_it_prev)
*bidi_it_prev = it->bidi_it;
set_iterator_to_next (it, 0);
it->c = 0;
return 1;
@ -5539,6 +5518,8 @@ forward_to_next_line_start (struct it *it, int *skipped_p)
if (!get_next_display_element (it))
return 0;
newline_found_p = it->what == IT_CHARACTER && it->c == '\n';
if (newline_found_p && it->bidi_p && bidi_it_prev)
*bidi_it_prev = it->bidi_it;
set_iterator_to_next (it, 0);
}
@ -5573,6 +5554,8 @@ forward_to_next_line_start (struct it *it, int *skipped_p)
&& !newline_found_p)
{
newline_found_p = ITERATOR_AT_END_OF_LINE_P (it);
if (newline_found_p && it->bidi_p && bidi_it_prev)
*bidi_it_prev = it->bidi_it;
set_iterator_to_next (it, 0);
}
}
@ -5696,8 +5679,9 @@ static void
reseat_at_next_visible_line_start (struct it *it, int on_newline_p)
{
int newline_found_p, skipped_p = 0;
struct bidi_it bidi_it_prev;
newline_found_p = forward_to_next_line_start (it, &skipped_p);
newline_found_p = forward_to_next_line_start (it, &skipped_p, &bidi_it_prev);
/* Skip over lines that are invisible because they are indented
more than the value of IT->selective. */
@ -5708,7 +5692,8 @@ reseat_at_next_visible_line_start (struct it *it, int on_newline_p)
{
xassert (IT_BYTEPOS (*it) == BEGV
|| FETCH_BYTE (IT_BYTEPOS (*it) - 1) == '\n');
newline_found_p = forward_to_next_line_start (it, &skipped_p);
newline_found_p =
forward_to_next_line_start (it, &skipped_p, &bidi_it_prev);
}
/* Position on the newline if that's what's requested. */
@ -5724,11 +5709,14 @@ reseat_at_next_visible_line_start (struct it *it, int on_newline_p)
--IT_STRING_BYTEPOS (*it);
}
else
/* Setting this flag will cause
bidi_move_to_visually_next not to advance, but
instead deliver the current character (newline),
which is what the ON_NEWLINE_P flag wants. */
it->bidi_it.first_elt = 1;
{
/* We need to restore the bidi iterator to the state
it had on the newline, and resync the IT's
position with that. */
it->bidi_it = bidi_it_prev;
IT_STRING_CHARPOS (*it) = it->bidi_it.charpos;
IT_STRING_BYTEPOS (*it) = it->bidi_it.bytepos;
}
}
}
else if (IT_CHARPOS (*it) > BEGV)
@ -5738,9 +5726,14 @@ reseat_at_next_visible_line_start (struct it *it, int on_newline_p)
--IT_CHARPOS (*it);
--IT_BYTEPOS (*it);
}
/* With bidi iteration, the call to `reseat' will cause
bidi_move_to_visually_next deliver the current character,
the newline, instead of advancing. */
else
{
/* We need to restore the bidi iterator to the state it
had on the newline and resync IT with that. */
it->bidi_it = bidi_it_prev;
IT_CHARPOS (*it) = it->bidi_it.charpos;
IT_BYTEPOS (*it) = it->bidi_it.bytepos;
}
reseat (it, it->current.pos, 0);
}
}