GP-4303 Collapse STARTSYM, ENDSYM, NEXT2SYM, etc. into single token type

This commit is contained in:
caheckman 2024-02-07 00:54:24 +00:00
parent d1dc48547e
commit ae6f7b479c
12 changed files with 2390 additions and 3125 deletions

File diff suppressed because it is too large Load diff

View file

@ -38,9 +38,6 @@ extern int pcodeerror(const char *str );
SpaceSymbol *spacesym; SpaceSymbol *spacesym;
UserOpSymbol *useropsym; UserOpSymbol *useropsym;
LabelSymbol *labelsym; LabelSymbol *labelsym;
StartSymbol *startsym;
EndSymbol *endsym;
Next2Symbol *next2sym;
OperandSymbol *operandsym; OperandSymbol *operandsym;
VarnodeSymbol *varsym; VarnodeSymbol *varsym;
SpecificSymbol *specsym; SpecificSymbol *specsym;
@ -77,9 +74,7 @@ extern int pcodeerror(const char *str );
%token <useropsym> USEROPSYM %token <useropsym> USEROPSYM
%token <varsym> VARSYM %token <varsym> VARSYM
%token <operandsym> OPERANDSYM %token <operandsym> OPERANDSYM
%token <startsym> STARTSYM %token <specsym> JUMPSYM
%token <endsym> ENDSYM
%token <next2sym> NEXT2SYM
%token <labelsym> LABELSYM %token <labelsym> LABELSYM
%type <param> paramlist %type <param> paramlist
@ -197,9 +192,7 @@ sizedstar: '*' '[' SPACESYM ']' ':' INTEGER { $$ = new StarQuality; $$->size = *
| '*' ':' INTEGER { $$ = new StarQuality; $$->size = *$3; delete $3; $$->id=ConstTpl(pcode->getDefaultSpace()); } | '*' ':' INTEGER { $$ = new StarQuality; $$->size = *$3; delete $3; $$->id=ConstTpl(pcode->getDefaultSpace()); }
| '*' { $$ = new StarQuality; $$->size = 0; $$->id=ConstTpl(pcode->getDefaultSpace()); } | '*' { $$ = new StarQuality; $$->size = 0; $$->id=ConstTpl(pcode->getDefaultSpace()); }
; ;
jumpdest: STARTSYM { VarnodeTpl *sym = $1->getVarnode(); $$ = new VarnodeTpl(ConstTpl(ConstTpl::j_curspace),sym->getOffset(),ConstTpl(ConstTpl::j_curspace_size)); delete sym; } jumpdest: JUMPSYM { VarnodeTpl *sym = $1->getVarnode(); $$ = new VarnodeTpl(ConstTpl(ConstTpl::j_curspace),sym->getOffset(),ConstTpl(ConstTpl::j_curspace_size)); delete sym; }
| ENDSYM { VarnodeTpl *sym = $1->getVarnode(); $$ = new VarnodeTpl(ConstTpl(ConstTpl::j_curspace),sym->getOffset(),ConstTpl(ConstTpl::j_curspace_size)); delete sym; }
| NEXT2SYM { VarnodeTpl *sym = $1->getVarnode(); $$ = new VarnodeTpl(ConstTpl(ConstTpl::j_curspace),sym->getOffset(),ConstTpl(ConstTpl::j_curspace_size)); delete sym; }
| INTEGER { $$ = new VarnodeTpl(ConstTpl(ConstTpl::j_curspace),ConstTpl(ConstTpl::real,*$1),ConstTpl(ConstTpl::j_curspace_size)); delete $1; } | INTEGER { $$ = new VarnodeTpl(ConstTpl(ConstTpl::j_curspace),ConstTpl(ConstTpl::real,*$1),ConstTpl(ConstTpl::j_curspace_size)); delete $1; }
| BADINTEGER { $$ = new VarnodeTpl(ConstTpl(ConstTpl::j_curspace),ConstTpl(ConstTpl::real,0),ConstTpl(ConstTpl::j_curspace_size)); yyerror("Parsed integer is too big (overflow)"); } | BADINTEGER { $$ = new VarnodeTpl(ConstTpl(ConstTpl::j_curspace),ConstTpl(ConstTpl::real,0),ConstTpl(ConstTpl::j_curspace_size)); yyerror("Parsed integer is too big (overflow)"); }
| INTEGER '[' SPACESYM ']' { AddrSpace *spc = $3->getSpace(); $$ = new VarnodeTpl(ConstTpl(spc),ConstTpl(ConstTpl::real,*$1),ConstTpl(ConstTpl::real,spc->getAddrSize())); delete $1; } | INTEGER '[' SPACESYM ']' { AddrSpace *spc = $3->getSpace(); $$ = new VarnodeTpl(ConstTpl(spc),ConstTpl(ConstTpl::real,*$1),ConstTpl(ConstTpl::real,spc->getAddrSize())); delete $1; }
@ -224,9 +217,7 @@ label: '<' LABELSYM '>' { $$ = $2; }
; ;
specificsymbol: VARSYM { $$ = $1; } specificsymbol: VARSYM { $$ = $1; }
| OPERANDSYM { $$ = $1; } | OPERANDSYM { $$ = $1; }
| STARTSYM { $$ = $1; } | JUMPSYM { $$ = $1; }
| ENDSYM { $$ = $1; }
| NEXT2SYM { $$ = $1; }
; ;
paramlist: /* EMPTY */ { $$ = new vector<ExprTree *>; } paramlist: /* EMPTY */ { $$ = new vector<ExprTree *>; }
| expr { $$ = new vector<ExprTree *>; $$->push_back($1); } | expr { $$ = new vector<ExprTree *>; $$->push_back($1); }
@ -750,14 +741,12 @@ int4 PcodeSnippet::lex(void)
yylval.operandsym = (OperandSymbol *)sym; yylval.operandsym = (OperandSymbol *)sym;
return OPERANDSYM; return OPERANDSYM;
case SleighSymbol::start_symbol: case SleighSymbol::start_symbol:
yylval.startsym = (StartSymbol *)sym;
return STARTSYM;
case SleighSymbol::end_symbol: case SleighSymbol::end_symbol:
yylval.endsym = (EndSymbol *)sym; case SleighSymbol::next2_symbol:
return ENDSYM; case SleighSymbol::flowdest_symbol:
case SleighSymbol::next2_symbol: case SleighSymbol::flowref_symbol:
yylval.next2sym = (Next2Symbol *)sym; yylval.specsym = (SpecificSymbol *)sym;
return NEXT2SYM; return JUMPSYM;
case SleighSymbol::label_symbol: case SleighSymbol::label_symbol:
yylval.labelsym = (LabelSymbol *)sym; yylval.labelsym = (LabelSymbol *)sym;
return LABELSYM; return LABELSYM;

File diff suppressed because it is too large Load diff

View file

@ -13,11 +13,12 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
/* A Bison parser, made by GNU Bison 3.0.4. */ /* A Bison parser, made by GNU Bison 3.5.1. */
/* Bison interface for Yacc-like parsers in C /* Bison interface for Yacc-like parsers in C
Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2020 Free Software Foundation,
Inc.
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -45,6 +46,9 @@
This special exception was added by the Free Software Foundation in This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */ version 2.2 of Bison. */
/* Undocumented macros, especially those whose name start with YY_,
are private implementation details. Do not rely on them. */
#ifndef YY_SLEIGH_SLGHPARSE_HH_INCLUDED #ifndef YY_SLEIGH_SLGHPARSE_HH_INCLUDED
# define YY_SLEIGH_SLGHPARSE_HH_INCLUDED # define YY_SLEIGH_SLGHPARSE_HH_INCLUDED
/* Debug traces. */ /* Debug traces. */
@ -175,22 +179,18 @@ extern int sleighdebug;
SPECSYM = 362, SPECSYM = 362,
VARLISTSYM = 363, VARLISTSYM = 363,
OPERANDSYM = 364, OPERANDSYM = 364,
STARTSYM = 365, JUMPSYM = 365,
ENDSYM = 366, MACROSYM = 366,
NEXT2SYM = 367, LABELSYM = 367,
MACROSYM = 368, SUBTABLESYM = 368
LABELSYM = 369,
SUBTABLESYM = 370
}; };
#endif #endif
/* Value type. */ /* Value type. */
#if ! defined SLEIGHSTYPE && ! defined SLEIGHSTYPE_IS_DECLARED #if ! defined SLEIGHSTYPE && ! defined SLEIGHSTYPE_IS_DECLARED
union SLEIGHSTYPE union SLEIGHSTYPE
{ {
char ch; char ch;
uintb *i; uintb *i;
intb *big; intb *big;
@ -220,9 +220,6 @@ union SLEIGHSTYPE
MacroSymbol *macrosym; MacroSymbol *macrosym;
LabelSymbol *labelsym; LabelSymbol *labelsym;
SubtableSymbol *subtablesym; SubtableSymbol *subtablesym;
StartSymbol *startsym;
EndSymbol *endsym;
Next2Symbol *next2sym;
OperandSymbol *operandsym; OperandSymbol *operandsym;
VarnodeListSymbol *varlistsym; VarnodeListSymbol *varlistsym;
VarnodeSymbol *varsym; VarnodeSymbol *varsym;
@ -236,7 +233,6 @@ union SLEIGHSTYPE
}; };
typedef union SLEIGHSTYPE SLEIGHSTYPE; typedef union SLEIGHSTYPE SLEIGHSTYPE;
# define SLEIGHSTYPE_IS_TRIVIAL 1 # define SLEIGHSTYPE_IS_TRIVIAL 1
# define SLEIGHSTYPE_IS_DECLARED 1 # define SLEIGHSTYPE_IS_DECLARED 1

