new WITH SYNTAX clause parsing
git-svn-id: https://asn1c.svn.sourceforge.net/svnroot/asn1c/trunk@1072 59561ff5-6e30-0410-9f3c-9617f08c8826
diff --git a/libasn1parser/asn1p_l.l b/libasn1parser/asn1p_l.l
index c7bb18e..a327277 100644
--- a/libasn1parser/asn1p_l.l
+++ b/libasn1parser/asn1p_l.l
@@ -99,7 +99,7 @@
--<[ \t]*ASN1C.RepresentAsPointer[ \t]*>-- asn1p_as_pointer = 1;
--- yy_push_state(dash_comment);
+<INITIAL,with_syntax>-- yy_push_state(dash_comment);
<dash_comment,idash_comment>{
{NL} yy_pop_state();
@@ -109,7 +109,7 @@
[^\r\v\f\n-]+ /* Eat */
}
-<INITIAL,cpp_comment>"/*" yy_push_state(cpp_comment);
+<INITIAL,cpp_comment,with_syntax>"/*" yy_push_state(cpp_comment);
<cpp_comment>{
[^*/<] /* Eat */
"*/" yy_pop_state();
@@ -391,12 +391,25 @@
<with_syntax>{
- [^&{} \t\r\v\f\n]+ {
- asn1p_lval.tv_opaque.buf = strdup(yytext);
- asn1p_lval.tv_opaque.len = yyleng;
- return TOK_opaque;
+ [A-Z][A-Za-z0-9]*([-][A-Za-z0-9]+)* {
+ asn1p_lval.tv_str = strdup(yytext);
+ return TOK_Literal;
}
+ "," {
+ asn1p_lval.tv_str = strdup(yytext);
+ return TOK_Literal;
+ }
+
+ "{" {
+ yy_push_state(with_syntax);
+ asn1p_lval.tv_str = strdup(yytext);
+ return TOK_Literal;
+ }
+
+ "[" return '[';
+ "]" return ']';
+
{WSP}+ {
asn1p_lval.tv_opaque.buf = strdup(yytext);
asn1p_lval.tv_opaque.len = yyleng;
@@ -405,7 +418,12 @@
"}" {
yy_pop_state();
- return '}';
+ if(YYSTATE == with_syntax) {
+ asn1p_lval.tv_str = strdup(yytext);
+ return TOK_Literal;
+ } else {
+ return '}';
+ }
}
}