Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
IPDSnelting
mjtest
Commits
99df6a0d
Commit
99df6a0d
authored
Nov 25, 2016
by
Johannes Bechberger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve preprocessor and BitOps
parent
8ff97bdd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
preproc/preproc/preprocessor.py
preproc/preproc/preprocessor.py
+3
-3
No files found.
preproc/preproc/preprocessor.py
View file @
99df6a0d
...
...
@@ -21,8 +21,8 @@ class PreProcessor:
self
.
dst_file
=
dst_file
self
.
imported_strs
=
[]
self
.
_already_imported_classes
=
{}
# name -> full_name
self
.
_import_regexp
=
re
.
compile
(
"import [A-Za-z.]+;"
)
self
.
_imported_class_regexp
=
re
.
compile
(
"[A-Za-z.]+;"
)
self
.
_import_regexp
=
re
.
compile
(
"import [A-Za-z.
0-9
]+;"
)
self
.
_imported_class_regexp
=
re
.
compile
(
"[A-Za-z.
0-9
]+;"
)
self
.
_imported_classes
=
defaultdict
(
lambda
:
[])
# name -> embedding files
if
not
os
.
path
.
isfile
(
src_file
):
raise
PreProcessorError
(
"Source file '{}' isn't a file"
.
format
(
src_file
))
...
...
@@ -127,7 +127,7 @@ def is_importable_file(file: str) -> bool:
if
line
.
startswith
(
"package "
):
has_package
=
True
elif
line
.
startswith
(
"public class "
):
match
=
re
.
search
(
"[A-Za-z_]+"
,
line
.
replace
(
"public class "
,
""
))
match
=
re
.
search
(
"[A-Za-z_
0-9
]+"
,
line
.
replace
(
"public class "
,
""
))
if
match
:
has_public_class
=
True
if
match
.
group
(
0
)
!=
name
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment