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.
- PyReprism/__init__.py +0 -0
- PyReprism/languages/__init__.py +147 -0
- PyReprism/languages/_base.py +30 -0
- PyReprism/languages/abap.py +52 -0
- PyReprism/languages/actionscript.py +52 -0
- PyReprism/languages/ada.py +53 -0
- PyReprism/languages/apacheconf.py +52 -0
- PyReprism/languages/apl.py +52 -0
- PyReprism/languages/applescript.py +52 -0
- PyReprism/languages/arduino.py +52 -0
- PyReprism/languages/arff.py +52 -0
- PyReprism/languages/asciidoc.py +52 -0
- PyReprism/languages/asm6502.py +51 -0
- PyReprism/languages/aspnet.py +51 -0
- PyReprism/languages/autohotkey.py +51 -0
- PyReprism/languages/autoit.py +50 -0
- PyReprism/languages/bash.py +52 -0
- PyReprism/languages/basic.py +52 -0
- PyReprism/languages/batch.py +52 -0
- PyReprism/languages/bison.py +52 -0
- PyReprism/languages/brainfuck.py +52 -0
- PyReprism/languages/bro.py +50 -0
- PyReprism/languages/c.py +52 -0
- PyReprism/languages/clike.py +52 -0
- PyReprism/languages/clojure.py +50 -0
- PyReprism/languages/coffeescript.py +50 -0
- PyReprism/languages/cpp.py +52 -0
- PyReprism/languages/crystal.py +50 -0
- PyReprism/languages/csharp.py +53 -0
- PyReprism/languages/csp.py +50 -0
- PyReprism/languages/css.py +50 -0
- PyReprism/languages/css_extras.py +50 -0
- PyReprism/languages/d.py +50 -0
- PyReprism/languages/dart.py +52 -0
- PyReprism/languages/diff.py +49 -0
- PyReprism/languages/django.py +55 -0
- PyReprism/languages/docker.py +50 -0
- PyReprism/languages/eiffel.py +49 -0
- PyReprism/languages/elixir.py +50 -0
- PyReprism/languages/erb.py +0 -0
- PyReprism/languages/erlang.py +50 -0
- PyReprism/languages/flow.py +0 -0
- PyReprism/languages/fortran.py +49 -0
- PyReprism/languages/fsharp.py +49 -0
- PyReprism/languages/gedcom.py +0 -0
- PyReprism/languages/gherkin.py +0 -0
- PyReprism/languages/git.py +0 -0
- PyReprism/languages/glsl.py +0 -0
- PyReprism/languages/go.py +53 -0
- PyReprism/languages/graphql.py +50 -0
- PyReprism/languages/groovy.py +53 -0
- PyReprism/languages/haml.py +50 -0
- PyReprism/languages/handlebars.py +0 -0
- PyReprism/languages/haskell.py +53 -0
- PyReprism/languages/haxe.py +0 -0
- PyReprism/languages/hpkp.py +0 -0
- PyReprism/languages/hsts.py +0 -0
- PyReprism/languages/html.py +50 -0
- PyReprism/languages/ichigojam.py +0 -0
- PyReprism/languages/icon.py +0 -0
- PyReprism/languages/inform7.py +0 -0
- PyReprism/languages/ini.py +41 -0
- PyReprism/languages/io.py +0 -0
- PyReprism/languages/j.py +50 -0
- PyReprism/languages/java.py +53 -0
- PyReprism/languages/javascript.py +53 -0
- PyReprism/languages/jolie.py +50 -0
- PyReprism/languages/json.py +50 -0
- PyReprism/languages/jsx.py +53 -0
- PyReprism/languages/julia.py +53 -0
- PyReprism/languages/keyman.py +0 -0
- PyReprism/languages/kotlin.py +53 -0
- PyReprism/languages/latex.py +50 -0
- PyReprism/languages/less.py +50 -0
- PyReprism/languages/liquid.py +49 -0
- PyReprism/languages/livescript.py +49 -0
- PyReprism/languages/lolcode.py +0 -0
- PyReprism/languages/lua.py +0 -0
- PyReprism/languages/makefile.py +50 -0
- PyReprism/languages/markdown.py +31 -0
- PyReprism/languages/markup.py +50 -0
- PyReprism/languages/markup_templating.py +0 -0
- PyReprism/languages/matlab.py +51 -0
- PyReprism/languages/mel.py +0 -0
- PyReprism/languages/mizar.py +0 -0
- PyReprism/languages/monkey.py +0 -0
- PyReprism/languages/n4js.py +50 -0
- PyReprism/languages/nasm.py +0 -0
- PyReprism/languages/nginx.py +50 -0
- PyReprism/languages/nim.py +0 -0
- PyReprism/languages/nix.py +0 -0
- PyReprism/languages/nsis.py +0 -0
- PyReprism/languages/objectivec.py +49 -0
- PyReprism/languages/ocaml.py +51 -0
- PyReprism/languages/opencl.py +0 -0
- PyReprism/languages/oz.py +0 -0
- PyReprism/languages/parigp.py +0 -0
- PyReprism/languages/parser.py +0 -0
- PyReprism/languages/pascal.py +49 -0
- PyReprism/languages/perl.py +53 -0
- PyReprism/languages/php.py +50 -0
- PyReprism/languages/php_extras.py +0 -0
- PyReprism/languages/plsql.py +0 -0
- PyReprism/languages/powershell.py +0 -0
- PyReprism/languages/processing.py +0 -0
- PyReprism/languages/prolog.py +51 -0
- PyReprism/languages/properties.py +0 -0
- PyReprism/languages/protobuf.py +0 -0
- PyReprism/languages/pug.py +0 -0
- PyReprism/languages/puppet.py +0 -0
- PyReprism/languages/pure.py +0 -0
- PyReprism/languages/python.py +54 -0
- PyReprism/languages/q.py +0 -0
- PyReprism/languages/qore.py +0 -0
- PyReprism/languages/r.py +0 -0
- PyReprism/languages/reason.py +0 -0
- PyReprism/languages/renpy.py +0 -0
- PyReprism/languages/rest.py +0 -0
- PyReprism/languages/rip.py +0 -0
- PyReprism/languages/roboconf.py +0 -0
- PyReprism/languages/ruby.py +50 -0
- PyReprism/languages/rust.py +52 -0
- PyReprism/languages/sas.py +0 -0
- PyReprism/languages/sass.py +0 -0
- PyReprism/languages/scala.py +53 -0
- PyReprism/languages/scheme.py +51 -0
- PyReprism/languages/scss.py +50 -0
- PyReprism/languages/smalltalk.py +51 -0
- PyReprism/languages/smarty.py +0 -0
- PyReprism/languages/soy.py +0 -0
- PyReprism/languages/stylus.py +52 -0
- PyReprism/languages/swift.py +52 -0
- PyReprism/languages/tcl.py +0 -0
- PyReprism/languages/textile.py +0 -0
- PyReprism/languages/tsx.py +52 -0
- PyReprism/languages/twig.py +0 -0
- PyReprism/languages/typescript.py +52 -0
- PyReprism/languages/vbnet.py +51 -0
- PyReprism/languages/velocity.py +52 -0
- PyReprism/languages/verilog.py +0 -0
- PyReprism/languages/vhdl.py +0 -0
- PyReprism/languages/vim.py +52 -0
- PyReprism/languages/visual_basic.py +52 -0
- PyReprism/languages/wasam.py +0 -0
- PyReprism/languages/xeora.py +0 -0
- PyReprism/languages/xojo.py +0 -0
- PyReprism/languages/yaml.py +53 -0
- PyReprism/utils/__init__.py +0 -0
- PyReprism/utils/extension.py +149 -0
- PyReprism/utils/normalizer.py +18 -0
- pyreprism-0.0.1.dist-info/METADATA +94 -0
- pyreprism-0.0.1.dist-info/RECORD +154 -0
- pyreprism-0.0.1.dist-info/WHEEL +4 -0
- pyreprism-0.0.1.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import re
|
|
2
|
+
from PyReprism.utils import extension
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class Eiffel:
|
|
6
|
+
def __init__():
|
|
7
|
+
pass
|
|
8
|
+
|
|
9
|
+
@staticmethod
|
|
10
|
+
def file_extension() -> str:
|
|
11
|
+
return extension.eiffel
|
|
12
|
+
|
|
13
|
+
@staticmethod
|
|
14
|
+
def keywords() -> list:
|
|
15
|
+
keyword = 'across|agent|alias|all|and|attached|as|assign|attribute|check|class|convert|create|Current|debug|deferred|detachable|do|else|elseif|end|ensure|expanded|export|external|feature|from|frozen|if|implies|inherit|inspect|invariant|like|local|loop|not|note|obsolete|old|once|or|Precursor|redefine|rename|require|rescue|Result|retry|select|separate|some|then|undefine|until|variant|Void|when|xor|True|False'.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'\b0[xcb][\da-f](?:_*[\da-f])*\b|(?:\d(?:_*\d)*)?\.(?:(?:\d(?:_*\d)*)?e[+-]?)?\d(?:_*\d)*|\d(?:_*\d)*\.?')
|
|
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(Eiffel.keywords()) + r')\b')
|
|
36
|
+
|
|
37
|
+
@staticmethod
|
|
38
|
+
def remove_comments(source_code: str, isList: bool = False) -> str:
|
|
39
|
+
result = []
|
|
40
|
+
for match in Eiffel.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(Eiffel.keywords_regex()), '', source)
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import re
|
|
2
|
+
from PyReprism.utils import extension
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class Elixir:
|
|
6
|
+
def __init__():
|
|
7
|
+
pass
|
|
8
|
+
|
|
9
|
+
@staticmethod
|
|
10
|
+
def file_extension() -> str:
|
|
11
|
+
return extension.elixir
|
|
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]*?"""|\'\'\'[\s\S]*?\'\'\')|(?P<noncomment>[^#\'"\n]*[^\n]*)', re.MULTILINE | re.DOTALL)
|
|
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(Elixir.keywords()) + r')\b')
|
|
36
|
+
|
|
37
|
+
@staticmethod
|
|
38
|
+
def remove_comments(source_code: str, isList: bool = False) -> str:
|
|
39
|
+
result = []
|
|
40
|
+
for match in Elixir.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(Elixir.keywords_regex()), '', source)
|
|
50
|
+
|
|
File without changes
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import re
|
|
2
|
+
from PyReprism.utils import extension
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class ErLang:
|
|
6
|
+
def __init__():
|
|
7
|
+
pass
|
|
8
|
+
|
|
9
|
+
@staticmethod
|
|
10
|
+
def file_extension() -> str:
|
|
11
|
+
return extension.erlang
|
|
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>%.*?$)|(?P<noncomment>[^%\n]*[^\n]*)', 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(ErLang.keywords()) + r')\b')
|
|
36
|
+
|
|
37
|
+
@staticmethod
|
|
38
|
+
def remove_comments(source_code: str, isList: bool = False) -> str:
|
|
39
|
+
result = []
|
|
40
|
+
for match in ErLang.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(ErLang.keywords_regex()), '', source)
|
|
50
|
+
|
|
File without changes
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import re
|
|
2
|
+
from PyReprism.utils import extension
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class ForTran:
|
|
6
|
+
def __init__():
|
|
7
|
+
pass
|
|
8
|
+
|
|
9
|
+
@staticmethod
|
|
10
|
+
def file_extension() -> str:
|
|
11
|
+
return extension.fortran
|
|
12
|
+
|
|
13
|
+
@staticmethod
|
|
14
|
+
def keywords() -> list:
|
|
15
|
+
keyword = 'INTEGER|REAL|DOUBLE|PRECISION|COMPLEX|CHARACTER|LOGICAL|/\b(?:END ?)?(?:BLOCK ?DATA|DO|FILE|FORALL|FUNCTION|IF|INTERFACE|MODULE(?! PROCEDURE)|PROGRAM|SELECT|SUBROUTINE|TYPE|WHERE|ALLOCATABLE|ALLOCATE|BACKSPACE|CALL|CASE|CLOSE|COMMON|CONTAINS|CONTINUE|CYCLE|DATA|DEALLOCATE|DIMENSION|DO|END|EQUIVALENCE|EXIT|EXTERNAL|FORMAT|GO ?TO|IMPLICIT(?: NONE)?|INQUIRE|INTENT|INTRINSIC|MODULE PROCEDURE|NAMELIST|NULLIFY|OPEN|OPTIONAL|PARAMETER|POINTER|PRINT|PRIVATE|PUBLIC|READ|RETURN|REWIND|SAVE|SELECT|STOP|TARGET|WHILE|WRITE|ASS'.split('|')
|
|
16
|
+
return keyword
|
|
17
|
+
|
|
18
|
+
@staticmethod
|
|
19
|
+
def comment_regex():
|
|
20
|
+
pattern = re.compile(r'(?P<comment>!.*?$)|(?P<noncomment>[^!]*[^\n]*)', re.MULTILINE)
|
|
21
|
+
return pattern
|
|
22
|
+
|
|
23
|
+
@staticmethod
|
|
24
|
+
def number_regex():
|
|
25
|
+
pattern = re.compile(r'(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[ED][+-]?\d+)?(?:_\w+)?')
|
|
26
|
+
return pattern
|
|
27
|
+
|
|
28
|
+
@staticmethod
|
|
29
|
+
def operator_regex():
|
|
30
|
+
pattern = re.compile(r'\*\*|\/\/|=>|[=\/]=|[<>]=?|::|[+\-*=%]|\.(?:EQ|NE|LT|LE|GT|GE|NOT|AND|OR|EQV|NEQV)\.|\.[A-Z]+\.')
|
|
31
|
+
return pattern
|
|
32
|
+
|
|
33
|
+
@staticmethod
|
|
34
|
+
def keywords_regex():
|
|
35
|
+
return re.compile(r'\b(' + '|'.join(ForTran.keywords()) + r')\b')
|
|
36
|
+
|
|
37
|
+
@staticmethod
|
|
38
|
+
def remove_comments(source_code: str, isList: bool = False) -> str:
|
|
39
|
+
result = []
|
|
40
|
+
for match in ForTran.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(ForTran.keywords_regex()), '', source)
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import re
|
|
2
|
+
from PyReprism.utils import extension
|
|
3
|
+
|
|
4
|
+
class FSharp:
|
|
5
|
+
def __init__():
|
|
6
|
+
pass
|
|
7
|
+
|
|
8
|
+
@staticmethod
|
|
9
|
+
def file_extension() -> str:
|
|
10
|
+
return extension.fsharp
|
|
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>//.*?$|\(\*[\s\S]*?\*\)|\(\*.*?$|^.*?\*\))|(?P<noncomment>[^/(\*]*[^\n]*)', re.MULTILINE | re.DOTALL)
|
|
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(FSharp.keywords()) + r')\b')
|
|
35
|
+
|
|
36
|
+
@staticmethod
|
|
37
|
+
def remove_comments(source_code: str, isList: bool = False) -> str:
|
|
38
|
+
result = []
|
|
39
|
+
for match in FSharp.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(FSharp.keywords_regex()), '', source)
|
|
49
|
+
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import re
|
|
2
|
+
from PyReprism.utils import extension
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class Go:
|
|
6
|
+
def __init__():
|
|
7
|
+
pass
|
|
8
|
+
|
|
9
|
+
@staticmethod
|
|
10
|
+
def file_extension() -> str:
|
|
11
|
+
return extension.Go
|
|
12
|
+
|
|
13
|
+
@staticmethod
|
|
14
|
+
def keywords() -> list:
|
|
15
|
+
keyword = 'break|case|chan|const|continue|default|defer|else|fallthrough|for|func|go(?:to)?|if|import|interface|map|package|range|return|select|struct|switch|type|var|bool|byte|complex(?:64|128)|error|float32|float64|rune|string|u?int(?:8|16|32|64)?|uintptr|append|cap|close|complex|copy|delete|imag|len|make|new|panic|print|println|real|recover|iota|nil|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'\b0b[01]+\b|\b0x[\da-f]*\.?[\da-fp-]+\b|(?:\b\d+\.?\d*|\B\.\d+)(?:e[+-]?\d+)?[df]?')
|
|
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(Go.keywords()) + r')\b')
|
|
38
|
+
|
|
39
|
+
@staticmethod
|
|
40
|
+
def remove_comments(source_code: str, isList: bool = False) -> str:
|
|
41
|
+
result = []
|
|
42
|
+
for match in Go.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(Go.keywords_regex()), '', source)
|
|
53
|
+
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import re
|
|
2
|
+
from PyReprism.utils import extension
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class GraphSql:
|
|
6
|
+
def __init__():
|
|
7
|
+
pass
|
|
8
|
+
|
|
9
|
+
@staticmethod
|
|
10
|
+
def file_extension() -> str:
|
|
11
|
+
return extension.graphql
|
|
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>#.*?$)|(?P<noncomment>[^#]*)', 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(GraphSql.keywords()) + r')\b')
|
|
36
|
+
|
|
37
|
+
@staticmethod
|
|
38
|
+
def remove_comments(source_code: str, isList: bool = False) -> str:
|
|
39
|
+
result = []
|
|
40
|
+
for match in GraphSql.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(GraphSql.keywords_regex()), '', source)
|
|
50
|
+
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import re
|
|
2
|
+
from PyReprism.utils import extension
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class Groovy:
|
|
6
|
+
def __init__():
|
|
7
|
+
pass
|
|
8
|
+
|
|
9
|
+
@staticmethod
|
|
10
|
+
def file_extension() -> str:
|
|
11
|
+
return extension.groovy
|
|
12
|
+
|
|
13
|
+
@staticmethod
|
|
14
|
+
def keywords() -> list:
|
|
15
|
+
keyword = 'as|def|in|abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|native|new|package|private|protected|public|return|short|static|strictfp|super|switch|synchronized|this|throw|throws|trait|transient|try|void|volatile|while|setup|given|when|then|and|cleanup|expect|where'.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'\b(?:0b[01_]+|0x[\da-f_]+(?:\.[\da-f_p\-]+)?|[\d_]+(?:\.[\d_]+)?(?:e[+-]?[\d]+)?)[glidf]?\b')
|
|
28
|
+
return pattern
|
|
29
|
+
|
|
30
|
+
@staticmethod
|
|
31
|
+
def operator_regex():
|
|
32
|
+
pattern = re.compile(r'(^|[^.])(?:~|==?~?|\?[.:]?|\*(?:[.=]|\*=?)?|\.[@&]|\.\.<|\.{1,2}(?!\.)|-[-=>]?|\+[+=]?|!=?|<(?:<=?|=>?)?|>(?:>>?=?|=)?|&[&=]?|\|[|=]?|\/=?|\^=?|%=?)')
|
|
33
|
+
return pattern
|
|
34
|
+
|
|
35
|
+
@staticmethod
|
|
36
|
+
def keywords_regex():
|
|
37
|
+
return re.compile(r'\b(' + '|'.join(Groovy.keywords()) + r')\b')
|
|
38
|
+
|
|
39
|
+
@staticmethod
|
|
40
|
+
def remove_comments(source_code: str, isList: bool = False) -> str:
|
|
41
|
+
result = []
|
|
42
|
+
for match in Groovy.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(Groovy.keywords_regex()), '', source)
|
|
53
|
+
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import re
|
|
2
|
+
from PyReprism.utils import extension
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class Haml:
|
|
6
|
+
def __init__():
|
|
7
|
+
pass
|
|
8
|
+
|
|
9
|
+
@staticmethod
|
|
10
|
+
def file_extension() -> str:
|
|
11
|
+
return extension.haml
|
|
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]*?(?=\n\S)|^-#[\s\S]*?$)|(?P<noncomment>[^\n]*?(?=\n\S|$))', 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(Haml.keywords()) + r')\b')
|
|
36
|
+
|
|
37
|
+
@staticmethod
|
|
38
|
+
def remove_comments(source_code: str, isList: bool = False) -> str:
|
|
39
|
+
result = []
|
|
40
|
+
for match in Haml.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(Haml.keywords_regex()), '', source)
|
|
50
|
+
|
|
File without changes
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import re
|
|
2
|
+
from PyReprism.utils import extension
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class Haskell:
|
|
6
|
+
def __init__():
|
|
7
|
+
pass
|
|
8
|
+
|
|
9
|
+
@staticmethod
|
|
10
|
+
def file_extension() -> str:
|
|
11
|
+
return extension.haskell
|
|
12
|
+
|
|
13
|
+
@staticmethod
|
|
14
|
+
def keywords() -> list:
|
|
15
|
+
keyword = 'case|class|data|deriving|do|else|if|in|infixl|infixr|instance|let|module|newtype|of|primitive|then|type|where|abs|acos|acosh|all|and|any|appendFile|approxRational|asTypeOf|asin|asinh|atan|atan2|atanh|basicIORun|break|catch|ceiling|chr|compare|concat|concatMap|const|cos|cosh|curry|cycle|decodeFloat|denominator|digitToInt|div|divMod|drop|dropWhile|either|elem|encodeFloat|enumFrom|enumFromThen|enumFromThenTo|enumFromTo|error|even|exp|exponent|fail|filter|flip|floatDigits|floatRadix|floatRange|floor|fmap|foldl|foldl1|foldr|foldr1|fromDouble|fromEnum|fromInt|fromInteger|fromIntegral|fromRational|fst|gcd|getChar|getContents|getLine|group|head|id|inRange|index|init|intToDigit|interact|ioError|isAlpha|isAlphaNum|isAscii|isControl|isDenormalized|isDigit|isHexDigit|isIEEE|isInfinite|isLower|isNaN|isNegativeZero|isOctDigit|isPrint|isSpace|isUpper|iterate|last|lcm|length|lex|lexDigits|lexLitChar|lines|log|logBase|lookup|map|mapM|mapM_|max|maxBound|maximum|maybe|min|minBound|minimum|mod|negate|not|notElem|null|numerator|odd|or|ord|otherwise|pack|pi|pred|primExitWith|print|product|properFraction|putChar|putStr|putStrLn|quot|quotRem|range|rangeSize|read|readDec|readFile|readFloat|readHex|readIO|readInt|readList|readLitChar|readLn|readOct|readParen|readSigned|reads|readsPrec|realToFrac|recip|rem|repeat|replicate|return|reverse|round|scaleFloat|scanl|scanl1|scanr|scanr1|seq|sequence|sequence_|show|showChar|showInt|showList|showLitChar|showParen|showSigned|showString|shows|showsPrec|significand|signum|sin|sinh|snd|sort|span|splitAt|sqrt|subtract|succ|sum|tail|take|takeWhile|tan|tanh|threadToIOResult|toEnum|toInt|toInteger|toLower|toRational|toUpper|truncate|uncurry|undefined|unlines|until|unwords|unzip|unzip3|userError|words|writeFile|zip|zip3|zipWith|zipWith3)'.split('|')
|
|
16
|
+
|
|
17
|
+
return keyword
|
|
18
|
+
|
|
19
|
+
@staticmethod
|
|
20
|
+
def comment_regex():
|
|
21
|
+
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'\b(?:\d+(?:\.\d+)?(?:e[+-]?\d+)?|0o[0-7]+|0x[0-9a-f]+)\b')
|
|
28
|
+
return pattern
|
|
29
|
+
|
|
30
|
+
@staticmethod
|
|
31
|
+
def operator_regex():
|
|
32
|
+
pattern = re.compile(r"\s\.\s|[-!#$%*+=?&@|~.:<>^\\\/]*\.[-!#$%*+=?&@|~.:<>^\\\/]+|[-!#$%*+=?&@|~.:<>^\\\/]+\.[-!#$%*+=?&@|~.:<>^\\\/]*|[-!#$%*+=?&@|~:<>^\\\/]+|`([A-Z][\w']*\.)*[_a-z][\w']*`")
|
|
33
|
+
return pattern
|
|
34
|
+
|
|
35
|
+
@staticmethod
|
|
36
|
+
def keywords_regex():
|
|
37
|
+
return re.compile(r'\b(' + '|'.join(Haskell.keywords()) + r')\b')
|
|
38
|
+
|
|
39
|
+
@staticmethod
|
|
40
|
+
def remove_comments(source_code: str, isList: bool = False) -> str:
|
|
41
|
+
result = []
|
|
42
|
+
for match in Haskell.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(Haskell.keywords_regex()), '', source)
|
|
53
|
+
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import re
|
|
2
|
+
from PyReprism.utils import extension
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class HTML:
|
|
6
|
+
def __init__():
|
|
7
|
+
pass
|
|
8
|
+
|
|
9
|
+
@staticmethod
|
|
10
|
+
def file_extension() -> str:
|
|
11
|
+
return extension.html
|
|
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>[^<]*)', 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(' + '|'.HTMLoin(HTML.keywords()) + r')\b')
|
|
36
|
+
|
|
37
|
+
@staticmethod
|
|
38
|
+
def remove_comments(source_code: str, isList: bool = False) -> str:
|
|
39
|
+
result = []
|
|
40
|
+
for match in HTML.comment_regex().finditer(source_code):
|
|
41
|
+
if match.group('noncomment'):
|
|
42
|
+
result.append(match.group('noncomment'))
|
|
43
|
+
if isList:
|
|
44
|
+
return result
|
|
45
|
+
return ''.HTMLoin(result)
|
|
46
|
+
|
|
47
|
+
@staticmethod
|
|
48
|
+
def remove_keywords(source: str):
|
|
49
|
+
return re.sub(re.compile(HTML.keywords_regex()), '', source)
|
|
50
|
+
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import re
|
|
2
|
+
from PyReprism.utils import extension
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class INI:
|
|
6
|
+
def __init__():
|
|
7
|
+
pass
|
|
8
|
+
|
|
9
|
+
@staticmethod
|
|
10
|
+
def file_extension() -> str:
|
|
11
|
+
return extension.ini
|
|
12
|
+
|
|
13
|
+
@staticmethod
|
|
14
|
+
def keywords() -> list:
|
|
15
|
+
pass
|
|
16
|
+
|
|
17
|
+
@staticmethod
|
|
18
|
+
def comment_regex():
|
|
19
|
+
pattern = re.compile(r'^[ \t]*;.*$', re.MULTILINE)
|
|
20
|
+
return pattern
|
|
21
|
+
|
|
22
|
+
@staticmethod
|
|
23
|
+
def number_regex():
|
|
24
|
+
pass
|
|
25
|
+
|
|
26
|
+
@staticmethod
|
|
27
|
+
def operator_regex():
|
|
28
|
+
pass
|
|
29
|
+
|
|
30
|
+
@staticmethod
|
|
31
|
+
def keywords_regex():
|
|
32
|
+
pass
|
|
33
|
+
|
|
34
|
+
@staticmethod
|
|
35
|
+
def remove_comments(source_code: str, isList: bool = False) -> str:
|
|
36
|
+
return re.sub(re.compile(INI.keywords_regex()), '', source_code)
|
|
37
|
+
|
|
38
|
+
@staticmethod
|
|
39
|
+
def remove_keywords(source: str):
|
|
40
|
+
pass
|
|
41
|
+
|
|
File without changes
|