From: Philipp Stephani <p.stephani2@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Using semantic lexers together with Wisent
Date: Tue, 16 Jun 2015 15:53:18 +0200 [thread overview]
Message-ID: <wvr4y4jj220h.fsf@qarth.roam.corp.google.com> (raw)
Hi,
consider the following lexer/parser combination:
(with-temp-buffer
(emacs-lisp-mode)
(insert ".")
(semantic-lex-init)
(let ((wisent-lex-istream (semantic-simple-lexer (point-min) (point-max))))
(wisent-parse
(wisent-compile-grammar
'((symbol)
nil
(dot ((?.)))))
#'wisent-lex)))
This returns 'nil' because ?. doesn't actually match a dot. I need to
explicitly specify 'symbol', which of course matches too much. Is there
a way to match a specific character without defining my own lexer or
writing a wrapper around `wisent-lex'? The Wisent examples are full of
such constructs, but they don't seem to work.
Another problem occurs with the following combination:
(with-temp-buffer
(emacs-lisp-mode)
(insert "-2.3")
(semantic-lex-init)
(semantic-simple-lexer (point-min) (point-max)))
This analyzes -2.3 as a symbol instead of a number (or punctuation +
number). Is there a simple way to match negative numbers, again without
defining a custom lexer?
Thanks,
Philipp
--
Google Germany GmbH
Dienerstraße 12
80331 München
Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg
Geschäftsführer: Graham Law, Christine Elizabeth Flores
Diese E-Mail ist vertraulich. Wenn Sie nicht der richtige Adressat sind,
leiten Sie diese bitte nicht weiter, informieren Sie den Absender und löschen
Sie die E-Mail und alle Anhänge. Vielen Dank.
This e-mail is confidential. If you are not the right addressee please do not
forward it, please inform the sender, and please erase this e-mail including
any attachments. Thanks.
reply other threads:[~2015-06-16 13:53 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=wvr4y4jj220h.fsf@qarth.roam.corp.google.com \
--to=p.stephani2@gmail.com \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.