ergo
ergo_input_processor.c File Reference

Parses the input. More...

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "ergo_scripted.h"

Classes

union  YYSTYPE
 
union  yyalloc
 

Macros

#define YYBISON   1
 
#define YYBISON_VERSION   "2.5"
 
#define YYSKELETON_NAME   "yacc.c"
 
#define YYPURE   0
 
#define YYPUSH   0
 
#define YYPULL   1
 
#define YYLSP_NEEDED   0
 
#define YYERROR_VERBOSE
 
#define YYDEBUG   0
 
#define YYERROR_VERBOSE   1
 
#define YYTOKEN_TABLE   0
 
#define YYTOKENTYPE
 
#define NUMBER   258
 
#define DOT   259
 
#define SYMBOL   260
 
#define EQUAL   261
 
#define STRING   262
 
#define EOFTAG   263
 
#define GETEXC   264
 
#define GETPOL   265
 
#define K_ALL   266
 
#define HELP   267
 
#define MOLTAG   268
 
#define GHOSTTAG   269
 
#define MOLDAL   270
 
#define QUIT   271
 
#define RUNTAG   272
 
#define SYSTEM   273
 
#define GHOST   274
 
#define ANGSTROM   275
 
#define PRECISION   276
 
#define RANGE   277
 
#define WARRANTY   278
 
#define SET_NTHREADS   279
 
#define PLUS   280
 
#define MINUS   281
 
#define TIMES   282
 
#define DIVIDE   283
 
#define POWER   284
 
#define LEFT_PARENTHESIS   285
 
#define RIGHT_PARENTHESIS   286
 
#define EOL   287
 
#define NEG   288
 
#define YYSTYPE_IS_TRIVIAL   1
 
#define yystype   YYSTYPE /* obsolescent; will be withdrawn */
 
#define YYSTYPE_IS_DECLARED   1
 
#define YYSIZE_T   unsigned int
 
#define YYSIZE_MAXIMUM   ((YYSIZE_T) -1)
 
#define YY_(msgid)   msgid
 
#define YYUSE(e)   ((void) (e))
 
#define YYID(n)   (n)
 
#define YYSTACK_ALLOC   YYMALLOC
 
#define YYSTACK_FREE   YYFREE
 
#define YYSTACK_ALLOC_MAXIMUM   YYSIZE_MAXIMUM
 
#define YYMALLOC   malloc
 
#define YYFREE   free
 
#define YYSTACK_GAP_MAXIMUM   (sizeof (union yyalloc) - 1)
 
#define YYSTACK_BYTES(N)
 
#define YYCOPY_NEEDED   1
 
#define YYSTACK_RELOCATE(Stack_alloc, Stack)
 
#define YYCOPY(To, From, Count)
 
#define YYFINAL   35
 
#define YYLAST   106
 
#define YYNTOKENS   34
 
#define YYNNTS   9
 
#define YYNRULES   43
 
#define YYNSTATES   92
 
#define YYUNDEFTOK   2
 
#define YYMAXUTOK   288
 
#define YYTRANSLATE(YYX)   ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
 
#define YYPACT_NINF   -39
 
#define YYTABLE_NINF   -6
 
#define yypact_value_is_default(yystate)   ((yystate) == (-39))
 
#define yytable_value_is_error(yytable_value)   YYID (0)
 
#define yyerrok   (yyerrstatus = 0)
 
#define yyclearin   (yychar = YYEMPTY)
 
#define YYEMPTY   (-2)
 
#define YYEOF   0
 
#define YYACCEPT   goto yyacceptlab
 
#define YYABORT   goto yyabortlab
 
#define YYERROR   goto yyerrorlab
 
#define YYFAIL   goto yyerrlab
 
#define YYRECOVERING()   (!!yyerrstatus)
 
#define YYBACKUP(Token, Value)
 
#define YYTERROR   1
 
#define YYERRCODE   256
 
#define YYRHSLOC(Rhs, K)   ((Rhs)[K])
 
