#include <sstream>
using namespace std;
+#include "context.hh" // for nested_property_alist
#include "international.hh"
#include "interval.hh"
#include "keyword.hh"
}
void
-Lily_lexer::set_identifier (SCM name, SCM s)
+Lily_lexer::set_identifier (SCM path, SCM s)
{
- SCM sym = name;
- if (scm_is_string (name))
- sym = scm_string_to_symbol (name);
+ SCM sym = path;
+ SCM val = s;
+ if (scm_is_string (path))
+ sym = scm_string_to_symbol (path);
+ else if (scm_is_pair (path))
+ {
+ sym = scm_car (path);
+ path = scm_cdr (path);
+ }
if (scm_is_symbol (sym))
{
SCM mod = scm_car (scopes_);
- scm_module_define (mod, sym, s);
+ if (scm_is_pair (path))
+ {
+ SCM prev = scm_module_lookup (mod, sym);
+ if (prev != SCM_UNDEFINED)
+ val = nested_property_alist (prev, path, s);
+ }
+ scm_module_define (mod, sym, val);
}
else
programming_error ("identifier is not a symbol");
assignment:
assignment_id '=' identifier_init {
PARSER->lexer_->set_identifier ($1, $3);
-
+ }
+ | assignment_id property_path '=' identifier_init {
+ SCM path = scm_cons (scm_string_to_symbol ($1), $2);
+ PARSER->lexer_->set_identifier (path, $4);
+ ;
/*
TODO: devise standard for protection in parser.