-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #127 from aya-lang/current-file-op
Add operator for getting the path to the current file (M0)
- Loading branch information
Showing
2 changed files
with
33 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package aya.parser.tokens; | ||
|
||
import aya.exceptions.parser.ParserException; | ||
import aya.instruction.Instruction; | ||
import aya.instruction.StringLiteralInstruction; | ||
import aya.parser.SourceStringRef; | ||
|
||
public class CurrentFileToken extends StdToken { | ||
|
||
public CurrentFileToken(SourceStringRef source) { | ||
super(source.getSource().getFilename(), Token.STRING, source); | ||
} | ||
|
||
@Override | ||
public Instruction getInstruction() throws ParserException { | ||
return new StringLiteralInstruction(source, this.source.getSource().getFilename()); | ||
} | ||
|
||
@Override | ||
public String typeString() { | ||
return "constant_current_file"; | ||
} | ||
} |