Just Launched: You can now import projects and releases from Google Code onto SourceForge
We are excited to release new functionality to enable a 1-click import from Google Code onto the Allura platform on SourceForge. You can import tickets, wikis, source, releases, and more with a few simple steps. Read More
The following "hacky" alternative defun of lex-string
(defun lex-string (string &optional mode start end depth length)
"Scan STRING using the lexical elements described by the syntax
in MODE. MODE is the function name of an Emacs Mode such as
c-mode, emacs-lisp-mode, etc."
(set-buffer (find-file-noselect (concat "~/.emacs.d/" "lex-"
(when mode (funcall `,mode))
(unless start (setq start (point-min))) ;start defaults to point-min
(unless end (setq end (point-max)))
(semantic-lex start end depth length)))
;; Use: (lex-string "int x = 1;" 'c-mode nil nil 10)
also fails with the same errror
Debugger entered--Lisp error: (wrong-type-argument syntax-table-p nil)
apply(debug error (wrong-type-argument syntax-table-p nil))
edebug(error (wrong-type-argument syntax-table-p nil))
semantic-c-lexer(1 11 10 nil)
semantic-lex(1 11 10 nil)
(save-current-buffer (set-buffer (find-file-noselect ...)) (erase-buffer)
(when mode (funcall ...)) (insert string) (unless start (setq start ...))
(unless end (setq end ...)) (semantic-lex start end depth length))
lex-string("int x = 1;" c-mode nil nil 10)
eval((lex-string "int x = 1;" (quote c-mode) nil nil 10))
Why isn't the syntax-table defined?
Sorry for the duplicate sending in the previous email....
From: Eric M. Ludlam <eric@si...> - 2010-03-01 17:33:03
On 03/01/2010 09:23 AM, Per Nordlöw wrote:
> How do I setup semantic-lex to be used in a /temporary buffer/ not
> connected but to use a specific major-mode so that the *syntax-table*
> get defined?
> A quick /hack/ would be to create a file in /tmp/BUFFER_NAME (that of
> course auto-inherits the major-mode from auto-mode-alist) clear it and
> insert the search string into it.*
Thanks for sharing. I will probably give it a try soon because it
sounds really cool. Short term, however, I'll provide a pointer for the
above. I had to solve a similar problem for the C preprocessor and
macro expansion. That code is in:
semantic-c.el, semantic-c-parse-lexical-token, around line
886 (from CVS).
It is short-ish, but it isn't simple.