#define YYLLOC_DEFAULT(Current, Rhs, N)
 
#define YY_LOCATION_PRINT(File, Loc)   ((void) 0)
 
#define YYLEX   yylex ()
 
#define YYDPRINTF(Args)
 
#define YY_SYMBOL_PRINT(Title, Type, Value, Location)
 
#define YY_STACK_PRINT(Bottom, Top)
 
#define YY_REDUCE_PRINT(Rule)
 
#define YYINITDEPTH   200
 
#define YYMAXDEPTH   10000
 
#define YYCASE_(N, S)
 
#define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N))
 
#define YYSYNTAX_ERROR
 

Typedefs

typedef union YYSTYPE YYSTYPE
 
typedef unsigned char yytype_uint8
 
typedef short int yytype_int8
 
typedef unsigned short int yytype_uint16
 
typedef short int yytype_int16
 

Enumerations

enum  yytokentype {
  NUMBER = 258, DOT = 259, SYMBOL = 260, EQUAL = 261,
  STRING = 262, EOFTAG = 263, GETEXC = 264, GETPOL = 265,
  K_ALL = 266, HELP = 267, MOLTAG = 268, GHOSTTAG = 269,
  MOLDAL = 270, QUIT = 271, RUNTAG = 272, SYSTEM = 273,
  GHOST = 274, ANGSTROM = 275, PRECISION = 276, RANGE = 277,
  WARRANTY = 278, SET_NTHREADS = 279, PLUS = 280, MINUS = 281,
  TIMES = 282, DIVIDE = 283, POWER = 284, LEFT_PARENTHESIS = 285,
  RIGHT_PARENTHESIS = 286, EOL = 287, NEG = 288, NUMBER = 258,
  DOT = 259, SYMBOL = 260, EQUAL = 261, STRING = 262,
  EOFTAG = 263, GETEXC = 264, GETPOL = 265, K_ALL = 266,
  HELP = 267, MOLTAG = 268, GHOSTTAG = 269, MOLDAL = 270,
  QUIT = 271, RUNTAG = 272, SYSTEM = 273, GHOST = 274,
  ANGSTROM = 275, PRECISION = 276, RANGE = 277, WARRANTY = 278,
  SET_NTHREADS = 279, PLUS = 280, MINUS = 281, TIMES = 282,
  DIVIDE = 283, POWER = 284, LEFT_PARENTHESIS = 285, RIGHT_PARENTHESIS = 286,
  EOL = 287, NEG = 288
}
 

Functions

int yylex (void)
 
int yyerror (char *s)
 
static YYSIZE_T yystrlen (char *yystr) const
 
static char * yystpcpy (char *yydest, const char *yysrc)
 
static YYSIZE_T yytnamerr (char *yyres, const char *yystr)
 
static int yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, yytype_int16 *yyssp, int yytoken)
 
static void yydestruct (char *yymsg, int yytype, YYSTYPE *yyvaluep) const
 
int yyparse ()
 

Variables

static const char * last_token = NULL
 
static const yytype_uint8 yytranslate []
 
static const char *const yytname []
 
static const yytype_uint8 yyr1 []
 
static const yytype_uint8 yyr2 []
 
static const yytype_uint8 yydefact []
 
static const yytype_int8 yydefgoto []
 
static const yytype_int8 yypact []
 
static const yytype_int8 yypgoto []
 
static const yytype_int8 yytable []
 
static const yytype_uint8 yycheck []
 
static const yytype_uint8 yystos []
 
int yychar
 
YYSTYPE yylval
 
int yynerrs
 
int ergo_scanner_lineno = 1
 
int ergo_scanner_reading_stdin = 0
 

Detailed Description

Parses the input.

Uses bison code generator to generate the parses.

Macro Definition Documentation

#define ANGSTROM   275

Referenced by while().

#define DIVIDE   283

Referenced by while().

#define DOT   259

Referenced by while().

#define EOFTAG   263

Referenced by while().

