Semantic 2.0 is a major new version.
Semantic now uses `inversion' to track version numbers of different
releases. Semanticdb table files save the version number they are
created at, and can identify old tables to regenerate them when an
incompatible upgrade occurs.
* API changes
** Naming Conventions
There is a new naming convention for the things Semantic refers too.
The list of renamed functions is far to long to list here. All
functions that used the old conventions have been changed to use the
new conventions, and are not explicitly listed here unless there is
an incompatible change.
*** New conventions
token - Refers to a lexical analyzer production.
stream - A list of tokens
tag - Refers to a datastructure created by a grammar to represent
something in a language file
table - A hierarchical list of tags.
tag-class - A tag may represent a function, data type, or variable.
parse - Run a source file through a parser.
*** Old conventions
token - Could be a lexical token, or a tag
nonterminal - Could be a grammar nonterminal, or a tag
stream - Could be a list of lexical tokens, or a tag table.
token-type - New represented as tag-class
bovinate - Run a source file through a parser.
*** Obsoletion stratety
The new framework function `semantic-alias-obsolete' has been used to
obsolete old functions and allow old code to continue working. Byte
compiler warnings will be produced if old functions are used. The
old function will be completely removed in a future release.
For variables, the function `semantic-varalias-obsolete' has been
used. When available it uses a native alias routine for compatibility
or displays a warning.
** Lexical analysis.
*** The old `semantic-flex' API is deprecated.
The lexical analysis toolkit has been completely rewritten as a new
*** Lexical token management.
Create a new lexical token.
Fetch the class of a lexical token.
Fetch the start and end locations of a lexical token.
`semantic-lex-token-start' and `semantic-lex-token-end'
Respectively fetch the start and end position of a lexical token.
Fetch the text associated with a lexical token.
*** Macros to easily build custom lexers.
Define a new lexer as a set of lexical rules.
Base macro to create a lexical rule.
A lexical rule associates a PATTERN to an ACTION.
A PATTERN describes how to match data in the input stream, with a
combination of regular expressions and strings.
An ACTION is a set of arbitrary Emacs Lisp statements executed when
the input stream matches the corresponding PATTERN, typically to push
a new token on the lexical stream.
`define-lex-regex-analyzer' and `define-lex-simple-regex-analyzer'
Create lexical rules that match a regexp.
Create a lexical rule for paired delimiters blocks.
*** A set of useful lexical rules is predefined.
*** Some lexers are predefined too.
A comment lexer: `semantic-comment-lexer' that handles comments.
A `semantic-simple-lexer' that ignores comments and whitespace, and
returns tokens corresponding to syntax as specified by the syntax
*** `semantic-lex' core "overload" function.
Called to lexically analyze text in an area of the current buffer.
*** debugging bad syntax
Using `semantic-lex-debug-analyzers' combined with `debug-on-error'
allows you to debug analyzers inside usually protected parsing
*** API to manage a parse tree state.
Indicate that there are lexical issues that prevent parsing.
Return non-nil if there are lexical issues that prevent parsing.
Indicate that the current parse tree needs to be updated.
Return non-nil if the current parse tree needs to be updated.
Indicate that the current parse tree needs to be rebuilt.
Return non-nil if the current parse tree needs to be rebuilt.
Indicate that the current parse tree is up to date.
Return non-nil if the current parse tree is up to date.
*** Core "overload" functions to abstract call to parsers.
New parsers can be plugged-in easily by overriding the following
`semantic-parse-stream' called to parse a given stream, starting at a
given nonterminal rule.
`semantic-parse-changes' called to reparse changes in the current
`semantic-parse-region' called to parse a buffer's area.
*** Four core parsers are available.
- Two general parsers
- The Semantic "bovinator".
- A new LALR(1) parser: Wisent, port of Bison 1.3 in Elisp.
- Two specific parsers
- The Elisp parser based on the Emacs built-in function `read'.
- A regexp parser used in `texinfo-mode'.
*** Iterative parser.
Iterative parsers are better than rule-based iterative functions
in that they can handle obscure errors more cleanly.
The new `semantic-repeat-parse-whole-stream' helper function abstracts
this action for other parser centric routines.
*** Incremental parser.
In Semantic 1.x, changes were handled in a simplistic manner, where
tags that changed were reparsed one at a time. Any other form of
edit were managed through a full re-parse.
The new `semantic-edits-incremental-parser' attempts to minimize the
number of times a full re-parse needs to occur. While overlays and
tags will continue to be recycled in the simple case, new cases
where tags are inserted or old tags removed from the original list
*** Lexical Safety feature.
You can protect code from reparsing the buffer if there are lexical
errors with the `semantic-lex-catch-errors' macro.
*** Deprecated and removed API.
The `semantic-flex' API is deprecated, and replaced by the new
`semantic-lex' API. The old API still exists for compatibility with
`semantic-parse-region' should be used instead of
`semantic-bovinate-from-nonterminal-full' which still exist for
compatibility with the Semantic 1.x API.
The old incremental parser `semantic-rebovinate-token' and associated
`semantic-show-dirty-mode' have been removed and replaced respectively
by new `semantic-edits-incremental-parser' and
`semantic-bovinate-toplevel-override' is replaced by the new core
`semantic-bovine-toplevel-partial-reparse-needed-p' are replaced by
the new parse tree state management API.
`semanticdb-project-predicates' hook is renamed
* Grammar framework.
Semantic 2.0 introduced a new common grammar framework to simplify
development of grammars suitable to parser needs.
** New "abstract" major mode: `semantic-grammar-mode'.
That defines a useful environment to develop grammars (indentation,
syntax highlighting, parsing, etc.).
By deriving new "concrete" major modes one can provide customized
generators that convert a grammar parse tree into Elisp forms needed
by a particular parser.
** New "overloads" are provided to customize Elisp generation.
That returns the setup code form.
That returns the parser table value.
That returns the keyword table table value.
That returns the token table value.
** New grammar modes derived from `semantic-grammar-mode'.
That converts grammar input form into Elisp code to be used by the
"bovinator". Such grammars are associated to the .by file extension.
Old grammars in .bnf files are no longer supported.
That converts grammar input form into Elisp code to be used by the
Wisent LALR parser. Such grammars are associated to the .wy
** Grammar build process
A new grammar construction process separates generated code from hand
written code. An semantic specific EDE extension will generate
Makefile rules to build these files.
Language specific human written code must call the automatically
generated setup function.
*** Auto-generation of lexical rules
The new %type statement combined with the use of %token and %keyword
statements permits the declaration of a lexical type and associates it
with patterns that define how to match lexical tokens of that type.
The grammar construction process can benefit from the %type, %keyword
and %token declarations to automatically generate the definition of a
lexical rule for each explicitly declared lexical type.
Default values are provided for well known types like <keyword>,
<symbol>, <string>, <number>, <punctuation>, and <block>. Those types
assume that the correct patterns are provided by %keyword and %token
statements, a simple "%type <type>" declaration should generally
suffice to auto-generate a suitable lexical rule.
It is then easy to put predefined and auto-generated lexical rules
together to build ad-hoc lexical analyzers. Examples are available
among the grammars included in the distribution.
*** Bovine grammar
A file FOO.by will create the file FOO-by.el, and FOO-by.elc
*** Wisent grammar
A file FOO.wy will create the file FOO-wy.el, and FOO-wy.elc
** secondary overlays
An API for adding secondary overlays onto a tag has been added.
This allows you to add/remove arbitrary visual effects onto a tag.
Uses tag link hooks to make sure the overlays are added/removed
** folded tags
New functions `semantic-set-tag-folded' and `semantic-tag-folded-p'
allow you to put a tag into a 'folded' state where only the 1st line
New base class for all tables of tokens lists.
Inherits from the abstract table.
No longer saves itself to a file.
New routines for databases saved to disk in plain EIEIO save files.
Depends on `inversion' for save file compatibility tests.
File based project database type.
All old search routines have been moved into this file.
All old search routines are now methods on database projects.
All old search routines have been obsoleted. Use semanticdb-find.el
based routines instead. These functions are still maintained because
the semanticdb-find based routines do not yet handle all the same
search paramters as the old routines.
Class for any search in a database with no tables of its own.
*** Different search classes
Searches in databases have been broken into three classes.
- Basic search - on values as stored directly in a semantic token.
- Advanced search - complex searches of relationships. Needed for
system databases which cannot support a generic search.
- Generic search - Takes a predicate. System databases cannot usually
support this style of search.
New prefered search routines which start with `semanticdb-find...'.
These routines take fewer parameters. There are more types of search
routines than before to make up for the missing parameters.
*** Basic search
Scans the current buffer, and all files included into this buffer.
Only scans top level tags.
*** Deep search
A Deep search will "flatten" the tags in a file so they are all
visible, including parts of structures or classes.
*** Brute searches
As a basic search, but scans all files in the current project.
This new routines determines the "path" to scan. There are two basic
types of paths. The default is to examine the specified buffers
include list, and only scan those files. Optional "brute" path will
scan all files in the current project, including system level databases.
*** database Find Results
Find Results are somewhat more formalized, and have routines to
deal with them.
Find results can be passed into any semanticdb-find routine as the
path and only those results will be scanned.
*** New types of searches not originally in semanticdb-search.el
Searches "for completion" use different matching constraints
equivalent to the regular expression "^chars", which provide a speed
Representation of a database belonging to system libraries.
These databases may not come from source code, and can represent
object files, header file libraries and the like.
Baseclass for any system database.
Class for C libraries of header files.
Special system database representing Emacs' internal state.
Implements all search routines optimized as much as possible.
Table representing search results for Emacs Lisp symbols.
Database representing Emacs' internal symbol obarray.
Routines for building semantic.cache files from a command line script.
Find the parent of a tag by overlays.
* Minor modes.
Display the parser state in the modeline.
Highlight areas that a user edits.
Make the current functions header `sticky' to the top of the current
window. (Emacs 21 required)
** `semantic-auto-parse-mode' obsolete
** `semantic-summary-mode' obsolete
Replaces seman`tic-auto-parse-mode'. Reparses all buffers.
Also schedules additional functionality.
Replaces seman`tic-summary-mode'. Uses the new idle scheduler
to execute itself.
New minor mode for automatically going into inline completion
for symbol prefixes.
New minor mode that manages any form of decoration to be added to
tags. It absorbs the duties of:
** `semantic-show-tag-boundaries-mode': obsolete
** `semantic-highlight-by-attribute-mode': obsolete
Run before option `semantic-auto-parse-mode' begins parsing.
Run after option `semantic-auto-parse-mode' has parsed.
* Smart Completion
This is now an overridable function.
The objects contain more details on scoping for more accurate
This is now an overridable function.
A lot of things are now auto-loaded on demand. Setup should now be
done through the cedet.el initialization file.
** Python parser added.
The LALR grammar is based on the official grammar with slight
modifications. The tokens generated are formatted similar to
those produced by the Java parser.
** Erlang parser added.
The grammar was written for semantic 1.4 in BNF format, and converted
to .by format.
** HTML external parser added.
The regexp based parser was copied from the texinfo example
and modified for semantic 2.0.
** Makefile parser improved.
There is now excellent smart completion support.
** Emacs lisp parser improved.
The Emacs Lisp parser is now more flexible. Using the new macros
`semantic-elisp-reuse-form-parser', it is easy to parse all kind of
Lisp forms to produce semantic tags.
** Texinfo parser improved
The texinfo parser was updated, and supports the new
paragraph-separate: "[ ]*$"