|
|
|
Re: Column based grammar [message #1075738 is a reply to message #1075596] |
Tue, 30 July 2013 01:07 |
Henrik Lindberg Messages: 2509 Registered: July 2009 |
Senior Member |
|
|
On 2013-29-07 20:08, Paulo Dias wrote:
> I think I do not explained correctly the issue.
>
> I'm not talking about validation, but to have that rules enforced by the
> grammar. Explaining better (I hope so):
>
It is a really bad idea - because the user will be hammered with syntax
errors without further explanation or help. IMHO, you want to do this in
validation; that is almost the same as having the grammar enforce it. If
you want other features like code completion to behave differently
depending on where on the line it is invoked, you need to also handle
that naturally.
As a rule of thumb, the grammar should be as forgiving as possible since
this enables you to give the user a better editing/quick fix experience.
When you implement it this way, and something is in error, you can
provide the user with quick fixes like "move it/indent it, put it first
on the line, etc...".
> Is there a way to specify on a rule that expresses that a specific
> keyword is only upper case with 3 of size and starts at column 1 or that
> the comment can be any character starting at position (column) 30 til
> the end of line.
>
No.
The way to do it would be to enforce/check it in the lexer and emit
different tokens. This would only lead to grammatical errors which will
manifest themselves as syntax errors to the user.
> Thanks
|
|
|
|
Powered by
FUDForum. Page generated in 0.04009 seconds