Next: , Up: Working with grammars

4.1 Editing grammars

— Command: semantic-grammar-create-package &optional force

Create package Lisp code from grammar in current buffer. Does nothing if the Lisp code seems up to date. If optional argument FORCE is non-nil, unconditionally re-generate the Lisp code.

You can run the command semantic-grammar-create-package with C-c C-c (or C-u C-c C-c to unconditionally re-generate the Lisp code).

Additionally, when this command is run interactively, all open buffers of that mode have their setup functions re-run. That way after compiling your grammar, all relevant buffers will be actively using that grammar so you can test what you have done.

— Command: semantic-grammar-indent

Indent the current line. Use the Lisp or grammar indenter depending on point location.

You can run the command semantic-grammar-indent with <TAB>.

— Command: semantic-grammar-complete

Attempt to complete the symbol under point. Completion is position sensitive. If the cursor is in a match section of a rule, then nonterminals symbols are scanned. If the cursor is in a Lisp expression then Lisp symbols are completed.

You can run the command semantic-grammar-complete with <META> <TAB>.

— Command: semantic-grammar-find-macro-expander macro-name library

Visit the Emacs Lisp library where a grammar macro is implemented. MACRO-NAME is a symbol that identifies a grammar macro. LIBRARY is the name (sans extension) of the Emacs Lisp library where to start searching the macro implementation. Lookup in included libraries, if necessary. Find a function tag (in current tags table) whose name contains MACRO-NAME. Select the buffer containing the tag's definition, and move point there.

Please note:
Enabling the global-semanticdb-minor-mode is highly recommended because this command uses the semanticdb-find feature to automatically search for a macro expander function into included libraries. For more details, see Semantic Database.

You can run the command semantic-grammar-find-macro-expander with C-c m.

The characters | ; % ( ) : are electric punctuations. Each time you type one, the line is re-indented after the character is inserted.

— Command: semantic-grammar-insert-keyword name

Insert a new %keyword declaration with name. Assumes it is typed in with the correct casing.

You can run the command semantic-grammar-insert-keyword with C-c i k.