Re[5]: [cedet-semantic] Using Semantic to parse XPATH
Brought to you by:
zappo
From: Eric M. L. <er...@si...> - 2001-12-09 23:19:21
|
>>> Alex Schroeder <al...@gn...> seems to think that: >Thanks a lot for your help! [ ... ] >> %token NAME symbol "^[a-zA-Z_][a-zA-Z_0-9.-_]*$" >> >> Name: NAME ( $1 ) >> ; > >Cool. > >Can you explain the difference between the following two, however? > >%token ANCESTOR-AXIS "ancestor" >%token NAME symbol "^[a-zA-Z_][a-zA-Z_0-9.-_]*$" > >As far as I understand the documentation, the second form applies only >when the entire token has the symbol syntax class. That means I >should change all my FOO-AXIS tokens to the second form, right? [ ... ] Hi, There is some small magic here. When you specify a type for the token (symbol or punctuation) the string is a regular expression. When you exclude the type, it creates a new token primitive with the name specified, and it must match exactly with an implied ^ and $. >I would like to run this very simple test: > >(with-temp-buffer > (insert "child::para") > (xpath-default-setup) > (bovinate t)) > >However, I get the following error: > >Debugger entered--Lisp error: (wrong-type-argument listp [[((default . error) (25 . 4) >... [ugly crud deleted] ... > assq(bovine-toplevel [[(... ... ...) (... ...) (...) (...) (... ... ... ... ... ... . > (cdr (assq nonterminal table)) > (let ((matchlist ...) (starting-stream stream) (nt-loop t) nt-popup nt-stack s lse lt > semantic-bovinate-nonterminal(((CHILD-AXIS 1 . 6) (punctuation 6 . 7) (punctuation 7 >... [etc.] ... > >What does that mean? > >My BNF file contains the following line: > >%start LocationPath > >Thus, I get suspicious when I see the bovine-toplevel thing in the >backtrace. The error seems to be somewhere else, however: TABLE is >not a list but some weird vector instead. Perhaps that is correct, >because xpath-tables has exactly this value: Unfortunately, I am not yet very savvy in the wisent parser's details. Perhaps David Ponce can offer some suggestions. As for `bovine-toplevel', the %start token is just replaced in the actual language definition. That should probably be fixed up sometime. Eric -- Eric Ludlam: za...@gn..., er...@si... Home: www.ultranet.com/~zappo Siege: www.siege-engine.com Emacs: http://cedet.sourceforge.net GNU: www.gnu.org |