All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.ripe.db.whois.common.generated.InjectR6Parser Maven / Gradle / Ivy

//### This file created by BYACC 1.8(/Java extension  1.15)
//### Java capabilities added 7 Jan 97, Bob Jamison
//### Updated : 27 Nov 97  -- Bob Jamison, Joe Nieten
//###           01 Jan 98  -- Bob Jamison -- fixed generic semantic constructor
//###           01 Jun 99  -- Bob Jamison -- added Runnable support
//###           06 Aug 00  -- Bob Jamison -- made state variables class-global
//###           03 Jan 01  -- Bob Jamison -- improved flags, tracing
//###           16 May 01  -- Bob Jamison -- added custom stack sizing
//###           04 Mar 02  -- Yuval Oren  -- improved java performance, added options
//###           14 Mar 02  -- Tomas Hurka -- -d support, static initializer workaround
//### Please send bug reports to [email protected]
//### static char yysccsid[] = "@(#)yaccpar	1.8 (Berkeley) 01/20/90";



package net.ripe.db.whois.common.generated;



//#line 2 "src/main/parser/byacc/inject_r6.y"
import net.ripe.db.whois.common.rpsl.AttributeParser;
import net.ripe.db.whois.common.rpsl.ParserHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;
import java.io.StringReader;
/*
  filename: inject_r6.y

  description:
    Defines the grammar for an RPSLng route6 inject attribute.  It is
    derived from inject.y.

  notes:
    Defines tokens for the associated lexer, inject_r6.l.
*/
//#line 35 "InjectR6Parser.java"




