Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.laytonsmith.core.compiler.analysis;

import com.laytonsmith.core.NodeModifiers;
import com.laytonsmith.core.constructs.Target;

/**
* Represents a breakable (for(), while(), switch(), etc) bound declaration in a scope graph.
* This indicates a boundary where lookup for a breakable should stop.
* @author P.J.S. Kools
*/
public class BreakableBoundDeclaration extends Declaration {

/**
* Creates a new {@link BreakableBoundDeclaration} in the {@link Namespace#BREAKABLE} namespace.
* @param modifiers The node modifiers.
* @param t The breakable target.
*/
public BreakableBoundDeclaration(NodeModifiers modifiers, Target t) {
super(Namespace.BREAKABLE, null, null, modifiers, t);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package com.laytonsmith.core.compiler.analysis;

import com.laytonsmith.core.NodeModifiers;
import com.laytonsmith.core.constructs.Target;

/**
* Represents a breakable (for(), while(), switch(), etc) declaration in a scope graph.
* @author P.J.S. Kools
*/
public class BreakableDeclaration extends Declaration {

private final Scope parentScope;

/**
* Creates a new {@link BreakableDeclaration} in the {@link Namespace#BREAKABLE} namespace.
* @param parentScope The parent scope of the breakable (that does not include this declaration).
* @param modifiers The node modifiers.
* @param t The breakable target.
*/
public BreakableDeclaration(Scope parentScope, NodeModifiers modifiers, Target t) {
super(Namespace.BREAKABLE, null, null, modifiers, t);
this.parentScope = parentScope;
}

public Scope getParentScope() {
return this.parentScope;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.laytonsmith.core.compiler.analysis;

import com.laytonsmith.core.constructs.Target;

/**
* Represents a reference to a breakable (by the break() function) in a scope graph.
* @author P.J.S. Kools
*/
public class BreakableReference extends Reference {

/**
* Creates a new {@link BreakableReference} in the {@link Namespace#BREAKABLE} scope.
* @param t - The target of the reference.
*/
public BreakableReference(Target t) {
super(Namespace.BREAKABLE, null, t);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.laytonsmith.core.compiler.analysis;

import com.laytonsmith.core.NodeModifiers;
import com.laytonsmith.core.constructs.Target;

/**
* Represents a continuable (for(), while(), etc) bound declaration in a scope graph.
* This indicates a boundary where lookup for a continuable should stop.
* @author P.J.S. Kools
*/
public class ContinuableBoundDeclaration extends Declaration {

/**
* Creates a new {@link ContinuableBoundDeclaration} in the {@link Namespace#CONTINUABLE} namespace.
* @param modifiers The node modifiers.
* @param t The continuable target.
*/
public ContinuableBoundDeclaration(NodeModifiers modifiers, Target t) {
super(Namespace.CONTINUABLE, null, null, modifiers, t);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.laytonsmith.core.compiler.analysis;

import com.laytonsmith.core.NodeModifiers;
import com.laytonsmith.core.constructs.Target;

/**
* Represents a continuable (for(), while(), etc) declaration in a scope graph.
* @author P.J.S. Kools
*/
public class ContinuableDeclaration extends Declaration {

/**
* Creates a new {@link ContinuableDeclaration} in the {@link Namespace#CONTINUABLE} namespace.
* @param modifiers The node modifiers.
* @param t The continuable target.
*/
public ContinuableDeclaration(NodeModifiers modifiers, Target t) {
super(Namespace.CONTINUABLE, null, null, modifiers, t);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.laytonsmith.core.compiler.analysis;

import com.laytonsmith.core.constructs.Target;

/**
* Represents a reference to a continuable (by the continue()) function in a scope graph.
* @author P.J.S. Kools
*/
public class ContinuableReference extends Reference {

/**
* Creates a new {@link ContinuableReference} in the {@link Namespace#CONTINUABLE} scope.
* @param t - The target of the reference.
*/
public ContinuableReference(Target t) {
super(Namespace.CONTINUABLE, null, t);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class IncludeReference extends Reference {
* @param identifier - The include identifier (the path passed to include(), which should resolve to a file).
* @param inScope - The parent scope which the include should be linked to.
* @param outScope - The scope in which the include should be usable.
* @param t - The target of the declaration.
* @param t - The target of the reference.
*/
public IncludeReference(String identifier, Scope inScope, Scope outScope, Target t) {
super(Namespace.INCLUDE, identifier, t);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,8 @@ public enum Namespace {
IVARIABLE,
IVARIABLE_ASSIGN,
PROCEDURE,
INCLUDE
INCLUDE,
RETURNABLE,
BREAKABLE,
CONTINUABLE
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.laytonsmith.core.compiler.analysis;

import com.laytonsmith.core.NodeModifiers;
import com.laytonsmith.core.constructs.CClassType;
import com.laytonsmith.core.constructs.Target;

/**
* Represents a returnable declaration in a scope graph.
* @author P.J.S. Kools
*/
public class ReturnableDeclaration extends Declaration {

/**
* Creates a new {@link ReturnableDeclaration} in the {@link Namespace#RETURNABLE} namespace.
* @param type The expected return {@link CClassType}.
* @param modifiers The node modifiers.
* @param t The returnable target.
*/
public ReturnableDeclaration(CClassType type, NodeModifiers modifiers, Target t) {
super(Namespace.RETURNABLE, null, type, modifiers, t);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.laytonsmith.core.compiler.analysis;

import com.laytonsmith.core.constructs.Target;

/**
* Represents a reference to a returnable in a scope graph.
* @author P.J.S. Kools
*/
public class ReturnableReference extends Reference {

/**
* Creates a new {@link ReturnableReference} in the {@link Namespace#RETURNABLE} scope.
* @param t - The target of the reference.
*/
public ReturnableReference(Target t) {
super(Namespace.RETURNABLE, null, t);
}
}
Loading