support parsing realnumber tokens in constraints


git-svn-id: https://asn1c.svn.sourceforge.net/svnroot/asn1c/trunk@1152 59561ff5-6e30-0410-9f3c-9617f08c8826
diff --git a/libasn1parser/asn1p_l.l b/libasn1parser/asn1p_l.l
index 2594b55..33d2a14 100644
--- a/libasn1parser/asn1p_l.l
+++ b/libasn1parser/asn1p_l.l
@@ -27,6 +27,7 @@
 int asn1p_as_pointer;
 
 static asn1c_integer_t _lex_atoi(const char *ptr);
+static double          _lex_atod(const char *ptr);
 
 /*
  * Check that the type is defined in the year of the standard choosen.
@@ -240,6 +241,13 @@
 		return TOK_number;
 	}
 
+[-+]?[0-9]+[.]?([eE][-+]?)?[0-9]+ {
+		asn1p_lval.a_dbl = _lex_atod(yytext);
+		if(errno == ERANGE)
+			return -1;
+		return TOK_realnumber;
+	}
+
 ABSENT			return TOK_ABSENT;
 ALL			return TOK_ALL;
 ANY			{
@@ -564,3 +572,19 @@
 	}
 	return value;
 }
+
+static double
+_lex_atod(const char *ptr) {
+	double value;
+	errno = 0;
+	value = strtod(ptr, 0);
+	if(errno) {
+		fprintf(stderr,
+			"Value \"%s\" at line %d is outside of `double` range "
+			"in this compiler! Please contact the asn1c author.\n",
+			ptr, yylineno);
+		errno = ERANGE;
+	}
+	return value;
+}
+