mirror of
https://github.com/pocketpy/pocketpy
synced 2025-11-08 20:50:16 +00:00
add formats.
This commit is contained in:
parent
f34b1eb0e4
commit
d37c11090d
106
.clang-format
106
.clang-format
@ -1,6 +1,102 @@
|
|||||||
# https://clang.llvm.org/docs/ClangFormatStyleOptions.html
|
|
||||||
BasedOnStyle: Google
|
|
||||||
IndentWidth: 4
|
|
||||||
UseTab: Never
|
|
||||||
|
|
||||||
IndentPPDirectives: BeforeHash
|
# clang-format configuration
|
||||||
|
# compatible with clang-format 18
|
||||||
|
|
||||||
|
UseTab: Never
|
||||||
|
ColumnLimit: 120
|
||||||
|
|
||||||
|
# Indent
|
||||||
|
IndentWidth: 4
|
||||||
|
BracedInitializerIndentWidth: 4
|
||||||
|
AccessModifierOffset: -4
|
||||||
|
IndentAccessModifiers: false
|
||||||
|
IndentCaseLabels: true
|
||||||
|
IndentExternBlock: Indent
|
||||||
|
IndentGotoLabels: true
|
||||||
|
IndentRequiresClause: true
|
||||||
|
IndentWrappedFunctionNames: true
|
||||||
|
NamespaceIndentation: None
|
||||||
|
LambdaBodyIndentation: Signature
|
||||||
|
BitFieldColonSpacing: Both
|
||||||
|
|
||||||
|
# Insert
|
||||||
|
InsertBraces: true
|
||||||
|
InsertNewlineAtEOF: true
|
||||||
|
KeepEmptyLinesAtEOF: true
|
||||||
|
|
||||||
|
# Align
|
||||||
|
AlignAfterOpenBracket: true
|
||||||
|
AlignTrailingComments:
|
||||||
|
Kind: Always
|
||||||
|
|
||||||
|
AlignArrayOfStructures: Left
|
||||||
|
PointerAlignment: Left
|
||||||
|
|
||||||
|
BreakAfterAttributes: Leave
|
||||||
|
BreakBeforeBinaryOperators: None
|
||||||
|
BreakBeforeConceptDeclarations: Always
|
||||||
|
BreakBeforeInlineASMColon: OnlyMultiline
|
||||||
|
BreakBeforeTernaryOperators: true
|
||||||
|
BreakConstructorInitializers: AfterColon
|
||||||
|
BreakInheritanceList: AfterColon
|
||||||
|
BreakAdjacentStringLiterals: false
|
||||||
|
BreakStringLiterals: false
|
||||||
|
CompactNamespaces: false
|
||||||
|
Cpp11BracedListStyle: true
|
||||||
|
EmptyLineAfterAccessModifier: Never
|
||||||
|
EmptyLineBeforeAccessModifier: Always
|
||||||
|
|
||||||
|
AllowAllArgumentsOnNextLine: false
|
||||||
|
AllowAllParametersOfDeclarationOnNextLine: false
|
||||||
|
AllowBreakBeforeNoexceptSpecifier: Never
|
||||||
|
AllowShortBlocksOnASingleLine: Always
|
||||||
|
AllowShortCaseLabelsOnASingleLine: true
|
||||||
|
AllowShortCompoundRequirementOnASingleLine: true
|
||||||
|
AllowShortEnumsOnASingleLine: true
|
||||||
|
AllowShortFunctionsOnASingleLine: All
|
||||||
|
AllowShortIfStatementsOnASingleLine: Never
|
||||||
|
AllowShortLambdasOnASingleLine: All
|
||||||
|
AllowShortLoopsOnASingleLine: false
|
||||||
|
AlwaysBreakAfterReturnType: None
|
||||||
|
AlwaysBreakBeforeMultilineStrings: true
|
||||||
|
AlwaysBreakTemplateDeclarations: Yes
|
||||||
|
RequiresClausePosition: OwnLine
|
||||||
|
BinPackArguments: false
|
||||||
|
BinPackParameters: false
|
||||||
|
|
||||||
|
# Space
|
||||||
|
SeparateDefinitionBlocks: Always
|
||||||
|
SpaceBeforeParens: Custom
|
||||||
|
SpaceBeforeParensOptions:
|
||||||
|
AfterControlStatements: false
|
||||||
|
AfterForeachMacros: false
|
||||||
|
AfterFunctionDeclarationName: false
|
||||||
|
AfterFunctionDefinitionName: false
|
||||||
|
AfterIfMacros: false
|
||||||
|
AfterOverloadedOperator: true
|
||||||
|
AfterRequiresInClause: true
|
||||||
|
AfterRequiresInExpression: false
|
||||||
|
BeforeNonEmptyParentheses: false
|
||||||
|
|
||||||
|
SpaceBeforeRangeBasedForLoopColon: false
|
||||||
|
SpaceBeforeSquareBrackets: false
|
||||||
|
SpaceInEmptyBlock: false
|
||||||
|
SpacesBeforeTrailingComments: 2
|
||||||
|
SpacesInAngles: Never
|
||||||
|
|
||||||
|
SpacesInParens: Custom
|
||||||
|
SpacesInParensOptions:
|
||||||
|
InConditionalStatements: false
|
||||||
|
InCStyleCasts: false
|
||||||
|
InEmptyParentheses: false
|
||||||
|
Other: false
|
||||||
|
|
||||||
|
SpacesInSquareBrackets: false
|
||||||
|
|
||||||
|
# Order
|
||||||
|
QualifierAlignment: Custom
|
||||||
|
QualifierOrder: ["constexpr", "const", "inline", "static", "type"]
|
||||||
|
SortIncludes: Never
|
||||||
|
SortUsingDeclarations: LexicographicNumeric
|
||||||
|
|
||||||
|
WhitespaceSensitiveMacros: ["PK_PROTECTED"]
|
||||||
@ -16,7 +16,7 @@ def get_all_files(root: str):
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
files = []
|
files = []
|
||||||
# files.extend(get_all_files('include'))
|
files.extend(get_all_files('include'))
|
||||||
# files.extend(get_all_files('src'))
|
files.extend(get_all_files('src'))
|
||||||
files.extend(get_all_files('src2'))
|
files.extend(get_all_files('src2'))
|
||||||
subprocess.run(['clang-format', '-i'] + files, check=True)
|
subprocess.run(['clang-format', '-i'] + files, check=True)
|
||||||
|
|||||||
@ -110,7 +110,7 @@ namespace pkpy{
|
|||||||
// http://journal.stuffwithstuff.com/2011/03/19/pratt-parsers-expression-parsing-made-easy/
|
// http://journal.stuffwithstuff.com/2011/03/19/pratt-parsers-expression-parsing-made-easy/
|
||||||
#define PK_METHOD(name) &Compiler::name
|
#define PK_METHOD(name) &Compiler::name
|
||||||
#define PK_NO_INFIX nullptr, PREC_LOWEST
|
#define PK_NO_INFIX nullptr, PREC_LOWEST
|
||||||
for(TokenIndex i=0; i<kTokenCount; i++) rules[i] = { nullptr, PK_NO_INFIX };
|
for(TokenIndex i = 0; i < kTokenCount; i++) rules[i] = { nullptr, PK_NO_INFIX };
|
||||||
rules[TK(".")] = { nullptr, PK_METHOD(exprAttrib), PREC_PRIMARY };
|
rules[TK(".")] = { nullptr, PK_METHOD(exprAttrib), PREC_PRIMARY };
|
||||||
rules[TK("(")] = { PK_METHOD(exprGroup), PK_METHOD(exprCall), PREC_PRIMARY };
|
rules[TK("(")] = { PK_METHOD(exprGroup), PK_METHOD(exprCall), PREC_PRIMARY };
|
||||||
rules[TK("[")] = { PK_METHOD(exprList), PK_METHOD(exprSubscr), PREC_PRIMARY };
|
rules[TK("[")] = { PK_METHOD(exprList), PK_METHOD(exprSubscr), PREC_PRIMARY };
|
||||||
|
|||||||
@ -458,8 +458,8 @@ namespace pkpy{
|
|||||||
case '.': case 'f': case 'd': case 's':
|
case '.': case 'f': case 'd': case 's':
|
||||||
case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9':
|
case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9':
|
||||||
return true;
|
return true;
|
||||||
// clang-format on
|
|
||||||
default: return false;
|
default: return false;
|
||||||
|
// clang-format on
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -15,8 +15,8 @@ static bool is_possible_number_char(char c){
|
|||||||
case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
|
case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
|
||||||
case '.': case 'L': case 'x': case 'o': case 'j':
|
case '.': case 'L': case 'x': case 'o': case 'j':
|
||||||
return true;
|
return true;
|
||||||
// clang-format on
|
|
||||||
default: return false;
|
default: return false;
|
||||||
|
// clang-format on
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user