diff options
Diffstat (limited to 'src/emu/netlist/nl_parser.c')
-rw-r--r-- | src/emu/netlist/nl_parser.c | 41 |
1 files changed, 36 insertions, 5 deletions
diff --git a/src/emu/netlist/nl_parser.c b/src/emu/netlist/nl_parser.c index 3f36f676297..a8a5174aca8 100644 --- a/src/emu/netlist/nl_parser.c +++ b/src/emu/netlist/nl_parser.c @@ -214,8 +214,10 @@ ATTR_COLD void netlist_parser::verror(pstring msg, int line_num, pstring line) } -void netlist_parser::parse(const char *buf) +void netlist_parser::parse(const char *buf, const pstring nlname) { + m_buf = buf; + reset(buf); set_identifier_chars("abcdefghijklmnopqrstuvwvxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890_.-"); set_number_chars("01234567890eE-."); //FIXME: processing of numbers @@ -234,19 +236,20 @@ void netlist_parser::parse(const char *buf) m_tok_ALIAS = register_token("ALIAS"); m_tok_NET_C = register_token("NET_C"); m_tok_PARAM = register_token("PARAM"); - m_tok_NET_MODEL = register_token("PARAM"); + m_tok_NET_MODEL = register_token("NET_MODEL"); + m_tok_INCLUDE = register_token("INCLUDE"); + m_tok_SUBMODEL = register_token("SUBMODEL"); m_tok_NETLIST_START = register_token("NETLIST_START"); m_tok_NETLIST_END = register_token("NETLIST_END"); bool in_nl = false; - pstring nlname = ""; - while (true) + while (true) { token_t token = get_token(); if (token.is_type(ENDOFFILE)) - return; + error("EOF while searching for <%s>", nlname.cstr()); if (token.is(m_tok_NETLIST_END)) { @@ -297,6 +300,10 @@ void netlist_parser::parse_netlist(const pstring &nlname) netdev_param(); else if (token.is(m_tok_NET_MODEL)) net_model(); + else if (token.is(m_tok_SUBMODEL)) + net_submodel(); + else if (token.is(m_tok_INCLUDE)) + net_include(); else if (token.is(m_tok_NETLIST_END)) { netdev_netlist_end(); @@ -329,6 +336,30 @@ void netlist_parser::net_model() require_token(m_tok_param_right); } +void netlist_parser::net_submodel() +{ + // don't do much + pstring name = get_identifier(); + require_token(m_tok_comma); + pstring model = get_identifier(); + require_token(m_tok_param_right); + + m_setup.namespace_push(name); + netlist_parser subparser(m_setup); + subparser.parse(m_buf, model); + m_setup.namespace_pop(); +} + +void netlist_parser::net_include() +{ + // don't do much + pstring name = get_identifier(); + require_token(m_tok_param_right); + + netlist_parser subparser(m_setup); + subparser.parse(m_buf, name); +} + void netlist_parser::net_alias() { pstring alias = get_identifier(); |