public class InjectR6Parser
             implements AttributeParser
{

boolean yydebug;        //do I want debug output?
int yynerrs;            //number of errors so far
int yyerrflag;          //was there an error?
int yychar;             //the current working character

//########## MESSAGES ##########
//###############################################################
// method: debug
//###############################################################
void debug(String msg)
{
  if (yydebug)
    System.out.println(msg);
}

//########## STATE STACK ##########
final static int YYSTACKSIZE = 500;  //maximum stack size
int statestk[] = new int[YYSTACKSIZE]; //state stack
int stateptr;
int stateptrmax;                     //highest index of stackptr
int statemax;                        //state when highest index reached
//###############################################################
// methods: state stack push,pop,drop,peek
//###############################################################
final void state_push(int state)
{
  try {
		stateptr++;
		statestk[stateptr]=state;
	 }
	 catch (ArrayIndexOutOfBoundsException e) {
     int oldsize = statestk.length;
     int newsize = oldsize * 2;
     int[] newstack = new int[newsize];
     System.arraycopy(statestk,0,newstack,0,oldsize);
     statestk = newstack;
     statestk[stateptr]=state;
  }
}
final int state_pop()
{
  return statestk[stateptr--];
}
final void state_drop(int cnt)
{
  stateptr -= cnt; 
}
final int state_peek(int relative)
{
  return statestk[stateptr-relative];
}
//###############################################################
// method: init_stacks : allocate and prepare stacks
//###############################################################
final boolean init_stacks()
{
  stateptr = -1;
  val_init();
  return true;
}
//###############################################################
// method: dump_stacks : show n levels of the stacks
//###############################################################
void dump_stacks(int count)
{
int i;
  System.out.println("=index==state====value=     s:"+stateptr+"  v:"+valptr);
  for (i=0;i=YYSTACKSIZE)
    return;
  valstk[++valptr]=val;
}
InjectR6ParserVal val_pop()
{
  if (valptr<0)
    return new InjectR6ParserVal();
  return valstk[valptr--];
}
void val_drop(int cnt)
{
int ptr;
  ptr=valptr-cnt;
  if (ptr<0)
    return;
  valptr = ptr;
}
InjectR6ParserVal val_peek(int relative)
{
int ptr;
  ptr=valptr-relative;
  if (ptr<0)
    return new InjectR6ParserVal();
  return valstk[ptr];
}
final InjectR6ParserVal dup_yyval(InjectR6ParserVal val)
{
  InjectR6ParserVal dup = new InjectR6ParserVal();
  dup.ival = val.ival;
  dup.dval = val.dval;
  dup.sval = val.sval;
  dup.obj = val.obj;
  return dup;
}
//#### end semantic value section ####
public final static short OP_OR=257;
public final static short OP_EQUAL=258;
public final static short OP_APPEND=259;
public final static short OP_COMPARE=260;
public final static short OP_AND=261;
public final static short TKN_ASNO=262;
public final static short TKN_IPV4=263;
public final static short TKN_IPV6=264;
public final static short TKN_IPV6DC=265;
public final static short KEYW_ACTION=266;
public final static short KEYW_AFI=267;
public final static short KEYW_AFI_VALUE=268;
public final static short TKN_PREF=269;
public final static short TKN_MED=270;
public final static short TKN_DPA=271;
public final static short TKN_ASPATH=272;
public final static short TKN_COMMUNITY=273;
public final static short TKN_NEXT_HOP=274;
public final static short TKN_COST=275;
public final static short TKN_COMM_NO=276;
public final static short TKN_RTRSNAME=277;
public final static short TKN_PRFXV4=278;
public final static short TKN_PRFXV4RNG=279;
public final static short TKN_PRFXV6=280;
public final static short TKN_PRFXV6DC=281;
public final static short TKN_PRFXV6RNG=282;
public final static short TKN_PRFXV6DCRNG=283;
public final static short KEYW_IGP_COST=284;
public final static short KEYW_SELF=285;
public final static short KEYW_PREPEND=286;
public final static short KEYW_APPEND=287;
public final static short KEYW_DELETE=288;
public final static short KEYW_CONTAINS=289;
public final static short KEYW_AT=290;
public final static short KEYW_EXCEPT=291;
public final static short KEYW_UPON=292;
public final static short KEYW_STATIC=293;
public final static short KEYW_HAVE_COMPONENTS=294;
public final static short KEYW_EXCLUDE=295;
public final static short KEYW_INTERNET=296;
public final static short KEYW_NO_EXPORT=297;
public final static short KEYW_NO_ADVERTISE=298;
public final static short KEYW_MASKLEN=299;
public final static short TKN_INT=300;
public final static short TKN_DNS=301;
public final static short YYERRCODE=256;
final static short yylhs[] = {                           -1,
    0,    2,    2,    5,    5,    6,    6,    6,    7,    7,
    8,    8,    8,    8,    8,    1,    1,    3,    3,    4,
    4,   10,   10,   11,   11,   12,   12,   13,   13,   13,
   14,   14,   15,   15,   16,   16,   16,   16,    9,    9,
   17,   17,   17,   17,   17,   17,   17,   18,   19,   19,
   20,   21,   25,   25,   22,   22,   22,   22,   22,   22,
   22,   26,   27,   27,   28,   28,   28,   28,   28,   23,
   23,   23,   23,   24,
};
final static short yylen[] = {                            2,
    3,    0,    2,    3,    1,    3,    3,    1,    3,    1,
    1,    1,    1,    1,    1,    1,    3,    0,    2,    0,
    2,    3,    1,    3,    1,    3,    1,    1,    4,    4,
    0,    1,    1,    3,    1,    1,    1,    1,    2,    3,
    1,    1,    1,    1,    1,    1,    1,    3,    3,    3,
    3,    6,    1,    3,    3,    3,    6,    6,    6,    4,
    3,    3,    1,    3,    1,    1,    1,    1,    1,    3,
    3,    3,    3,    3,
};
final static short yydefred[] = {                         0,
    0,    0,    0,   11,   12,   13,   15,   16,    0,    0,
    0,    0,    8,   10,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
   41,   42,   43,   44,   45,   46,   47,    0,    1,    9,
   17,    0,    6,    7,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,   39,   28,    0,    0,
    0,    0,    0,   25,   27,   48,   50,   49,   51,    0,
    0,   55,   56,   61,   69,   65,   66,   67,   68,    0,
   63,    0,    0,    0,   70,   71,   72,   73,   74,   40,
    0,    0,    0,    0,    0,    0,    0,   60,    0,    0,
    0,    0,   35,   36,   37,   38,    0,    0,   33,    0,
   26,    0,   24,   53,    0,   62,   64,    0,    0,    0,
   29,    0,   30,   52,    0,   57,   58,   59,   34,   54,
};
final static short yydgoto[] = {                          2,
   10,    3,   16,   39,   11,   12,   13,   14,   29,   62,
   63,   64,   65,  107,  108,  109,   30,   31,   32,   33,
   34,   35,   36,   37,  115,   72,   80,   81,
};
final static short yysindex[] = {                      -276,
  -40,    0, -246,    0,    0,    0,    0,    0,  -40,  -25,
 -231, -243,    0,    0, -215, -257,  -26, -230,  -40,  -40,
  -40, -221, -188, -186,   29,  -30, -182, -181, -215,   19,
    0,    0,    0,    0,    0,    0,    0,  -21,    0,    0,
    0, -243,    0,    0, -219, -271, -218, -207,  -43,  -43,
  -43, -264, -220, -240, -217,   25,    0,    0,  -38,  -37,
  -21, -170, -173,    0,    0,    0,    0,    0,    0,   49,
 -264,    0,    0,    0,    0,    0,    0,    0,    0,  -14,
    0,   50,   51,   53,    0,    0,    0,    0,    0,    0,
 -242, -242,  -24,  -21,  -21, -168,  -33,    0, -264, -264,
 -264, -264,    0,    0,    0,    0,  -29,   54,    0,  -28,
    0, -173,    0,    0,  -13,    0,    0,   20,   21,   22,
    0, -242,    0,    0, -167,    0,    0,    0,    0,    0,
};
final static short yyrindex[] = {                         4,
    0,    0,    6,    0,    0,    0,    0,    0,    0,    1,
    5,    2,    0,    0,    0,   99,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    7,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    3,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,  100,    8,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
  -23,  -23,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,  -22,    0,    0,
    0,    9,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
};
final static short yygindex[] = {                         0,
    0,    0,    0,    0,   92,   85,   26,    0,    0,   44,
   12,   13,    0,   15,    0,  -12,   80,    0,    0,    0,
    0,    0,    0,    0,    0,   23,  -49,   14,
};
final static int YYTABLESIZE=299;
static short yytable[];
static { yytable();}
static void yytable(){
yytable = new short[]{                          9,
   14,    5,    4,    2,    3,   18,   19,   23,   22,   52,
   99,   75,   67,    1,   40,   53,  111,   20,   61,   15,
   18,   97,   85,   86,   87,   19,   98,  124,   68,   99,
  125,   76,   77,   78,   38,   79,   45,  103,  104,  105,
  106,   14,    5,    4,   88,   43,   44,   21,   23,   22,
  118,  119,  120,   22,   23,   24,   25,   26,   27,   28,
  126,  127,  128,   99,   99,   99,   82,   83,   84,   46,
   41,   47,   73,   74,   48,   54,   55,   57,   70,   71,
   66,   69,   89,   90,   91,   92,   94,   95,   96,  100,
  101,  116,  102,  114,  130,  121,  123,  122,   20,   21,
   17,   31,   32,   42,   93,  112,  110,  113,   56,  129,
    0,    0,  117,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    4,    5,    6,    0,    0,   49,   50,   51,
   19,    0,   94,    0,    0,    0,    7,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,   14,    5,    4,
    8,   14,    0,    0,   23,   22,   14,    5,    4,    2,
    3,   58,   59,   60,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,   14,   14,    5,    4,    2,    3,   18,   19,
};
}
static short yycheck[];
static { yycheck(); }
static void yycheck() {
yycheck = new short[] {                         40,
    0,    0,    0,    0,    0,    0,    0,    0,    0,   40,
   44,  276,  284,  290,   41,   46,   41,  261,   40,  266,
   46,   71,  263,  264,  265,  257,   41,   41,  300,   44,
   44,  296,  297,  298,  292,  300,  258,  280,  281,  282,
  283,   41,   41,   41,  285,   20,   21,  291,   41,   41,
  100,  101,  102,  269,  270,  271,  272,  273,  274,  275,
   41,   41,   41,   44,   44,   44,  287,  288,  289,  258,
  301,  258,   50,   51,   46,  258,  258,   59,  286,  123,
  300,  300,  300,   59,  123,  123,  257,  261,   40,   40,
   40,  125,   40,  262,  262,  125,  125,   44,    0,    0,
    9,  125,  125,   19,   61,   94,   92,   95,   29,  122,
   -1,   -1,   99,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,  263,  264,  265,   -1,   -1,  258,  259,  260,
  257,   -1,  257,   -1,   -1,   -1,  277,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,  257,  257,  257,
  301,  261,   -1,   -1,  257,  257,  266,  266,  266,  266,
  266,  293,  294,  295,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,  291,  292,  292,  292,  292,  292,  292,  292,
};
}
final static short YYFINAL=2;
final static short YYMAXTOKEN=301;
final static String yyname[] = {
"end-of-file",null,null,null,null,null,null,null,null,null,null,null,null,null,
null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,
null,null,null,null,null,null,null,null,null,null,"'('","')'",null,null,"','",
null,"'.'",null,null,null,null,null,null,null,null,null,null,null,null,"';'",
null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,
null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,
null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,
null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,
"'{'",null,"'}'",null,null,null,null,null,null,null,null,null,null,null,null,
null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,
null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,
null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,
null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,
null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,
null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,
null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,
null,null,null,null,null,null,null,"OP_OR","OP_EQUAL","OP_APPEND","OP_COMPARE",
"OP_AND","TKN_ASNO","TKN_IPV4","TKN_IPV6","TKN_IPV6DC","KEYW_ACTION","KEYW_AFI",
"KEYW_AFI_VALUE","TKN_PREF","TKN_MED","TKN_DPA","TKN_ASPATH","TKN_COMMUNITY",
"TKN_NEXT_HOP","TKN_COST","TKN_COMM_NO","TKN_RTRSNAME","TKN_PRFXV4",
"TKN_PRFXV4RNG","TKN_PRFXV6","TKN_PRFXV6DC","TKN_PRFXV6RNG","TKN_PRFXV6DCRNG",
"KEYW_IGP_COST","KEYW_SELF","KEYW_PREPEND","KEYW_APPEND","KEYW_DELETE",
"KEYW_CONTAINS","KEYW_AT","KEYW_EXCEPT","KEYW_UPON","KEYW_STATIC",
"KEYW_HAVE_COMPONENTS","KEYW_EXCLUDE","KEYW_INTERNET","KEYW_NO_EXPORT",
"KEYW_NO_ADVERTISE","KEYW_MASKLEN","TKN_INT","TKN_DNS",
};
final static String yyrule[] = {
"$accept : inject_r6",
"inject_r6 : mp_opt_router_expr_with_at mp_opt_action mp_opt_inject_expr",
"mp_opt_router_expr_with_at :",
"mp_opt_router_expr_with_at : KEYW_AT mp_router_expr",
"mp_router_expr : mp_router_expr OP_OR mp_router_expr_term",
"mp_router_expr : mp_router_expr_term",
"mp_router_expr_term : mp_router_expr_term OP_AND mp_router_expr_factor",
"mp_router_expr_term : mp_router_expr_term KEYW_EXCEPT mp_router_expr_factor",
"mp_router_expr_term : mp_router_expr_factor",
"mp_router_expr_factor : '(' mp_router_expr ')'",
"mp_router_expr_factor : mp_router_expr_operand",
"mp_router_expr_operand : TKN_IPV4",
"mp_router_expr_operand : TKN_IPV6",
"mp_router_expr_operand : TKN_IPV6DC",
"mp_router_expr_operand : domain_name",
"mp_router_expr_operand : TKN_RTRSNAME",
"domain_name : TKN_DNS",
"domain_name : domain_name '.' TKN_DNS",
"mp_opt_action :",
"mp_opt_action : KEYW_ACTION mp_action",
"mp_opt_inject_expr :",
"mp_opt_inject_expr : KEYW_UPON mp_inject_expr",
"mp_inject_expr : mp_inject_expr OP_OR mp_inject_expr_term",
"mp_inject_expr : mp_inject_expr_term",
"mp_inject_expr_term : mp_inject_expr_term OP_AND mp_inject_expr_factor",
"mp_inject_expr_term : mp_inject_expr_factor",
"mp_inject_expr_factor : '(' mp_inject_expr ')'",
"mp_inject_expr_factor : mp_inject_expr_operand",
"mp_inject_expr_operand : KEYW_STATIC",
"mp_inject_expr_operand : KEYW_HAVE_COMPONENTS '{' mp_opt_filter_prefix_list '}'",
"mp_inject_expr_operand : KEYW_EXCLUDE '{' mp_opt_filter_prefix_list '}'",
"mp_opt_filter_prefix_list :",
"mp_opt_filter_prefix_list : mp_filter_prefix_list",
"mp_filter_prefix_list : mp_filter_prefix_list_prefix",
"mp_filter_prefix_list : mp_filter_prefix_list ',' mp_filter_prefix_list_prefix",
"mp_filter_prefix_list_prefix : TKN_PRFXV6",
"mp_filter_prefix_list_prefix : TKN_PRFXV6DC",
"mp_filter_prefix_list_prefix : TKN_PRFXV6RNG",
"mp_filter_prefix_list_prefix : TKN_PRFXV6DCRNG",
"mp_action : mp_rp_attribute ';'",
"mp_action : mp_action mp_rp_attribute ';'",
"mp_rp_attribute : pref",
"mp_rp_attribute : med",
"mp_rp_attribute : dpa",
"mp_rp_attribute : aspath",
"mp_rp_attribute : community",
"mp_rp_attribute : mp_next_hop",
"mp_rp_attribute : cost",
"pref : TKN_PREF OP_EQUAL TKN_INT",
"med : TKN_MED OP_EQUAL TKN_INT",
"med : TKN_MED OP_EQUAL KEYW_IGP_COST",
"dpa : TKN_DPA OP_EQUAL TKN_INT",
"aspath : TKN_ASPATH '.' KEYW_PREPEND '(' asno_list ')'",
"asno_list : TKN_ASNO",
"asno_list : asno_list ',' TKN_ASNO",
"community : TKN_COMMUNITY OP_EQUAL community_list",
"community : TKN_COMMUNITY OP_APPEND community_list",
"community : TKN_COMMUNITY '.' KEYW_APPEND '(' community_elm_list ')'",
"community : TKN_COMMUNITY '.' KEYW_DELETE '(' community_elm_list ')'",
"community : TKN_COMMUNITY '.' KEYW_CONTAINS '(' community_elm_list ')'",
"community : TKN_COMMUNITY '(' community_elm_list ')'",
"community : TKN_COMMUNITY OP_COMPARE community_list",
"community_list : '{' community_elm_list '}'",
"community_elm_list : community_elm",
"community_elm_list : community_elm_list ',' community_elm",
"community_elm : KEYW_INTERNET",
"community_elm : KEYW_NO_EXPORT",
"community_elm : KEYW_NO_ADVERTISE",
"community_elm : TKN_INT",
"community_elm : TKN_COMM_NO",
"mp_next_hop : TKN_NEXT_HOP OP_EQUAL TKN_IPV4",
"mp_next_hop : TKN_NEXT_HOP OP_EQUAL TKN_IPV6",
"mp_next_hop : TKN_NEXT_HOP OP_EQUAL TKN_IPV6DC",
"mp_next_hop : TKN_NEXT_HOP OP_EQUAL KEYW_SELF",
"cost : TKN_COST OP_EQUAL TKN_INT",
};

//#line 186 "src/main/parser/byacc/inject_r6.y"

protected final Logger LOGGER = LoggerFactory.getLogger(InjectR6Parser.class);

private InjectR6Lexer lexer;

private int yylex () {
	int yyl_return = -1;
	try {
		yyl_return = lexer.yylex();
	}
	catch (IOException e) {
		 LOGGER.error(e.getMessage(), e);
	}
	return yyl_return;
}

public void yyerror(final String error) {
    String errorMessage = (yylval.sval == null ? error : yylval.sval);
    ParserHelper.parserError(errorMessage);
}

@Override
public Void parse(final String attributeValue) {
	lexer = new InjectR6Lexer(new StringReader(attributeValue), this);
    final int result = yyparse();
	if (result > 0) {
	    throw new IllegalArgumentException("Unexpected parse result: " + result);
	}
	return null;
}

//#line 437 "InjectR6Parser.java"
//###############################################################
// method: yylexdebug : check lexer state
//###############################################################
void yylexdebug(int state,int ch)
{
String s=null;
  if (ch < 0) ch=0;
  if (ch <= YYMAXTOKEN) //check index bounds
     s = yyname[ch];    //now get it
  if (s==null)
    s = "illegal-symbol";
  debug("state "+state+", reading "+ch+" ("+s+")");
}





//The following are now global, to aid in error reporting
int yyn;       //next next thing to do
int yym;       //
int yystate;   //current parsing state from state table
String yys;    //current token string


//###############################################################
// method: yyparse : parse input and execute indicated items
//###############################################################
int yyparse()
{
boolean doaction;
  init_stacks();
  yynerrs = 0;
  yyerrflag = 0;
  yychar = -1;          //impossible char forces a read
  yystate=0;            //initial state
  state_push(yystate);  //save it
  val_push(yylval);     //save empty value
  while (true) //until parsing is done, either correctly, or w/error
    {
    doaction=true;
    //if (yydebug) debug("loop"); 
    //#### NEXT ACTION (from reduction table)
    for (yyn=yydefred[yystate];yyn==0;yyn=yydefred[yystate])
      {
      //if (yydebug) debug("yyn:"+yyn+"  state:"+yystate+"  yychar:"+yychar);
      if (yychar < 0)      //we want a char?
        {
        yychar = yylex();  //get next token
        //if (yydebug) debug(" next yychar:"+yychar);
        //#### ERROR CHECK ####
        if (yychar < 0)    //it it didn't work/error
          {
          yychar = 0;      //change it to default string (no -1!)
          //if (yydebug)
          //  yylexdebug(yystate,yychar);
          }
        }//yychar<0
      yyn = yysindex[yystate];  //get amount to shift by (shift index)
      if ((yyn != 0) && (yyn += yychar) >= 0 &&
          yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
        {
        //if (yydebug)
          //debug("state "+yystate+", shifting to state "+yytable[yyn]);
        //#### NEXT STATE ####
        yystate = yytable[yyn];//we are in a new state
        state_push(yystate);   //save it
        val_push(yylval);      //push our lval as the input for next rule
        yychar = -1;           //since we have 'eaten' a token, say we need another
        if (yyerrflag > 0)     //have we recovered an error?
           --yyerrflag;        //give ourselves credit
        doaction=false;        //but don't process yet
        break;   //quit the yyn=0 loop
        }

    yyn = yyrindex[yystate];  //reduce
    if ((yyn !=0 ) && (yyn += yychar) >= 0 &&
            yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
      {   //we reduced!
      //if (yydebug) debug("reduce");
      yyn = yytable[yyn];
      doaction=true; //get ready to execute
      break;         //drop down to actions
      }
    else //ERROR RECOVERY
      {
      if (yyerrflag==0)
        {
        yyerror("syntax error");
        yynerrs++;
        }
      if (yyerrflag < 3) //low error count?
        {
        yyerrflag = 3;
        while (true)   //do until break
          {
          if (stateptr<0)   //check for under & overflow here
            {
            yyerror("stack underflow. aborting...");  //note lower case 's'
            return 1;
            }
          yyn = yysindex[state_peek(0)];
          if ((yyn != 0) && (yyn += YYERRCODE) >= 0 &&
                    yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)
            {
            //if (yydebug)
              //debug("state "+state_peek(0)+", error recovery shifting to state "+yytable[yyn]+" ");
            yystate = yytable[yyn];
            state_push(yystate);
            val_push(yylval);
            doaction=false;
            break;
            }
          else
            {
            //if (yydebug)
              //debug("error recovery discarding state "+state_peek(0)+" ");
            if (stateptr<0)   //check for under & overflow here
              {
              yyerror("Stack underflow. aborting...");  //capital 'S'
              return 1;
              }
            state_pop();
            val_pop();
            }
          }
        }
      else            //discard this token
        {
        if (yychar == 0)
          return 1; //yyabort
        //if (yydebug)
          //{
          //yys = null;
          //if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
          //if (yys == null) yys = "illegal-symbol";
          //debug("state "+yystate+", error recovery discards token "+yychar+" ("+yys+")");
          //}
        yychar = -1;  //read another
        }
      }//end error recovery
    }//yyn=0 loop
    if (!doaction)   //any reason not to proceed?
      continue;      //skip action
    yym = yylen[yyn];          //get count of terminals on rhs
    //if (yydebug)
      //debug("state "+yystate+", reducing "+yym+" by rule "+yyn+" ("+yyrule[yyn]+")");
    if (yym>0)                 //if count of rhs not 'nil'
      yyval = val_peek(yym-1); //get current semantic value
    yyval = dup_yyval(yyval); //duplicate yyval if ParserVal is used as semantic value
    switch(yyn)
      {
//########## USER-SUPPLIED ACTIONS ##########
case 14:
//#line 64 "src/main/parser/byacc/inject_r6.y"
{
    ParserHelper.checkStringLength(val_peek(0).sval, 255);
}
break;
case 48:
//#line 126 "src/main/parser/byacc/inject_r6.y"
{
    ParserHelper.check16bit(val_peek(0).sval);
}
break;
case 49:
//#line 131 "src/main/parser/byacc/inject_r6.y"
{
    ParserHelper.check16bit(val_peek(0).sval);
}
break;
case 51:
//#line 137 "src/main/parser/byacc/inject_r6.y"
{
    ParserHelper.check16bit(val_peek(0).sval);
}
break;
case 68:
//#line 168 "src/main/parser/byacc/inject_r6.y"
{
      ParserHelper.check32bit(val_peek(0).sval);
}
break;
case 74:
//#line 180 "src/main/parser/byacc/inject_r6.y"
{
    ParserHelper.check16bit(val_peek(0).sval);
}
break;
//#line 622 "InjectR6Parser.java"
//########## END OF USER-SUPPLIED ACTIONS ##########
    }//switch
    //#### Now let's reduce... ####
    //if (yydebug) debug("reduce");
    state_drop(yym);             //we just reduced yylen states
    yystate = state_peek(0);     //get new state
    val_drop(yym);               //corresponding value drop
    yym = yylhs[yyn];            //select next TERMINAL(on lhs)
    if (yystate == 0 && yym == 0)//done? 'rest' state and at first TERMINAL
      {
      //if (yydebug) debug("After reduction, shifting from state 0 to state "+YYFINAL+"");
      yystate = YYFINAL;         //explicitly say we're done
      state_push(YYFINAL);       //and save it
      val_push(yyval);           //also save the semantic value of parsing
      if (yychar < 0)            //we want another character?
        {
        yychar = yylex();        //get next character
        if (yychar<0) yychar=0;  //clean, if necessary
        //if (yydebug)
          //yylexdebug(yystate,yychar);
        }
      if (yychar == 0)          //Good exit (if lex returns 0 ;-)
         break;                 //quit the loop--all DONE
      }//if yystate
    else                        //else not done yet
      {                         //get next state and push, for next yydefred[]
      yyn = yygindex[yym];      //find out where to go
      if ((yyn != 0) && (yyn += yystate) >= 0 &&
            yyn <= YYTABLESIZE && yycheck[yyn] == yystate)
        yystate = yytable[yyn]; //get new state
      else
        yystate = yydgoto[yym]; //else go to new defred
      //if (yydebug) debug("after reduction, shifting from state "+state_peek(0)+" to state "+yystate+"");
      state_push(yystate);     //going again, so push state & val...
      val_push(yyval);         //for next action
      }
    }//main loop
  return 0;//yyaccept!!
}
//## end of method parse() ######################################



//## run() --- for Thread #######################################
//## The -Jnorun option was used ##
//## end of method run() ########################################



//## Constructors ###############################################
//## The -Jnoconstruct option was used ##
//###############################################################



}
//################### END OF CLASS ##############################




© 2015 - 2024 Weber Informatics LLC | Privacy Policy