mirror of
git://projects.qi-hardware.com/eda-tools.git
synced 2024-11-26 09:28:24 +02:00
b2/: export field hierarchy and substitution rules from lang.y
This commit is contained in:
parent
fd14c5200a
commit
04d858e047
@ -13,6 +13,13 @@
|
||||
#ifndef LANG_H
|
||||
#define LANG_H
|
||||
|
||||
#include "chr.h"
|
||||
#include "subst.h"
|
||||
|
||||
|
||||
extern struct action hierarchy;
|
||||
extern struct subst *substitutions;
|
||||
|
||||
void parse_hierarchy(const char *name);
|
||||
void parse_characteristics(const char *name);
|
||||
void parse_inventory(const char *name);
|
||||
|
24
b2/lang.y
24
b2/lang.y
@ -24,7 +24,9 @@
|
||||
#include "y.tab.h"
|
||||
|
||||
|
||||
static struct action hierarchy;
|
||||
struct action hierarchy;
|
||||
struct subst *substitutions = NULL;
|
||||
|
||||
static struct currency *curr;
|
||||
|
||||
|
||||
@ -100,23 +102,29 @@ static const struct field *top_field(void)
|
||||
%type <field> /*rules*/ opt_rule rule opt_fields fields field
|
||||
%type <sel> selectors
|
||||
%type <cond> conditions condition
|
||||
%type <act> opt_wildcard action
|
||||
%type <act> hierarchy opt_wildcard action
|
||||
%type <part> part inventory_item
|
||||
%type <param> param params
|
||||
%type <price> prices price
|
||||
%type <stock> stock
|
||||
%type <prov> providers provider
|
||||
%type <subst> block opt_block
|
||||
%type <subst> substitutions block opt_block
|
||||
|
||||
%%
|
||||
|
||||
all:
|
||||
START_HIERARCHY hierarchy
|
||||
{
|
||||
hierarchy = $2;
|
||||
}
|
||||
| START_CHAR characteristics
|
||||
| START_INVENTORY inventory
|
||||
| START_EXCHANGE exchange
|
||||
| START_PROVIDERS providers
|
||||
| START_SUBST substitutions
|
||||
{
|
||||
substitutions = $2;
|
||||
}
|
||||
;
|
||||
|
||||
|
||||
@ -125,9 +133,12 @@ all:
|
||||
|
||||
hierarchy:
|
||||
nameset hierarchy
|
||||
{
|
||||
$$ = $2;
|
||||
}
|
||||
| action
|
||||
{
|
||||
hierarchy = $1;
|
||||
$$ = $1;
|
||||
field_dump(stderr, $1.fields);
|
||||
field_dump(stderr, $1.rules);
|
||||
}
|
||||
@ -566,8 +577,9 @@ provider:
|
||||
substitutions:
|
||||
block
|
||||
{
|
||||
subst_finalize($1);
|
||||
subst_dump(stderr, $1);
|
||||
$$ = $1;
|
||||
subst_finalize($$);
|
||||
subst_dump(stderr, $$);
|
||||
}
|
||||
;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user