#define EOL   287

Referenced by while().

#define EQUAL   261

Referenced by while().

#define GETEXC   264

Referenced by while().

#define GETPOL   265

Referenced by while().

#define GHOST   274

Referenced by while().

#define GHOSTTAG   269
#define HELP   267

Referenced by while().

#define K_ALL   266

Referenced by while().

#define LEFT_PARENTHESIS   285

Referenced by while().

#define MINUS   281

Referenced by while().

#define MOLDAL   270

Referenced by while().

#define MOLTAG   268

Referenced by while().

#define NEG   288
#define NUMBER   258

Referenced by while().

#define PLUS   280

Referenced by while().

#define POWER   284

Referenced by while().

#define PRECISION   276

Referenced by while().

#define QUIT   271

Referenced by while().

#define RANGE   277

Referenced by while().

#define RIGHT_PARENTHESIS   286

Referenced by while().

#define RUNTAG   272

Referenced by while().

#define SET_NTHREADS   279

Referenced by while().

#define STRING   262

Referenced by while().

#define SYMBOL   260

Referenced by while().

#define SYSTEM   273

Referenced by while().

#define TIMES   282

Referenced by while().

#define WARRANTY   278

Referenced by while().

#define YY_ (   msgid)    msgid

Referenced by yyparse(), and yysyntax_error().

#define YY_LOCATION_PRINT (   File,
  Loc 
)    ((void) 0)
#define YY_REDUCE_PRINT (   Rule)

Referenced by yyparse().

#define YY_STACK_PRINT (   Bottom,
  Top 
)

Referenced by yyparse().

#define YY_SYMBOL_PRINT (   Title,
  Type,
  Value,
  Location 
)

Referenced by yydestruct(), and yyparse().

#define YYABORT   goto yyabortlab

Referenced by yyparse().

#define YYACCEPT   goto yyacceptlab

Referenced by yyparse().

#define YYBACKUP (   Token,
  Value 
)
Value:
if (yychar == YYEMPTY && yylen == 1) \
{ \
yychar = (Token); \
yylval = (Value); \
YYPOPSTACK (1); \
goto yybackup; \
} \
else \
{ \
yyerror (YY_("syntax error: cannot back up")); \
YYERROR; \
} \
while (YYID (0))
#define YYBISON   1
#define YYBISON_VERSION   "2.5"
#define YYCASE_ (   N,
 
)
Value:
case N: \
yyformat = S; \
break

Referenced by yysyntax_error().

#define yyclearin   (yychar = YYEMPTY)
#define YYCOPY (   To,
  From,
  Count 
)
Value:
do \
{ \
YYSIZE_T yyi; \
for (yyi = 0; yyi < (Count); yyi++) \
(To)[yyi] = (From)[yyi]; \
} \
while (YYID (0))
#define YYCOPY_NEEDED   1
#define YYDEBUG   0
#define YYDPRINTF (   Args)

Referenced by yyparse().

#define YYEMPTY   (-2)

Referenced by yyparse(), and yysyntax_error().

#define YYEOF   0

Referenced by yyparse().

#define YYERRCODE   256
#define yyerrok   (yyerrstatus = 0)
#define YYERROR   goto yyerrorlab

Referenced by yyparse().

#define YYERROR_VERBOSE
#define YYERROR_VERBOSE   1
#define YYFAIL   goto yyerrlab
#define YYFINAL   35

Referenced by yyparse().

#define YYFREE   free
#define YYID (   n)    (n)

Referenced by yyparse().

#define YYINITDEPTH   200

Referenced by yyparse().

#define YYLAST   106

Referenced by yyparse(), and yysyntax_error().

#define YYLEX   yylex ()

Referenced by yyparse().

