PyReprism 0.0.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (154) hide show
  1. PyReprism/__init__.py +0 -0
  2. PyReprism/languages/__init__.py +147 -0
  3. PyReprism/languages/_base.py +30 -0
  4. PyReprism/languages/abap.py +52 -0
  5. PyReprism/languages/actionscript.py +52 -0
  6. PyReprism/languages/ada.py +53 -0
  7. PyReprism/languages/apacheconf.py +52 -0
  8. PyReprism/languages/apl.py +52 -0
  9. PyReprism/languages/applescript.py +52 -0
  10. PyReprism/languages/arduino.py +52 -0
  11. PyReprism/languages/arff.py +52 -0
  12. PyReprism/languages/asciidoc.py +52 -0
  13. PyReprism/languages/asm6502.py +51 -0
  14. PyReprism/languages/aspnet.py +51 -0
  15. PyReprism/languages/autohotkey.py +51 -0
  16. PyReprism/languages/autoit.py +50 -0
  17. PyReprism/languages/bash.py +52 -0
  18. PyReprism/languages/basic.py +52 -0
  19. PyReprism/languages/batch.py +52 -0
  20. PyReprism/languages/bison.py +52 -0
  21. PyReprism/languages/brainfuck.py +52 -0
  22. PyReprism/languages/bro.py +50 -0
  23. PyReprism/languages/c.py +52 -0
  24. PyReprism/languages/clike.py +52 -0
  25. PyReprism/languages/clojure.py +50 -0
  26. PyReprism/languages/coffeescript.py +50 -0
  27. PyReprism/languages/cpp.py +52 -0
  28. PyReprism/languages/crystal.py +50 -0
  29. PyReprism/languages/csharp.py +53 -0
  30. PyReprism/languages/csp.py +50 -0
  31. PyReprism/languages/css.py +50 -0
  32. PyReprism/languages/css_extras.py +50 -0
  33. PyReprism/languages/d.py +50 -0
  34. PyReprism/languages/dart.py +52 -0
  35. PyReprism/languages/diff.py +49 -0
  36. PyReprism/languages/django.py +55 -0
  37. PyReprism/languages/docker.py +50 -0
  38. PyReprism/languages/eiffel.py +49 -0
  39. PyReprism/languages/elixir.py +50 -0
  40. PyReprism/languages/erb.py +0 -0
  41. PyReprism/languages/erlang.py +50 -0
  42. PyReprism/languages/flow.py +0 -0
  43. PyReprism/languages/fortran.py +49 -0
  44. PyReprism/languages/fsharp.py +49 -0
  45. PyReprism/languages/gedcom.py +0 -0
  46. PyReprism/languages/gherkin.py +0 -0
  47. PyReprism/languages/git.py +0 -0
  48. PyReprism/languages/glsl.py +0 -0
  49. PyReprism/languages/go.py +53 -0
  50. PyReprism/languages/graphql.py +50 -0
  51. PyReprism/languages/groovy.py +53 -0
  52. PyReprism/languages/haml.py +50 -0
  53. PyReprism/languages/handlebars.py +0 -0
  54. PyReprism/languages/haskell.py +53 -0
  55. PyReprism/languages/haxe.py +0 -0
  56. PyReprism/languages/hpkp.py +0 -0
  57. PyReprism/languages/hsts.py +0 -0
  58. PyReprism/languages/html.py +50 -0
  59. PyReprism/languages/ichigojam.py +0 -0
  60. PyReprism/languages/icon.py +0 -0
  61. PyReprism/languages/inform7.py +0 -0
  62. PyReprism/languages/ini.py +41 -0
  63. PyReprism/languages/io.py +0 -0
  64. PyReprism/languages/j.py +50 -0
  65. PyReprism/languages/java.py +53 -0
  66. PyReprism/languages/javascript.py +53 -0
  67. PyReprism/languages/jolie.py +50 -0
  68. PyReprism/languages/json.py +50 -0
  69. PyReprism/languages/jsx.py +53 -0
  70. PyReprism/languages/julia.py +53 -0
  71. PyReprism/languages/keyman.py +0 -0
  72. PyReprism/languages/kotlin.py +53 -0
  73. PyReprism/languages/latex.py +50 -0
  74. PyReprism/languages/less.py +50 -0
  75. PyReprism/languages/liquid.py +49 -0
  76. PyReprism/languages/livescript.py +49 -0
  77. PyReprism/languages/lolcode.py +0 -0
  78. PyReprism/languages/lua.py +0 -0
  79. PyReprism/languages/makefile.py +50 -0
  80. PyReprism/languages/markdown.py +31 -0
  81. PyReprism/languages/markup.py +50 -0
  82. PyReprism/languages/markup_templating.py +0 -0
  83. PyReprism/languages/matlab.py +51 -0
  84. PyReprism/languages/mel.py +0 -0
  85. PyReprism/languages/mizar.py +0 -0
  86. PyReprism/languages/monkey.py +0 -0
  87. PyReprism/languages/n4js.py +50 -0
  88. PyReprism/languages/nasm.py +0 -0
  89. PyReprism/languages/nginx.py +50 -0
  90. PyReprism/languages/nim.py +0 -0
  91. PyReprism/languages/nix.py +0 -0
  92. PyReprism/languages/nsis.py +0 -0
  93. PyReprism/languages/objectivec.py +49 -0
  94. PyReprism/languages/ocaml.py +51 -0
  95. PyReprism/languages/opencl.py +0 -0
  96. PyReprism/languages/oz.py +0 -0
  97. PyReprism/languages/parigp.py +0 -0
  98. PyReprism/languages/parser.py +0 -0
  99. PyReprism/languages/pascal.py +49 -0
  100. PyReprism/languages/perl.py +53 -0
  101. PyReprism/languages/php.py +50 -0
  102. PyReprism/languages/php_extras.py +0 -0
  103. PyReprism/languages/plsql.py +0 -0
  104. PyReprism/languages/powershell.py +0 -0
  105. PyReprism/languages/processing.py +0 -0
  106. PyReprism/languages/prolog.py +51 -0
  107. PyReprism/languages/properties.py +0 -0
  108. PyReprism/languages/protobuf.py +0 -0
  109. PyReprism/languages/pug.py +0 -0
  110. PyReprism/languages/puppet.py +0 -0
  111. PyReprism/languages/pure.py +0 -0
  112. PyReprism/languages/python.py +54 -0
  113. PyReprism/languages/q.py +0 -0
  114. PyReprism/languages/qore.py +0 -0
  115. PyReprism/languages/r.py +0 -0
  116. PyReprism/languages/reason.py +0 -0
  117. PyReprism/languages/renpy.py +0 -0
  118. PyReprism/languages/rest.py +0 -0
  119. PyReprism/languages/rip.py +0 -0
  120. PyReprism/languages/roboconf.py +0 -0
  121. PyReprism/languages/ruby.py +50 -0
  122. PyReprism/languages/rust.py +52 -0
  123. PyReprism/languages/sas.py +0 -0
  124. PyReprism/languages/sass.py +0 -0
  125. PyReprism/languages/scala.py +53 -0
  126. PyReprism/languages/scheme.py +51 -0
  127. PyReprism/languages/scss.py +50 -0
  128. PyReprism/languages/smalltalk.py +51 -0
  129. PyReprism/languages/smarty.py +0 -0
  130. PyReprism/languages/soy.py +0 -0
  131. PyReprism/languages/stylus.py +52 -0
  132. PyReprism/languages/swift.py +52 -0
  133. PyReprism/languages/tcl.py +0 -0
  134. PyReprism/languages/textile.py +0 -0
  135. PyReprism/languages/tsx.py +52 -0
  136. PyReprism/languages/twig.py +0 -0
  137. PyReprism/languages/typescript.py +52 -0
  138. PyReprism/languages/vbnet.py +51 -0
  139. PyReprism/languages/velocity.py +52 -0
  140. PyReprism/languages/verilog.py +0 -0
  141. PyReprism/languages/vhdl.py +0 -0
  142. PyReprism/languages/vim.py +52 -0
  143. PyReprism/languages/visual_basic.py +52 -0
  144. PyReprism/languages/wasam.py +0 -0
  145. PyReprism/languages/xeora.py +0 -0
  146. PyReprism/languages/xojo.py +0 -0
  147. PyReprism/languages/yaml.py +53 -0
  148. PyReprism/utils/__init__.py +0 -0
  149. PyReprism/utils/extension.py +149 -0
  150. PyReprism/utils/normalizer.py +18 -0
  151. pyreprism-0.0.1.dist-info/METADATA +94 -0
  152. pyreprism-0.0.1.dist-info/RECORD +154 -0
  153. pyreprism-0.0.1.dist-info/WHEEL +4 -0
  154. pyreprism-0.0.1.dist-info/licenses/LICENSE +21 -0
