You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The only two currently available printer patterns @NewLine and @Indent are not flexible enough to define the default formatting a language should have. The following features are missing:
Printer pattern for a TokenPart (i.e. from @Before, @After) enabling:
leading new line
newline bewteen tokens in String[] value
trailing new line
indentation
Printer pattern enabling trailing new line after BindingNotationPart or OptionalPart. Currently @NewLine can be used to put a leading new line there.
Suggestions:
add an enum field to @NewLine with values BEFORE, AFTER, BOTH; or
rename @NewLine to @OnNewLine/@FirstOnLine and introduce a new annotation @LastOnLine/@OnEndOfLine
Separator new line style with the following options:
i. last on line
elem1,
elem2
ii. first on line
elem1
, elem2
iii. no new line elem1 , elem2
iv. own line
elem1
,
elem2
Note: It should be possible to define an empty separator just with the new line style.
"Stickiness" of TokenParts and Separators. It is the ability of the terminal token (usually punctuation) to ignore whitespace from its sides:
not sticky array [ 0 ] . method ( )
left-sticky separator elem1, elem2, elem3
right-sticky lpar if (condition
both sides sticky dot operator obj.method
Empty separator should be implicitly sticky from either right or left, so that there is only 1 space
Optionally define more abstract annotations, which replace multiple usages of others. F.e. @Vertical for marking a constructor instead of writing @NewLine before all parameters starting with the second (skipping the first because that should be governed from outside). However, it should be thought through whether the new line applies before the first @Before token or before the actual properties.
Optional: TokenParts do not have a connection with their property currently. That means there is no way to know where the last token from @After ends and where the first token from the next @Before starts. It could maybe be useful to know which tokens are in one "group" for some formatting in the future. F.e. @Vertical could be applied also to one group, meaning each token from @Before, @After and the property are on a new line.
The text was updated successfully, but these errors were encountered:
Another feature can be optional TokenParts. Theoretically, this could be achieved with @Flag (#31), but maybe we do not really need the boolean value itself, so that the abstract syntax is not touched, only the concrete syntax. Example: the optional AN keyword in LOLCODE binary operators.
The only two currently available printer patterns
@NewLine
and@Indent
are not flexible enough to define the default formatting a language should have. The following features are missing:TokenPart
(i.e. from@Before
,@After
) enabling:String[] value
BindingNotationPart
orOptionalPart
. Currently@NewLine
can be used to put a leading new line there.Suggestions:
@NewLine
with valuesBEFORE
,AFTER
,BOTH
; or@NewLine
to@OnNewLine
/@FirstOnLine
and introduce a new annotation@LastOnLine
/@OnEndOfLine
i. last on line
ii. first on line
iii. no new line
elem1 , elem2
iv. own line
TokenParts
andSeparators
. It is the ability of the terminal token (usually punctuation) to ignore whitespace from its sides:array [ 0 ] . method ( )
elem1, elem2, elem3
if (condition
obj.method
Optionally define more abstract annotations, which replace multiple usages of others. F.e.
@Vertical
for marking a constructor instead of writing@NewLine
before all parameters starting with the second (skipping the first because that should be governed from outside). However, it should be thought through whether the new line applies before the first@Before
token or before the actual properties.Optional:
TokenParts
do not have a connection with their property currently. That means there is no way to know where the last token from@After
ends and where the first token from the next@Before
starts. It could maybe be useful to know which tokens are in one "group" for some formatting in the future. F.e.@Vertical
could be applied also to one group, meaning each token from@Before
,@After
and the property are on a new line.The text was updated successfully, but these errors were encountered: