Ask a questionAsk a question
 

AnswerToken Alias problem ?

  • Wednesday, September 30, 2009 7:10 AMGary Ranson Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hi,

    I am currently crafting a DSL and have discovered what I think may be a problem. In my reseach, I have discovered a similar problem which relates to the use of the CaseInsensitive attribute, but I will document it here anyway.

    for a syntax defined as such ...

    token   tRelation
            =   "<"     => "LessThan"
            |   ">"     => "GreaterThan"
            |   "<="    => "LessThanOrEqual"
            |   ">="    => "GreaterThanOrEqual"
            ;

    syntax  RelationalExpression
            =   p:AdditiveExpression => p
            |   l:RelationalExpression t:tRelation r:AdditiveExpression => id(t){Left=>l,Right=>r}
            |   l:RelationalExpression t:tRelation error
            ;
           
    You will notice that I use the "id(x)" form. This works very well for me, but with one exception. The AST is built perfectly, but for some reason the syntax highlighting does not work for any token with an alias. Interestingly, there problem also exists for ActiPro's SyntaxEditor with their Oslo plugin.

    Can anyone comment on this, or is this by design?

    Regards,

    Gary Ranson.

Answers

  • Tuesday, October 27, 2009 2:33 PMKraig BrockschmidtMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Gary--do you have any more info here? Otherwise this question is getting old and I'd like to close the thread instead of leaving it dangling.

    .Kraig

All Replies

  • Friday, October 02, 2009 6:18 PMKraig BrockschmidtMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    HI Gary--one of the members of the "M" team (who help he get answers for these question) asked if you could explain what's happening a little more. Could you supply your grammar file, an example input file, and both your expected and observed behaviors?

    Thanks

    .Kraig
  • Monday, October 05, 2009 6:18 PMDavid LangworthyMSFTUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    The syntax highlighting is driven at a pretty low level, so I can belive that if its going wrong in one place that it's going wrong in another. 

    Where is the attribute that declares the token as an operator?
  • Tuesday, October 27, 2009 2:33 PMKraig BrockschmidtMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Gary--do you have any more info here? Otherwise this question is getting old and I'd like to close the thread instead of leaving it dangling.

    .Kraig