This commit is contained in:
anon 2023-08-15 23:24:34 +02:00
commit 93c905bb38
8 changed files with 65 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
__pycache__/
venv/

13
Makefile Normal file
View File

@ -0,0 +1,13 @@
include config.py
main: venv
cp ${TEMPLATE} ${OUT}
source venv/bin/activate; \
python scrapper.py >> ${OUT}
printf ${VIM_SPECIAL_HL_STR} >> ${OUT}
tr '\n' ' ' < special.list >> ${OUT}
venv:
python -m venv venv
source venv/bin/activate; pip install -r requirements.txt

6
config.py Normal file
View File

@ -0,0 +1,6 @@
URL="https://clang.llvm.org/docs/ClangFormatStyleOptions.html"
VIM_KEY_HL_STR="syn keyword Type %s"
VIM_VAL_HL_STR="syn keyword Constant %s"
VIM_SPECIAL_HL_STR="syn keyword Special " # append only
OUT="hl.vim"
TEMPLATE="template.vim"

5
hl.vim Normal file
View File

@ -0,0 +1,5 @@
" Vim highlighting for clang-format (.clang-tidy files)
syn match Comment "^\s*#.*"
syn keyword Type BasedOnStyle AccessModifierOffset AlignAfterOpenBracket AlignArrayOfStructures AlignConsecutiveAssignments AlignConsecutiveBitFields AlignConsecutiveDeclarations AlignConsecutiveMacros AlignConsecutiveShortCaseStatements AlignEscapedNewlines AlignOperands AlignTrailingComments AllowAllArgumentsOnNextLine AllowAllConstructorInitializersOnNextLine AllowAllParametersOfDeclarationOnNextLine AllowShortBlocksOnASingleLine AllowShortCaseLabelsOnASingleLine AllowShortEnumsOnASingleLine AllowShortFunctionsOnASingleLine AllowShortIfStatementsOnASingleLine AllowShortLambdasOnASingleLine AllowShortLoopsOnASingleLine AlwaysBreakAfterDefinitionReturnType AlwaysBreakAfterReturnType AlwaysBreakBeforeMultilineStrings AlwaysBreakTemplateDeclarations AttributeMacros BinPackArguments BinPackParameters BitFieldColonSpacing BraceWrapping BracedInitializerIndentWidth BreakAfterAttributes BreakAfterJavaFieldAnnotations BreakArrays BreakBeforeBinaryOperators BreakBeforeBraces BreakBeforeConceptDeclarations BreakBeforeInlineASMColon BreakBeforeTernaryOperators BreakConstructorInitializers BreakInheritanceList BreakStringLiterals ColumnLimit CommentPragmas CompactNamespaces ConstructorInitializerAllOnOneLineOrOnePerLine ConstructorInitializerIndentWidth ContinuationIndentWidth Cpp11BracedListStyle DeriveLineEnding DerivePointerAlignment DisableFormat EmptyLineAfterAccessModifier EmptyLineBeforeAccessModifier ExperimentalAutoDetectBinPacking FixNamespaceComments ForEachMacros IfMacros IncludeBlocks IncludeCategories IncludeIsMainRegex IncludeIsMainSourceRegex IndentAccessModifiers IndentCaseBlocks IndentCaseLabels IndentExternBlock IndentGotoLabels IndentPPDirectives IndentRequiresClause IndentWidth IndentWrappedFunctionNames InsertBraces InsertNewlineAtEOF InsertTrailingCommas IntegerLiteralSeparator JavaImportGroups JavaScriptQuotes JavaScriptWrapImports KeepEmptyLinesAtEOF KeepEmptyLinesAtTheStartOfBlocks LambdaBodyIndentation Language LineEnding MacroBlockBegin MacroBlockEnd Macros MaxEmptyLinesToKeep NamespaceIndentation NamespaceMacros ObjCBinPackProtocolList ObjCBlockIndentWidth ObjCBreakBeforeNestedBlockParam ObjCSpaceAfterProperty ObjCSpaceBeforeProtocolList PPIndentWidth PackConstructorInitializers PenaltyBreakAssignment PenaltyBreakBeforeFirstCallParameter PenaltyBreakComment PenaltyBreakFirstLessLess PenaltyBreakOpenParenthesis PenaltyBreakString PenaltyBreakTemplateDeclaration PenaltyExcessCharacter PenaltyIndentedWhitespace PenaltyReturnTypeOnItsOwnLine PointerAlignment QualifierAlignment QualifierOrder RawStringFormats ReferenceAlignment ReflowComments RemoveBracesLLVM RemoveParentheses RemoveSemicolon RequiresClausePosition RequiresExpressionIndentation SeparateDefinitionBlocks ShortNamespaceLines SortIncludes SortJavaStaticImport SortUsingDeclarations SpaceAfterCStyleCast SpaceAfterLogicalNot SpaceAfterTemplateKeyword SpaceAroundPointerQualifiers SpaceBeforeAssignmentOperators SpaceBeforeCaseColon SpaceBeforeCpp11BracedList SpaceBeforeCtorInitializerColon SpaceBeforeInheritanceColon SpaceBeforeJsonColon SpaceBeforeParens SpaceBeforeParensOptions SpaceBeforeRangeBasedForLoopColon SpaceBeforeSquareBrackets SpaceInEmptyBlock SpaceInEmptyParentheses SpacesBeforeTrailingComments SpacesInAngles SpacesInCStyleCastParentheses SpacesInConditionalStatement SpacesInContainerLiterals SpacesInLineCommentPrefix SpacesInParens SpacesInParensOptions SpacesInParentheses SpacesInSquareBrackets Standard StatementAttributeLikeMacros StatementMacros TabWidth TypeNames TypenameMacros UseCRLF UseTab VerilogBreakBetweenInstancePorts WhitespaceSensitiveMacros
syn keyword Constant Empty OnlyFirstIf Java Middle NonEmptyParentheses Signature MultipleParentheses Pointer LogicalBlock DeriveLF Double DeriveCRLF CRLF TableGen BinPack BeforeHash Never CaseSensitive AllDefinitions Allowed Attach Align Verilog AlignWithSpaces Stroustrup Keyword Always Linux OwnLine Merge Yes SingleLine Default ForIndentation WithPreceding Mozilla LF Left BeforeComma Preserve All Cpp AfterComma TopLevel ForContinuationAndIndentation Wrapped NonAssignment Single GNU BeforeColon NextLineOnly Inline CSharp WithFollowing None Right CaseInsensitive MultiLine Regroup AfterExternBlock Both ControlStatements ControlStatementsExceptControlMacros Inner InlineOnly Allman TopLevelDefinitions AlwaysBreak Indent Latest No CurrentLine Whitesmiths ReturnStatement Proto AlignAfterOperator WebKit WithoutElse OnlyMultiline Auto OuterScope Custom AllIfsAndElse DontAlign AfterColon Before After ObjC BlockIndent TextProto Lexicographic AfterHash Leave NextLine NoIndent Json JavaScript LexicographicNumeric
syn keyword Special true false LLVM Google Chromium Mozilla WebKit Microsoft GNU InheritParentConfig

2
requirements.txt Normal file
View File

@ -0,0 +1,2 @@
requests
bs4

25
scrapper.py Executable file
View File

@ -0,0 +1,25 @@
#!/bin/python3
import requests
import bs4
import re
from config import *
c = []
page = bs4.BeautifulSoup(requests.get(URL).text, 'html.parser')
# Keys
for i in page.find_all('dl'):
i = i.find('strong')
if i != None:
c.append(i.get_text())
VIM_KEY_HL_STR = VIM_KEY_HL_STR.replace("%s", ' '.join(c))
print(VIM_KEY_HL_STR)
# Values
c = set()
for i in re.finditer(r'\(in configuration: (\w+)\)', page.get_text()):
c.update([i.group(1)])
VIM_VAL_HL_STR = VIM_VAL_HL_STR.replace("%s", ' '.join(c))
print(VIM_VAL_HL_STR)

10
special.list Normal file
View File

@ -0,0 +1,10 @@
true
false
LLVM
Google
Chromium
Mozilla
WebKit
Microsoft
GNU
InheritParentConfig

2
template.vim Normal file
View File

@ -0,0 +1,2 @@
" Vim highlighting for clang-format (.clang-tidy files)
syn match Comment "^\s*#.*"