summaryrefslogtreecommitdiff
path: root/usr.bin/indent/indent.h
AgeCommit message (Collapse)Author
2023-06-26indent: implement 'blank line above first statement in function body'rillig
2023-06-23indent: properly store parser state in debug moderillig
The stacks in the parser state are allocated now and need to be copied individually. The test whether two paren stacks are equal was broken since 2023-06-14 14:11:28.
2023-06-16indent: merge lexer symbols for type in/outside parenthesesrillig
2023-06-16indent: fix indentation and linebreaks in typedef declarationsrillig
2023-06-16indent: don't force a blank line between '}' and preprocessing linerillig
2023-06-16indent: rename a field of the parser staterillig
The previous name 'comment_in_first_line' was misleading, as it could mean that there was a comment in the first line of the file. No functional change.
2023-06-15indent: rename state variable to be more accuraterillig
No binary change.
2023-06-14indent: clean up the code, add a few testsrillig
2023-06-14indent: allow more than 128 brace levelsrillig
2023-06-14indent: clean up array indexing for parser symbolsrillig
With 'top' pointing to the actual top element, the array was indexed in the closed range from 0 to top. All other arrays are indexed by the usual half-open interval from 0 to len. No functional change.
2023-06-14indent: allow more than 20 nested parentheses or bracketsrillig
2023-06-14indent: clean up debugging coderillig
2023-06-14indent: clean up handling of commentsrillig
One less moving part in the parser state. No functional change.
2023-06-14indent: remove another flag from parser staterillig
When processing a comment, the flag ps.next_col_1 was not used for the next token, but for a line within a comment. As its scope was limited to a single comment, there is no need to store it any longer than that No functional change.
2023-06-14indent: remove a redundant flag from the parser staterillig
No functional change.
2023-06-14indent: merge parser symbols for stmt and stmt_listrillig
They were handled in exactly the same way.
2023-06-10indent: rename misleading variablerillig
The name started with 'line_start', but the value is not always the value from the beginning of the line. No functional change.
2023-06-10indent: miscellaneous cleanupsrillig
2023-06-10indent: in debug mode, null-terminate buffersrillig
2023-06-10indent: clean up function and variable namesrillig
2023-06-10indent: rename and sort variables in parser staterillig
No functional change.
2023-06-09indent: trim trailing blank linesrillig
2023-06-09indent: group lexer symbols by topic, sort processing functionsrillig
No functional change.
2023-06-09indent: don't treat function call expressions as cast expressionsrillig
2023-06-09indent: when an indentation is ambiguous, indent one level furtherrillig
The '-eei' mode now applies whenever the indentation from a multi-line expression could be confused with a following statement.
2023-06-08indent: remove fragile heuristic for detecting cast expressionsrillig
The assumption that in an expression of the form '(a * anything)', the '*' marks a pointer type was too simple-minded. For now, fix the obvious cases and leave the others for later. If needed, they can be worked around using the '-T' option.
2023-06-08indent: clean up and condense coderillig
No functional change.
2023-06-07indent: extract the stack of parser symbols to a separate structrillig
No functional change.
2023-06-06indent: compute indentation of 'case' labels on-demandrillig
One less moving part to keep track of. No functional change.
2023-06-05indent: sync debug output with parser staterillig
2023-06-05indent: format own source coderillig
2023-06-05indent: do not report broken lines, report configuration on stderrrillig
2023-06-05indent: rename variables, clean up commentsrillig
No binary change.
2023-06-04indent: remove read pointer from buffers that don't need itrillig
The only buffer that needs a read pointer is the current input line in 'inp'. No functional change.
2023-06-04indent: track the kind of '{' on the parser stackrillig
2023-06-04indent: fix debug output of the parser symbol stackrillig
Even though the stack always contains a stmt_list as first element, print it nevertheless to avoid confusion about starting at index 1, and to provide the full picture.
2023-06-04indent: rename struct field, for better symmetryrillig
No binary change outside debug mode.
2023-06-04lint: use separate lexer symbols for 'case' and 'default'rillig
It's not strictly necessary since these tokens behave in the same way, still, the code is more straight-forward when there are separate tokens.
2023-06-04indent: classify 'inline' as a modifier rather than a wordrillig
2023-06-04indent: use separate lexer symbols for the different kinds of ':'rillig
2023-06-04indent: handle the indentation of 'case' in a simpler wayrillig
2023-06-04indent: separate code for handling parentheses and bracketsrillig
Handling parentheses is more complicated than for brackets.
2023-06-02indent: improve heuristics of classifying '*' as pointer or operatorrillig
2023-06-02indent: clean uprillig
Only print the 'token' buffer in debug mode if it is interesting, group the blocks in handling of '(' tokens by topic, remove obsolete comment from test.
2023-06-02indent: fix formatting of declarations with preprocessing linesrillig
2023-05-23indent: split debug output into paragraphsrillig
The paragraphs separate the different processing steps: getting a token from the lexer, processing the token, updating the parser state, sending a finished line to the output.
2023-05-23indent: fix spacing in declarations in for loopsrillig
2023-05-22indent: implement suppressing optional blank linesrillig
2023-05-20indent: extract the output state from the parser staterillig
The parser state depends on the preprocessing lines, the output state shouldn't.
2023-05-20indent: implement blank line above block commentrillig