Community
Participate
Working Groups
Build Identifier: I20110613-1736 While editing a .xtext-file within the Xtext editor, I think that it would be useful to get a list of sample strings which match a given grammar rule. This could be delivered as additional information when moving the mouse over the rule name, or via a selection and a context menu. The list should be generated of as many terms of the grammar rule as possible. So that, if you view a grammar rule as a syntex tree, the process of sample string generation should visit each branch at least once. Example: [xtext] terminal ID: '^'?('a'..'z'|'A'..'Z'|'_') ('a'..'z'|'A'..'Z'|'_'|'0'..'9')*; Rule: '^'* ID ('.' ID)?; [/xtext] [generated list for rule Rule] a ^ ^Aa . a ^^ _Aa ^^^ ^b_Aa . Aa ^^^^ B0_Aa ^^^^^ ^_b0_Aa . _Aa ^^^^^^ cBb0_Aa ^^^^^^^ ^C_Bb0_Aa . b_Aa ... [/generated list] The naive approach I tried to follow to generate this short list switches the quantifiers and alternatives. The maximum number of items quantified by '*' or '+' should be relatively small (~10). Maybe it is viable to reuse (parts of) the ANTLR ambiguity calculation to generate the sample strings. Reproducible: Always
I don't think that generated documentation is useful for grammars / terminal rules in any case.