View file

@ -58,9 +58,6 @@ extern int sleigherror(const char *str );
MacroSymbol *macrosym; MacroSymbol *macrosym;
LabelSymbol *labelsym; LabelSymbol *labelsym;
SubtableSymbol *subtablesym; SubtableSymbol *subtablesym;
StartSymbol *startsym;
EndSymbol *endsym;
Next2Symbol *next2sym;
OperandSymbol *operandsym; OperandSymbol *operandsym;
VarnodeListSymbol *varlistsym; VarnodeListSymbol *varlistsym;
VarnodeSymbol *varsym; VarnodeSymbol *varsym;
@ -122,9 +119,7 @@ extern int sleigherror(const char *str );
%token <specsym> SPECSYM %token <specsym> SPECSYM
%token <varlistsym> VARLISTSYM %token <varlistsym> VARLISTSYM
%token <operandsym> OPERANDSYM %token <operandsym> OPERANDSYM
%token <startsym> STARTSYM %token <specsym> JUMPSYM
%token <endsym> ENDSYM
%token <next2sym> NEXT2SYM
%token <macrosym> MACROSYM %token <macrosym> MACROSYM
%token <labelsym> LABELSYM %token <labelsym> LABELSYM
%token <subtablesym> SUBTABLESYM %token <subtablesym> SUBTABLESYM
@ -459,9 +454,7 @@ sizedstar: '*' '[' SPACESYM ']' ':' INTEGER { $$ = new StarQuality; $$->size = *
| '*' ':' INTEGER { $$ = new StarQuality; $$->size = *$3; delete $3; $$->id=ConstTpl(slgh->getDefaultCodeSpace()); } | '*' ':' INTEGER { $$ = new StarQuality; $$->size = *$3; delete $3; $$->id=ConstTpl(slgh->getDefaultCodeSpace()); }
| '*' { $$ = new StarQuality; $$->size = 0; $$->id=ConstTpl(slgh->getDefaultCodeSpace()); } | '*' { $$ = new StarQuality; $$->size = 0; $$->id=ConstTpl(slgh->getDefaultCodeSpace()); }
; ;
jumpdest: STARTSYM { VarnodeTpl *sym = $1->getVarnode(); $$ = new VarnodeTpl(ConstTpl(ConstTpl::j_curspace),sym->getOffset(),ConstTpl(ConstTpl::j_curspace_size)); delete sym; } jumpdest: JUMPSYM { VarnodeTpl *sym = $1->getVarnode(); $$ = new VarnodeTpl(ConstTpl(ConstTpl::j_curspace),sym->getOffset(),ConstTpl(ConstTpl::j_curspace_size)); delete sym; }
| ENDSYM { VarnodeTpl *sym = $1->getVarnode(); $$ = new VarnodeTpl(ConstTpl(ConstTpl::j_curspace),sym->getOffset(),ConstTpl(ConstTpl::j_curspace_size)); delete sym; }
| NEXT2SYM { VarnodeTpl *sym = $1->getVarnode(); $$ = new VarnodeTpl(ConstTpl(ConstTpl::j_curspace),sym->getOffset(),ConstTpl(ConstTpl::j_curspace_size)); delete sym; }
| INTEGER { $$ = new VarnodeTpl(ConstTpl(ConstTpl::j_curspace),ConstTpl(ConstTpl::real,*$1),ConstTpl(ConstTpl::j_curspace_size)); delete $1; } | INTEGER { $$ = new VarnodeTpl(ConstTpl(ConstTpl::j_curspace),ConstTpl(ConstTpl::real,*$1),ConstTpl(ConstTpl::j_curspace_size)); delete $1; }
| BADINTEGER { $$ = new VarnodeTpl(ConstTpl(ConstTpl::j_curspace),ConstTpl(ConstTpl::real,0),ConstTpl(ConstTpl::j_curspace_size)); slgh->reportError("Parsed integer is too big (overflow)"); } | BADINTEGER { $$ = new VarnodeTpl(ConstTpl(ConstTpl::j_curspace),ConstTpl(ConstTpl::real,0),ConstTpl(ConstTpl::j_curspace_size)); slgh->reportError("Parsed integer is too big (overflow)"); }
| OPERANDSYM { $$ = $1->getVarnode(); $1->setCodeAddress(); } | OPERANDSYM { $$ = $1->getVarnode(); $1->setCodeAddress(); }
@ -503,9 +496,7 @@ familysymbol: VALUESYM { $$ = $1; }
specificsymbol: VARSYM { $$ = $1; } specificsymbol: VARSYM { $$ = $1; }
| SPECSYM { $$ = $1; } | SPECSYM { $$ = $1; }
| OPERANDSYM { $$ = $1; } | OPERANDSYM { $$ = $1; }
| STARTSYM { $$ = $1; } | JUMPSYM { $$ = $1; }
| ENDSYM { $$ = $1; }
| NEXT2SYM { $$ = $1; }
; ;
charstring: CHAR { $$ = new string; (*$$) += $1; } charstring: CHAR { $$ = new string; (*$$) += $1; }
| charstring CHAR { $$ = $1; (*$$) += $2; } | charstring CHAR { $$ = $1; (*$$) += $2; }
@ -578,9 +569,7 @@ anysymbol: SPACESYM { $$ = $1; }
| VARSYM { $$ = $1; } | VARSYM { $$ = $1; }
| VARLISTSYM { $$ = $1; } | VARLISTSYM { $$ = $1; }
| OPERANDSYM { $$ = $1; } | OPERANDSYM { $$ = $1; }
| STARTSYM { $$ = $1; } | JUMPSYM { $$ = $1; }
| ENDSYM { $$ = $1; }
| NEXT2SYM { $$ = $1; }
| BITSYM { $$ = $1; } | BITSYM { $$ = $1; }
; ;
%% %%

View file

@ -1548,14 +1548,12 @@ int4 find_symbol(void) {
sleighlval.operandsym = (OperandSymbol *)sym; sleighlval.operandsym = (OperandSymbol *)sym;
return OPERANDSYM; return OPERANDSYM;
case SleighSymbol::start_symbol: case SleighSymbol::start_symbol:
sleighlval.startsym = (StartSymbol *)sym;
return STARTSYM;
case SleighSymbol::end_symbol: case SleighSymbol::end_symbol:
sleighlval.endsym = (EndSymbol *)sym;
return ENDSYM;
case SleighSymbol::next2_symbol: case SleighSymbol::next2_symbol:
sleighlval.next2sym = (Next2Symbol *)sym; case SleighSymbol::flowdest_symbol:
return NEXT2SYM; case SleighSymbol::flowref_symbol:
sleighlval.specsym = (SpecificSymbol *)sym;
return JUMPSYM;
case SleighSymbol::subtable_symbol: case SleighSymbol::subtable_symbol:
sleighlval.subtablesym = (SubtableSymbol *)sym; sleighlval.subtablesym = (SubtableSymbol *)sym;
return SUBTABLESYM; return SUBTABLESYM;

View file

@ -429,14 +429,12 @@ int4 find_symbol(void) {
sleighlval.operandsym = (OperandSymbol *)sym; sleighlval.operandsym = (OperandSymbol *)sym;
return OPERANDSYM; return OPERANDSYM;
case SleighSymbol::start_symbol: case SleighSymbol::start_symbol:
sleighlval.startsym = (StartSymbol *)sym;
return STARTSYM;
case SleighSymbol::end_symbol: case SleighSymbol::end_symbol:
sleighlval.endsym = (EndSymbol *)sym;
return ENDSYM;
case SleighSymbol::next2_symbol: case SleighSymbol::next2_symbol:
sleighlval.next2sym = (Next2Symbol *)sym; case SleighSymbol::flowdest_symbol:
return NEXT2SYM; case SleighSymbol::flowref_symbol:
sleighlval.specsym = (SpecificSymbol *)sym;
return JUMPSYM;
case SleighSymbol::subtable_symbol: case SleighSymbol::subtable_symbol:
sleighlval.subtablesym = (SubtableSymbol *)sym; sleighlval.subtablesym = (SubtableSymbol *)sym;
return SUBTABLESYM; return SUBTABLESYM;

View file

@ -28,7 +28,7 @@ public:
enum symbol_type { space_symbol, token_symbol, userop_symbol, value_symbol, valuemap_symbol, enum symbol_type { space_symbol, token_symbol, userop_symbol, value_symbol, valuemap_symbol,
name_symbol, varnode_symbol, varnodelist_symbol, operand_symbol, name_symbol, varnode_symbol, varnodelist_symbol, operand_symbol,
start_symbol, end_symbol, next2_symbol, subtable_symbol, macro_symbol, section_symbol, start_symbol, end_symbol, next2_symbol, subtable_symbol, macro_symbol, section_symbol,
bitrange_symbol, context_symbol, epsilon_symbol, label_symbol, bitrange_symbol, context_symbol, epsilon_symbol, label_symbol, flowdest_symbol, flowref_symbol,
dummy_symbol }; dummy_symbol };
private: private:
string name; string name;
@ -416,7 +416,7 @@ public:
virtual PatternExpression *getPatternExpression(void) const { throw SleighError("Cannot use symbol in pattern"); } virtual PatternExpression *getPatternExpression(void) const { throw SleighError("Cannot use symbol in pattern"); }
virtual void getFixedHandle(FixedHandle &hand,ParserWalker &walker) const; virtual void getFixedHandle(FixedHandle &hand,ParserWalker &walker) const;
virtual void print(ostream &s,ParserWalker &walker) const; virtual void print(ostream &s,ParserWalker &walker) const;
virtual symbol_type getType(void) const { return start_symbol; } virtual symbol_type getType(void) const { return flowdest_symbol; }
}; };
class FlowRefSymbol : public SpecificSymbol { class FlowRefSymbol : public SpecificSymbol {
@ -428,7 +428,7 @@ public:
virtual PatternExpression *getPatternExpression(void) const { throw SleighError("Cannot use symbol in pattern"); } virtual PatternExpression *getPatternExpression(void) const { throw SleighError("Cannot use symbol in pattern"); }
virtual void getFixedHandle(FixedHandle &hand,ParserWalker &walker) const; virtual void getFixedHandle(FixedHandle &hand,ParserWalker &walker) const;
virtual void print(ostream &s,ParserWalker &walker) const; virtual void print(ostream &s,ParserWalker &walker) const;
virtual symbol_type getType(void) const { return start_symbol; } virtual symbol_type getType(void) const { return flowref_symbol; }
}; };
class ContextChange { // Change to context command class ContextChange { // Change to context command

View file

@ -344,6 +344,8 @@ specific_symbol[String purpose] returns [SpecificSymbol symbol]
} else if(sym.getType() != symbol_type.start_symbol } else if(sym.getType() != symbol_type.start_symbol
&& sym.getType() != symbol_type.end_symbol && sym.getType() != symbol_type.end_symbol
&& sym.getType() != symbol_type.next2_symbol && sym.getType() != symbol_type.next2_symbol
&& sym.getType() != symbol_type.flowdest_symbol
&& sym.getType() != symbol_type.flowref_symbol
&& sym.getType() != symbol_type.operand_symbol && sym.getType() != symbol_type.operand_symbol
&& sym.getType() != symbol_type.epsilon_symbol && sym.getType() != symbol_type.epsilon_symbol
&& sym.getType() != symbol_type.varnode_symbol) { && sym.getType() != symbol_type.varnode_symbol) {
@ -841,6 +843,8 @@ pattern_symbol[String purpose] returns [PatternExpression expr]
} else if(sym.getType() == symbol_type.start_symbol } else if(sym.getType() == symbol_type.start_symbol
|| sym.getType() == symbol_type.end_symbol || sym.getType() == symbol_type.end_symbol
|| sym.getType() == symbol_type.next2_symbol || sym.getType() == symbol_type.next2_symbol
|| sym.getType() == symbol_type.flowdest_symbol
|| sym.getType() == symbol_type.flowref_symbol
|| sym.getType() == symbol_type.epsilon_symbol || sym.getType() == symbol_type.epsilon_symbol
|| sym.getType() == symbol_type.varnode_symbol) { || sym.getType() == symbol_type.varnode_symbol) {
SpecificSymbol ss = (SpecificSymbol) sym; SpecificSymbol ss = (SpecificSymbol) sym;
@ -874,6 +878,8 @@ pattern_symbol2[String purpose] returns [PatternExpression expr]
} else if(sym.getType() == symbol_type.start_symbol } else if(sym.getType() == symbol_type.start_symbol
|| sym.getType() == symbol_type.end_symbol || sym.getType() == symbol_type.end_symbol
|| sym.getType() == symbol_type.next2_symbol || sym.getType() == symbol_type.next2_symbol
|| sym.getType() == symbol_type.flowdest_symbol
|| sym.getType() == symbol_type.flowref_symbol
|| sym.getType() == symbol_type.operand_symbol || sym.getType() == symbol_type.operand_symbol
|| sym.getType() == symbol_type.epsilon_symbol || sym.getType() == symbol_type.epsilon_symbol
|| sym.getType() == symbol_type.varnode_symbol) { || sym.getType() == symbol_type.varnode_symbol) {
@ -945,6 +951,8 @@ cstatement[VectorSTL<ContextChange> r]
|| sym.getType() == symbol_type.start_symbol || sym.getType() == symbol_type.start_symbol
|| sym.getType() == symbol_type.end_symbol || sym.getType() == symbol_type.end_symbol
|| sym.getType() == symbol_type.next2_symbol || sym.getType() == symbol_type.next2_symbol
|| sym.getType() == symbol_type.flowdest_symbol
|| sym.getType() == symbol_type.flowref_symbol
|| sym.getType() == symbol_type.operand_symbol || sym.getType() == symbol_type.operand_symbol
|| sym.getType() == symbol_type.epsilon_symbol || sym.getType() == symbol_type.epsilon_symbol
|| sym.getType() == symbol_type.varnode_symbol) { || sym.getType() == symbol_type.varnode_symbol) {
@ -1178,6 +1186,8 @@ assignment returns [VectorSTL<OpTpl> value]
} else if(sym.getType() != symbol_type.start_symbol } else if(sym.getType() != symbol_type.start_symbol
&& sym.getType() != symbol_type.end_symbol && sym.getType() != symbol_type.end_symbol
&& sym.getType() != symbol_type.next2_symbol && sym.getType() != symbol_type.next2_symbol
&& sym.getType() != symbol_type.flowdest_symbol
&& sym.getType() != symbol_type.flowref_symbol
&& sym.getType() != symbol_type.operand_symbol && sym.getType() != symbol_type.operand_symbol
&& sym.getType() != symbol_type.epsilon_symbol && sym.getType() != symbol_type.epsilon_symbol
&& sym.getType() != symbol_type.varnode_symbol) { && sym.getType() != symbol_type.varnode_symbol) {
@ -1313,7 +1323,9 @@ jump_symbol[String purpose] returns [VarnodeTpl value]
unknownSymbolError($s.getText(), find($s), "start, end, or operand", purpose); unknownSymbolError($s.getText(), find($s), "start, end, or operand", purpose);
} else if (sym.getType() == symbol_type.start_symbol || } else if (sym.getType() == symbol_type.start_symbol ||
sym.getType() == symbol_type.end_symbol || sym.getType() == symbol_type.end_symbol ||
sym.getType() == symbol_type.next2_symbol) { sym.getType() == symbol_type.next2_symbol ||
sym.getType() == symbol_type.flowdest_symbol ||
sym.getType() == symbol_type.flowref_symbol) {
SpecificSymbol ss = (SpecificSymbol) sym; SpecificSymbol ss = (SpecificSymbol) sym;
$value = new VarnodeTpl(find($s), new ConstTpl(ConstTpl.const_type.j_curspace), $value = new VarnodeTpl(find($s), new ConstTpl(ConstTpl.const_type.j_curspace),
ss.getVarnode().getOffset(), ss.getVarnode().getOffset(),
@ -1518,6 +1530,8 @@ expr_apply returns [Object value]
} else if(sym.getType() == symbol_type.start_symbol } else if(sym.getType() == symbol_type.start_symbol
|| sym.getType() == symbol_type.end_symbol || sym.getType() == symbol_type.end_symbol
|| sym.getType() == symbol_type.next2_symbol || sym.getType() == symbol_type.next2_symbol
|| sym.getType() == symbol_type.flowdest_symbol
|| sym.getType() == symbol_type.flowref_symbol
|| sym.getType() == symbol_type.operand_symbol || sym.getType() == symbol_type.operand_symbol
|| sym.getType() == symbol_type.epsilon_symbol || sym.getType() == symbol_type.epsilon_symbol
|| sym.getType() == symbol_type.varnode_symbol) { || sym.getType() == symbol_type.varnode_symbol) {

View file

@ -41,7 +41,7 @@ public class FlowDestSymbol extends SpecificSymbol {
@Override @Override
public symbol_type getType() { public symbol_type getType() {
return symbol_type.start_symbol; return symbol_type.flowdest_symbol;
} }
@Override @Override

View file

@ -27,7 +27,7 @@ import ghidra.sleigh.grammar.Location;
*/ */
public class FlowRefSymbol extends SpecificSymbol { public class FlowRefSymbol extends SpecificSymbol {
private AddrSpace const_space; private AddrSpace const_space;
public FlowRefSymbol(Location location, String nm, AddrSpace cspc) { public FlowRefSymbol(Location location, String nm, AddrSpace cspc) {
super(location, nm); super(location, nm);
const_space = cspc; const_space = cspc;
@ -36,13 +36,13 @@ public class FlowRefSymbol extends SpecificSymbol {
} }
@Override @Override
public PatternExpression getPatternExpression() { public PatternExpression getPatternExpression() {
return null; // Cannot be used in pattern expressions return null; // Cannot be used in pattern expressions
} }
@Override @Override
public symbol_type getType() { public symbol_type getType() {
return symbol_type.start_symbol; return symbol_type.flowref_symbol;
} }
@Override @Override

View file

@ -35,5 +35,7 @@ public enum symbol_type {
context_symbol, context_symbol,
epsilon_symbol, epsilon_symbol,
label_symbol, label_symbol,
flowdest_symbol,
flowref_symbol,
dummy_symbol dummy_symbol
} }