mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-08-10 17:55:44 +00:00
Merge pull request #3064 from scratchcoder27/master
Added Variable Substitution support to `first` and `last` stmts in AUTOCAL
This commit is contained in:
commit
a34ca12047
@ -93,7 +93,7 @@ public class ParseMSES1Ext1 extends ParseMSES1 {
|
|||||||
if(lower.startsWith("first ")) {
|
if(lower.startsWith("first ")) {
|
||||||
if(line.length() <= 6) return EnumStatementReturn.PARAMETER_ERROR;
|
if(line.length() <= 6) return EnumStatementReturn.PARAMETER_ERROR;
|
||||||
try {
|
try {
|
||||||
int length = Integer.parseInt(line.substring(6));
|
int length = Integer.parseInt(substitute(ctx, line.substring(6), true));
|
||||||
int max = ctx.readBuffer().length();
|
int max = ctx.readBuffer().length();
|
||||||
if(length > max) length = max;
|
if(length > max) length = max;
|
||||||
ctx.writeBuffer(ctx.readBuffer().substring(0, length));
|
ctx.writeBuffer(ctx.readBuffer().substring(0, length));
|
||||||
@ -105,7 +105,7 @@ public class ParseMSES1Ext1 extends ParseMSES1 {
|
|||||||
if(lower.startsWith("last ")) {
|
if(lower.startsWith("last ")) {
|
||||||
if(line.length() <= 5) return EnumStatementReturn.PARAMETER_ERROR;
|
if(line.length() <= 5) return EnumStatementReturn.PARAMETER_ERROR;
|
||||||
try {
|
try {
|
||||||
int length = Integer.parseInt(line.substring(5));
|
int length = Integer.parseInt(substitute(ctx, line.substring(5), true));
|
||||||
int max = ctx.readBuffer().length();
|
int max = ctx.readBuffer().length();
|
||||||
if(length > max) length = max;
|
if(length > max) length = max;
|
||||||
ctx.writeBuffer(ctx.readBuffer().substring(max - length, max));
|
ctx.writeBuffer(ctx.readBuffer().substring(max - length, max));
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user