@@ -0,0 +1,50 @@
1
+ import re
2
+ from PyReprism.utils import extension
3
+
4
+
5
+ class Clojure:
6
+ def __init__():
7
+ pass
8
+
9
+ @staticmethod
10
+ def file_extension() -> str:
11
+ return extension.clojure
12
+
13
+ @staticmethod
14
+ def keywords() -> list:
15
+ keyword = 'def|if|do|let|\.\.|quote|var|->>|->|fn|loop|recur|throw|try|monitor-enter|\.|new|set!|def\-|defn|defn\-|defmacro|defmulti|defmethod|defstruct|defonce|declare|definline|definterface|defprotocol|==|defrecord|>=|deftype|<=|defproject|ns|\*|\+|\-|\/|<|=|>|accessor|agent|agent-errors|aget|alength|all-ns|alter|and|append-child|apply|array-map|aset|aset-boolean|aset-byte|aset-char|aset-double|aset-float|aset-int|aset-long|aset-short|assert|assoc|await|await-for|bean|binding|bit-and|bit-not|bit-or|bit-shift-left|bit-shift-right|bit-xor|boolean|branch\?|butlast|byte|cast|char|children|class|clear-agent-errors|comment|commute|comp|comparator|complement|concat|conj|cons|constantly|cond|if-not|construct-proxy|contains\?|count|create-ns|create-struct|cycle|dec|deref|difference|disj|dissoc|distinct|doall|doc|dorun|doseq|dosync|dotimes|doto|double|down|drop|drop-while|edit|end\?|ensure|eval|every\?|false\?|ffirst|file-seq|filter|find|find-doc|find-ns|find-var|first|float|flush|for|fnseq|frest|gensym|get-proxy-class|get|hash-map|hash-set|identical\?|identity|if-let|import|in-ns|inc|index|insert-child|insert-left|insert-right|inspect-table|inspect-tree|instance\?|int|interleave|intersection|into|into-array|iterate|join|key|keys|keyword|keyword\?|last|lazy-cat|lazy-cons|left|lefts|line-seq|list\*|list|load|load-file|locking|long|loop|macroexpand|macroexpand-1|make-array|make-node|map|map-invert|map\?|mapcat|max|max-key|memfn|merge|merge-with|meta|min|min-key|name|namespace|neg\?|new|newline|next|nil\?|node|not|not-any\?|not-every\?|not=|ns-imports|ns-interns|ns-map|ns-name|ns-publics|ns-refers|ns-resolve|ns-unmap|nth|nthrest|or|parse|partial|path|peek|pop|pos\?|pr|pr-str|print|print-str|println|println-str|prn|prn-str|project|proxy|proxy-mappings|quot|rand|rand-int|range|re-find|re-groups|re-matcher|re-matches|re-pattern|re-seq|read|read-line|reduce|ref|ref-set|refer|rem|remove|remove-method|remove-ns|rename|rename-keys|repeat|replace|replicate|resolve|rest|resultset-seq|reverse|rfirst|right|rights|root|rrest|rseq|second|select|select-keys|send|send-off|seq|seq-zip|seq\?|set|short|slurp|some|sort|sort-by|sorted-map|sorted-map-by|sorted-set|special-symbol\?|split-at|split-with|str|string\?|struct|struct-map|subs|subvec|symbol|symbol\?|sync|take|take-nth|take-while|test|time|to-array|to-array-2d|tree-seq|true\?|union|up|update-proxy|val|vals|var-get|var-set|var\?|vector|vector-zip|vector\?|when|when-first|when-let|when-not|with-local-vars|with-meta|with-open|with-out-str|xml-seq|xml-zip|zero\?|zipmap|zipper|true|false|nil'.split('|')
16
+ return keyword
17
+
18
+ @staticmethod
19
+ def comment_regex():
20
+ pattern = re.compile(r'(?P<comment>;.*?$)|(?P<noncomment>[^;]*)', re.MULTILINE)
21
+ return pattern
22
+
23
+ @staticmethod
24
+ def number_regex():
25
+ pattern = re.compile(r'\b[0-9A-Fa-f]+\b')
26
+ return pattern
27
+
28
+ @staticmethod
29
+ def operator_regex():
30
+ pattern = re.compile(r"(?:::|[:|'])\b[a-z][\w*+!?-]*\b")
31
+ return pattern
32
+
33
+ @staticmethod
34
+ def keywords_regex():
35
+ return re.compile(r'\b(' + '|'.join(Clojure.keywords()) + r')\b')
36
+
37
+ @staticmethod
38
+ def remove_comments(source_code: str, isList: bool = False) -> str:
39
+ result = []
40
+ for match in Clojure.comment_regex().finditer(source_code):
41
+ if match.group('noncomment'):
42
+ result.append(match.group('noncomment'))
43
+ if isList:
44
+ return result
45
+ return ''.join(result)
46
+
47
+ @staticmethod
48
+ def remove_keywords(source: str):
49
+ return re.sub(re.compile(Clojure.keywords_regex()), '', source)
50
+
@@ -0,0 +1,50 @@
1
+ import re
2
+ from PyReprism.utils import extension
3
+
4
+
5
+ class CoffeeScript:
6
+ def __init__():
7
+ pass
8
+
9
+ @staticmethod
10
+ def file_extension() -> str:
11
+ return extension.coffeescript
12
+
13
+ @staticmethod
14
+ def keywords() -> list:
15
+ keyword = 'and|break|by|catch|class|continue|debugger|delete|do|each|else|extend|extends|false|finally|for|if|in|instanceof|is|isnt|let|loop|namespace|new|no|not|null|of|off|on|or|own|return|super|switch|then|this|throw|true|try|typeof|undefined|unless|until|when|while|window|with|yes|yield'.split('|')
16
+ return keyword
17
+
18
+ @staticmethod
19
+ def comment_regex():
20
+ pattern = re.compile(r'(?P<comment>#.*?$|###.*?###|###.*?$|^.*?###)|(?P<noncomment>[^#]*[^\n]*)', re.DOTALL | re.MULTILINE)
21
+ return pattern
22
+
23
+ @staticmethod
24
+ def number_regex():
25
+ pattern = re.compile(r' ')
26
+ return pattern
27
+
28
+ @staticmethod
29
+ def operator_regex():
30
+ pattern = re.compile(r" ")
31
+ return pattern
32
+
33
+ @staticmethod
34
+ def keywords_regex():
35
+ return re.compile(r'\b(' + '|'.join(CoffeeScript.keywords()) + r')\b')
36
+
37
+ @staticmethod
38
+ def remove_comments(source_code: str, isList: bool = False) -> str:
39
+ result = []
40
+ for match in CoffeeScript.comment_regex().finditer(source_code):
41
+ if match.group('noncomment'):
42
+ result.append(match.group('noncomment'))
43
+ if isList:
44
+ return result
45
+ return ''.join(result)
46
+
47
+ @staticmethod
48
+ def remove_keywords(source: str):
49
+ return re.sub(re.compile(CoffeeScript.keywords_regex()), '', source)
50
+
@@ -0,0 +1,52 @@
1
+ import re
2
+ from PyReprism.utils import extension
3
+
4
+
5
+ class CPP:
6
+ def __init__():
7
+ pass
8
+
9
+ @staticmethod
10
+ def file_extension() -> str:
11
+ return extension.cpp
12
+
13
+ @staticmethod
14
+ def keywords() -> list:
15
+ keyword = 'alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|class|compl|const|constexpr|const_cast|continue|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|float|for|friend|goto|if|inline|int|int8_t|int16_t|int32_t|int64_t|uint8_t|uint16_t|uint32_t|uint64_t|long|mutable|namespace|new|noexcept|nullptr|operator|private|protected|public|register|reinterpret_cast|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|union|unsigned|using|virtual|void|volatile|wchar_t|while|true|false'.split('|')
16
+
17
+ return keyword
18
+
19
+ @staticmethod
20
+ def comment_regex():
21
+ pattern = re.compile(r'(?P<comment>//.*?$|/\*.*?\*/|/\*.*?$|^.*?\*/|[{}]+)|(?P<noncomment>\'(\\.|[^\\\'])*\'|"(\\.|[^\\"])*"|.[^/\'"{}]*)', re.DOTALL | re.MULTILINE)
22
+ return pattern
23
+
24
+
25
+ @staticmethod
26
+ def number_regex():
27
+ pattern = re.compile(r'(?:\b0x[\da-f]+|(?:\b\d+\.?\d*|\B\.\d+)(?:e[+-]?\d+)?)[ful]*')
28
+ return pattern
29
+
30
+ @staticmethod
31
+ def operator_regex():
32
+ pattern = re.compile(r'--?|\+\+?|!=?|<{1,2}=?|>{1,2}=?|->|:{1,2}|={1,2}|\^|~|%|&{1,2}|\|\|?|\?|\*|\/|\b(?:and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b')
33
+ return pattern
34
+
35
+ @staticmethod
36
+ def keywords_regex():
37
+ return re.compile(r'\b(' + '|'.join(CPP.keywords()) + r')\b')
38
+
39
+ @staticmethod
40
+ def remove_comments(source_code: str, isList: bool = False) -> str:
41
+ result = []
42
+ for match in CPP.comment_regex().finditer(source_code):
43
+ if match.group('noncomment'):
44
+ result.append(match.group('noncomment'))
45
+ if isList:
46
+ return result
47
+ return ''.join(result)
48
+
49
+
50
+ @staticmethod
51
+ def remove_keywords(source: str):
52
+ return re.sub(re.compile(CPP.keywords_regex()), '', source)
@@ -0,0 +1,50 @@
1
+ import re
2
+ from PyReprism.utils import extension
3
+
4
+
5
+ class Crystal:
6
+ def __init__():
7
+ pass
8
+
9
+ @staticmethod
10
+ def file_extension() -> str:
11
+ return extension.crystal
12
+
13
+ @staticmethod
14
+ def keywords() -> list:
15
+ keyword = 'abstract|alias|as|asm|begin|break|case|class|def|do|else|elsif|end|ensure|enum|extend|for|fun|if|include|instance_sizeof|lib|macro|module|next|of|out|pointerof|private|protected|rescue|return|require|select|self|sizeof|struct|super|then|type|typeof|uninitialized|union|unless|until|when|while|with|yield|__DIR__|__END_LINE__|__FILE__|__LINE__'.split('|')
16
+ return keyword
17
+
18
+ @staticmethod
19
+ def comment_regex():
20
+ pattern = re.compile(r'(?P<comment>#.*?$|=begin[\s\S]*?=end|=begin.*?$|^.*?=end)|(?P<noncomment>[^#=]*[^\n]*)', re.DOTALL | re.MULTILINE)
21
+ return pattern
22
+
23
+ @staticmethod
24
+ def number_regex():
25
+ pattern = re.compile(r'')
26
+ return pattern
27
+
28
+ @staticmethod
29
+ def operator_regex():
30
+ pattern = re.compile(r'\b(?:0b[01_]*[01]|0o[0-7_]*[0-7]|0x[\da-fA-F_]*[\da-fA-F]|(?:\d(?:[\d_]*\d)?)(?:\.[\d_]*\d)?(?:[eE][+-]?[\d_]*\d)?)(?:_(?:[uif](?:8|16|32|64))?)?\b')
31
+ return pattern
32
+
33
+ @staticmethod
34
+ def keywords_regex():
35
+ return re.compile(r'\b(' + '|'.join(Crystal.keywords()) + r')\b')
36
+
37
+ @staticmethod
38
+ def remove_comments(source_code: str, isList: bool = False) -> str:
39
+ result = []
40
+ for match in Crystal.comment_regex().finditer(source_code):
41
+ if match.group('noncomment'):
42
+ result.append(match.group('noncomment'))
43
+ if isList:
44
+ return result
45
+ return ''.join(result)
46
+
47
+ @staticmethod
48
+ def remove_keywords(source: str):
49
+ return re.sub(re.compile(Crystal.keywords_regex()), '', source)
50
+
@@ -0,0 +1,53 @@
1
+ import re
2
+ from PyReprism.utils import extension
3
+
4
+
5
+ class CSharp:
6
+ def __init__():
7
+ pass
8
+
9
+ @staticmethod
10
+ def file_extension() -> str:
11
+ return extension.csharp
12
+
13
+ @staticmethod
14
+ def keywords() -> list:
15
+ keyword = 'abstract|add|alias|as|ascending|async|await|base|bool|break|byte|case|catch|char|checked|class|const|continue|decimal|default|delegate|descending|do|double|dynamic|else|enum|event|explicit|extern|false|finally|fixed|float|for|foreach|from|get|global|goto|group|if|implicit|in|int|interface|internal|into|is|join|let|lock|long|namespace|new|null|object|operator|orderby|out|override|params|partial|private|protected|public|readonly|ref|remove|return|sbyte|sealed|select|set|short|sizeof|stackalloc|static|string|struct|switch|this|throw|true|try|typeof|uint|ulong|unchecked|unsafe|ushort|using|value|var|virtual|void|volatile|where|while|yield|warning|define|elif|endif|endregion|error|if|line|pragma|region|undef'.split('|')
16
+
17
+ return keyword
18
+
19
+ @staticmethod
20
+ def comment_regex():
21
+ pattern = re.compile(r'(?P<comment>//.*?$|/\*.*?\*/|/\*.*?$|^.*?\*/|[{}]+)|(?P<noncomment>\'(\\.|[^\\\'])*\'|"(\\.|[^\\"])*"|.[^/\'"{}]*)', re.DOTALL | re.MULTILINE)
22
+ return pattern
23
+
24
+
25
+ @staticmethod
26
+ def number_regex():
27
+ pattern = re.compile(r'\b0x[\da-f]+\b|(?:\b\d+\.?\d*|\B\.\d+)f?')
28
+ return pattern
29
+
30
+ @staticmethod
31
+ def operator_regex():
32
+ pattern = re.compile(r'(^|[^.])(?:\+[+=]?|-[-=]?|!=?|<<?=?|>>?>?=?|==?|&[&=]?|\|[|=]?|\*=?|\/=?|%=?|\^=?|[?:~])')
33
+ return pattern
34
+
35
+ @staticmethod
36
+ def keywords_regex():
37
+ return re.compile(r'\b(' + '|'.join(CSharp.keywords()) + r')\b')
38
+
39
+ @staticmethod
40
+ def remove_comments(source_code: str, isList: bool = False) -> str:
41
+ result = []
42
+ for match in CSharp.comment_regex().finditer(source_code):
43
+ if match.group('noncomment'):
44
+ result.append(match.group('noncomment'))
45
+ if isList:
46
+ return result
47
+ return ''.join(result)
48
+
49
+
50
+ @staticmethod
51
+ def remove_keywords(source: str):
52
+ return re.sub(re.compile(CSharp.keywords_regex()), '', source)
53
+
@@ -0,0 +1,50 @@
1
+ import re
2
+ from PyReprism.utils import extension
3
+
4
+
5
+ class CSP:
6
+ def __init__():
7
+ pass
8
+
9
+ @staticmethod
10
+ def file_extension() -> str:
11
+ return extension.csp
12
+
13
+ @staticmethod
14
+ def keywords() -> list:
15
+ keyword = 'base-uri|form-action|frame-ancestors|plugin-types|referrer|reflected-xss|report-to|report-uri|require-sri-for|sandbox) |(?:block-all-mixed-content|disown-opener|upgrade-insecure-requests)(?: |;)|(?:child|connect|default|font|frame|img|manifest|media|object|script|style|worker)-src'.split('|')
16
+ return keyword
17
+
18
+ @staticmethod
19
+ def comment_regex():
20
+ pattern = re.compile(r'(?P<comment>--.*?$|/\*[\s\S]*?\*/|/\*.*?$|^.*?\*/)|(?P<noncomment>[^/\-]*[^\n]*)', re.DOTALL | re.MULTILINE)
21
+ return pattern
22
+
23
+ @staticmethod
24
+ def number_regex():
25
+ pattern = re.compile(r'')
26
+ return pattern
27
+
28
+ @staticmethod
29
+ def operator_regex():
30
+ pattern = re.compile(r'')
31
+ return pattern
32
+
33
+ @staticmethod
34
+ def keywords_regex():
35
+ return re.compile(r'\b(' + '|'.join(CSP.keywords()) + r')\b')
36
+
37
+ @staticmethod
38
+ def remove_comments(source_code: str, isList: bool = False) -> str:
39
+ result = []
40
+ for match in CSP.comment_regex().finditer(source_code):
41
+ if match.group('noncomment'):
42
+ result.append(match.group('noncomment'))
43
+ if isList:
44
+ return result
45
+ return ''.join(result)
46
+
47
+ @staticmethod
48
+ def remove_keywords(source: str):
49
+ return re.sub(re.compile(CSP.keywords_regex()), '', source)
50
+
@@ -0,0 +1,50 @@
1
+ import re
2
+ from PyReprism.utils import extension
3
+
4
+
5
+ class CSS:
6
+ def __init__():
7
+ pass
8
+
9
+ @staticmethod
10
+ def file_extension() -> str:
11
+ return extension.css
12
+
13
+ @staticmethod
14
+ def keywords() -> list:
15
+ keyword = ''.split('|')
16
+ return keyword
17
+
18
+ @staticmethod
19
+ def comment_regex():
20
+ pattern = re.compile(r'(?P<comment>/\*[\s\S]*?\*/|/\*.*?$|^.*?\*/)|(?P<noncomment>[^/*]*[^\n]*)',re.DOTALL | re.MULTILINE)
21
+ return pattern
22
+
23
+ @staticmethod
24
+ def number_regex():
25
+ pattern = re.compile(r'')
26
+ return pattern
27
+
28
+ @staticmethod
29
+ def operator_regex():
30
+ pattern = re.compile(r'')
31
+ return pattern
32
+
33
+ @staticmethod
34
+ def keywords_regex():
35
+ return re.compile(r'\b(' + '|'.join(CSS.keywords()) + r')\b')
36
+
37
+ @staticmethod
38
+ def remove_comments(source_code: str, isList: bool = False) -> str:
39
+ result = []
40
+ for match in CSS.comment_regex().finditer(source_code):
41
+ if match.group('noncomment'):
42
+ result.append(match.group('noncomment'))
43
+ if isList:
44
+ return result
45
+ return ''.join(result)
46
+
47
+ @staticmethod
48
+ def remove_keywords(source: str):
49
+ return re.sub(re.compile(CSS.keywords_regex()), '', source)
50
+
@@ -0,0 +1,50 @@
1
+ import re
2
+ from PyReprism.utils import extension
3
+
4
+
5
+ class CssExtras:
6
+ def __init__():
7
+ pass
8
+
9
+ @staticmethod
10
+ def file_extension() -> str:
11
+ return extension.css_extras
12
+
13
+ @staticmethod
14
+ def keywords() -> list:
15
+ keyword = ''.split('|')
16
+ return keyword
17
+
18
+ @staticmethod
19
+ def comment_regex():
20
+ pattern = re.compile(r'(?P<comment>/\*[\s\S]*?\*/|/\*.*?$|^.*?\*/)|(?P<noncomment>[^/*]*[^\n]*)',re.DOTALL | re.MULTILINE)
21
+ return pattern
22
+
23
+ @staticmethod
24
+ def number_regex():
25
+ pattern = re.compile(r'')
26
+ return pattern
27
+
28
+ @staticmethod
29
+ def operator_regex():
30
+ pattern = re.compile(r'')
31
+ return pattern
32
+
33
+ @staticmethod
34
+ def keywords_regex():
35
+ return re.compile(r'\b(' + '|'.join(CssExtras.keywords()) + r')\b')
36
+
37
+ @staticmethod
38
+ def remove_comments(source_code: str, isList: bool = False) -> str:
39
+ result = []
40
+ for match in CssExtras.comment_regex().finditer(source_code):
41
+ if match.group('noncomment'):
42
+ result.append(match.group('noncomment'))
43
+ if isList:
44
+ return result
45
+ return ''.join(result)
46
+
47
+ @staticmethod
48
+ def remove_keywords(source: str):
49
+ return re.sub(re.compile(CssExtras.keywords_regex()), '', source)
50
+
@@ -0,0 +1,50 @@
1
+ import re
2
+ from PyReprism.utils import extension
3
+
4
+
5
+ class D:
6
+ def __init__():
7
+ pass
8
+
9
+ @staticmethod
10
+ def file_extension() -> str:
11
+ return extension.d
12
+
13
+ @staticmethod
14
+ def keywords() -> list:
15
+ keyword = 'abstract|alias|align|asm|assert|auto|body|bool|break|byte|case|cast|catch|cdouble|cent|cfloat|char|class|const|continue|creal|dchar|debug|default|delegate|delete|deprecated|do|double|else|enum|export|extern|false|final|finally|float|for|foreach|foreach_reverse|function|goto|idouble|if|ifloat|immutable|import|inout|int|interface|invariant|ireal|lazy|long|macro|mixin|module|new|nothrow|null|out|override|package|pragma|private|protected|public|pure|real|ref|return|scope|shared|short|static|struct|super|switch|synchronized|template|this|throw|true|try|typedef|typeid|typeof|ubyte|ucent|uint|ulong|union|unittest|ushort|version|void|volatile|wchar|while|with|__(?:(?:FILE|MODULE|LINE|FUNCTION|PRETTY_FUNCTION|DATE|EOF|TIME|TIMESTAMP|VENDOR|VERSION)__|gshared|traits|vector|parameters)|string|wstring|dstring|size_t|ptrdiff_t'.split('|')
16
+ return keyword
17
+
18
+ @staticmethod
19
+ def comment_regex():
20
+ pattern = re.compile(r'(?P<comment>//.*?$|/\*[\s\S]*?\*/|/\*.*?$|^.*?\*/|/\+[\s\S]*?\+/|/\+.*?$|^.*?\+/)|(?P<noncomment>[^/]*[^\n]*)', re.DOTALL | re.MULTILINE)
21
+ return pattern
22
+
23
+ @staticmethod
24
+ def number_regex():
25
+ pattern = re.compile(r'\b0x\.?[a-f\d_]+(?:(?!\.\.)\.[a-f\d_]*)?(?:p[+-]?[a-f\d_]+)?[ulfi]*')
26
+ return pattern
27
+
28
+ @staticmethod
29
+ def operator_regex():
30
+ pattern = re.compile(r'\|[|=]?|&[&=]?|\+[+=]?|-[-=]?|\.?\.\.|=[>=]?|!(?:i[ns]\b|<>?=?|>=?|=)?|\bi[ns]\b|(?:<[<>]?|>>?>?|\^\^|[*\/%^~])=?')
31
+ return pattern
32
+
33
+ @staticmethod
34
+ def keywords_regex():
35
+ return re.compile(r'\b(' + '|'.join(D.keywords()) + r')\b')
36
+
37
+ @staticmethod
38
+ def remove_comments(source_code: str, isList: bool = False) -> str:
39
+ result = []
40
+ for match in D.comment_regex().finditer(source_code):
41
+ if match.group('noncomment'):
42
+ result.append(match.group('noncomment'))
43
+ if isList:
44
+ return result
45
+ return ''.join(result)
46
+
47
+ @staticmethod
48
+ def remove_keywords(source: str):
49
+ return re.sub(re.compile(D.keywords_regex()), '', source)
50
+
@@ -0,0 +1,52 @@
1
+ import re
2
+ from PyReprism.utils import extension
3
+
4
+
5
+ class Dart:
6
+ def __init__():
7
+ pass
8
+
9
+ @staticmethod
10
+ def file_extension() -> str:
11
+ return extension.dart
12
+
13
+ @staticmethod
14
+ def keywords() -> list:
15
+ keyword = 'abstract|assert|async|await|break|case|catch|class|const|continue|default|deferred|do|dynamic|else|enum|export|external|extends|factory|final|finally|for|get|if|implements|import|in|library|new|null|operator|part|rethrow|return|set|static|super|switch|this|throw|try|typedef|var|void|while|with|yield|sync'.split('|')
16
+
17
+ return keyword
18
+
19
+ @staticmethod
20
+ def comment_regex():
21
+ pattern = pattern = re.compile(r'(?P<comment>//.*?$|/\*[\s\S]*?\*/|/\*.*?$|^.*?\*/|///.*?$)|(?P<noncomment>\'(\\.|[^\\\'])*\'|"(\\.|[^\\"])*"|.[^/\'"]*)', re.DOTALL | re.MULTILINE)
22
+ return pattern
23
+
24
+
25
+ @staticmethod
26
+ def number_regex():
27
+ pattern = re.compile(r'\b0x[\da-f]+\b|(?:\b\d+\.?\d*|\B\.\d+)(?:e[+-]?\d+)?')
28
+ return pattern
29
+
30
+ @staticmethod
31
+ def operator_regex():
32
+ pattern = re.compile(r'\bis!|\b(?:as|is)\b|\+\+|--|&&|\|\||<<=?|>>=?|~(?:\/=?)?|[+\-*\/%&^|=!<>]=?|\?')
33
+ return pattern
34
+
35
+ @staticmethod
36
+ def keywords_regex():
37
+ return re.compile(r'\b(' + '|'.join(Dart.keywords()) + r')\b')
38
+
39
+ @staticmethod
40
+ def remove_comments(source_code: str, isList: bool = False) -> str:
41
+ result = []
42
+ for match in Dart.comment_regex().finditer(source_code):
43
+ if match.group('noncomment'):
44
+ result.append(match.group('noncomment'))
45
+ if isList:
46
+ return result
47
+ return ''.join(result)
48
+
49
+
50
+ @staticmethod
51
+ def remove_keywords(source: str):
52
+ return re.sub(re.compile(Dart.keywords_regex()), '', source)
@@ -0,0 +1,49 @@
1
+ import re
2
+ from PyReprism.utils import extension
3
+
4
+ class Diff:
5
+ def __init__():
6
+ pass
7
+
8
+ @staticmethod
9
+ def file_extension() -> str:
10
+ return extension.diff
11
+
12
+ @staticmethod
13
+ def keywords() -> list:
14
+ keyword = ''.split('|')
15
+ return keyword
16
+
17
+ @staticmethod
18
+ def comment_regex():
19
+ pattern = re.compile(r'(?P<comment>^#.*?$)|(?P<noncomment>^[^#\n].*?$)', re.MULTILINE)
20
+ return pattern
21
+
22
+ @staticmethod
23
+ def number_regex():
24
+ pattern = re.compile(r'')
25
+ return pattern
26
+
27
+ @staticmethod
28
+ def operator_regex():
29
+ pattern = re.compile(r'')
30
+ return pattern
31
+
32
+ @staticmethod
33
+ def keywords_regex():
34
+ return re.compile(r'\b(' + '|'.join(Diff.keywords()) + r')\b')
35
+
36
+ @staticmethod
37
+ def remove_comments(source_code: str, isList: bool = False) -> str:
38
+ result = []
39
+ for match in Diff.comment_regex().finditer(source_code):
40
+ if match.group('noncomment'):
41
+ result.append(match.group('noncomment'))
42
+ if isList:
43
+ return result
44
+ return ''.join(result)
45
+
46
+ @staticmethod
47
+ def remove_keywords(source: str):
48
+ return re.sub(re.compile(Diff.keywords_regex()), '', source)
49
+
@@ -0,0 +1,55 @@
1
+ import re
2
+ from PyReprism.utils import extension
3
+
4
+
5
+ class Django:
6
+ def __init__():
7
+ pass
8
+
9
+ @staticmethod
10
+ def file_extension() -> str:
11
+ return extension.django
12
+
13
+ @staticmethod
14
+ def keywords() -> list:
15
+ keyword = 'load|verbatim|widthratio|ssi|firstof|for|url|ifchanged|csrf_token|lorem|ifnotequal|autoescape|now|templatetag|debug|cycle|ifequal|regroup|comment|filter|endfilter|if|spaceless|with|extends|block|include|else|empty|endif|endfor|as|endblock|endautoescape|endverbatim|trans|endtrans|[Tt]rue|[Ff]alse|[Nn]one|in|is|static|macro|endmacro|call|endcall|set|endset|raw|endraw'.split('|')
16
+ return keyword
17
+
18
+ @staticmethod
19
+ def functions() -> list:
20
+ func = 'abs|add|addslashes|attr|batch|callable|capfirst|capitalize|center|count|cut|d|date|default|default_if_none|defined|dictsort|dictsortreversed|divisibleby|e|equalto|escape|escaped|escapejs|even|filesizeformat|first|float|floatformat|force_escape|forceescape|format|get_digit|groupby|indent|int|iriencode|iterable|join|last|length|length_is|linebreaks|linebreaksbr|linenumbers|list|ljust|lower|make_list|map|mapping|number|odd|phone2numeric|pluralize|pprint|random|reject|rejectattr|removetags|replace|reverse|rjust|round|safe|safeseq|sameas|select|selectattr|sequence|slice|slugify|sort|string|stringformat|striptags|sum|time|timesince|timeuntil|title|trim|truncate|truncatechars|truncatechars_html|truncatewords|truncatewords_html|undefined|unordered_list|upper|urlencode|urlize|urlizetrunc|wordcount|wordwrap|xmlattr|yesno'.split('|')
21
+ return func
22
+
23
+ @staticmethod
24
+ def comment_regex():
25
+ pattern = re.compile(r'(?P<comment>\{#.*?#\})|(?P<noncomment>[^{]*[^\n]*)', re.DOTALL | re.MULTILINE)
26
+ return pattern
27
+
28
+ @staticmethod
29
+ def number_regex():
30
+ pattern = re.compile(r'')
31
+ return pattern
32
+
33
+ @staticmethod
34
+ def operator_regex():
35
+ pattern = re.compile(r'')
36
+ return pattern
37
+
38
+ @staticmethod
39
+ def keywords_regex():
40
+ return re.compile(r'\b(' + '|'.join(Django.keywords()) + r')\b')
41
+
42
+ @staticmethod
43
+ def remove_comments(source_code: str, isList: bool = False) -> str:
44
+ result = []
45
+ for match in Django.comment_regex().finditer(source_code):
46
+ if match.group('noncomment'):
47
+ result.append(match.group('noncomment'))
48
+ if isList:
49
+ return result
50
+ return ''.join(result)
51
+
52
+ @staticmethod
53
+ def remove_keywords(source: str):
54
+ return re.sub(re.compile(Django.keywords_regex()), '', source)
55
+
@@ -0,0 +1,50 @@
1
+ import re
2
+ from PyReprism.utils import extension
3
+
4
+
5
+ class Docker:
6
+ def __init__():
7
+ pass
8
+
9
+ @staticmethod
10
+ def file_extension() -> str:
11
+ return extension.docker
12
+
13
+ @staticmethod
14
+ def keywords() -> list:
15
+ keyword = 'ADD|ARG|CMD|COPY|ENTRYPOINT|ENV|EXPOSE|FROM|HEALTHCHECK|LABEL|MAINTAINER|ONBUILD|RUN|SHELL|STOPSIGNAL|USER|VOLUME|WORKDIR'.split('|')
16
+ return keyword
17
+
18
+ @staticmethod
19
+ def comment_regex():
20
+ pattern = re.compile(r'(?P<comment>#.*?$)|(?P<noncomment>[^#]*)', re.MULTILINE)
21
+ return pattern
22
+
23
+ @staticmethod
24
+ def number_regex():
25
+ pattern = ''
26
+ return pattern
27
+
28
+ @staticmethod
29
+ def operator_regex():
30
+ pattern = ''
31
+ return pattern
32
+
33
+ @staticmethod
34
+ def keywords_regex():
35
+ return re.compile(r'\b(' + '|'.join(Docker.keywords()) + r')\b')
36
+
37
+ @staticmethod
38
+ def remove_comments(source_code: str, isList: bool = False) -> str:
39
+ result = []
40
+ for match in Docker.comment_regex().finditer(source_code):
41
+ if match.group('noncomment'):
42
+ result.append(match.group('noncomment'))
43
+ if isList:
44
+ return result
45
+ return ''.join(result)
46
+
47
+ @staticmethod
48
+ def remove_keywords(source: str):
49
+ return re.sub(re.compile(Docker.keywords_regex()), '', source)
50
+