GP-3155 Regenerating parsers, documentation. LZCOUNT tests.

This commit is contained in:
caheckman 2023-03-03 15:10:55 -05:00
parent e4ab760242
commit 945d91fc93
54 changed files with 3252 additions and 3211 deletions

View file

@ -231,15 +231,15 @@ sla_opt/%.o: %.cc
$(CXX) $(ARCH_TYPE) -c $(OPT_CXXFLAGS) $(ADDITIONAL_FLAGS) $(SLEIGH_OPT) $< -o $@
grammar.cc: grammar.y
$(YACC) -p cparse -o $@ $<
$(YACC) -l -o $@ $<
xml.cc: xml.y
$(YACC) -p xml -o $@ $<
$(YACC) -l -o $@ $<
pcodeparse.cc: pcodeparse.y
$(YACC) -p pcode -o $@ $<
$(YACC) -l -o $@ $<
slghparse.cc: slghparse.y
$(YACC) -d -o $@ $<
$(YACC) -l -d -o $@ $<
slghscan.cc: slghscan.l
$(LEX) -o$@ $<
$(LEX) -L -o$@ $<
ruleparse.cc: ruleparse.y
$(YACC) -p ruleparse -d -o $@ $<

View file

@ -73,7 +73,8 @@
/* Pull parsers. */
#define YYPULL 1
/* Substitute the type names. */
#define YYSTYPE GRAMMARSTYPE
/* Substitute the variable and function names. */
#define yyparse grammarparse
#define yylex grammarlex
@ -85,16 +86,15 @@
#define yychar grammarchar
/* Copy the first part of user declarations. */
#line 16 "src/decompile/cpp/grammar.y" /* yacc.c:339 */
#include "grammar.hh"
extern int yylex(void);
extern int yyerror(const char *str);
extern int grammarlex(void);
extern int grammarerror(const char *str);
static CParse *parse;
extern int yydebug;
#line 83 "src/decompile/cpp/grammar.cc" /* yacc.c:339 */
# ifndef YY_NULLPTR
# if defined __cplusplus && 201103L <= __cplusplus
@ -114,17 +114,25 @@ extern int yydebug;
/* Debug traces. */
#ifndef YYDEBUG
# define YYDEBUG 0
#endif
#ifndef GRAMMARDEBUG
# if defined YYDEBUG
#if YYDEBUG
# define GRAMMARDEBUG 1
# else
# define GRAMMARDEBUG 0
# endif
# else /* ! defined YYDEBUG */
# define GRAMMARDEBUG 0
# endif /* ! defined YYDEBUG */
#endif /* ! defined GRAMMARDEBUG */
#if GRAMMARDEBUG
extern int grammardebug;
#endif
/* Token type. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
enum yytokentype
#ifndef GRAMMARTOKENTYPE
# define GRAMMARTOKENTYPE
enum grammartokentype
{
DOTDOTDOT = 258,
BADTOKEN = 259,
@ -143,11 +151,11 @@ extern int grammardebug;
#endif
/* Value type. */
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
#if ! defined GRAMMARSTYPE && ! defined GRAMMARSTYPE_IS_DECLARED
union YYSTYPE
union GRAMMARSTYPE
{
#line 25 "src/decompile/cpp/grammar.y" /* yacc.c:355 */
uint4 flags;
TypeDeclarator *dec;
@ -160,16 +168,16 @@ union YYSTYPE
string *str;
uintb *i;
#line 149 "src/decompile/cpp/grammar.cc" /* yacc.c:355 */
};
typedef union YYSTYPE YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
# define YYSTYPE_IS_DECLARED 1
typedef union GRAMMARSTYPE GRAMMARSTYPE;
# define GRAMMARSTYPE_IS_TRIVIAL 1
# define GRAMMARSTYPE_IS_DECLARED 1
#endif
extern YYSTYPE grammarlval;
extern GRAMMARSTYPE grammarlval;
int grammarparse (void);
@ -177,7 +185,7 @@ int grammarparse (void);
/* Copy the second part of user declarations. */
#line 166 "src/decompile/cpp/grammar.cc" /* yacc.c:358 */
#ifdef short
# undef short
@ -358,7 +366,7 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */
#if (! defined yyoverflow \
&& (! defined __cplusplus \
|| (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
|| (defined GRAMMARSTYPE_IS_TRIVIAL && GRAMMARSTYPE_IS_TRIVIAL)))
/* A type that is properly aligned for any stack member. */
union yyalloc
@ -472,7 +480,7 @@ static const yytype_uint8 yytranslate[] =
15
};
#if YYDEBUG
#if GRAMMARDEBUG
/* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
static const yytype_uint8 yyrline[] =
{
@ -487,7 +495,7 @@ static const yytype_uint8 yyrline[] =
};
#endif
#if YYDEBUG || YYERROR_VERBOSE || 0
#if GRAMMARDEBUG || YYERROR_VERBOSE || 0
/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
First, the terminals, then, starting at YYNTOKENS, nonterminals. */
static const char *const yytname[] =
@ -706,7 +714,7 @@ while (0)
/* Enable debugging if requested. */
#if YYDEBUG
#if GRAMMARDEBUG
# ifndef YYFPRINTF
# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
@ -827,12 +835,12 @@ do { \
/* Nonzero means print parse trace. It is left uninitialized so that
multiple parsers can coexist. */
int yydebug;
#else /* !YYDEBUG */
#else /* !GRAMMARDEBUG */
# define YYDPRINTF(Args)
# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
# define YY_STACK_PRINT(Bottom, Top)
# define YY_REDUCE_PRINT(Rule)
#endif /* !YYDEBUG */
#endif /* !GRAMMARDEBUG */
/* YYINITDEPTH -- initial size of the parser's stacks. */
@ -1343,427 +1351,427 @@ yyreduce:
switch (yyn)
{
case 2:
#line 60 "src/decompile/cpp/grammar.y" /* yacc.c:1646 */
{ parse->setResultDeclarations((yyvsp[0].declist)); }
#line 1334 "src/decompile/cpp/grammar.cc" /* yacc.c:1646 */
break;
case 3:
#line 61 "src/decompile/cpp/grammar.y" /* yacc.c:1646 */
{ vector<TypeDeclarator *> *res = parse->newVecDeclarator(); res->push_back((yyvsp[0].dec)); parse->setResultDeclarations(res); }
#line 1340 "src/decompile/cpp/grammar.cc" /* yacc.c:1646 */
break;
case 4:
#line 65 "src/decompile/cpp/grammar.y" /* yacc.c:1646 */
{ (yyval.declist) = parse->mergeSpecDecVec((yyvsp[-1].spec)); }
#line 1346 "src/decompile/cpp/grammar.cc" /* yacc.c:1646 */
break;
case 5:
#line 66 "src/decompile/cpp/grammar.y" /* yacc.c:1646 */
{ (yyval.declist) = parse->mergeSpecDecVec((yyvsp[-2].spec),(yyvsp[-1].declist)); }
#line 1352 "src/decompile/cpp/grammar.cc" /* yacc.c:1646 */
break;
case 6:
#line 70 "src/decompile/cpp/grammar.y" /* yacc.c:1646 */
{ (yyval.spec) = parse->newSpecifier(); parse->addSpecifier((yyval.spec),(yyvsp[0].str)); }
#line 1358 "src/decompile/cpp/grammar.cc" /* yacc.c:1646 */
break;
case 7:
#line 71 "src/decompile/cpp/grammar.y" /* yacc.c:1646 */
{ (yyval.spec) = parse->newSpecifier(); parse->addTypeSpecifier((yyval.spec),(yyvsp[0].type)); }
#line 1364 "src/decompile/cpp/grammar.cc" /* yacc.c:1646 */
break;
case 8:
#line 72 "src/decompile/cpp/grammar.y" /* yacc.c:1646 */
{ (yyval.spec) = parse->newSpecifier(); parse->addSpecifier((yyval.spec),(yyvsp[0].str)); }
#line 1370 "src/decompile/cpp/grammar.cc" /* yacc.c:1646 */
break;
case 9:
#line 73 "src/decompile/cpp/grammar.y" /* yacc.c:1646 */
{ (yyval.spec) = parse->newSpecifier(); parse->addFuncSpecifier((yyval.spec),(yyvsp[0].str)); }
#line 1376 "src/decompile/cpp/grammar.cc" /* yacc.c:1646 */
break;
case 10:
#line 74 "src/decompile/cpp/grammar.y" /* yacc.c:1646 */
{ (yyval.spec) = parse->addSpecifier((yyvsp[0].spec),(yyvsp[-1].str)); }
#line 1382 "src/decompile/cpp/grammar.cc" /* yacc.c:1646 */
break;
case 11:
#line 75 "src/decompile/cpp/grammar.y" /* yacc.c:1646 */
{ (yyval.spec) = parse->addTypeSpecifier((yyvsp[0].spec),(yyvsp[-1].type)); }
#line 1388 "src/decompile/cpp/grammar.cc" /* yacc.c:1646 */
break;
case 12:
#line 76 "src/decompile/cpp/grammar.y" /* yacc.c:1646 */
{ (yyval.spec) = parse->addSpecifier((yyvsp[0].spec),(yyvsp[-1].str)); }
#line 1394 "src/decompile/cpp/grammar.cc" /* yacc.c:1646 */
break;
case 13:
#line 77 "src/decompile/cpp/grammar.y" /* yacc.c:1646 */
{ (yyval.spec) = parse->addFuncSpecifier((yyvsp[0].spec),(yyvsp[-1].str)); }
#line 1400 "src/decompile/cpp/grammar.cc" /* yacc.c:1646 */
break;
case 14:
#line 81 "src/decompile/cpp/grammar.y" /* yacc.c:1646 */
{ (yyval.declist) = parse->newVecDeclarator(); (yyval.declist)->push_back((yyvsp[0].dec)); }
#line 1406 "src/decompile/cpp/grammar.cc" /* yacc.c:1646 */
break;
case 15:
#line 82 "src/decompile/cpp/grammar.y" /* yacc.c:1646 */
{ (yyval.declist) = (yyvsp[-2].declist); (yyval.declist)->push_back((yyvsp[0].dec)); }
#line 1412 "src/decompile/cpp/grammar.cc" /* yacc.c:1646 */
break;
case 16:
#line 86 "src/decompile/cpp/grammar.y" /* yacc.c:1646 */
{ (yyval.dec) = (yyvsp[0].dec); }
#line 1418 "src/decompile/cpp/grammar.cc" /* yacc.c:1646 */
break;
case 17:
#line 91 "src/decompile/cpp/grammar.y" /* yacc.c:1646 */
{ (yyval.type) = (yyvsp[0].type); }
#line 1424 "src/decompile/cpp/grammar.cc" /* yacc.c:1646 */
break;
case 18:
#line 92 "src/decompile/cpp/grammar.y" /* yacc.c:1646 */
{ (yyval.type) = (yyvsp[0].type); }
#line 1430 "src/decompile/cpp/grammar.cc" /* yacc.c:1646 */
break;
case 19:
#line 93 "src/decompile/cpp/grammar.y" /* yacc.c:1646 */
{ (yyval.type) = (yyvsp[0].type); }
#line 1436 "src/decompile/cpp/grammar.cc" /* yacc.c:1646 */
break;
case 20:
#line 97 "src/decompile/cpp/grammar.y" /* yacc.c:1646 */
{ (yyval.type) = parse->newStruct("",(yyvsp[-1].declist)); }
#line 1442 "src/decompile/cpp/grammar.cc" /* yacc.c:1646 */
break;
case 21:
#line 98 "src/decompile/cpp/grammar.y" /* yacc.c:1646 */
{ (yyval.type) = parse->newStruct(*(yyvsp[-3].str),(yyvsp[-1].declist)); }
#line 1448 "src/decompile/cpp/grammar.cc" /* yacc.c:1646 */
break;
case 22:
#line 99 "src/decompile/cpp/grammar.y" /* yacc.c:1646 */
{ (yyval.type) = parse->oldStruct(*(yyvsp[0].str)); }
#line 1454 "src/decompile/cpp/grammar.cc" /* yacc.c:1646 */
break;
case 23:
#line 100 "src/decompile/cpp/grammar.y" /* yacc.c:1646 */
{ (yyval.type) = parse->newUnion("",(yyvsp[-1].declist)); }
#line 1460 "src/decompile/cpp/grammar.cc" /* yacc.c:1646 */
break;
case 24:
#line 101 "src/decompile/cpp/grammar.y" /* yacc.c:1646 */
{ (yyval.type) = parse->newUnion(*(yyvsp[-3].str),(yyvsp[-1].declist)); }
#line 1466 "src/decompile/cpp/grammar.cc" /* yacc.c:1646 */
break;
case 25:
#line 102 "src/decompile/cpp/grammar.y" /* yacc.c:1646 */
{ (yyval.type) = parse->oldUnion(*(yyvsp[0].str)); }
#line 1472 "src/decompile/cpp/grammar.cc" /* yacc.c:1646 */
break;
case 26:
#line 106 "src/decompile/cpp/grammar.y" /* yacc.c:1646 */
{ (yyval.declist) = (yyvsp[0].declist); }
#line 1478 "src/decompile/cpp/grammar.cc" /* yacc.c:1646 */
break;
case 27:
#line 107 "src/decompile/cpp/grammar.y" /* yacc.c:1646 */
{ (yyval.declist) = (yyvsp[-1].declist); (yyval.declist)->insert((yyval.declist)->end(),(yyvsp[0].declist)->begin(),(yyvsp[0].declist)->end()); }
#line 1484 "src/decompile/cpp/grammar.cc" /* yacc.c:1646 */
break;
case 28:
#line 111 "src/decompile/cpp/grammar.y" /* yacc.c:1646 */
{ (yyval.declist) = parse->mergeSpecDecVec((yyvsp[-2].spec),(yyvsp[-1].declist)); }
#line 1490 "src/decompile/cpp/grammar.cc" /* yacc.c:1646 */
break;
case 29:
#line 115 "src/decompile/cpp/grammar.y" /* yacc.c:1646 */
{ (yyval.spec) = parse->newSpecifier(); parse->addTypeSpecifier((yyval.spec),(yyvsp[0].type)); }
#line 1496 "src/decompile/cpp/grammar.cc" /* yacc.c:1646 */
break;
case 30:
#line 116 "src/decompile/cpp/grammar.y" /* yacc.c:1646 */
{ (yyval.spec) = parse->addTypeSpecifier((yyvsp[0].spec),(yyvsp[-1].type)); }
#line 1502 "src/decompile/cpp/grammar.cc" /* yacc.c:1646 */
break;
case 31:
#line 117 "src/decompile/cpp/grammar.y" /* yacc.c:1646 */
{ (yyval.spec) = parse->newSpecifier(); parse->addSpecifier((yyval.spec),(yyvsp[0].str)); }
#line 1508 "src/decompile/cpp/grammar.cc" /* yacc.c:1646 */
break;
case 32:
#line 118 "src/decompile/cpp/grammar.y" /* yacc.c:1646 */
{ (yyval.spec) = parse->addSpecifier((yyvsp[0].spec),(yyvsp[-1].str)); }
#line 1514 "src/decompile/cpp/grammar.cc" /* yacc.c:1646 */
break;
case 33:
#line 122 "src/decompile/cpp/grammar.y" /* yacc.c:1646 */
{ (yyval.declist) = parse->newVecDeclarator(); (yyval.declist)->push_back((yyvsp[0].dec)); }
#line 1520 "src/decompile/cpp/grammar.cc" /* yacc.c:1646 */
break;
case 34:
#line 123 "src/decompile/cpp/grammar.y" /* yacc.c:1646 */
{ (yyval.declist) = (yyvsp[-2].declist); (yyval.declist)->push_back((yyvsp[0].dec)); }
#line 1526 "src/decompile/cpp/grammar.cc" /* yacc.c:1646 */
break;
case 35:
#line 127 "src/decompile/cpp/grammar.y" /* yacc.c:1646 */
{ (yyval.dec) = (yyvsp[0].dec); }
#line 1532 "src/decompile/cpp/grammar.cc" /* yacc.c:1646 */
break;
case 36:
#line 132 "src/decompile/cpp/grammar.y" /* yacc.c:1646 */
{ (yyval.type) = parse->newEnum(*(yyvsp[-3].str),(yyvsp[-1].vecenum)); }
#line 1538 "src/decompile/cpp/grammar.cc" /* yacc.c:1646 */
break;
case 37:
#line 133 "src/decompile/cpp/grammar.y" /* yacc.c:1646 */
{ (yyval.type) = parse->newEnum("",(yyvsp[-1].vecenum)); }
#line 1544 "src/decompile/cpp/grammar.cc" /* yacc.c:1646 */
break;
case 38:
#line 134 "src/decompile/cpp/grammar.y" /* yacc.c:1646 */
{ (yyval.type) = parse->newEnum(*(yyvsp[-4].str),(yyvsp[-2].vecenum)); }
#line 1550 "src/decompile/cpp/grammar.cc" /* yacc.c:1646 */
break;
case 39:
#line 135 "src/decompile/cpp/grammar.y" /* yacc.c:1646 */
{ (yyval.type) = parse->newEnum("",(yyvsp[-2].vecenum)); }
#line 1556 "src/decompile/cpp/grammar.cc" /* yacc.c:1646 */
break;
case 40:
#line 136 "src/decompile/cpp/grammar.y" /* yacc.c:1646 */
{ (yyval.type) = parse->oldEnum(*(yyvsp[0].str)); }
#line 1562 "src/decompile/cpp/grammar.cc" /* yacc.c:1646 */
break;
case 41:
#line 140 "src/decompile/cpp/grammar.y" /* yacc.c:1646 */
{ (yyval.vecenum) = parse->newVecEnumerator(); (yyval.vecenum)->push_back((yyvsp[0].enumer)); }
#line 1568 "src/decompile/cpp/grammar.cc" /* yacc.c:1646 */
break;
case 42:
#line 141 "src/decompile/cpp/grammar.y" /* yacc.c:1646 */
{ (yyval.vecenum) = (yyvsp[-2].vecenum); (yyval.vecenum)->push_back((yyvsp[0].enumer)); }
#line 1574 "src/decompile/cpp/grammar.cc" /* yacc.c:1646 */
break;
case 43:
#line 145 "src/decompile/cpp/grammar.y" /* yacc.c:1646 */
{ (yyval.enumer) = parse->newEnumerator(*(yyvsp[0].str)); }
#line 1580 "src/decompile/cpp/grammar.cc" /* yacc.c:1646 */
break;
case 44:
#line 146 "src/decompile/cpp/grammar.y" /* yacc.c:1646 */
{ (yyval.enumer) = parse->newEnumerator(*(yyvsp[-2].str),*(yyvsp[0].i)); }
#line 1586 "src/decompile/cpp/grammar.cc" /* yacc.c:1646 */
break;
case 45:
#line 150 "src/decompile/cpp/grammar.y" /* yacc.c:1646 */
{ (yyval.dec) = (yyvsp[0].dec); }
#line 1592 "src/decompile/cpp/grammar.cc" /* yacc.c:1646 */
break;
case 46:
#line 151 "src/decompile/cpp/grammar.y" /* yacc.c:1646 */
{ (yyval.dec) = parse->mergePointer((yyvsp[-1].ptrspec),(yyvsp[0].dec)); }
#line 1598 "src/decompile/cpp/grammar.cc" /* yacc.c:1646 */
break;
case 47:
#line 155 "src/decompile/cpp/grammar.y" /* yacc.c:1646 */
{ (yyval.dec) = parse->newDeclarator((yyvsp[0].str)); }
#line 1604 "src/decompile/cpp/grammar.cc" /* yacc.c:1646 */
break;
case 48:
#line 156 "src/decompile/cpp/grammar.y" /* yacc.c:1646 */
{ (yyval.dec) = (yyvsp[-1].dec); }
#line 1610 "src/decompile/cpp/grammar.cc" /* yacc.c:1646 */
break;
case 49:
#line 157 "src/decompile/cpp/grammar.y" /* yacc.c:1646 */
{ (yyval.dec) = parse->newArray((yyvsp[-4].dec),(yyvsp[-2].flags),(yyvsp[-1].i)); }
#line 1616 "src/decompile/cpp/grammar.cc" /* yacc.c:1646 */
break;
case 50:
#line 158 "src/decompile/cpp/grammar.y" /* yacc.c:1646 */
{ (yyval.dec) = parse->newArray((yyvsp[-3].dec),0,(yyvsp[-1].i)); }
#line 1622 "src/decompile/cpp/grammar.cc" /* yacc.c:1646 */
break;
case 51:
#line 160 "src/decompile/cpp/grammar.y" /* yacc.c:1646 */
{ (yyval.dec) = parse->newFunc((yyvsp[-3].dec),(yyvsp[-1].declist)); }
#line 1628 "src/decompile/cpp/grammar.cc" /* yacc.c:1646 */
break;
case 52:
#line 165 "src/decompile/cpp/grammar.y" /* yacc.c:1646 */
{ (yyval.ptrspec) = parse->newPointer(); (yyval.ptrspec)->push_back(0); }
#line 1634 "src/decompile/cpp/grammar.cc" /* yacc.c:1646 */
break;
case 53:
#line 166 "src/decompile/cpp/grammar.y" /* yacc.c:1646 */
{ (yyval.ptrspec) = parse->newPointer(); (yyval.ptrspec)->push_back((yyvsp[0].flags)); }
#line 1640 "src/decompile/cpp/grammar.cc" /* yacc.c:1646 */
break;
case 54:
#line 167 "src/decompile/cpp/grammar.y" /* yacc.c:1646 */
{ (yyval.ptrspec) = (yyvsp[0].ptrspec); (yyval.ptrspec)->push_back(0); }
#line 1646 "src/decompile/cpp/grammar.cc" /* yacc.c:1646 */
break;
case 55:
#line 168 "src/decompile/cpp/grammar.y" /* yacc.c:1646 */
{ (yyval.ptrspec) = (yyvsp[0].ptrspec); (yyval.ptrspec)->push_back((yyvsp[-1].flags)); }
#line 1652 "src/decompile/cpp/grammar.cc" /* yacc.c:1646 */
break;
case 56:
#line 172 "src/decompile/cpp/grammar.y" /* yacc.c:1646 */
{ (yyval.flags) = parse->convertFlag((yyvsp[0].str)); }
#line 1658 "src/decompile/cpp/grammar.cc" /* yacc.c:1646 */
break;
case 57:
#line 173 "src/decompile/cpp/grammar.y" /* yacc.c:1646 */
{ (yyval.flags) = (yyvsp[-1].flags); (yyval.flags) |= parse->convertFlag((yyvsp[0].str)); }
#line 1664 "src/decompile/cpp/grammar.cc" /* yacc.c:1646 */
break;
case 58:
#line 177 "src/decompile/cpp/grammar.y" /* yacc.c:1646 */
{ (yyval.declist) = (yyvsp[0].declist); }
#line 1670 "src/decompile/cpp/grammar.cc" /* yacc.c:1646 */
break;
case 59:
#line 178 "src/decompile/cpp/grammar.y" /* yacc.c:1646 */
{ (yyval.declist) = (yyvsp[-2].declist); (yyval.declist)->push_back((TypeDeclarator *)0); }
#line 1676 "src/decompile/cpp/grammar.cc" /* yacc.c:1646 */
break;
case 60:
#line 182 "src/decompile/cpp/grammar.y" /* yacc.c:1646 */
{ (yyval.declist) = parse->newVecDeclarator(); (yyval.declist)->push_back((yyvsp[0].dec)); }
#line 1682 "src/decompile/cpp/grammar.cc" /* yacc.c:1646 */
break;
case 61:
#line 183 "src/decompile/cpp/grammar.y" /* yacc.c:1646 */
{ (yyval.declist) = (yyvsp[-2].declist); (yyval.declist)->push_back((yyvsp[0].dec)); }
#line 1688 "src/decompile/cpp/grammar.cc" /* yacc.c:1646 */
break;
case 62:
#line 187 "src/decompile/cpp/grammar.y" /* yacc.c:1646 */
{ (yyval.dec) = parse->mergeSpecDec((yyvsp[-1].spec),(yyvsp[0].dec)); }
#line 1694 "src/decompile/cpp/grammar.cc" /* yacc.c:1646 */
break;
case 63:
#line 188 "src/decompile/cpp/grammar.y" /* yacc.c:1646 */
{ (yyval.dec) = parse->mergeSpecDec((yyvsp[0].spec)); }
#line 1700 "src/decompile/cpp/grammar.cc" /* yacc.c:1646 */
break;
case 64:
#line 189 "src/decompile/cpp/grammar.y" /* yacc.c:1646 */
{ (yyval.dec) = parse->mergeSpecDec((yyvsp[-1].spec),(yyvsp[0].dec)); }
#line 1706 "src/decompile/cpp/grammar.cc" /* yacc.c:1646 */
break;
case 65:
#line 193 "src/decompile/cpp/grammar.y" /* yacc.c:1646 */
{ (yyval.dec) = parse->newDeclarator(); parse->mergePointer((yyvsp[0].ptrspec),(yyval.dec)); }
#line 1712 "src/decompile/cpp/grammar.cc" /* yacc.c:1646 */
break;
case 66:
#line 194 "src/decompile/cpp/grammar.y" /* yacc.c:1646 */
{ (yyval.dec) = (yyvsp[0].dec); }
#line 1718 "src/decompile/cpp/grammar.cc" /* yacc.c:1646 */
break;
case 67:
#line 195 "src/decompile/cpp/grammar.y" /* yacc.c:1646 */
{ (yyval.dec) = parse->mergePointer((yyvsp[-1].ptrspec),(yyvsp[0].dec)); }
#line 1724 "src/decompile/cpp/grammar.cc" /* yacc.c:1646 */
break;
case 68:
#line 199 "src/decompile/cpp/grammar.y" /* yacc.c:1646 */
{ (yyval.dec) = (yyvsp[-1].dec); }
#line 1730 "src/decompile/cpp/grammar.cc" /* yacc.c:1646 */
break;
case 69:
#line 201 "src/decompile/cpp/grammar.y" /* yacc.c:1646 */
{ (yyval.dec) = parse->newArray((yyvsp[-3].dec),0,(yyvsp[-1].i)); }
#line 1736 "src/decompile/cpp/grammar.cc" /* yacc.c:1646 */
break;
case 70:
#line 203 "src/decompile/cpp/grammar.y" /* yacc.c:1646 */
{ (yyval.dec) = parse->newFunc((yyvsp[-3].dec),(yyvsp[-1].declist)); }
#line 1742 "src/decompile/cpp/grammar.cc" /* yacc.c:1646 */
break;
case 71:
#line 207 "src/decompile/cpp/grammar.y" /* yacc.c:1646 */
{ (yyval.i) = (yyvsp[0].i); }
#line 1748 "src/decompile/cpp/grammar.cc" /* yacc.c:1646 */
break;
#line 1752 "src/decompile/cpp/grammar.cc" /* yacc.c:1646 */
default: break;
}
/* User semantic actions sometimes alter yychar, and that requires
@ -1991,7 +1999,7 @@ yyreturn:
#endif
return yyresult;
}
#line 210 "src/decompile/cpp/grammar.y" /* yacc.c:1906 */
void GrammarToken::set(uint4 tp)
@ -3114,13 +3122,13 @@ bool CParse::parseStream(istream &s,uint4 doctype)
return runParse(doctype);
}
int yylex(void)
int grammarlex(void)
{
return parse->lex();
}
int yyerror(const char *str)
int grammarerror(const char *str)
{
return 0;

View file

@ -13,13 +13,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
%define api.prefix {grammar}
%{
#include "grammar.hh"
extern int yylex(void);
extern int yyerror(const char *str);
extern int grammarlex(void);
extern int grammarerror(const char *str);
static CParse *parse;
extern int yydebug;
%}
%union {
@ -1329,13 +1329,13 @@ bool CParse::parseStream(istream &s,uint4 doctype)
return runParse(doctype);
}
int yylex(void)
int grammarlex(void)
{
return parse->lex();
}
int yyerror(const char *str)
int grammarerror(const char *str)
{
return 0;

File diff suppressed because it is too large Load diff

View file

@ -13,14 +13,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
%define api.prefix {pcode}
%{
#include "pcodeparse.hh"
//#define YYERROR_VERBOSE
extern int yylex(void);
extern int pcodelex(void);
static PcodeSnippet *pcode;
extern int yydebug;
extern int yyerror(const char *str );
extern int pcodeerror(const char *str );
%}
%union {
@ -800,11 +800,11 @@ void PcodeSnippet::addOperand(const string &name,int4 index)
addSymbol(sym);
}
int yylex(void) {
int pcodelex(void) {
return pcode->lex();
}
int yyerror(const char *s)
int pcodeerror(const char *s)
{
pcode->reportError((const Location *)0,s);

View file

@ -10127,11 +10127,11 @@ int4 RuleXorSwap::applyOp(PcodeOp *op,Funcdata &data)
}
/// \class RuleLzcountShiftBool
/// \brief Simplify equality checks that use lzcount.
/// \brief Simplify equality checks that use lzcount: `lzcount(X) >> c => X == 0` if X is 2^c bits wide
///
/// Some compilers check if a value is equal to zero by checking the most
/// significant bit in lzcount; for instance on a 32-bit system,
/// it being equal to 32 would have the 5th bit set.
/// the result of lzcount on zero would have the 5th bit set.
/// - `lzcount(a ^ 3) >> 5 => a ^ 3 == 0 => a == 3` (by RuleXorCollapse)
/// - `lzcount(a - 3) >> 5 => a - 3 == 0 => a == 3` (by RuleEqual2Zero)
void RuleLzcountShiftBool::getOpList(vector<uint4> &oplist) const
@ -10170,7 +10170,6 @@ int4 RuleLzcountShiftBool::applyOp(PcodeOp *op,Funcdata &data)
// CPUI_INT_EQUAL must produce a 1-byte boolean result
Varnode* eqResVn = data.newUniqueOut(1, newOp);
data.opSetOutput(newOp, eqResVn);
data.opInsertBefore(newOp, baseOp);
@ -10178,7 +10177,10 @@ int4 RuleLzcountShiftBool::applyOp(PcodeOp *op,Funcdata &data)
// we have to guarantee that a Varnode of this size gets outputted
// to the descending PcodeOps. This is handled here with CPUI_INT_ZEXT.
data.opRemoveInput(baseOp, 1);
data.opSetOpcode(baseOp, CPUI_INT_ZEXT);
if (baseOp->getOut()->getSize() == 1)
data.opSetOpcode(baseOp, CPUI_COPY);
else
data.opSetOpcode(baseOp, CPUI_INT_ZEXT);
data.opSetInput(baseOp, eqResVn, 0);
return 1;
}

File diff suppressed because it is too large Load diff

View file

@ -107,71 +107,72 @@ extern int yydebug;
OP_CPOOLREF = 302,
OP_NEW = 303,
OP_POPCOUNT = 304,
BADINTEGER = 305,
GOTO_KEY = 306,
CALL_KEY = 307,
RETURN_KEY = 308,
IF_KEY = 309,
DEFINE_KEY = 310,
ATTACH_KEY = 311,
MACRO_KEY = 312,
SPACE_KEY = 313,
TYPE_KEY = 314,
RAM_KEY = 315,
DEFAULT_KEY = 316,
REGISTER_KEY = 317,
ENDIAN_KEY = 318,
WITH_KEY = 319,
ALIGN_KEY = 320,
OP_UNIMPL = 321,
TOKEN_KEY = 322,
SIGNED_KEY = 323,
NOFLOW_KEY = 324,
HEX_KEY = 325,
DEC_KEY = 326,
BIG_KEY = 327,
LITTLE_KEY = 328,
SIZE_KEY = 329,
WORDSIZE_KEY = 330,
OFFSET_KEY = 331,
NAMES_KEY = 332,
VALUES_KEY = 333,
VARIABLES_KEY = 334,
PCODEOP_KEY = 335,
IS_KEY = 336,
LOCAL_KEY = 337,
DELAYSLOT_KEY = 338,
CROSSBUILD_KEY = 339,
EXPORT_KEY = 340,
BUILD_KEY = 341,
CONTEXT_KEY = 342,
ELLIPSIS_KEY = 343,
GLOBALSET_KEY = 344,
BITRANGE_KEY = 345,
CHAR = 346,
INTEGER = 347,
INTB = 348,
STRING = 349,
SYMBOLSTRING = 350,
SPACESYM = 351,
SECTIONSYM = 352,
TOKENSYM = 353,
USEROPSYM = 354,
VALUESYM = 355,
VALUEMAPSYM = 356,
CONTEXTSYM = 357,
NAMESYM = 358,
VARSYM = 359,
BITSYM = 360,
SPECSYM = 361,
VARLISTSYM = 362,
OPERANDSYM = 363,
STARTSYM = 364,
ENDSYM = 365,
NEXT2SYM = 366,
MACROSYM = 367,
LABELSYM = 368,
SUBTABLESYM = 369
OP_LZCOUNT = 305,
BADINTEGER = 306,
GOTO_KEY = 307,
CALL_KEY = 308,
RETURN_KEY = 309,
IF_KEY = 310,
DEFINE_KEY = 311,
ATTACH_KEY = 312,
MACRO_KEY = 313,
SPACE_KEY = 314,
TYPE_KEY = 315,
RAM_KEY = 316,
DEFAULT_KEY = 317,
REGISTER_KEY = 318,
ENDIAN_KEY = 319,
WITH_KEY = 320,
ALIGN_KEY = 321,
OP_UNIMPL = 322,
TOKEN_KEY = 323,
SIGNED_KEY = 324,
NOFLOW_KEY = 325,
HEX_KEY = 326,
DEC_KEY = 327,
BIG_KEY = 328,
LITTLE_KEY = 329,
SIZE_KEY = 330,
WORDSIZE_KEY = 331,
OFFSET_KEY = 332,
NAMES_KEY = 333,
VALUES_KEY = 334,
VARIABLES_KEY = 335,
PCODEOP_KEY = 336,
IS_KEY = 337,
LOCAL_KEY = 338,
DELAYSLOT_KEY = 339,
CROSSBUILD_KEY = 340,
EXPORT_KEY = 341,
BUILD_KEY = 342,
CONTEXT_KEY = 343,
ELLIPSIS_KEY = 344,
GLOBALSET_KEY = 345,
BITRANGE_KEY = 346,
CHAR = 347,
INTEGER = 348,
INTB = 349,
STRING = 350,
SYMBOLSTRING = 351,
SPACESYM = 352,
SECTIONSYM = 353,
TOKENSYM = 354,
USEROPSYM = 355,
VALUESYM = 356,
VALUEMAPSYM = 357,
CONTEXTSYM = 358,
NAMESYM = 359,
VARSYM = 360,
BITSYM = 361,
SPECSYM = 362,
VARLISTSYM = 363,
OPERANDSYM = 364,
STARTSYM = 365,
ENDSYM = 366,
NEXT2SYM = 367,
MACROSYM = 368,
LABELSYM = 369,
SUBTABLESYM = 370
};
#endif
@ -180,7 +181,7 @@ extern int yydebug;
union YYSTYPE
{
#line 29 "slghparse.y" /* yacc.c:1909 */
char ch;
uintb *i;
@ -225,7 +226,7 @@ union YYSTYPE
FamilySymbol *famsym;
SpecificSymbol *specsym;
#line 214 "slghparse.hh" /* yacc.c:1909 */
};
typedef union YYSTYPE YYSTYPE;

File diff suppressed because it is too large Load diff

View file

@ -476,6 +476,7 @@ void ScoreUnionFields::scoreTrialDown(const Trial &trial,bool lastLevel)
case CPUI_INT_AND:
case CPUI_INT_OR:
case CPUI_POPCOUNT:
case CPUI_LZCOUNT:
if (meta == TYPE_ARRAY || meta == TYPE_STRUCT || meta == TYPE_UNION || meta == TYPE_CODE || meta == TYPE_FLOAT)
score = -5;
else if (meta == TYPE_PTR || meta == TYPE_BOOL)
@ -717,6 +718,7 @@ void ScoreUnionFields::scoreTrialUp(const Trial &trial,bool lastLevel)
case CPUI_INT_AND:
case CPUI_INT_OR:
case CPUI_POPCOUNT:
case CPUI_LZCOUNT:
if (meta == TYPE_ARRAY || meta == TYPE_STRUCT || meta == TYPE_UNION || meta == TYPE_CODE || meta == TYPE_FLOAT)
score = -5;
else if (meta == TYPE_PTR || meta == TYPE_BOOL)

View file

@ -73,7 +73,8 @@
/* Pull parsers. */
#define YYPULL 1
/* Substitute the type names. */
#define YYSTYPE XMLSTYPE
/* Substitute the variable and function names. */
#define yyparse xmlparse
#define yylex xmllex
@ -85,7 +86,7 @@
#define yychar xmlchar
/* Copy the first part of user declarations. */
#line 16 "src/decompile/cpp/xml.y" /* yacc.c:339 */
#include "xml.hh"
// CharData mode look for '<' '&' or "]]>"
@ -179,16 +180,15 @@ struct NameValue {
string *value; ///< The value
};
extern int yylex(void); ///< Interface to the scanner
extern int yyerror(const char *str); ///< Interface for registering an error in parsing
extern int xmllex(void); ///< Interface to the scanner
extern int xmlerror(const char *str); ///< Interface for registering an error in parsing
extern void print_content(const string &str); ///< Send character data to the ContentHandler
extern int4 convertEntityRef(const string &ref); ///< Convert an XML entity to its equivalent character
extern int4 convertCharRef(const string &ref); ///< Convert an XML character reference to its equivalent character
static XmlScan *global_scan; ///< Global reference to the scanner
static ContentHandler *handler; ///< Global reference to the content handler
extern int yydebug; ///< Debug mode
#line 177 "src/decompile/cpp/xml.cc" /* yacc.c:339 */
# ifndef YY_NULLPTR
# if defined __cplusplus && 201103L <= __cplusplus
@ -208,17 +208,25 @@ extern int yydebug; ///< Debug mode
/* Debug traces. */
#ifndef YYDEBUG
# define YYDEBUG 0
#endif
#ifndef XMLDEBUG
# if defined YYDEBUG
#if YYDEBUG
# define XMLDEBUG 1
# else
# define XMLDEBUG 0
# endif
# else /* ! defined YYDEBUG */
# define XMLDEBUG 0
# endif /* ! defined YYDEBUG */
#endif /* ! defined XMLDEBUG */
#if XMLDEBUG
extern int xmldebug;
#endif
/* Token type. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
enum yytokentype
#ifndef XMLTOKENTYPE
# define XMLTOKENTYPE
enum xmltokentype
{
CHARDATA = 258,
CDATA = 259,
@ -233,27 +241,27 @@ extern int xmldebug;
#endif
/* Value type. */
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
#if ! defined XMLSTYPE && ! defined XMLSTYPE_IS_DECLARED
union YYSTYPE
union XMLSTYPE
{
#line 119 "src/decompile/cpp/xml.y" /* yacc.c:355 */
int4 i;
string *str;
Attributes *attr;
NameValue *pair;
#line 233 "src/decompile/cpp/xml.cc" /* yacc.c:355 */
};
typedef union YYSTYPE YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
# define YYSTYPE_IS_DECLARED 1
typedef union XMLSTYPE XMLSTYPE;
# define XMLSTYPE_IS_TRIVIAL 1
# define XMLSTYPE_IS_DECLARED 1
#endif
extern YYSTYPE xmllval;
extern XMLSTYPE xmllval;
int xmlparse (void);
@ -261,7 +269,7 @@ int xmlparse (void);
/* Copy the second part of user declarations. */
#line 250 "src/decompile/cpp/xml.cc" /* yacc.c:358 */
#ifdef short
# undef short
@ -442,7 +450,7 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */
#if (! defined yyoverflow \
&& (! defined __cplusplus \
|| (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
|| (defined XMLSTYPE_IS_TRIVIAL && XMLSTYPE_IS_TRIVIAL)))
/* A type that is properly aligned for any stack member. */
union yyalloc
@ -555,7 +563,7 @@ static const yytype_uint8 yytranslate[] =
5, 6, 7, 8, 9, 10, 11
};
#if YYDEBUG
#if XMLDEBUG
/* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
static const yytype_uint8 yyrline[] =
{
@ -570,7 +578,7 @@ static const yytype_uint8 yyrline[] =
};
#endif
#if YYDEBUG || YYERROR_VERBOSE || 0
#if XMLDEBUG || YYERROR_VERBOSE || 0
/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
First, the terminals, then, starting at YYNTOKENS, nonterminals. */
static const char *const yytname[] =
@ -815,7 +823,7 @@ while (0)
/* Enable debugging if requested. */
#if YYDEBUG
#if XMLDEBUG
# ifndef YYFPRINTF
# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
@ -936,12 +944,12 @@ do { \
/* Nonzero means print parse trace. It is left uninitialized so that
multiple parsers can coexist. */
int yydebug;
#else /* !YYDEBUG */
#else /* !XMLDEBUG */
# define YYDPRINTF(Args)
# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
# define YY_STACK_PRINT(Bottom, Top)
# define YY_REDUCE_PRINT(Rule)
#endif /* !YYDEBUG */
#endif /* !XMLDEBUG */
/* YYINITDEPTH -- initial size of the parser's stacks. */
@ -1452,259 +1460,259 @@ yyreduce:
switch (yyn)
{
case 10:
#line 144 "src/decompile/cpp/xml.y" /* yacc.c:1646 */
{ (yyval.str) = new string; global_scan->setmode(XmlScan::AttValueSingleMode); }
#line 1443 "src/decompile/cpp/xml.cc" /* yacc.c:1646 */
break;
case 11:
#line 145 "src/decompile/cpp/xml.y" /* yacc.c:1646 */
{ (yyval.str) = (yyvsp[-1].str); *(yyval.str) += *(yyvsp[0].str); delete (yyvsp[0].str); global_scan->setmode(XmlScan::AttValueSingleMode); }
#line 1449 "src/decompile/cpp/xml.cc" /* yacc.c:1646 */
break;
case 12:
#line 146 "src/decompile/cpp/xml.y" /* yacc.c:1646 */
{ (yyval.str) = (yyvsp[-1].str); *(yyval.str) += (yyvsp[0].i); global_scan->setmode(XmlScan::AttValueSingleMode); }
#line 1455 "src/decompile/cpp/xml.cc" /* yacc.c:1646 */
break;
case 13:
#line 147 "src/decompile/cpp/xml.y" /* yacc.c:1646 */
{ (yyval.str) = new string; global_scan->setmode(XmlScan::AttValueDoubleMode); }
#line 1461 "src/decompile/cpp/xml.cc" /* yacc.c:1646 */
break;
case 14:
#line 148 "src/decompile/cpp/xml.y" /* yacc.c:1646 */
{ (yyval.str) = (yyvsp[-1].str); *(yyval.str) += *(yyvsp[0].str); delete (yyvsp[0].str); global_scan->setmode(XmlScan::AttValueDoubleMode); }
#line 1467 "src/decompile/cpp/xml.cc" /* yacc.c:1646 */
break;
case 15:
#line 149 "src/decompile/cpp/xml.y" /* yacc.c:1646 */
{ (yyval.str) = (yyvsp[-1].str); *(yyval.str) += (yyvsp[0].i); global_scan->setmode(XmlScan::AttValueDoubleMode); }
#line 1473 "src/decompile/cpp/xml.cc" /* yacc.c:1646 */
break;
case 16:
#line 150 "src/decompile/cpp/xml.y" /* yacc.c:1646 */
{ (yyval.str) = (yyvsp[-1].str); }
#line 1479 "src/decompile/cpp/xml.cc" /* yacc.c:1646 */
break;
case 17:
#line 151 "src/decompile/cpp/xml.y" /* yacc.c:1646 */
{ (yyval.str) = (yyvsp[-1].str); }
#line 1485 "src/decompile/cpp/xml.cc" /* yacc.c:1646 */
break;
case 18:
#line 152 "src/decompile/cpp/xml.y" /* yacc.c:1646 */
{ global_scan->setmode(XmlScan::NameMode); delete (yyvsp[0].str); }
#line 1491 "src/decompile/cpp/xml.cc" /* yacc.c:1646 */
break;
case 19:
#line 153 "src/decompile/cpp/xml.y" /* yacc.c:1646 */
{ global_scan->setmode(XmlScan::CommentMode); delete (yyvsp[-3].str); }
#line 1497 "src/decompile/cpp/xml.cc" /* yacc.c:1646 */
break;
case 20:
#line 154 "src/decompile/cpp/xml.y" /* yacc.c:1646 */
{ delete (yyvsp[-3].str); }
#line 1503 "src/decompile/cpp/xml.cc" /* yacc.c:1646 */
break;
case 21:
#line 155 "src/decompile/cpp/xml.y" /* yacc.c:1646 */
{ delete (yyvsp[-1].str); yyerror("Processing instructions are not supported"); YYERROR; }
#line 1509 "src/decompile/cpp/xml.cc" /* yacc.c:1646 */
break;
case 22:
#line 156 "src/decompile/cpp/xml.y" /* yacc.c:1646 */
{ (yyval.str) = (yyvsp[-1].str); }
#line 1515 "src/decompile/cpp/xml.cc" /* yacc.c:1646 */
break;
case 23:
#line 157 "src/decompile/cpp/xml.y" /* yacc.c:1646 */
{ global_scan->setmode(XmlScan::CDataMode); delete (yyvsp[-8].str); }
#line 1521 "src/decompile/cpp/xml.cc" /* yacc.c:1646 */
break;
case 32:
#line 168 "src/decompile/cpp/xml.y" /* yacc.c:1646 */
{ delete (yyvsp[-8].str); yyerror("DTD's not supported"); YYERROR; }
#line 1527 "src/decompile/cpp/xml.cc" /* yacc.c:1646 */
break;
case 39:
#line 176 "src/decompile/cpp/xml.y" /* yacc.c:1646 */
{ handler->setVersion(*(yyvsp[0].str)); delete (yyvsp[0].str); }
#line 1533 "src/decompile/cpp/xml.cc" /* yacc.c:1646 */
break;
case 40:
#line 177 "src/decompile/cpp/xml.y" /* yacc.c:1646 */
{ handler->setEncoding(*(yyvsp[0].str)); delete (yyvsp[0].str); }
#line 1539 "src/decompile/cpp/xml.cc" /* yacc.c:1646 */
break;
case 46:
#line 184 "src/decompile/cpp/xml.y" /* yacc.c:1646 */
{ handler->endElement((yyvsp[0].attr)->getelemURI(),(yyvsp[0].attr)->getelemName(),(yyvsp[0].attr)->getelemName()); delete (yyvsp[0].attr); }
#line 1545 "src/decompile/cpp/xml.cc" /* yacc.c:1646 */
break;
case 47:
#line 185 "src/decompile/cpp/xml.y" /* yacc.c:1646 */
{ handler->endElement((yyvsp[-2].attr)->getelemURI(),(yyvsp[-2].attr)->getelemName(),(yyvsp[-2].attr)->getelemName()); delete (yyvsp[-2].attr); delete (yyvsp[0].str); }
#line 1551 "src/decompile/cpp/xml.cc" /* yacc.c:1646 */
break;
case 48:
#line 187 "src/decompile/cpp/xml.y" /* yacc.c:1646 */
{ handler->startElement((yyvsp[-1].attr)->getelemURI(),(yyvsp[-1].attr)->getelemName(),(yyvsp[-1].attr)->getelemName(),*(yyvsp[-1].attr)); (yyval.attr) = (yyvsp[-1].attr); }
#line 1557 "src/decompile/cpp/xml.cc" /* yacc.c:1646 */
break;
case 49:
#line 188 "src/decompile/cpp/xml.y" /* yacc.c:1646 */
{ handler->startElement((yyvsp[-2].attr)->getelemURI(),(yyvsp[-2].attr)->getelemName(),(yyvsp[-2].attr)->getelemName(),*(yyvsp[-2].attr)); (yyval.attr) = (yyvsp[-2].attr); }
#line 1563 "src/decompile/cpp/xml.cc" /* yacc.c:1646 */
break;
case 50:
#line 189 "src/decompile/cpp/xml.y" /* yacc.c:1646 */
{ handler->startElement((yyvsp[-2].attr)->getelemURI(),(yyvsp[-2].attr)->getelemName(),(yyvsp[-2].attr)->getelemName(),*(yyvsp[-2].attr)); (yyval.attr) = (yyvsp[-2].attr); }
#line 1569 "src/decompile/cpp/xml.cc" /* yacc.c:1646 */
break;
case 51:
#line 190 "src/decompile/cpp/xml.y" /* yacc.c:1646 */
{ handler->startElement((yyvsp[-3].attr)->getelemURI(),(yyvsp[-3].attr)->getelemName(),(yyvsp[-3].attr)->getelemName(),*(yyvsp[-3].attr)); (yyval.attr) = (yyvsp[-3].attr); }
#line 1575 "src/decompile/cpp/xml.cc" /* yacc.c:1646 */
break;
case 52:
#line 192 "src/decompile/cpp/xml.y" /* yacc.c:1646 */
{ (yyval.attr) = new Attributes((yyvsp[0].str)); global_scan->setmode(XmlScan::SNameMode); }
#line 1581 "src/decompile/cpp/xml.cc" /* yacc.c:1646 */
break;
case 53:
#line 193 "src/decompile/cpp/xml.y" /* yacc.c:1646 */
{ (yyval.attr) = (yyvsp[-1].attr); (yyval.attr)->add_attribute( (yyvsp[0].pair)->name, (yyvsp[0].pair)->value); delete (yyvsp[0].pair); global_scan->setmode(XmlScan::SNameMode); }
#line 1587 "src/decompile/cpp/xml.cc" /* yacc.c:1646 */
break;
case 54:
#line 194 "src/decompile/cpp/xml.y" /* yacc.c:1646 */
{ (yyval.pair) = new NameValue; (yyval.pair)->name = (yyvsp[-2].str); (yyval.pair)->value = (yyvsp[0].str); }
#line 1593 "src/decompile/cpp/xml.cc" /* yacc.c:1646 */
break;
case 55:
#line 195 "src/decompile/cpp/xml.y" /* yacc.c:1646 */
{ global_scan->setmode(XmlScan::NameMode); delete (yyvsp[-1].str); }
#line 1599 "src/decompile/cpp/xml.cc" /* yacc.c:1646 */
break;
case 56:
#line 196 "src/decompile/cpp/xml.y" /* yacc.c:1646 */
{ (yyval.str) = (yyvsp[-1].str); }
#line 1605 "src/decompile/cpp/xml.cc" /* yacc.c:1646 */
break;
case 57:
#line 197 "src/decompile/cpp/xml.y" /* yacc.c:1646 */
{ (yyval.str) = (yyvsp[-2].str); }
#line 1611 "src/decompile/cpp/xml.cc" /* yacc.c:1646 */
break;
case 58:
#line 199 "src/decompile/cpp/xml.y" /* yacc.c:1646 */
{ global_scan->setmode(XmlScan::CharDataMode); }
#line 1617 "src/decompile/cpp/xml.cc" /* yacc.c:1646 */
break;
case 59:
#line 200 "src/decompile/cpp/xml.y" /* yacc.c:1646 */
{ print_content( *(yyvsp[0].str) ); delete (yyvsp[0].str); global_scan->setmode(XmlScan::CharDataMode); }
#line 1623 "src/decompile/cpp/xml.cc" /* yacc.c:1646 */
break;
case 60:
#line 201 "src/decompile/cpp/xml.y" /* yacc.c:1646 */
{ global_scan->setmode(XmlScan::CharDataMode); }
#line 1629 "src/decompile/cpp/xml.cc" /* yacc.c:1646 */
break;
case 61:
#line 202 "src/decompile/cpp/xml.y" /* yacc.c:1646 */
{ string *tmp=new string(); *tmp += (yyvsp[0].i); print_content(*tmp); delete tmp; global_scan->setmode(XmlScan::CharDataMode); }
#line 1635 "src/decompile/cpp/xml.cc" /* yacc.c:1646 */
break;
case 62:
#line 203 "src/decompile/cpp/xml.y" /* yacc.c:1646 */
{ print_content( *(yyvsp[0].str) ); delete (yyvsp[0].str); global_scan->setmode(XmlScan::CharDataMode); }
#line 1641 "src/decompile/cpp/xml.cc" /* yacc.c:1646 */
break;
case 63:
#line 204 "src/decompile/cpp/xml.y" /* yacc.c:1646 */
{ global_scan->setmode(XmlScan::CharDataMode); }
#line 1647 "src/decompile/cpp/xml.cc" /* yacc.c:1646 */
break;
case 64:
#line 205 "src/decompile/cpp/xml.y" /* yacc.c:1646 */
{ global_scan->setmode(XmlScan::CharDataMode); }
#line 1653 "src/decompile/cpp/xml.cc" /* yacc.c:1646 */
break;
case 65:
#line 207 "src/decompile/cpp/xml.y" /* yacc.c:1646 */
{ (yyval.i) = convertEntityRef(*(yyvsp[0].str)); delete (yyvsp[0].str); }
#line 1659 "src/decompile/cpp/xml.cc" /* yacc.c:1646 */
break;
case 66:
#line 208 "src/decompile/cpp/xml.y" /* yacc.c:1646 */
{ (yyval.i) = convertCharRef(*(yyvsp[0].str)); delete (yyvsp[0].str); }
#line 1665 "src/decompile/cpp/xml.cc" /* yacc.c:1646 */
break;
case 67:
#line 210 "src/decompile/cpp/xml.y" /* yacc.c:1646 */
{ global_scan->setmode(XmlScan::NameMode); }
#line 1671 "src/decompile/cpp/xml.cc" /* yacc.c:1646 */
break;
case 68:
#line 211 "src/decompile/cpp/xml.y" /* yacc.c:1646 */
{ global_scan->setmode(XmlScan::CharRefMode); }
#line 1677 "src/decompile/cpp/xml.cc" /* yacc.c:1646 */
break;
case 69:
#line 212 "src/decompile/cpp/xml.y" /* yacc.c:1646 */
{ (yyval.str) = (yyvsp[-1].str); }
#line 1683 "src/decompile/cpp/xml.cc" /* yacc.c:1646 */
break;
case 70:
#line 213 "src/decompile/cpp/xml.y" /* yacc.c:1646 */
{ (yyval.str) = (yyvsp[-1].str); }
#line 1689 "src/decompile/cpp/xml.cc" /* yacc.c:1646 */
break;
#line 1693 "src/decompile/cpp/xml.cc" /* yacc.c:1646 */
default: break;
}
/* User semantic actions sometimes alter yychar, and that requires
@ -1932,7 +1940,7 @@ yyreturn:
#endif
return yyresult;
}
#line 214 "src/decompile/cpp/xml.y" /* yacc.c:1906 */
XmlScan::XmlScan(istream &t) : s(t)
@ -2217,7 +2225,7 @@ int4 convertCharRef(const string &ref)
return val;
}
int yylex(void)
int xmllex(void)
{
int res = global_scan->nexttoken();
@ -2226,7 +2234,7 @@ int yylex(void)
return res;
}
int yyerror(const char *str)
int xmlerror(const char *str)
{
handler->setError(str);

View file

@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
%define api.prefix {xml}
%{
#include "xml.hh"
// CharData mode look for '<' '&' or "]]>"
@ -106,14 +107,13 @@ struct NameValue {
string *value; ///< The value
};
extern int yylex(void); ///< Interface to the scanner
extern int yyerror(const char *str); ///< Interface for registering an error in parsing
extern int xmllex(void); ///< Interface to the scanner
extern int xmlerror(const char *str); ///< Interface for registering an error in parsing
extern void print_content(const string &str); ///< Send character data to the ContentHandler
extern int4 convertEntityRef(const string &ref); ///< Convert an XML entity to its equivalent character
extern int4 convertCharRef(const string &ref); ///< Convert an XML character reference to its equivalent character
static XmlScan *global_scan; ///< Global reference to the scanner
static ContentHandler *handler; ///< Global reference to the content handler
extern int yydebug; ///< Debug mode
%}
%union {
@ -495,7 +495,7 @@ int4 convertCharRef(const string &ref)
return val;
}
int yylex(void)
int xmllex(void)
{
int res = global_scan->nexttoken();
@ -504,7 +504,7 @@ int yylex(void)
return res;
}
int yyerror(const char *str)
int xmlerror(const char *str)
{
handler->setError(str);