* CamlP4 lexer problem
@ 2008-06-30 17:46 dream.designer
2008-06-30 19:18 ` [Caml-list] " Richard Jones
0 siblings, 1 reply; 4+ messages in thread
From: dream.designer @ 2008-06-30 17:46 UTC (permalink / raw)
To: caml-list
[-- Attachment #1: Type: text/plain, Size: 864 bytes --]
Hello everyone.
I'm trying to write a syntax extension that introduces two new tokens "[%"
and "%]". But I'm getting a syntax error if token ")" follows token "%]".
Could anybody help me please?
Here's the minimal syntax extension code that reproduces the issue:
===================================================================
open Camlp4.PreCast
open Syntax
EXTEND Gram
expr:
[ [ "[%"; e = expr LEVEL "simple"; "%]" -> e ] ] ;
END ;;
===================================================================
Usage sample:
===================================================================
# [% 5 %] ;;
- : int = 5
# ([% 5 %]) ;;
Characters 6-9:
([% 5 %]);;
^^^
Parse error: [expr level simple] expected after "[%" (in [expr])
===================================================================
Thanks in advance.
--
vadim.shender@gmail.com
[-- Attachment #2: Type: text/html, Size: 2602 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Caml-list] CamlP4 lexer problem
2008-06-30 17:46 CamlP4 lexer problem dream.designer
@ 2008-06-30 19:18 ` Richard Jones
2008-06-30 19:24 ` Vadim Shender
0 siblings, 1 reply; 4+ messages in thread
From: Richard Jones @ 2008-06-30 19:18 UTC (permalink / raw)
To: dream.designer; +Cc: caml-list
On Mon, Jun 30, 2008 at 08:46:57PM +0300, dream.designer wrote:
> # ([% 5 %]) ;;
> Characters 6-9:
> ([% 5 %]);;
> ^^^
> Parse error: [expr level simple] expected after "[%" (in [expr])
Is it not just the case that the scanner thinks %]) is a single token?
Rich.
--
Richard Jones
Red Hat
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Caml-list] CamlP4 lexer problem
2008-06-30 19:18 ` [Caml-list] " Richard Jones
@ 2008-06-30 19:24 ` Vadim Shender
2008-07-01 10:16 ` Nicolas Pouillard
0 siblings, 1 reply; 4+ messages in thread
From: Vadim Shender @ 2008-06-30 19:24 UTC (permalink / raw)
To: Richard Jones; +Cc: caml-list
[-- Attachment #1: Type: text/plain, Size: 467 bytes --]
Yes, seems so, but is there a way to make it think otherwise?
2008/6/30 Richard Jones <rich@annexia.org>:
> On Mon, Jun 30, 2008 at 08:46:57PM +0300, dream.designer wrote:
> > # ([% 5 %]) ;;
> > Characters 6-9:
> > ([% 5 %]);;
> > ^^^
> > Parse error: [expr level simple] expected after "[%" (in [expr])
>
> Is it not just the case that the scanner thinks %]) is a single token?
>
> Rich.
>
> --
> Richard Jones
> Red Hat
>
--
vadim.shender@gmail.com
[-- Attachment #2: Type: text/html, Size: 901 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Caml-list] CamlP4 lexer problem
2008-06-30 19:24 ` Vadim Shender
@ 2008-07-01 10:16 ` Nicolas Pouillard
0 siblings, 0 replies; 4+ messages in thread
From: Nicolas Pouillard @ 2008-07-01 10:16 UTC (permalink / raw)
To: dream.designer; +Cc: Richard Jones, caml-list
[-- Attachment #1: Type: text/plain, Size: 595 bytes --]
Excerpts from dream.designer's message of Mon Jun 30 21:24:30 +0200 2008:
> Yes, seems so, but is there a way to make it think otherwise?
Not really.
> 2008/6/30 Richard Jones <rich@annexia.org>:
>
> > On Mon, Jun 30, 2008 at 08:46:57PM +0300, dream.designer wrote:
> > > # ([% 5 %]) ;;
> > > Characters 6-9:
> > > ([% 5 %]);;
> > > ^^^
> > > Parse error: [expr level simple] expected after "[%" (in [expr])
> >
> > Is it not just the case that the scanner thinks %]) is a single token?
> >
> > Rich.
> >
> > --
> > Richard Jones
> > Red Hat
> >
>
--
Nicolas Pouillard aka Ertai
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 240 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-07-01 10:17 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-06-30 17:46 CamlP4 lexer problem dream.designer
2008-06-30 19:18 ` [Caml-list] " Richard Jones
2008-06-30 19:24 ` Vadim Shender
2008-07-01 10:16 ` Nicolas Pouillard
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox