File: const_gram.h

package info (click to toggle)
pcb-rnd 3.0.6-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 29,624 kB
  • sloc: ansic: 197,571; yacc: 6,153; sh: 5,808; awk: 2,708; makefile: 2,139; lex: 1,107; python: 519; xml: 261; lisp: 169; tcl: 67; perl: 34; javascript: 6; ruby: 5
file content (124 lines) | stat: -rw-r--r-- 3,424 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
#ifndef _pcb_ordc__defines_h_
#define _pcb_ordc__defines_h_

typedef short pcb_ordc_int_t;
#define pcb_ordc_chr yyctx->chr
#define pcb_ordc_val yyctx->val
#define pcb_ordc_lval yyctx->lval
#define pcb_ordc_stack yyctx->stack
#define pcb_ordc_debug yyctx->debug
#define pcb_ordc_nerrs yyctx->nerrs
#define pcb_ordc_errflag yyctx->errflag
#define pcb_ordc_state yyctx->state
#define pcb_ordc_yyn yyctx->yyn
#define pcb_ordc_yym yyctx->yym
#define pcb_ordc_jump yyctx->jump
#line 18 "../src_plugins/order/const_gram.y"
/*
 *                            COPYRIGHT
 *
 *  pcb-rnd, interactive printed circuit board design
 *
 *  order plugin - constraint language grammar
 *  pcb-rnd Copyright (C) 2020 Tibor 'Igor2' Palinkas
 *
 *  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
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 *  Contact:
 *    Project page: http://repo.hu/projects/pcb-rnd
 *    lead developer: http://repo.hu/projects/pcb-rnd/contact.html
 *    mailing list: pcb-rnd (at) list.repo.hu (send "subscribe")
 */
#include "../src_plugins/order/const_gram.h"
#include "../src_plugins/order/constraint.h"


#line 8 "../src_plugins/order/const_gram.y"
typedef union pcb_ordc_tokunion_u
{
	double d;
	int i;
	char *s;
	pcb_ordc_node_t *tree;
} pcb_ordc_tokunion_t;
#line 3 "../src_plugins/order/const_gram.y"
typedef struct pcb_ordc_tokstruct_s
{
	pcb_ordc_tokunion_t un;
	long line, first_col, last_col;
} pcb_ordc_tokstruct_t;
typedef pcb_ordc_tokstruct_t pcb_ordc_STYPE;


#define T_CINT 257
#define T_CFLOAT 258
#define T_STRING 259
#define T_QSTR 260
#define T_ID 261
#define T_EQ 262
#define T_NEQ 263
#define T_GE 264
#define T_LE 265
#define T_GT 266
#define T_LT 267
#define T_AND 268
#define T_OR 269
#define T_NOT 270
#define T_IF 271
#define T_ERROR 272
#define T_INT 273
#define T_FLOAT 274
#define T_STR 275
#define pcb_ordc_ERRCODE 256

#ifndef pcb_ordc_INITSTACKSIZE
#define pcb_ordc_INITSTACKSIZE 200
#endif

typedef struct {
	unsigned stacksize;
	pcb_ordc_int_t *s_base;
	pcb_ordc_int_t *s_mark;
	pcb_ordc_int_t *s_last;
	pcb_ordc_STYPE *l_base;
	pcb_ordc_STYPE *l_mark;
#if pcb_ordc_DEBUG
	int debug;
#endif
} pcb_ordc_STACKDATA;

typedef struct {
	int errflag;
	int chr;
	pcb_ordc_STYPE val;
	pcb_ordc_STYPE lval;
	int nerrs;
	int yym, yyn, state;
	int jump;
	int stack_max_depth;
	int debug;

	/* variables for the parser stack */
	pcb_ordc_STACKDATA stack;
} pcb_ordc_yyctx_t;

typedef enum { pcb_ordc_RES_NEXT, pcb_ordc_RES_DONE, pcb_ordc_RES_ABORT } pcb_ordc_res_t;

extern int pcb_ordc_parse_init(pcb_ordc_yyctx_t *yyctx);
extern pcb_ordc_res_t pcb_ordc_parse(pcb_ordc_yyctx_t *yyctx, pcb_ordc_ctx_t *ctx, int tok, pcb_ordc_STYPE *lval);
extern void pcb_ordc_error(pcb_ordc_ctx_t *ctx, pcb_ordc_STYPE tok, const char *msg);


#endif /* _pcb_ordc__defines_h_ */