MGrammar Syntax Highlighting

SyntaxEditor for WPF Forum

Posted 10 years ago by Bradley
Avatar
I'm not really sure if this belongs in the actipro forum or a MS forum as I'm not sure what's going on behind the scenes. The DSL I'm working on supports variables and functions. All variables are identified as

final token AlphaNumeric  =  (Letter | Digit | NegativeDigit | ""_"");  
@{Classification[""Identifier""]}                     
final token tID            = Common.Letter Common.AlphaNumeric*; 
and functions are

@{Classification[""Functions""]}  
final token Functions = (Letter | Digit | '.' | '_');  
@{Classification[""Functions""]}
token func = Common.Letter Common.Functions*;
and used like
syntax sFunctionStatement = x:func lparent  s:Common.List( sFunctionParamaters ) rparent "";""? => FunctionStatement{Name{x}, ParamaterList{s}};
So the only real difference is functions support the ".". Now all my grammar gets compiled properly so functions are being identified as functions and not identifiers in my AST. The problem is when I load up my syntax editor and start typing in code all the syntax highlighting works fine except every function gets identified as an identifier unless it has a "." in it. Any ideas? It's probably a bug with my grammar instead of MGrammar or Syntax Editor, but I'm not really sure of a way around it. Thanks

Comments (2)

Posted 10 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Bradley,

You'd probably want to post in the Microsoft MGrammar forums for more help on that. Offhand it looks like you've created an ambiguous choice between the identifier and function in some scenarios (where there is no dot), so it doesn't know which one to pick. That's my guess anyhow, but I'm sure Microsoft could give you some more insight on how to handle it.


Actipro Software Support

Posted 10 years ago by Bradley
Avatar
I will give that a shot, but there's no ambiguity warnings popping up either in my code when I try to parse it or in Intellipad so I don't think it's an ambiguity problem.
The latest build of this product (v2019.1 build 0683) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.