caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* 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

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;
as well as URLs for NNTP newsgroup(s).