Commit 0e90aa04 authored by Lev Walkin's avatar Lev Walkin

parsing-level support for [[ extension brackets ]]

parent 46755ce2
......@@ -214,6 +214,18 @@ asn1p_expr_add(asn1p_expr_t *to, asn1p_expr_t *what) {
what->parent_expr = to;
}
/*
* Add inner expressions as members of another.
*/
void
asn1p_expr_add_many(asn1p_expr_t *to, asn1p_expr_t *from_what) {
asn1p_expr_t *expr;
TQ_FOR(expr, &(from_what->members), next) {
expr->parent_expr = to;
}
TQ_CONCAT(&(to->members), &(from_what->members), next);
}
/*
* Destruct the types collection structure.
......
......@@ -278,6 +278,7 @@ asn1p_expr_t *asn1p_expr_clone_with_resolver(asn1p_expr_t *,
asn1p_expr_t *(*resolver)(asn1p_expr_t *to_resolve, void *resolver_arg),
void *resolver_arg);
void asn1p_expr_add(asn1p_expr_t *to, asn1p_expr_t *what);
void asn1p_expr_add_many(asn1p_expr_t *to, asn1p_expr_t *from_what);
void asn1p_expr_free(asn1p_expr_t *expr);
#define TAG2STRING_BUFFER_SIZE 64 /* buf should be at least this big */
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -510,6 +510,9 @@ WITH return TOK_WITH;
}
"[[" return TOK_VBracketLeft;
"]]" return TOK_VBracketRight;
[(){},;:|!.&@\[\]^] return yytext[0];
[^A-Za-z0-9:=,{}<.@()[]'\"|&^*;!-] {
......
......@@ -45,6 +45,14 @@
(head)->tq_tail = &TQ_NEXT((__el), field); \
} while(0)
#define TQ_CONCAT(head1, head2, field) do { \
if(TQ_FIRST(head2)) { \
*(head1)->tq_tail = (head2)->tq_head; \
(head1)->tq_tail = (head2)->tq_tail; \
TQ_INIT(head2); \
} \
} while(0)
/*
* Remove the first element and return it.
*/
......
This diff is collapsed.
This diff is collapsed.
......@@ -124,6 +124,7 @@ static asn1p_module_t *currentModule;
* Token types returned by scanner.
*/
%token TOK_PPEQ /* "::=", Pseudo Pascal EQuality */
%token TOK_VBracketLeft TOK_VBracketRight /* "[[", "]]" */
%token <tv_opaque> TOK_whitespace /* A span of whitespace */
%token <tv_opaque> TOK_opaque /* opaque data (driven from .y) */
%token <tv_str> TOK_bstring
......@@ -970,6 +971,10 @@ ComponentTypeLists:
$$ = $1;
asn1p_expr_add($$, $3);
}
| ComponentTypeLists ',' TOK_VBracketLeft ComponentTypeLists TOK_VBracketRight {
$$ = $1;
asn1p_expr_add_many($$, $4);
}
;
ComponentType:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment