preliminary stupid things

diff --git a/libasn1parser/asn1p_y.y b/libasn1parser/asn1p_y.y
index 8c714f1..a2f31a8 100644
--- a/libasn1parser/asn1p_y.y
+++ b/libasn1parser/asn1p_y.y
@@ -23,32 +23,37 @@
 #define	yylineno	asn1p_lineno
 extern int asn1p_lineno;
 
+/*
+ * This temporary variable is used to solve the shortcomings of 1-lookahead
+ * parser.
+ */
+static struct AssignedIdentifier *saved_aid;
 
 static asn1p_value_t *
 	_convert_bitstring2binary(char *str, int base);
 
-#define	checkmem(ptr)	do {					\
-		if(!(ptr))					\
-		return yyerror("Memory failure");		\
+#define	checkmem(ptr)	do {						\
+		if(!(ptr))						\
+		return yyerror("Memory failure");			\
 	} while(0)
 
-#define	CONSTRAINT_INSERT(root, constr_type, arg1, arg2) do {	\
-		if(arg1->type != constr_type) {			\
-			int __ret;				\
-			root = asn1p_constraint_new(yylineno);	\
-			checkmem(root);				\
-			root->type = constr_type;		\
-			__ret = asn1p_constraint_insert(root,	\
-				arg1);				\
-			checkmem(__ret == 0);			\
-		} else {					\
-			root = arg1;				\
-		}						\
-		if(arg2) {					\
-			int __ret				\
-			= asn1p_constraint_insert(root, arg2);	\
-			checkmem(__ret == 0);			\
-		}						\
+#define	CONSTRAINT_INSERT(root, lloc, constr_type, arg1, arg2) do {	\
+		if(arg1->type != constr_type) {				\
+			int __ret;					\
+			root = asn1p_constraint_new(yylineno);		\
+			checkmem(root);					\
+			root->type = constr_type;			\
+			__ret = asn1p_constraint_insert(root,		\
+				arg1);					\
+			checkmem(__ret == 0);				\
+		} else {						\
+			root = arg1;					\
+		}							\
+		if(arg2) {						\
+			int __ret					\
+			= asn1p_constraint_insert(root, arg2);		\
+			checkmem(__ret == 0);				\
+		}							\
 	} while(0)
 
 %}
@@ -68,6 +73,7 @@
 	asn1p_constraint_t	*a_constr;	/* Constraint */
 	enum asn1p_constraint_type_e	a_ctype;/* Constraint type */
 	asn1p_xports_t		*a_xports;	/* IMports/EXports */
+	struct AssignedIdentifier a_aid;	/* Assigned Identifier */
 	asn1p_oid_t		*a_oid;		/* Object Identifier */
 	asn1p_oid_arc_t		 a_oid_arc;	/* Single OID's arc */
 	struct asn1p_type_tag_s	 a_tag;		/* A tag */
@@ -258,6 +264,7 @@
 %type	<a_plist>		ParameterArgumentList
 %type	<a_expr>		ActualParameter
 %type	<a_expr>		ActualParameterList
+%type	<a_aid>			AssignedIdentifier	/* OID/DefinedValue */
 %type	<a_oid>			ObjectIdentifier	/* OID */
 %type	<a_oid>			optObjectIdentifier	/* Optional OID */
 %type	<a_oid>			ObjectIdentifierBody
@@ -346,7 +353,7 @@
 		}
 		checkmem($$);
 
-		$$->Identifier = $1;
+		$$->ModuleName = $1;
 		$$->module_oid = $2;
 		$$->module_flags = $4;
 	}
@@ -574,6 +581,10 @@
  */
 ImportsDefinition:
 	TOK_IMPORTS ImportsBundleSet ';' {
+		if(!saved_aid && 0)
+			return yyerror("Unterminated IMPORTS FROM, "
+					"expected semicolon ';'");
+		saved_aid = 0;
 		$$ = $2;
 	}
 	/*
@@ -596,11 +607,18 @@
 	}
 	;
 
+AssignedIdentifier:
+	{ memset(&$$, 0, sizeof($$)); }
+	| ObjectIdentifier { $$.oid = $1; };
+	/* | DefinedValue { $$.value = $1; }; // Handled through saved_aid */
+
 ImportsBundle:
-	ImportsList TOK_FROM TypeRefName optObjectIdentifier {
+	ImportsList TOK_FROM TypeRefName AssignedIdentifier {
 		$$ = $1;
-		$$->from = $3;
-		$$->from_oid = $4;
+		$$->fromModuleName = $3;
+		$$->identifier = $4;
+		/* This stupid thing is used for look-back hack. */
+		saved_aid = $$->identifier.oid ? 0 : &($$->identifier);
 		checkmem($$);
 	}
 	;
@@ -1520,14 +1538,14 @@
 
 Constraints:
 	SetOfConstraints {
-		CONSTRAINT_INSERT($$, ACT_CA_SET, $1, 0);
+		CONSTRAINT_INSERT($$, @1, ACT_CA_SET, $1, 0);
 	}
 	| TOK_SIZE '('  ElementSetSpecs ')' {
 		/*
 		 * This is a special case, for compatibility purposes.
 		 * It goes without parentheses.
 		 */
-		CONSTRAINT_INSERT($$, ACT_CT_SIZE, $3, 0);
+		CONSTRAINT_INSERT($$, @1, ACT_CT_SIZE, $3, 0);
 	}
 	;
 
@@ -1536,7 +1554,7 @@
 		$$ = $2;
 	}
 	| SetOfConstraints '(' ElementSetSpecs ')' {
-		CONSTRAINT_INSERT($$, ACT_CA_SET, $1, $3);
+		CONSTRAINT_INSERT($$, @1, ACT_CA_SET, $1, $3);
 	}
 	;
 
