cache: add script id to grammar
This commit is contained in:
@@ -26,13 +26,15 @@ grammar rs2asm;
|
||||
|
||||
prog: (header NEWLINE)* (line NEWLINE)+ ;
|
||||
|
||||
header: int_stack_count | string_stack_count | int_var_count | string_var_count ;
|
||||
header: id | int_stack_count | string_stack_count | int_var_count | string_var_count ;
|
||||
|
||||
id: '.id ' id_value ;
|
||||
int_stack_count: '.int_stack_count ' int_stack_value ;
|
||||
string_stack_count: '.string_stack_count ' string_stack_value ;
|
||||
int_var_count: '.int_var_count ' int_var_value ;
|
||||
string_var_count: '.string_var_count ' string_var_value ;
|
||||
|
||||
id_value: INT ;
|
||||
int_stack_value: INT ;
|
||||
string_stack_value: INT ;
|
||||
int_var_value: INT ;
|
||||
|
||||
@@ -42,6 +42,7 @@ public class ScriptWriter extends rs2asmBaseListener
|
||||
private final Instructions instructions;
|
||||
private final LabelVisitor labelVisitor;
|
||||
|
||||
private int id;
|
||||
private int pos;
|
||||
private int intStackCount;
|
||||
private int stringStackCount;
|
||||
@@ -58,6 +59,13 @@ public class ScriptWriter extends rs2asmBaseListener
|
||||
this.labelVisitor = labelVisitor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enterId_value(rs2asmParser.Id_valueContext ctx)
|
||||
{
|
||||
int value = Integer.parseInt(ctx.getText());
|
||||
id = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enterInt_stack_value(rs2asmParser.Int_stack_valueContext ctx)
|
||||
{
|
||||
@@ -209,6 +217,7 @@ public class ScriptWriter extends rs2asmBaseListener
|
||||
public ScriptDefinition buildScript()
|
||||
{
|
||||
ScriptDefinition script = new ScriptDefinition();
|
||||
script.setId(id);
|
||||
script.setIntStackCount(intStackCount);
|
||||
script.setStringStackCount(stringStackCount);
|
||||
script.setLocalIntCount(localIntCount);
|
||||
|
||||
Reference in New Issue
Block a user