Re: [PATCH v1] kconfig: add config and source entry details

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Apr 23, 2024 at 3:41 PM Prasad Pandit <pjp@xxxxxxxxxxxxxxxxx> wrote:
>
> Hi,
>
> On Saturday, 20 April, 2024 at 12:54:59 pm IST, Masahiro Yamada wrote:
> >>Because even config entries ending with an 'EOF' are not flagged as an error.
> >Why should it be flagged as an error?
>
> * Kconfig file defines records of config entries, wherein each line starts with a keyword. Line there implies an EOL at the end. So when a config entry does not end with an EOL, then it is inconsistent with other config records, which then requires special handling while parsing. Ex.
>
>    config OPTION-A
>       bool
>       default 1
>
>    config OPTION-B
>       stirng
>       default "Value-B"
>
>    ....
>
>    config OPTION-N
>       int<EOF>
>
> If the last entry was like int<EOL><EOF>, that makes them entries consistent and easier to parse. I don't see much value in allowing such inconsistency.



EOL is a statement separator.

There is no ambiguity even if the last statement lacks EOL
because the whole code ends with EOF anyway.



Could you give me an example programming language
that errors out when \n is missing at the end of the
source file?



I do not think requiring EOL at the end of file
would help simplify the lexer/parser.

When the lexer is encountered with EOF, it must
tell the parser to finish the current statement
and go back to the previous source file.
So, EOF implies the end of the statement anyway.



> >Kconfig does not require a new line at the end of file.
> >Same for other languages such as C, Python, etc.
>
> * It's not about EOL at the end of file, but EOL at the end of a config entry/record.
>
> * C, Python all languages define statements to have fixed format ex. in C statement must end with a semi-colon (;), a function definition has to have both opening ({) and closing braces (}). Python requires that a conditional statement must end with a colon (:) character, Python also requires that indentations are consistent.
>
>     $ python t.py
>     File "/tmp/t.py", line 3
>       if (x == 10)
>                 ^
>     SyntaxError: expected ':'
>
> And any such digressions are flagged as an error. IMHO, config entry records should have consistent format/syntax.



This is a job of linter or code formatter.


Requiring a new line at the end of a file is a coding style.
Not a grammatical requirement.







>
>
> Thank you.
> ---
>   -Prasad



-- 
Best Regards
Masahiro Yamada





[Index of Archives]     [Linux&nblp;USB Development]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite Secrets]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux