Hi,
If a symbol in clojure can be:
list)
then I think you are out of luck. How can you ever know if it is a
paren or not?
If the symbol is instead represented like this in your text file:
list\)
then you will need tup write your own symbol lexer which would probably
look like this:
"\\(\\w\\|[\\][()]\\)+"
^ ^---^-- chars to be quoted
+--- symbol chars
you would then need to make sure your syntax table lists parens as
parens, not as symbol constituents.
In this case, it is all about the lexer. The grammar should be fine.
Good Luck
Eric
On 09/18/2012 08:14 AM, kototama kototama wrote:
> Hi,
>
>
> I'm trying to parse some Clojure code, and I have a rule like this in
> my grammar:
>
> LPAREN atom RPAREN
>
> (Basically here above instead of atom it should be list-content, but
> let's use this example to simplify).
>
> atom:
> SYMBOL
> | ... other things ...
>
> The problem is ( and ) are valid characters within a symbol in
> Clojure. For instance this expression is valid (\)) and represents a
> list containing the ) character (the expression should be quoted to be
> valid but this does not matter for the example).
>
> I get a failure with the lexer because this expression:
>
> (list)
>
> returns
> ((LPAREN 1 . 2)
> (SYMBOL 2 . 7))
>
> instead of LPAREN SYMBOL RPAREN since my regular expressions for
> lexing symbols allows the parenthesis.
>
>
> I'm a bit rusted with Bison so I'm not even sure if it's possible to
> achieve what I want with a LALR parser.
>
> Is there a solution?
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> cedet-semantic mailing list
> cedet-semantic@...
> https://lists.sourceforge.net/lists/listinfo/cedet-semantic
>
|