Re: [cedet-semantic] simple bovine example of "A Rule must return a single tag-line list!"
Brought to you by:
zappo
From: Eric M. L. <er...@si...> - 2007-05-20 19:19:04
|
Hi, Emacs says I forgot to answer you email. My apologies! The answer to the "A Rule must return a single tag-line list" is that the purpose of the grammar is to create a list of tags. The "article" rule should, at a minimum, look like this: article : environment-declaration text-proper (TAG "somename" 'tagclassimadeup :optionaldetail "somethingelse") ; The declaration of the tag can occur anywhere in the grammar, and each production passes the value up until it reaches your %start token. See the "Optional Lambda Expression" section in the bovine.info file. You might be able to put a nil in there too. I don't recall the specifics. Sorry for the delay. Eric >>> Jesse Alama <al...@st...> seems to think that: >After fooling around with a bovine grammar I'm working on, I managed >to find a simple example of a grammar which, when I call `bovinate', >give me the error "A Rule must return a single tag-line list!". > >Here's the bovine file: > >---------------------------------------------------------------------- >%package pretty-trivial > >%language-mode my-trivial-mode >%start article > >%keyword ENVIRON "environ" >%put ENVIRON summary >%keyword BEGIN "begin" >%put BEGIN summary > >%% > >article > : environment-declaration text-proper > ; > >environment-declaration > : ENVIRON > ; > >text-proper > : BEGIN > ; > >%% >---------------------------------------------------------------------- > >Then here's the package file: > >---------------------------------------------------------------------- >(require 'semantic) >(require 'pretty-trivial) >(require 'backquote) > >;; Depending on what elements you include specialized support for >(eval-when-compile > (require 'semantic-ctxt) > (require 'semantic-imenu) > (require 'document) > (require 'senator)) > >;;; Code: > >;; Create a lexical analyzer for your language. You can use >;; both the provided analyzers, and your own custom analyzers >;; that let you take short-cuts in your language. > >;; Define the lexial analyzer >(define-lex semantic-trivial-lexer > "Lexical Analyzer for trivial articles." > semantic-lex-ignore-whitespace > semantic-lex-ignore-newline > semantic-lex-number > semantic-lex-symbol-or-keyword > semantic-lex-paren-or-list > semantic-lex-close-paren > semantic-lex-ignore-comments > semantic-lex-punctuation > semantic-lex-default-action) > >(defun semantic-default-trivial-setup () > "Set up a buffer for semantic parsing of the skeleton language." > (pretty-trivial--install-parser) > (setq semantic-lex-analyzer #'semantic-trivial-lexer) > ) >---------------------------------------------------------------------- >Evaluate the package file generated by the bovine grammar, then the >above file. Visit a buffer whose content is >---------------------------------------------------------------------- >environ > >begin >---------------------------------------------------------------------- >Then evaluate `semantic-default-trivial-setup' and then evaluate >`semantic-new-buffer-fcn'. I immediately get the error > > A Rule must return a single tag-line list! > >What does that error mean and why is it coming up in this example? > >Thanks, > >Jesse > |