Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Milhomme Allan
JavaMetaParser
Commits
e136473e
Commit
e136473e
authored
Oct 19, 2018
by
Custom2043
Browse files
Ignore are now only inner
parent
afd136e9
Changes
5
Hide whitespace changes
Inline
Side-by-side
JMP.jar
View file @
e136473e
No preview for this file type
src/compiler/Compiler.java
View file @
e136473e
...
...
@@ -55,6 +55,9 @@ public class Compiler
for
(
Token
t
:
tokens
)
{
if
(
t
instanceof
Space
||
t
instanceof
Jump
)
continue
;
if
(
t
instanceof
ParserString
&&
((
ParserString
)
t
).
index
==
ParserString
.
anyChar
.
getIndex
())
report
(
new
Info
(
InfoModel
.
invalidChar
,
t
));
else
if
(
t
instanceof
Line
)
...
...
@@ -76,7 +79,7 @@ public class Compiler
lines
.
add
((
Line
)
t
);
}
else
if
(!(
t
instanceof
Space
||
t
instanceof
Jump
))
else
report
(
new
Info
(
InfoModel
.
syntaxError
,
t
));
enabled
=
t
instanceof
Line
;
...
...
src/parser/ArraySearch.java
View file @
e136473e
package
parser
;
import
java.util.LinkedList
;
import
java.util.List
;
/**
* An array search is composed of a left search, a core and a right search
...
...
@@ -181,11 +182,30 @@ public class ArraySearch extends MultipleSearch
@Override
MultipleSearch
addIgnore
(
Ignore
ignore
)
{
return
new
ArraySearch
(
this
.
getSearchName
(),
this
.
minSize
,
this
.
maxSize
,
/*
return new ArraySearch(this.getSearchName(), this.minSize, this.maxSize,
TokenBuilder.addIgnoresToArray(ignore, this.leftSearches),
TokenBuilder.addIgnoresToArray(ignore, this.getSearches()),
TokenBuilder.addIgnoresToArray(ignore, this.rightSearches)
);
);*/
List
<
Search
>
leftWithIgnored
=
TokenBuilder
.
addIgnores
(
ignore
,
this
.
leftSearches
),
coreWithIgnored
=
TokenBuilder
.
addIgnores
(
ignore
,
this
.
getSearches
()),
rightWithIgnored
=
TokenBuilder
.
addIgnores
(
ignore
,
this
.
rightSearches
);
if
(
leftWithIgnored
.
size
()
>
0
)
leftWithIgnored
.
add
(
0
,
ignore
.
getRealSearch
());
leftWithIgnored
.
add
(
ignore
.
getRealSearch
());
if
(
rightWithIgnored
.
size
()
>
0
)
rightWithIgnored
.
add
(
0
,
ignore
.
getRealSearch
());
return
new
ArraySearch
(
this
.
getSearchName
(),
this
.
minSize
,
this
.
maxSize
,
leftWithIgnored
.
toArray
(
new
Search
[
leftWithIgnored
.
size
()]),
coreWithIgnored
.
toArray
(
new
Search
[
coreWithIgnored
.
size
()]),
rightWithIgnored
.
toArray
(
new
Search
[
rightWithIgnored
.
size
()])
);
//coreWithIgnored, coreWithIgnored.length == 0 ? new Search[0] : ignore.getRealSearch());
}
@Override
...
...
@@ -198,5 +218,30 @@ public class ArraySearch extends MultipleSearch
for
(
Search
s
:
this
.
getRightSearches
())
s
.
setDeclarationBuilder
(
builder
);
}
@Override
public
final
String
toString
(
int
tabs
)
{
String
tab
=
""
,
s
;
for
(
int
i
=
0
;
i
<
tabs
;
i
++)
tab
+=
"\t"
;
s
=
tab
+
this
.
getClass
().
getSimpleName
();
s
+=
" "
+
this
.
getSearchName
()+
" : "
;
s
+=
"\n"
+
tab
+
"LeftSearches :"
;
for
(
Search
ss
:
this
.
leftSearches
)
s
+=
"\n"
+
ss
.
toString
(
tabs
+
1
);
s
+=
"\n"
+
tab
+
"CoreSearches :"
;
for
(
Search
ss
:
this
.
getSearches
())
s
+=
"\n"
+
ss
.
toString
(
tabs
+
1
);
s
+=
"\n"
+
tab
+
"RightSearches :"
;
for
(
Search
ss
:
this
.
rightSearches
)
s
+=
"\n"
+
ss
.
toString
(
tabs
+
1
);
return
s
;
}
}
src/parser/MultipleSearch.java
View file @
e136473e
...
...
@@ -17,7 +17,7 @@ public abstract class MultipleSearch extends Search
abstract
MultipleSearch
addIgnore
(
Ignore
ignore
);
@Override
public
final
String
toString
(
int
tabs
)
public
String
toString
(
int
tabs
)
{
String
s
=
""
;
for
(
int
i
=
0
;
i
<
tabs
;
i
++)
...
...
src/parser/TokenBuilder.java
View file @
e136473e
...
...
@@ -44,14 +44,16 @@ public class TokenBuilder extends Builder
{
List
<
Search
>
searchesWithIgnore
=
new
LinkedList
<>();
for
(
Search
s
:
searches
)
{
if
(
s
instanceof
TokenSearch
||
s
instanceof
OrSearch
)
{
searchesWithIgnore
.
add
(
s
);
if
(
s
!=
searches
[
searches
.
length
-
1
])
searchesWithIgnore
.
add
(
ignore
.
getRealSearch
());
}
else
if
(
s
instanceof
MultipleSearch
)
searchesWithIgnore
.
add
(((
MultipleSearch
)
s
).
addIgnore
(
ignore
));
if
(
s
!=
searches
[
searches
.
length
-
1
])
searchesWithIgnore
.
add
(
ignore
.
getRealSearch
());
}
return
searchesWithIgnore
;
}
...
...
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