[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Using semantic lexers together with Wisent
From: |
Philipp Stephani |
Subject: |
Using semantic lexers together with Wisent |
Date: |
Tue, 16 Jun 2015 15:53:18 +0200 |
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.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Using semantic lexers together with Wisent,
Philipp Stephani <=