Skip to content

Commit

Permalink
Merge branch 'topic/update_lkql_doc' into 'master'
Browse files Browse the repository at this point in the history
Update and enhance the LKQL reference manual

See merge request eng/libadalang/langkit-query-language!323
  • Loading branch information
HugoGGuerrier committed Dec 3, 2024
2 parents eaa6b66 + fc340e7 commit fdde06a
Show file tree
Hide file tree
Showing 5 changed files with 758 additions and 604 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,8 @@

package com.adacore.lkql_jit.nodes.expressions.operators;

import com.adacore.libadalang.Libadalang;
import com.adacore.lkql_jit.exception.LKQLRuntimeException;
import com.adacore.lkql_jit.nodes.expressions.Expr;
import com.adacore.lkql_jit.nodes.patterns.BasePattern;
import com.adacore.lkql_jit.utils.LKQLTypesHelper;
import com.oracle.truffle.api.dsl.Fallback;
import com.oracle.truffle.api.dsl.NodeChild;
import com.oracle.truffle.api.dsl.Specialization;
import com.oracle.truffle.api.frame.VirtualFrame;
Expand Down Expand Up @@ -47,26 +43,14 @@ protected IsClause(SourceSection location, BasePattern pattern) {
// ----- Execution methods -----

/**
* Execute the is clause when the expression is a node.
* Execute the "is" clause on the provided value.
*
* @param frame The frame to execute the pattern in.
* @param node The node to verify.
* @return The result of the pattern execution.
* @param object The value to match against the "is" clause pattern.
* @return A boolean, representing whether the given value has been validated by the pattern.
*/
@Specialization
protected boolean executeNode(VirtualFrame frame, Libadalang.AdaNode node) {
return this.pattern.executeValue(frame, node);
}

/**
* Fallback method if the left operand is not a node.
*
* @param notNode The object that is not a node.
*/
@Fallback
protected void notNode(Object notNode) {
throw LKQLRuntimeException.wrongType(
LKQLTypesHelper.ADA_NODE, LKQLTypesHelper.fromJava(notNode), this.getNodeExpr());
protected boolean executeValue(VirtualFrame frame, Object object) {
return this.pattern.executeValue(frame, object);
}

// ----- Override methods -----
Expand All @@ -78,6 +62,4 @@ protected void notNode(Object notNode) {
public String toString(int indentLevel) {
return this.nodeRepresentation(indentLevel);
}

public abstract Expr getNodeExpr();
}

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit fdde06a

Please sign in to comment.