Skip to content

Commit

Permalink
feat(objectionary#226): fix the bug related to 'frame' parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
volodya-lombrozo committed May 16, 2024
1 parent b4b8eda commit 84cb49d
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/it/staticize/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ SOFTWARE.
<configuration>
<sourcesDir>${project.build.directory}/generated-sources/jeo-decompile-xmir</sourcesDir>
<outputDir>${project.build.directory}/generated-sources/opeo-decompile-xmir</outputDir>
<copyDir>${project.build.directory}/generated-sources/opep-decompile-xmir-copy</copyDir>
<modifiedDir>${project.build.directory}/generated-sources/opep-decompile-xmir-modified</modifiedDir>
</configuration>
</execution>
<execution>
Expand Down
32 changes: 32 additions & 0 deletions src/main/java/org/eolang/opeo/ast/RawXml.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package org.eolang.opeo.ast;

import com.jcabi.xml.XMLDocument;
import java.util.Collections;
import java.util.List;
import org.eolang.jeo.representation.xmir.XmlNode;
import org.w3c.dom.Node;
import org.xembly.Directive;
import org.xembly.Directives;
import org.xembly.ImpossibleModificationException;
import org.xembly.Xembler;

public final class RawXml implements AstNode {

private final XmlNode node;

public RawXml(final XmlNode node) {
this.node = node;
}

@Override
public List<AstNode> opcodes() {
return Collections.singletonList(this);
}

@Override
public Iterable<Directive> toXmir() {
//todo!
return new Directives().append(new XMLDocument(
new XMLDocument(this.node.node()).toString()).node());
}
}
3 changes: 3 additions & 0 deletions src/main/java/org/eolang/opeo/compilation/XmirParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
import org.eolang.opeo.ast.Literal;
import org.eolang.opeo.ast.LocalVariable;
import org.eolang.opeo.ast.Opcode;
import org.eolang.opeo.ast.RawXml;
import org.eolang.opeo.ast.StaticInvocation;
import org.eolang.opeo.ast.StoreArray;
import org.eolang.opeo.ast.Substraction;
Expand Down Expand Up @@ -160,6 +161,8 @@ private AstNode node(final XmlNode node) {
result = new Substraction(node, this::node);
} else if ("cast".equals(base)) {
result = new Cast(node, this::node);
} else if ("frame".equals(base)) {
result = new RawXml(node);
} else if ("opcode".equals(base)) {
final XmlInstruction instruction = new XmlInstruction(node);
final int opcode = instruction.opcode();
Expand Down

0 comments on commit 84cb49d

Please sign in to comment.