commit 93c905bb3838a1ac2081b60bbe616c34ef406383 Author: anon Date: Tue Aug 15 23:24:34 2023 +0200 init diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..92afa22 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +__pycache__/ +venv/ diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..b154203 --- /dev/null +++ b/Makefile @@ -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 diff --git a/config.py b/config.py new file mode 100644 index 0000000..ca8e708 --- /dev/null +++ b/config.py @@ -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" diff --git a/hl.vim b/hl.vim new file mode 100644 index 0000000..f3828f9 --- /dev/null +++ b/hl.vim @@ -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 \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..dc1536f --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +requests +bs4 diff --git a/scrapper.py b/scrapper.py new file mode 100755 index 0000000..d1c935d --- /dev/null +++ b/scrapper.py @@ -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) diff --git a/special.list b/special.list new file mode 100644 index 0000000..cdb3cf7 --- /dev/null +++ b/special.list @@ -0,0 +1,10 @@ +true +false +LLVM +Google +Chromium +Mozilla +WebKit +Microsoft +GNU +InheritParentConfig diff --git a/template.vim b/template.vim new file mode 100644 index 0000000..8fb78f5 --- /dev/null +++ b/template.vim @@ -0,0 +1,2 @@ +" Vim highlighting for clang-format (.clang-tidy files) +syn match Comment "^\s*#.*"