#define YYLLOC_DEFAULT (   Current,
  Rhs,
 
)
Value:
if (YYID (N)) \
{ \
(Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
(Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
(Current).last_line = YYRHSLOC (Rhs, N).last_line; \
(Current).last_column = YYRHSLOC (Rhs, N).last_column; \
} \
else \
{ \
(Current).first_line = (Current).last_line = \
YYRHSLOC (Rhs, 0).last_line; \
(Current).first_column = (Current).last_column = \
YYRHSLOC (Rhs, 0).last_column; \
} \
while (YYID (0))
#define YYLSP_NEEDED   0
#define YYMALLOC   malloc
#define YYMAXDEPTH   10000

Referenced by yyparse().

#define YYMAXUTOK   288
#define YYNNTS   9
#define YYNRULES   43
#define YYNSTATES   92
#define YYNTOKENS   34

Referenced by yyparse(), and yysyntax_error().

#define YYPACT_NINF   -39
#define yypact_value_is_default (   yystate)    ((yystate) == (-39))

Referenced by yyparse(), and yysyntax_error().

#define YYPOPSTACK (   N)    (yyvsp -= (N), yyssp -= (N))

Referenced by yyparse().

#define YYPULL   1
#define YYPURE   0
#define YYPUSH   0
#define YYRECOVERING ( )    (!!yyerrstatus)
#define YYRHSLOC (   Rhs,
 
)    ((Rhs)[K])
#define YYSIZE_MAXIMUM   ((YYSIZE_T) -1)
#define YYSIZE_T   unsigned int
#define YYSKELETON_NAME   "yacc.c"
#define YYSTACK_ALLOC   YYMALLOC

Referenced by yyparse().

#define YYSTACK_ALLOC_MAXIMUM   YYSIZE_MAXIMUM

Referenced by yysyntax_error().

#define YYSTACK_BYTES (   N)
Value:
((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \

Referenced by yyparse().

#define YYSTACK_FREE   YYFREE

Referenced by yyparse().

#define YYSTACK_GAP_MAXIMUM   (sizeof (union yyalloc) - 1)
#define YYSTACK_RELOCATE (   Stack_alloc,
  Stack 
)
Value:
do \
{ \
YYSIZE_T yynewbytes; \
YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
Stack = &yyptr->Stack_alloc; \
yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
yyptr += yynewbytes / sizeof (*yyptr); \
} \
while (YYID (0))

Referenced by yyparse().

#define yystype   YYSTYPE /* obsolescent; will be withdrawn */
#define YYSTYPE_IS_DECLARED   1
#define YYSTYPE_IS_TRIVIAL   1
#define YYSYNTAX_ERROR
Value:
yysyntax_error (&yymsg_alloc, &yymsg, \
yyssp, yytoken)

Referenced by yyparse().

#define YYTABLE_NINF   -6
#define yytable_value_is_error (   yytable_value)    YYID (0)

Referenced by yyparse(), and yysyntax_error().

#define YYTERROR   1

Referenced by yyparse(), and yysyntax_error().

#define YYTOKEN_TABLE   0
#define YYTOKENTYPE
#define YYTRANSLATE (   YYX)    ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)

Referenced by yyparse().

#define YYUNDEFTOK   2
#define YYUSE (   e)    ((void) (e))

Referenced by yydestruct().

Typedef Documentation

typedef union YYSTYPE YYSTYPE
typedef short int yytype_int16
typedef short int yytype_int8
typedef unsigned short int yytype_uint16
typedef unsigned char yytype_uint8

Enumeration Type Documentation

Enumerator
NUMBER 
DOT 
SYMBOL 
EQUAL 
STRING 
EOFTAG 
GETEXC 
GETPOL 
K_ALL 
HELP 
MOLTAG 
GHOSTTAG 
MOLDAL 
QUIT 
RUNTAG 
SYSTEM 
GHOST 
ANGSTROM 
PRECISION 
RANGE 
WARRANTY 
SET_NTHREADS 
PLUS 
MINUS 
TIMES 
DIVIDE 
POWER 
LEFT_PARENTHESIS 
RIGHT_PARENTHESIS 
EOL 
NEG 
NUMBER 
DOT 
SYMBOL 
EQUAL 
STRING 
EOFTAG 
GETEXC 
GETPOL 
K_ALL 
HELP 
MOLTAG 
GHOSTTAG 
MOLDAL 
QUIT 
RUNTAG 
SYSTEM 
GHOST 
ANGSTROM 
PRECISION 
RANGE 
WARRANTY 
SET_NTHREADS 
PLUS 
MINUS 
TIMES 
DIVIDE 
POWER 
LEFT_PARENTHESIS 
RIGHT_PARENTHESIS 
EOL 
NEG 

Function Documentation

static void yydestruct ( char *  yymsg,
int  yytype,
YYSTYPE yyvaluep 
) const
static

References YY_SYMBOL_PRINT, and YYUSE.

Referenced by yyparse().

int yyerror ( char *  s)

References ergo_scanner_reading_stdin, and last_token.

Referenced by yyparse().

int yylex ( void  )
static char* yystpcpy ( char *  yydest,
const char *  yysrc 
)
static

Referenced by yytnamerr().

static YYSIZE_T yystrlen ( char *  yystr) const
static

References YYSIZE_T.

Referenced by yysyntax_error(), and yytnamerr().

static int yysyntax_error ( YYSIZE_T yymsg_alloc,
char **  yymsg,
yytype_int16 yyssp,
int  yytoken 
)
static
static YYSIZE_T yytnamerr ( char *  yyres,
const char *  yystr 
)
static

References YYSIZE_T, yystpcpy(), and yystrlen().

Referenced by yysyntax_error().

Variable Documentation

int ergo_scanner_lineno = 1

Referenced by while().

int ergo_scanner_reading_stdin = 0
const char* last_token = NULL
static

Referenced by yyerror(), and yyparse().

int yychar
const yytype_uint8 yycheck[]
static
Initial value:
=
{
38, 20, 7, 20, 3, 5, 11, 5, 8, 0,
1, 7, 7, 32, 5, 32, 54, 55, 9, 10,
19, 12, 13, 14, 15, 16, 17, 18, 3, 7,
21, 22, 23, 24, 72, 73, 74, 75, 76, 3,
3, 32, 7, 7, 7, 27, 25, 26, 27, 28,
29, 26, 31, 7, 19, 30, 27, 28, 29, 4,
42, 6, 26, 26, 46, 47, 30, 30, 25, 26,
27, 28, 29, 0, 31, 25, 26, 27, 28, 29,
32, 30, 3, 7, 4, 32, 32, 6, 3, 5,
3, 3, 3, 3, 31, 3, 3, 6, 3, 29,
3, 7, 3, 32, 36, 7, 5
}
const yytype_uint8 yydefact[]
static
Initial value:
=
{
0, 8, 11, 0, 0, 17, 0, 0, 0, 30,
0, 0, 19, 0, 26, 0, 0, 3, 6, 0,
7, 0, 0, 18, 0, 0, 0, 0, 20, 0,
22, 25, 0, 0, 0, 1, 0, 0, 0, 27,
0, 0, 0, 0, 33, 13, 0, 0, 15, 21,
0, 0, 36, 0, 0, 0, 0, 4, 12, 10,
9, 28, 29, 14, 0, 34, 16, 0, 0, 24,
41, 0, 0, 0, 0, 0, 0, 23, 0, 0,
0, 43, 37, 38, 39, 40, 42, 0, 31, 0,
35, 32
}
const yytype_int8 yydefgoto[]
static
Initial value:
=
{
-1, 16, 17, 18, 19, 20, 45, 46, 56
}
YYSTYPE yylval

Referenced by while(), and yyparse().

int yynerrs

Referenced by yyparse().

const yytype_int8 yypact[]
static
Initial value:
=
{
9, -39, -39, 4, 5, 2, -19, -17, 35, -39,
22, 46, -39, 1, -39, 51, 73, 48, -39, 55,
-39, 79, -5, 80, 53, 0, 54, 0, -39, 76,
-39, -39, 81, 85, 36, -39, 9, 84, 37, -39,
87, 88, 0, 89, -39, -39, 0, 0, -39, -39,
90, 91, -39, 63, 25, 25, 21, -39, -39, -39,
50, -39, -39, -39, 92, -39, -39, 93, 95, -39,
70, 43, 25, 25, 25, 25, 25, -39, 97, 94,
99, -39, 29, 29, 70, 70, 70, 71, -39, 98,
-39, -39
}
const yytype_int8 yypgoto[]
static
Initial value:
=
{
-39, 68, -39, -39, 101, -39, 18, -39, -38
}
const yytype_uint8 yyr1[]
static
Initial value:
=
{
0, 34, 35, 35, 35, 36, 36, 36, 36, 37,
37, 38, 38, 39, 39, 39, 39, 39, 39, 39,
39, 39, 39, 39, 39, 39, 39, 39, 39, 39,
39, 39, 39, 40, 40, 41, 42, 42, 42, 42,
42, 42, 42, 42
}
const yytype_uint8 yyr2[]
static
Initial value:
=
{
0, 2, 0, 1, 3, 0, 1, 1, 1, 3,
3, 1, 3, 3, 4, 3, 4, 1, 2, 1,
2, 3, 2, 4, 4, 2, 1, 3, 4, 4,
1, 6, 7, 1, 2, 5, 1, 3, 3, 3,
3, 2, 3, 3
}
const yytype_uint8 yystos[]
static
Initial value:
=
{
0, 1, 5, 9, 10, 12, 13, 14, 15, 16,
17, 18, 21, 22, 23, 24, 35, 36, 37, 38,
39, 7, 7, 38, 20, 32, 20, 32, 7, 19,
7, 7, 3, 19, 30, 0, 32, 4, 6, 3,
7, 11, 32, 5, 8, 40, 41, 32, 40, 7,
6, 3, 3, 7, 26, 30, 42, 35, 5, 7,
42, 3, 3, 40, 3, 40, 40, 3, 6, 31,
42, 42, 25, 26, 27, 28, 29, 31, 3, 3,
3, 31, 42, 42, 42, 42, 42, 3, 7, 3,
32, 7
}
const yytype_int8 yytable[]
static
Initial value:
=
{
60, 24, 40, 26, 32, 43, 41, 2, 44, -2,
1, 21, 22, 25, 2, 27, 70, 71, 3, 4,
33, 5, 6, 7, 8, 9, 10, 11, 52, 30,
12, 13, 14, 15, 82, 83, 84, 85, 86, 52,
52, -5, 28, 53, 59, 48, 72, 73, 74, 75,
76, 54, 77, 31, 29, 55, 74, 75, 76, 37,
63, 38, 54, 54, 65, 66, 55, 55, 72, 73,
74, 75, 76, 35, 81, 72, 73, 74, 75, 76,
36, 34, 39, 49, 37, 42, 47, 50, 51, 58,
61, 62, 64, 67, 69, 78, 79, 68, 80, 76,
87, 88, 89, 90, 57, 91, 23
}
const char* const yytname[]
static
Initial value:
=
{
"$end", "error", "$undefined", "NUMBER", "DOT", "SYMBOL", "EQUAL",
"STRING", "EOFTAG", "GETEXC", "GETPOL", "K_ALL", "HELP", "MOLTAG",
"GHOSTTAG", "MOLDAL", "QUIT", "RUNTAG", "SYSTEM", "GHOST", "ANGSTROM",
"PRECISION", "RANGE", "WARRANTY", "SET_NTHREADS", "PLUS", "MINUS",
"TIMES", "DIVIDE", "POWER", "LEFT_PARENTHESIS", "RIGHT_PARENTHESIS",
"EOL", "NEG", "$accept", "Input", "Line", "Assignment", "Lvalue",
"Command", "Molinput", "Molline", "Expression", 0
}
const yytype_uint8 yytranslate[]
static