Re: [cedet-semantic] using semantic/wisent as a parser
Brought to you by:
zappo
From: David P. <dav...@wa...> - 2004-04-15 09:09:20
|
Hi Joe, > OK - I said I would get back to you. Here we go. > > I want to use *wisent* to parse a simple language. > > But I am having some trouble with this. > > Specifically, in my example file, "example.simple", this is what I > see: > > M-: (semantic-parse-region (point-min) (point-max) nil nil t) > ;=> (void-function semantic-simple-parse-region) That looks right, `semantic-simple-parse-region' isn't defined anywhere in your code. See also my comments below. > > M-: (semantic-debug) > ;=> (error "This major mode does not support parser debugging") That's true, for now wisent doesn't support semantic-debug. [...] > ;;=============== > ;; System Setup > ;;=============== > > ;; The needed files. Load these once. > (add-to-list 'load-path "~/cedet-1.0beta2a/semantic/") > (add-to-list 'load-path "~/cedet-1.0beta2a/common/") > (add-to-list 'load-path "~/cedet-1.0beta2a/eieio/") > ;(setq semantic-load-turn-everything-on t) > (load "~/cedet-1.0beta2a/semantic/semantic-load.el") > (load "/Users/arided/cedet-1.0beta2a/common/cedet-load.el") > (load "~/cedet-1.0beta2a/eieio/eieio-load.el") Why not just: (load "~/cedet-1.0beta2a/common/cedet.el") It will setup the load-path, and other needed things, for you. [...] > ;;========================= > ;;========================= > ;; FILE: semantic-simple.el > ;;========================= > ;;========================= > > (require 'simple-wy) ;; The parser > > (define-mode-overload-implementation > semantic-parse-region simple-mode > (start end &optional nonterminal depth returnonerror) > "Over-ride in order to initialize some variables." > (semantic-parse-region-default > start end nonterminal depth returnonerror)) > > ;; As instructed by the info node Semantic Overload Mechanism, we look at > ;; examples. The examples seem to indicate that we should do something like > ;; this: > > ;;;###autoload > (defun semantic-default-simple-setup () > "Set up a buffer for semantic parsing of the SIMPLE language." > (semantic-install-function-overrides > '((parse-region . semantic-simple-parse-region) > (parse-changes . semantic-simple-parse-changes))) [...] In fact your problem is in the above code. First you define a override to semantic-parse-region in simple-mode (looks correct), but then you override it again locally in the buffer with the undefined function `semantic-simple-parse-region'. IMO, you should just remove the above call to `semantic-install-function-overrides'. Good luck! David |