@@ -1548,15 +1566,15 @@
 		asn1p_constraint_t *ct;
 		ct = asn1p_constraint_new(yylineno);
 		ct->type = ACT_EL_EXT;
-		CONSTRAINT_INSERT($$, ACT_CA_CSV, $1, ct);
+		CONSTRAINT_INSERT($$, @1, ACT_CA_CSV, $1, ct);
 	}
 	| ElementSetSpec ',' TOK_ThreeDots ',' ElementSetSpec {
 		asn1p_constraint_t *ct;
 		ct = asn1p_constraint_new(yylineno);
 		ct->type = ACT_EL_EXT;
-		CONSTRAINT_INSERT($$, ACT_CA_CSV, $1, ct);
+		CONSTRAINT_INSERT($$, @1, ACT_CA_CSV, $1, ct);
 		ct = $$;
-		CONSTRAINT_INSERT($$, ACT_CA_CSV, ct, $5);
+		CONSTRAINT_INSERT($$, @1, ACT_CA_CSV, ct, $5);
 	}
 	;
 
@@ -1565,16 +1583,16 @@
 		$$ = $1;
 	}
 	| TOK_ALL TOK_EXCEPT ConstraintSubtypeElement {
-		CONSTRAINT_INSERT($$, ACT_CA_AEX, $3, 0);
+		CONSTRAINT_INSERT($$, @1, ACT_CA_AEX, $3, 0);
 	}
 	| ElementSetSpec Union ConstraintSubtypeElement {
-		CONSTRAINT_INSERT($$, ACT_CA_UNI, $1, $3);
+		CONSTRAINT_INSERT($$, @1, ACT_CA_UNI, $1, $3);
 	}
 	| ElementSetSpec Intersection ConstraintSubtypeElement {
-		CONSTRAINT_INSERT($$, ACT_CA_INT, $1, $3);
+		CONSTRAINT_INSERT($$, @1, ACT_CA_INT, $1, $3);
 	}
 	| ConstraintSubtypeElement Except ConstraintSubtypeElement {
-		CONSTRAINT_INSERT($$, ACT_CA_EXC, $1, $3);
+		CONSTRAINT_INSERT($$, @1, ACT_CA_EXC, $1, $3);
 	}
 	;
 
@@ -1718,10 +1736,10 @@
 
 InnerTypeConstraint:
 	TOK_WITH TOK_COMPONENT SetOfConstraints {
-		CONSTRAINT_INSERT($$, ACT_CT_WCOMP, $3, 0);
+		CONSTRAINT_INSERT($$, @1, ACT_CT_WCOMP, $3, 0);
 	}
 	| TOK_WITH TOK_COMPONENTS '{' WithComponentsList '}' {
-		CONSTRAINT_INSERT($$, ACT_CT_WCOMPS, $4, 0);
+		CONSTRAINT_INSERT($$, @1, ACT_CT_WCOMPS, $4, 0);
 	}
 	;
 
@@ -1730,7 +1748,7 @@
 		$$ = $1;
 	}
 	| WithComponentsList ',' WithComponentsElement {
-		CONSTRAINT_INSERT($$, ACT_CT_WCOMPS, $1, $3);
+		CONSTRAINT_INSERT($$, @1, ACT_CT_WCOMPS, $1, $3);
 	}
 	;
 
@@ -1794,13 +1812,13 @@
 		checkmem($$);
 		ct->type = ACT_EL_VALUE;
 		ct->value = asn1p_value_fromref(ref, 0);
-		CONSTRAINT_INSERT($$, ACT_CA_CRC, ct, 0);
+		CONSTRAINT_INSERT($$, @1, ACT_CA_CRC, ct, 0);
 	}
 	;
 
 ComponentRelationConstraint:
 	SimpleTableConstraint '{' AtNotationList '}' {
-		CONSTRAINT_INSERT($$, ACT_CA_CRC, $1, $3);
+		CONSTRAINT_INSERT($$, @1, ACT_CA_CRC, $1, $3);
 	}
 	;
 
@@ -1817,7 +1835,7 @@
 		checkmem(ct);
 		ct->type = ACT_EL_VALUE;
 		ct->value = asn1p_value_fromref($3, 0);
-		CONSTRAINT_INSERT($$, ACT_CA_CSV, $1, ct);
+		CONSTRAINT_INSERT($$, @1, ACT_CA_CSV, $1, ct);
 	}
 	;